Browse Source

Merge pull request #47 from openoms/VMv1.2

add sdb to hdd checks for VM build
master
bluecell296 6 years ago
committed by GitHub
parent
commit
6eb88b07c4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      home.admin/30initHDD.sh
  2. 10
      home.admin/_bootstrap.sh

10
home.admin/30initHDD.sh

@ -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

10
home.admin/_bootstrap.sh

@ -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…
Cancel
Save