diff --git a/archlabs-installer b/archlabs-installer index 0c41af0..dd70469 100755 --- a/archlabs-installer +++ b/archlabs-installer @@ -5,7 +5,7 @@ # Some ideas and code reworked from other resources # AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due -VER="2.0.42" # installer version +VER="2.0.44" # installer version DIST="ArchLabs" # linux distributor MNT="/mnt" # install mountpoint ANS="/tmp/ans" # dialog answer file @@ -939,28 +939,17 @@ part_shrink() # get device size info num="${part: -1}" - end=$(parted -s "$device" unit KiB print | awk '/^\s*'"$num"'/ {print int($3)}') # part size in KiB - devsize=$(parted -s "$device" unit KiB print | awk '/Disk '"${device//\//\\/}"':/ {print int($3)}') # whole device size in KiB - - # minimum in KiB (2^10) - case "$fs" in - ext[2-4]) - mount "$part" $MNT >/dev/null 2>&1; sleep 0.5 - min=$(df --output=used --block-size=KiB "$part" | awk 'NR == 2 {print int($1)}') - umount $MNT >/dev/null 2>&1 - ;; - ntfs) min=$(ntfsresize -f -m "$part" | awk 'NR == 2 {print int(($NF * 1000 * 1000) / 1024)}') >/dev/null 2>&1 ;; - esac - - # KiB -> MiB - mbmin=$(((min / 1024) + 200)) - mbend=$((end / 1024)) + end=$(parted -s "$device" unit KiB print | awk '/^\s*'"$num"'/ {print $3}') # part size in KiB + devsize=$(parted -s "$device" unit KiB print | awk '/Disk '"${device//\//\\/}"':/ {print $3}') # whole device size in KiB + mount "$part" $MNT >/dev/null 2>&1; sleep 0.5 + min=$(df --output=used --block-size=MiB "$part" | awk 'NR == 2 {print int($1) + 256}') + max=$(df --output=avail --block-size=MiB "$part" | awk 'NR == 2 {print int($1)}') + umount $MNT >/dev/null 2>&1 # get new size from user tput cnorm - if dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " Resize: $part " --rangebox "$_resize" 17 "$COLUMNS" "$mbmin" "$mbend" $((mbend / 2)) 2>$ANS; then - (( (size = $(< "$ANS")) < mbend )) || return 1 - size=$((size * 1024)) + if dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " Resize: $part " --rangebox "$_resize" 17 "$COLUMNS" "$min" "$max" $((max / 2)) 2>$ANS; then + size=$(< "$ANS"); size=$((size * 1024)) else return 1 fi