mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-24 14:51:03 +01:00
Merge pull request #47 from openoms/VMv1.2
add sdb to hdd checks for VM build
This commit is contained in:
commit
6eb88b07c4
2 changed files with 16 additions and 4 deletions
|
@ -14,7 +14,8 @@ if [ ${existsHDD} -eq 1 ]; then
|
|||
|
||||
# check if there is s sda2
|
||||
existsHDD2=$(lsblk | grep -c sda2)
|
||||
if [ ${existsHDD2} -eq 1 ]; then
|
||||
hddSecondDriveExists=$(lsblk | grep -c sdb)
|
||||
if [ ${existsHDD2} -eq 1 ] || [ ${hddSecondDriveExists} -eq 1 ] ; then
|
||||
echo "OK - HDD found at sda2 ... determine which is bigger"
|
||||
|
||||
# get both with size
|
||||
|
@ -22,11 +23,16 @@ if [ ${existsHDD} -eq 1 ]; then
|
|||
echo "sda1(${size1})"
|
||||
size2=$(lsblk -o NAME,SIZE -b | grep "sda2" | awk '{ print substr( $0, 12, length($0)-2 ) }' | xargs)
|
||||
echo "sda2(${size2})"
|
||||
size3=$(lsblk -o NAME,SIZE -b | grep "sdb" | awk '{ print substr( $0, 8, length($0)-2 ) }' | xargs)
|
||||
echo "sdb(${size2})"
|
||||
|
||||
# chosse to run with the bigger one
|
||||
# choose to run with the bigger one
|
||||
if [ ${size2} -gt ${size1} ]; then
|
||||
echo "sda2 is BIGGER - run with this one"
|
||||
device="sda2"
|
||||
elif [ ${size3} -gt ${size1} ]; then
|
||||
echo "sdb is BIGGER - run with this one"
|
||||
device="sdb"
|
||||
else
|
||||
echo "sda1 is BIGGER - run with this one"
|
||||
fi
|
||||
|
|
|
@ -148,17 +148,23 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then
|
|||
# detect for correct device name (the biggest partition)
|
||||
hddDeviceName="sda1"
|
||||
hddSecondPartitionExists=$(lsblk | grep -c sda2)
|
||||
if [ ${hddSecondPartitionExists} -eq 1 ]; then
|
||||
hddSecondDriveExists=$(lsblk | grep -c sdb)
|
||||
if [ ${hddSecondPartitionExists} -eq 1 ] || [ ${hddSecondDriveExists} -eq 1 ] ; then
|
||||
echo "HDD has a second partition - choosing the bigger one ..." >> $logFile
|
||||
# get both with size
|
||||
size1=$(lsblk -o NAME,SIZE -b | grep "sda1" | awk '{ print substr( $0, 12, length($0)-2 ) }' | xargs)
|
||||
echo "sda1(${size1})" >> $logFile
|
||||
size2=$(lsblk -o NAME,SIZE -b | grep "sda2" | awk '{ print substr( $0, 12, length($0)-2 ) }' | xargs)
|
||||
echo "sda2(${size2})" >> $logFile
|
||||
# chosse to run with the bigger one
|
||||
size3=$(lsblk -o NAME,SIZE -b | grep "sdb" | awk '{ print substr( $0, 8, length($0)-2 ) }' | xargs)
|
||||
echo "sdb(${size2})" >> $logFile
|
||||
# choose to run with the bigger one
|
||||
if [ ${size2} -gt ${size1} ]; then
|
||||
echo "sda2 is BIGGER - run with this one" >> $logFile
|
||||
hddDeviceName="sda2"
|
||||
elif [ ${size3} -gt ${size1} ]; then
|
||||
echo "sdb is BIGGER - run with this one" >> $logFile
|
||||
hddDeviceName="sdb"
|
||||
else
|
||||
echo "sda1 is BIGGER - run with this one" >> $logFile
|
||||
hddDeviceName="sda1"
|
||||
|
|
Loading…
Add table
Reference in a new issue