mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-19 19:40:37 +02:00
fixed size calculation dialogs
This commit is contained in:
parent
780528c7c8
commit
9205ca2b0b
1 changed files with 25 additions and 15 deletions
|
@ -154,20 +154,24 @@ finddisks() {
|
||||||
# ide devices
|
# ide devices
|
||||||
for dev in $(ls $block 2>/dev/null | egrep '^hd'); do
|
for dev in $(ls $block 2>/dev/null | egrep '^hd'); do
|
||||||
if [ "$(cat $block/$dev/device/media)" = "disk" ]; then
|
if [ "$(cat $block/$dev/device/media)" = "disk" ]; then
|
||||||
|
if ! [ "$(cat $block/$dev/size)" = "0" ]; then
|
||||||
if ! [ "$(cat /proc/mdstat 2>/dev/null | grep "$dev\[")" -o "$(dmraid -rc | grep /dev/$dev)" ]; then
|
if ! [ "$(cat /proc/mdstat 2>/dev/null | grep "$dev\[")" -o "$(dmraid -rc | grep /dev/$dev)" ]; then
|
||||||
echo "/dev/$dev"
|
echo "/dev/$dev"
|
||||||
[ "$1" ] && echo $1
|
[ "$1" ] && echo $1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
#scsi/sata devices
|
#scsi/sata devices
|
||||||
for dev in $(ls $block 2>/dev/null | egrep '^sd'); do
|
for dev in $(ls $block 2>/dev/null | egrep '^sd'); do
|
||||||
if ! [ "$(cat $block/$dev/device/type)" = "5" ]; then
|
if ! [ "$(cat $block/$dev/device/type)" = "5" ]; then
|
||||||
|
if ! [ "$(cat $block/$dev/size)" = "0" ]; then
|
||||||
if ! [ "$(cat /proc/mdstat 2>/dev/null | grep "$dev\[")" -o "$(dmraid -rc | grep /dev/$dev)" ]; then
|
if ! [ "$(cat /proc/mdstat 2>/dev/null | grep "$dev\[")" -o "$(dmraid -rc | grep /dev/$dev)" ]; then
|
||||||
echo "/dev/$dev"
|
echo "/dev/$dev"
|
||||||
[ "$1" ] && echo $1
|
[ "$1" ] && echo $1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
# cciss controllers
|
# cciss controllers
|
||||||
if [ -d /dev/cciss ] ; then
|
if [ -d /dev/cciss ] ; then
|
||||||
|
@ -202,20 +206,24 @@ findbootloaderdisks() {
|
||||||
# ide devices
|
# ide devices
|
||||||
for dev in $(ls $block | egrep '^hd'); do
|
for dev in $(ls $block | egrep '^hd'); do
|
||||||
if [ "$(cat $block/$dev/device/media)" = "disk" ]; then
|
if [ "$(cat $block/$dev/device/media)" = "disk" ]; then
|
||||||
|
if ! [ "$(cat $block/$dev/size)" = "0" ]; then
|
||||||
if ! [ "$(cat /proc/mdstat 2>/dev/null | grep "$dev\[")" -o "$(dmraid -rc | grep /dev/$dev)" ]; then
|
if ! [ "$(cat /proc/mdstat 2>/dev/null | grep "$dev\[")" -o "$(dmraid -rc | grep /dev/$dev)" ]; then
|
||||||
echo "/dev/$dev"
|
echo "/dev/$dev"
|
||||||
[ "$1" ] && echo $1
|
[ "$1" ] && echo $1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
#scsi/sata devices
|
#scsi/sata devices
|
||||||
for dev in $(ls $block | egrep '^sd'); do
|
for dev in $(ls $block | egrep '^sd'); do
|
||||||
if ! [ "$(cat $block/$dev/device/type)" = "5" ]; then
|
if ! [ "$(cat $block/$dev/device/type)" = "5" ]; then
|
||||||
|
if ! [ "$(cat $block/$dev/size)" = "0" ]; then
|
||||||
if ! [ "$(cat /proc/mdstat 2>/dev/null | grep "$dev\[")" -o "$(dmraid -rc | grep /dev/$dev)" ]; then
|
if ! [ "$(cat /proc/mdstat 2>/dev/null | grep "$dev\[")" -o "$(dmraid -rc | grep /dev/$dev)" ]; then
|
||||||
echo "/dev/$dev"
|
echo "/dev/$dev"
|
||||||
[ "$1" ] && echo $1
|
[ "$1" ] && echo $1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
# cciss controllers
|
# cciss controllers
|
||||||
if [ -d /dev/cciss ] ; then
|
if [ -d /dev/cciss ] ; then
|
||||||
|
@ -515,10 +523,10 @@ _getavaildisks()
|
||||||
# NOTE: to test as non-root, stick in a 'sudo' before the hdparm call
|
# NOTE: to test as non-root, stick in a 'sudo' before the hdparm call
|
||||||
for i in $(finddisks); do
|
for i in $(finddisks); do
|
||||||
if ! [ "$(pvs -o pv_name --noheading | grep $i)" ]; then
|
if ! [ "$(pvs -o pv_name --noheading | grep $i)" ]; then
|
||||||
if [ $(echo "$i" | grep 'md_d[0-9]') ]; then
|
if [ $(echo "$i" | grep 'mapper') ]; then
|
||||||
echo -n "$i : "; echo $(($(expr 512 '*' $(cat /sys/block/$(basename $i)/size))/1000000)) MB; echo "\n"
|
echo -n "$i : "; echo $(($(expr 512 '*' $(dmsetup status $i | cut -f2 -d " "))/1000000)) MB; echo "\n"
|
||||||
else
|
else
|
||||||
echo -n "$i: "; hdparm -I $i | grep -F '1000*1000' | sed "s/.*1000:[ \t]*\(.*\)/\1/"; echo "\n"
|
echo -n "$i : "; echo $(($(expr 512 '*' $(cat /sys/block/$(basename $i)/size))/1000000)) MB; echo "\n"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -538,6 +546,8 @@ _getavailpartitions()
|
||||||
elif [ $(echo "$i" | grep 'mapper') ]; then
|
elif [ $(echo "$i" | grep 'mapper') ]; then
|
||||||
if [ "$(cryptsetup status $i 2>/dev/null)" ]; then
|
if [ "$(cryptsetup status $i 2>/dev/null)" ]; then
|
||||||
echo -n "$i: "; echo $(($(expr 512 '*' $(cryptsetup status $(basename $i) | grep " size:" | sed -e 's#sectors##g' -e 's#size:##g'))/1000000)) MB; echo "\n"
|
echo -n "$i: "; echo $(($(expr 512 '*' $(cryptsetup status $(basename $i) | grep " size:" | sed -e 's#sectors##g' -e 's#size:##g'))/1000000)) MB; echo "\n"
|
||||||
|
elif [ "$(dmsetup info $i | grep 'DMRAID')" ]; then
|
||||||
|
[ $(echo $i | grep 'p*[0-9]$') ] && echo -n "$i : "; echo $(($(expr 512 '*' $(dmsetup status $i | cut -f2 -d " "))/1000000)) MB; echo "\n"
|
||||||
else
|
else
|
||||||
echo -n "$i : "; echo $(lvs -o lv_size --noheading --units m $i | sed -e 's#M##g') MB; echo "\n"
|
echo -n "$i : "; echo $(lvs -o lv_size --noheading --units m $i | sed -e 's#M##g') MB; echo "\n"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue