-
Here's my attempt at a patch. It now accepts "MB" and "GB" as units (non-case-sensitive) and will loop until it gets valid input, is canceled, or times out. I didn't attempt to add error messages because I only speak English, so I wouldn't be able to properly localize them.
Code:
--- /mnt/sda1/knx/master/boot/isolinux/minirtdir/init 2010-07-02 12:59:57.000000000 +0000
+++ ./init 2010-07-02 12:48:10.000000000 +0000
@@ -531,12 +531,23 @@
}
createdata(){
- local rc size avail
+ local rc size sizein sizeunits avail
avail="$(df -m /mnt-system | awk '{size=$4}END{print size - 1}')"
[ "$avail" -ge 200 ] 2>/dev/null || return 2
- runknoppixchroot /usr/bin/dialog --timeout 10 --inputbox "\n${CREATEIMG1}${avail}${CREATEIMG2}\n" 16 75 2>/tmp/knoppix.size; rc="$?"
- read size </tmp/knoppix.size; rm -f /tmp/knoppix.size
- [ "$rc" = "0" -a "$size" -ge 200 -a "$size" -le "$avail" ] 2>/dev/null || return 3
+ until [ "$size" -ge 200 -a "$size" -le "$avail" ] ; do
+ runknoppixchroot /usr/bin/dialog --timeout 10 --inputbox "\n${CREATEIMG1}${avail}${CREATEIMG2}\n" 16 75 2>/tmp/knoppix.size; rc="$?"
+ read sizein </tmp/knoppix.size; rm -f /tmp/knoppix.size
+ [ "x$sizein" = "x" -o "$rc" != "0" ] && return 3
+ size="$(echo $sizein | sed 's/[^0-9]//g')"
+ sizeunits="$(echo $sizein | sed 's/[^A-Za-z]//g' | awk '{print toupper($1)}')"
+ if [ "x$sizeunits" != "x" ] ; then
+ if [ $sizeunits = "GB" ] ; then
+ size=$(($size*1024))
+ elif [ $sizeunits != "MB" ]; then
+ size=0
+ fi
+ fi
+ done
runknoppixchroot /usr/bin/dialog --yes-label "${ENCRYPT}" --no-label "${NO_ENCRYPT}" --defaultno --yesno "${QUESTION_ENCRYPT}" 16 75 2>/dev/null; rc="$?"
[ -b /dev/loop0 ] || mknod -m 755 /dev/loop0 b 7 0
[ -d /KNOPPIX-DATA ] || mkdir -m 755 /KNOPPIX-DATA
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules

Dell T7910 Workstation Tower Homelab AI Server PC - Xeon CPU - NO HDD/RAM/GPU
$279.99

Intel Xeon Phi 5110P 60-Core 1.053GHz Coprocessor
$50.00

Dell Precision T1700 Workstation Intel Xeon 16G Ram 256GG SSD Nvidia 600 Win 10
$109.99

Lenovo ThinkStation P520c Intel Xeon W-2133 6-Core 3.60GHz -NO RAM/ HDD/ GPU/ OS
$127.54

Intel Xeon E5-2699 V4 2.20GHz 55M 22-CORES LGA2011-3 Server Processor 145W SR2JS
$84.49

Intel Xeon E5-2680 V2 2.8GHz 10-Core 25MB 8GT/s SR1A6 LGA2011 B Grade Server CPU
$7.95

Dell Precision T5820 Workstation 3.70GHz W-2135 No RAM/ GPU/ HDD/ OS
$179.98

Intel Xeon W-2155 SR3LR 3.30GHz, 10 Cores Processor.
$99.00

Dell Precision Tower 7810 Xeon E5-2630 v3 @ 2.40GHz , 32GB Ram, NO HDD, NO OS
$239.99

Dell EMC PowerEdge R440 Xeon silver 4215 2.5GHz 16 GB ram 2x 550W PSU No HDD
$275.00