Browse Source

fix hdd chack output

master
openoms 6 years ago
parent
commit
f7eee12720
  1. 4
      home.admin/30initHDD.sh
  2. 2
      home.admin/_bootstrap.sh

4
home.admin/30initHDD.sh

@ -16,7 +16,7 @@ if [ ${existsHDD} -eq 1 ]; then
existsHDD2=$(lsblk | grep -c sda2) existsHDD2=$(lsblk | grep -c sda2)
hddSecondDriveExists=$(lsblk | grep -c sdb) hddSecondDriveExists=$(lsblk | grep -c sdb)
if [ ${existsHDD2} -eq 1 ] || [ ${hddSecondDriveExists} -eq 1 ] ; then if [ ${existsHDD2} -eq 1 ] || [ ${hddSecondDriveExists} -eq 1 ] ; then
echo "OK - HDD found at sda2 ... determine which is bigger" echo "OK - another HDD found at sdb ... determine which is bigger"
# get both with size # get both with size
size1=$(lsblk -o NAME,SIZE -b | grep "sda1" | awk '{ print substr( $0, 12, length($0)-2 ) }' | xargs) size1=$(lsblk -o NAME,SIZE -b | grep "sda1" | awk '{ print substr( $0, 12, length($0)-2 ) }' | xargs)
@ -24,7 +24,7 @@ if [ ${existsHDD} -eq 1 ]; then
size2=$(lsblk -o NAME,SIZE -b | grep "sda2" | awk '{ print substr( $0, 12, length($0)-2 ) }' | xargs) size2=$(lsblk -o NAME,SIZE -b | grep "sda2" | awk '{ print substr( $0, 12, length($0)-2 ) }' | xargs)
echo "sda2(${size2})" echo "sda2(${size2})"
size3=$(lsblk -o NAME,SIZE -b | grep "sdb" | awk '{ print substr( $0, 8, length($0)-2 ) }' | xargs) size3=$(lsblk -o NAME,SIZE -b | grep "sdb" | awk '{ print substr( $0, 8, length($0)-2 ) }' | xargs)
echo "sdb(${size2})" echo "sdb(${size3})"
# choose to run with the bigger one # choose to run with the bigger one
if [ ${size2} -gt ${size1} ]; then if [ ${size2} -gt ${size1} ]; then

2
home.admin/_bootstrap.sh

@ -157,7 +157,7 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then
size2=$(lsblk -o NAME,SIZE -b | grep "sda2" | awk '{ print substr( $0, 12, length($0)-2 ) }' | xargs) size2=$(lsblk -o NAME,SIZE -b | grep "sda2" | awk '{ print substr( $0, 12, length($0)-2 ) }' | xargs)
echo "sda2(${size2})" >> $logFile echo "sda2(${size2})" >> $logFile
size3=$(lsblk -o NAME,SIZE -b | grep "sdb" | awk '{ print substr( $0, 8, length($0)-2 ) }' | xargs) size3=$(lsblk -o NAME,SIZE -b | grep "sdb" | awk '{ print substr( $0, 8, length($0)-2 ) }' | xargs)
echo "sdb(${size2})" >> $logFile echo "sdb(${size3})" >> $logFile
# choose to run with the bigger one # choose to run with the bigger one
if [ ${size2} -gt ${size1} ]; then if [ ${size2} -gt ${size1} ]; then
echo "sda2 is BIGGER - run with this one" >> $logFile echo "sda2 is BIGGER - run with this one" >> $logFile

Loading…
Cancel
Save