slitaz-tools annotate tinyutils/bootfloppybox @ rev 158
Modified tazx for Openbox as default WM
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Tue Apr 22 22:58:03 2008 +0200 (2008-04-22) |
parents | 5a8b1bbb13f1 |
children | c5bcea9f5099 |
rev | line source |
---|---|
pascal@130 | 1 #! /bin/sh |
pascal@130 | 2 # |
pascal@130 | 3 # Gtkdialog box for the mount command. Part of SliTaz tools. |
pascal@130 | 4 # |
pascal@130 | 5 VERSION=20080409 |
pascal@130 | 6 |
pascal@130 | 7 # Check if user is root. |
pascal@130 | 8 check_root() |
pascal@130 | 9 { |
pascal@130 | 10 if test $(id -u) != 0 ; then |
pascal@130 | 11 echo -e " |
pascal@130 | 12 You must be root to run `basename $0`. Please type 'su' and |
pascal@130 | 13 root password to become super-user.\n" |
pascal@130 | 14 exit 0 |
pascal@130 | 15 fi |
pascal@130 | 16 } |
pascal@130 | 17 |
pascal@130 | 18 # Write bootfloppy image to floppy device. |
pascal@130 | 19 # |
pascal@130 | 20 BOOT_DIALOG=' |
pascal@139 | 21 <window title="bootfloppybox" icon-name="gtk-floppy"> |
pascal@130 | 22 <vbox> |
pascal@130 | 23 |
pascal@130 | 24 <text use-markup="true"> |
pascal@130 | 25 <label> |
pascal@130 | 26 " |
pascal@130 | 27 <b>SliTaz - Bootfloppybox</b>" |
pascal@130 | 28 </label> |
pascal@130 | 29 </text> |
pascal@134 | 30 <text wrap="false" width-chars="44" use-markup="true"> |
pascal@130 | 31 <label> |
pascal@130 | 32 " |
pascal@135 | 33 Create a floppy to boot a LiveCD, in a PXE network... |
pascal@130 | 34 Need a floppy disk in drive. Erase the whole floppy disk. |
pascal@130 | 35 " |
pascal@130 | 36 </label> |
pascal@130 | 37 </text> |
pascal@130 | 38 |
pascal@130 | 39 <frame Floppy disk drive> |
pascal@130 | 40 <hbox> |
pascal@130 | 41 <text use-markup="true"> |
pascal@132 | 42 <label>"<b>Device : </b>"</label> |
pascal@130 | 43 </text> |
pascal@130 | 44 <entry> |
pascal@130 | 45 <default>/dev/fd0</default> |
pascal@130 | 46 <variable>DEVICE</variable> |
pascal@130 | 47 </entry> |
pascal@132 | 48 <button> |
pascal@132 | 49 <label>Format floppy</label> |
pascal@132 | 50 <input file icon="forward"></input> |
pascal@132 | 51 <action>fdformat -n $DEVICE</action> |
pascal@132 | 52 </button> |
pascal@130 | 53 </hbox> |
pascal@130 | 54 </frame> |
pascal@135 | 55 <notebook labels="LiveCD|PXE Network|Memory Test|Expert"> |
pascal@130 | 56 ' |
pascal@130 | 57 while read name file pkg desc; do |
pascal@130 | 58 tmp="<frame $name> |
pascal@130 | 59 <hbox> |
pascal@130 | 60 <text wrap=\"true\" width-chars=\"44\" use-markup=\"true\"> |
pascal@130 | 61 <label> |
pascal@130 | 62 \" |
pascal@130 | 63 $(echo -e $desc) |
pascal@130 | 64 \" |
pascal@130 | 65 </label> |
pascal@130 | 66 </text> |
pascal@130 | 67 </hbox> |
pascal@130 | 68 " |
pascal@130 | 69 if [ -f $file ]; then |
pascal@130 | 70 case "$file" in |
pascal@131 | 71 *.lzma) action="unlzma -c";; |
pascal@130 | 72 *.gz) action="zcat";; |
pascal@130 | 73 *) action="cat";; |
pascal@130 | 74 esac |
pascal@135 | 75 if [ "$pkg" = "grub" ]; then |
pascal@135 | 76 tmp="$tmp |
pascal@135 | 77 <hbox> |
pascal@135 | 78 <button> |
pascal@135 | 79 <label>Write floppy</label> |
pascal@135 | 80 <input file icon=\"forward\"></input> |
pascal@135 | 81 <action>mke2fs \$DEVICE</action> |
pascal@135 | 82 <action>mkdir /media/floppy ; mount \$DEVICE /media/floppy</action> |
pascal@135 | 83 <action>mkdir -p /media/floppy/boot/grub</action> |
pascal@135 | 84 <action>cp /usr/lib/grub/i386-pc/stage? /media/floppy/boot/grub</action> |
pascal@136 | 85 <action>[ -f /usr/share/boot/etherboot ] && cp /usr/share/boot/etherboot /media/floppy/boot</action> |
pascal@136 | 86 <action>[ -f /usr/share/boot/memtest.lzma ] && unlzma -c /usr/share/boot/memtest.lzma > /media/floppy/boot/memtest</action> |
pascal@135 | 87 <action>umount \$DEVICE</action> |
pascal@135 | 88 <action>echo -e \"root (\${DEVICE#/dev/})\\nsetup (\${DEVICE#/dev/})\\nquit\" | grub --batch </action> |
pascal@135 | 89 </button> |
pascal@135 | 90 </hbox> |
pascal@135 | 91 </frame> |
pascal@135 | 92 " |
pascal@135 | 93 else |
pascal@135 | 94 tmp="$tmp |
pascal@130 | 95 <hbox> |
pascal@130 | 96 <button> |
pascal@130 | 97 <label>Write floppy</label> |
pascal@130 | 98 <input file icon=\"forward\"></input> |
pascal@130 | 99 <action>$action $file > \$DEVICE</action> |
pascal@130 | 100 </button> |
pascal@130 | 101 </hbox> |
pascal@130 | 102 </frame> |
pascal@130 | 103 " |
pascal@135 | 104 fi |
pascal@130 | 105 else |
pascal@130 | 106 tmp="$tmp |
pascal@130 | 107 <hbox> |
pascal@157 | 108 <text wrap=\"true\" width-chars=\"34\" use-markup=\"true\"> |
pascal@130 | 109 <label> |
pascal@130 | 110 \"<i>The package <b>$pkg</b> is not yet installed</i>\" |
pascal@130 | 111 </label> |
pascal@130 | 112 </text> |
pascal@157 | 113 <button> |
pascal@157 | 114 <input file icon=\"go-jump\"></input> |
pascal@157 | 115 <label>Install</label> |
pascal@157 | 116 <action>[ -f /var/lib/tazpkg/packages.list ] || tazpkg recharge</action> |
pascal@157 | 117 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x17 -title \"$pkg install\" -e \"tazpkg get-install $pkg ; echo -e \\\"----\\n\\nENTER to continue...\\\" && read close\"</action> |
pascal@157 | 118 <action type=\"exit\">Exit</action> |
pascal@157 | 119 </button> |
pascal@130 | 120 </hbox> |
pascal@130 | 121 </frame> |
pascal@130 | 122 " |
pascal@130 | 123 fi |
pascal@130 | 124 BOOT_DIALOG="$BOOT_DIALOG$tmp" |
pascal@130 | 125 done <<EOT |
pascal@130 | 126 SmartBtmgr /usr/share/boot/btmgr btmgr This OS independent Smart Boot Manager can boot any partition or ATAPI CD-ROM. |
pascal@130 | 127 Etherboot /usr/share/boot/etherboot etherboot This network bootloader provides a replacement for proprietary PXE or NBI ROMs. |
pascal@130 | 128 Memtest86+ /usr/share/boot/memtest.lzma memtest Memory failures detection tool. |
pascal@135 | 129 Grub /usr/sbin/grub grub General purpose boot loader with command shell |
pascal@130 | 130 EOT |
pascal@130 | 131 tmp=' |
pascal@134 | 132 </notebook> |
pascal@130 | 133 <hbox> |
pascal@130 | 134 <button> |
pascal@130 | 135 <input file icon="exit"></input> |
pascal@130 | 136 <label>Exit</label> |
pascal@130 | 137 <action type="exit">Exit</action> |
pascal@130 | 138 </button> |
pascal@130 | 139 </hbox> |
pascal@130 | 140 |
pascal@130 | 141 </vbox> |
pascal@130 | 142 </window> |
pascal@130 | 143 ' |
pascal@130 | 144 BOOT_DIALOG="$BOOT_DIALOG$tmp" |
pascal@130 | 145 export BOOT_DIALOG |
pascal@130 | 146 |
pascal@130 | 147 # Only root can create floppy. |
pascal@130 | 148 check_root |
pascal@130 | 149 gtkdialog --program=BOOT_DIALOG |
pascal@130 | 150 |
pascal@130 | 151 exit 0 |