Results 1 to 9 of 9

Thread: Persistent image creation prompt

  1. #1
    Junior Member
    Join Date
    Jun 2010
    Posts
    5

    Persistent image creation prompt

    I'd like to change the text at the persistent image creation prompt, because some of the users of my live CD find it confusing. (It gives sizes with a suffix, e.g. "400MB", but if you type the size with a suffix, image creation fails silently. I want to change the prompt to make it clear that you have to type in a pure number.) The problem is I'm having trouble finding the script responsible for doing persistent image creation. I've looked at the knoppix init scripts in /etc/init.d, and tried grepping phrases from the prompt, but haven't had any success. Can someone point me in the right direction?

  2. #2
    Junior Member
    Join Date
    Jun 2010
    Posts
    5
    Oh, should have mentioned this is Knoppix v6.2.1.

  3. #3
    Senior Member registered user
    Join Date
    Feb 2010
    Posts
    512
    You can find the init script inside the initial ramdisk minirt.gz. If you need help to extract minirt.gz and recreate it then you should read http://www.knoppix.net/wiki/Knoppix_...up_script_text

  4. #4
    Junior Member
    Join Date
    Jun 2010
    Posts
    5
    Ah, thank you. I think that was the clue I needed.

  5. #5
    Senior Member registered user
    Join Date
    Dec 2009
    Posts
    423
    Quote Originally Posted by brodbd View Post
    I'd like to change the text at the persistent image creation prompt, because some of the users of my live CD find it confusing. (It gives sizes with a suffix, e.g. "400MB", but if you type the size with a suffix, image creation fails silently. I want to change the prompt to make it clear that you have to type in a pure number.)
    Why don't you change it to accept both 400 ***AND*** 400MB ?

    You can consider using sed to accomplish the job :-

    Code:
                   $ echo 400MB | sed "s/[^0-9]//g"
                    400
    Code:
                    $ echo 400MB | sed "s/[0-9]//g"
                    MB
    By using sed, you can extract the number portion of the user input. If the user input something else other than 400MB and 400, you might want to prompt for error.

  6. #6
    Moderator Moderator
    Join Date
    Jan 2010
    Location
    Asheville, NC, USA
    Posts
    528
    Quote Originally Posted by klaus2008 View Post
    You can find the init script inside the initial ramdisk minirt.gz. If you need help to extract minirt.gz and recreate it then you should read http://www.knoppix.net/wiki/Knoppix_...up_script_text
    Note: FWIW, the path has changed from
    Code:
    cd /mnt/hda1/knx/master/boot/isolinux
    to
    Code:
    cd /mnt-system/boot/syslinux/


    Cheers!
    Krishna

  7. #7
    Moderator Moderator
    Join Date
    Jan 2010
    Location
    Asheville, NC, USA
    Posts
    528
    Quote Originally Posted by kl522 View Post
    Why don't you change it to accept both 400 ***AND*** 400MB ?

    You can consider using sed to accomplish the job :-

    Code:
                   $ echo 400MB | sed "s/[^0-9]//g"
                    400
    Code:
                    $ echo 400MB | sed "s/[0-9]//g"
                    MB
    By using sed, you can extract the number portion of the user input. If the user input something else other than 400MB and 400, you might want to prompt for error.
    This seems like a good addition, esp. for newbies; the prompt could say "Enter size (MB):"

    Cheers!
    Krishna

  8. #8
    Junior Member
    Join Date
    Jun 2010
    Posts
    5
    Thanks for the suggestion. I may just do that. It would have the added benefit of working for any localization, too.

  9. #9
    Junior Member
    Join Date
    Jun 2010
    Posts
    5
    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
  •  


Supermicro SuperServer E300-15 - SYS-e300-9C - 16GB RAM 240GB Samsung SSD picture

Supermicro SuperServer E300-15 - SYS-e300-9C - 16GB RAM 240GB Samsung SSD

$199.99



HP Proliant MicroServer Gen 8 2.23GHz Xeon 16GB RAM NO SSD picture

HP Proliant MicroServer Gen 8 2.23GHz Xeon 16GB RAM NO SSD

$249.99



Supermicro 505-2   Server picture

Supermicro 505-2 Server

$280.00



Supermicro E300-12C Mini 1U Barebone X12SCV-LVDS LGA1200 SNK-P0073A4 w/ Adapter picture

Supermicro E300-12C Mini 1U Barebone X12SCV-LVDS LGA1200 SNK-P0073A4 w/ Adapter

$225.00



Supermicro 2U X10DRU-i 2x E5-2680 v3 2.5ghz 32gb Ram  240gb SSD 2x GPU *READ* picture

Supermicro 2U X10DRU-i 2x E5-2680 v3 2.5ghz 32gb Ram 240gb SSD 2x GPU *READ*

$369.99



New Barebones Supermicro 5019D Server, 4C/8T Xeon D-2123T, 1U Rackmountable, 10G picture

New Barebones Supermicro 5019D Server, 4C/8T Xeon D-2123T, 1U Rackmountable, 10G

$449.99



Supermicro SYS-6019P-ACR12L 2x Xeon Silver 4110 2.1GHz 0GB RAM 1U Rack Server picture

Supermicro SYS-6019P-ACR12L 2x Xeon Silver 4110 2.1GHz 0GB RAM 1U Rack Server

$499.00



SuperMicro 4U CSE 847 36 Bay LFF Barebone 2x 1280W w/ 2x Bays 2.5 Rear w/Trays picture

SuperMicro 4U CSE 847 36 Bay LFF Barebone 2x 1280W w/ 2x Bays 2.5 Rear w/Trays

$499.99



Supermicro 938-16 16-LFF MicroCloud SuperServer 5038MR-H8TRF *No Blade Servers* picture

Supermicro 938-16 16-LFF MicroCloud SuperServer 5038MR-H8TRF *No Blade Servers*

$159.99



Nasuni NF-50 Supermicro Server, Atom CPU C2558, @ 2.40GHz, 8GB RAM-No HDD/OS/AC picture

Nasuni NF-50 Supermicro Server, Atom CPU C2558, @ 2.40GHz, 8GB RAM-No HDD/OS/AC

$250.00