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@476
|
5 VERSION=20100401
|
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
|
paul@477
|
18 # This function is used after each screen to continue or abort install.
|
pascal@213
|
19 check_retval()
|
pascal@213
|
20 {
|
pascal@213
|
21 case $retval in
|
pascal@213
|
22 1)
|
pascal@214
|
23 rm -f /tmp/floppybox.grub.menu
|
pascal@213
|
24 echo -e "\nVoluntary exit.\n" && exit 0 ;;
|
pascal@213
|
25 255)
|
pascal@214
|
26 rm -f /tmp/floppybox.grub.menu
|
pascal@213
|
27 echo -e "ESC pressed.\n" && exit 0 ;;
|
pascal@213
|
28 esac
|
pascal@213
|
29 }
|
pascal@213
|
30
|
pascal@474
|
31 # check or list floppy devices.
|
pascal@474
|
32 list_floppy()
|
pascal@474
|
33 {
|
pascal@474
|
34 local list
|
pascal@474
|
35 list=""
|
pascal@474
|
36 for i in /sys/devices/platform/floppy.*/block:*; do
|
pascal@474
|
37 [ -d $i ] || continue
|
pascal@474
|
38 list="$list ${i#*block:}"
|
pascal@474
|
39 done
|
pascal@474
|
40 [ -n "$1" ] || echo $list
|
pascal@474
|
41 [ -n "$list" ]
|
pascal@474
|
42 }
|
pascal@474
|
43
|
pascal@474
|
44 # dialog to select the floppy device
|
pascal@213
|
45 select_floppy()
|
pascal@213
|
46 {
|
pascal@264
|
47 DEVICE="$DIALOG --title \" Floppy device \" --backtitle \"Boot Floppy Creation\" --clear --extra-button --extra-label \"Format\" --colors --radiolist \"
|
pascal@264
|
48 Select boot device
|
pascal@264
|
49 \" 18 70 50"
|
pascal@264
|
50 on=on
|
pascal@474
|
51 for i in $(list_floppy); do
|
pascal@474
|
52 DEVICE="$DEVICE /dev/$i 'Floppy in $i' $on"
|
pascal@264
|
53 on=off
|
pascal@264
|
54 done
|
pascal@474
|
55 DEVICE="$DEVICE floppy \"floppy image file boot.fd\" $on"
|
pascal@474
|
56 DEVICE="$DEVICE cdrom \"cdrom image file boot.iso\" off 2>&1 1>&3"
|
pascal@213
|
57 exec 3>&1
|
pascal@264
|
58 DEVICE=`eval $DEVICE`
|
pascal@213
|
59 retval=$?
|
pascal@213
|
60 exec 3>&-
|
pascal@213
|
61 check_retval
|
pascal@213
|
62 if [ "$retval" = "3" ]; then
|
pascal@264
|
63 case "$DEVICE" in
|
pascal@264
|
64 /dev/*) fdformat -n $DEVICE;;
|
pascal@264
|
65 esac
|
pascal@213
|
66 fi
|
pascal@213
|
67 }
|
pascal@213
|
68
|
pascal@474
|
69 # Build menu for grub or grub4dos
|
pascal@274
|
70 mkmenu()
|
pascal@274
|
71 {
|
pascal@274
|
72 if [ "$1" = "grub4dos" ]; then
|
pascal@274
|
73 SAVEDEFAULT="save default"
|
pascal@274
|
74 cat > /tmp/floppybox.grub.menu <<EOT
|
pascal@274
|
75 # grub4dos menu
|
pascal@274
|
76 default /default
|
pascal@274
|
77 EOT
|
pascal@274
|
78 else
|
pascal@274
|
79 SAVEDEFAULT="savedefault"
|
pascal@274
|
80 cat > /tmp/floppybox.grub.menu <<EOT
|
pascal@274
|
81 # grub menu
|
pascal@274
|
82 default saved
|
pascal@274
|
83 EOT
|
pascal@274
|
84 fi
|
pascal@274
|
85 cat >> /tmp/floppybox.grub.menu <<EOT
|
pascal@274
|
86 timeout 8
|
pascal@274
|
87 color yellow/brown light-green/black
|
pascal@274
|
88
|
pascal@274
|
89 EOT
|
pascal@274
|
90 entry=0
|
pascal@274
|
91 [ -f /boot/gpxe ] && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
|
pascal@274
|
92 title gPXE (Boot from the Web, PXE/iSCSI/AoE support)
|
pascal@274
|
93 kernel /boot/gpxe $(dd if=/boot/gpxe bs=1 skip=519 count=255 2>/dev/null | strings)
|
pascal@274
|
94
|
pascal@274
|
95 EOT
|
pascal@274
|
96 [ -f /usr/share/boot/btmgr -a -f /usr/share/boot/memdisk.lzma ] \
|
pascal@274
|
97 && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
|
pascal@274
|
98 title Smart Boot Manager (text - boot floppy, hard disk or CD/DVD)
|
pascal@274
|
99 kernel /boot/memdisk floppy c=80 h=2 s=18
|
pascal@274
|
100 initrd /boot/btmgr.gz
|
pascal@274
|
101
|
pascal@274
|
102 EOT
|
pascal@382
|
103 http://mirror.slitaz.org/boot/plpbt.bin
|
pascal@382
|
104 [ -f /usr/share/boot/plpbt.bin ] \
|
pascal@274
|
105 && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
|
pascal@274
|
106 title Plop Boot Manager (graphic - boot floppy, hard disk, CD/DVD or USB)
|
pascal@382
|
107 kernel /boot/plpbt.bin
|
pascal@274
|
108
|
pascal@274
|
109 EOT
|
pascal@274
|
110 [ -f /usr/share/boot/etherboot ] && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
|
pascal@274
|
111 title Etherboot (LAN boot, PXE or NBI)
|
pascal@274
|
112 kernel /boot/etherboot
|
pascal@274
|
113
|
pascal@274
|
114 EOT
|
pascal@274
|
115 [ -f /usr/share/boot/memtest.lzma -a -f /usr/share/boot/memdisk.lzma ] \
|
pascal@274
|
116 && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
|
pascal@274
|
117 title Memtest86+ (Test system memory)
|
pascal@274
|
118 kernel /boot/memdisk floppy c=80 h=2 s=18
|
pascal@274
|
119 initrd /boot/memtest.gz
|
pascal@274
|
120
|
pascal@274
|
121 EOT
|
pascal@274
|
122 [ "$1" = "grub4dos" ] && entry=$(($entry + 3)) && cat >> /tmp/floppybox.grub.menu <<EOT
|
pascal@274
|
123 title Windows (scan ntldr)
|
pascal@274
|
124 fallback $(($entry -3 + 1))
|
pascal@274
|
125 find --set-root /ntldr
|
pascal@274
|
126 chainloader /ntldr
|
pascal@274
|
127 $SAVEDEFAULT --wait=2
|
pascal@274
|
128
|
pascal@274
|
129 title Windows (scan cmldr)
|
pascal@274
|
130 fallback $(($entry -3 + 2))
|
pascal@274
|
131 find --set-root /cmldr
|
pascal@274
|
132 chainloader /cmldr
|
pascal@274
|
133 $SAVEDEFAULT --wait=2
|
pascal@274
|
134
|
pascal@274
|
135 title Windows (scan io.sys)
|
pascal@274
|
136 fallback $(($entry -3 + 3))
|
pascal@274
|
137 find --set-root /io.sys
|
pascal@274
|
138 chainloader /io.sys
|
pascal@274
|
139 $SAVEDEFAULT --wait=2
|
pascal@274
|
140
|
pascal@274
|
141 EOT
|
pascal@274
|
142 entry=$(($entry + 3)) && cat >> /tmp/floppybox.grub.menu <<EOT
|
pascal@274
|
143 title Windows (example on /dev/hda1)
|
pascal@274
|
144 rootnoverify (hd0,0)
|
pascal@274
|
145 chainloader +1
|
pascal@274
|
146 $SAVEDEFAULT
|
pascal@274
|
147
|
pascal@274
|
148 title Slitaz Frugal (example on /dev/hda1)
|
pascal@274
|
149 root (hd0,0)
|
pascal@274
|
150 kernel /boot/bzImage rw root=/dev/null vga=normal
|
pascal@274
|
151 initrd /boot/rootfs.gz
|
pascal@274
|
152 $SAVEDEFAULT
|
pascal@274
|
153
|
pascal@274
|
154 title Slitaz Installed (example on /dev/hda2)
|
pascal@274
|
155 root (hd0,1)
|
pascal@274
|
156 kernel /boot/bzImage ro root=/dev/hda2 vga=normal
|
pascal@274
|
157 $SAVEDEFAULT
|
pascal@274
|
158
|
pascal@274
|
159 EOT
|
pascal@274
|
160 [ "$1" = "grub4dos" ] && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
|
pascal@274
|
161 title Slitaz cdrom image (example on /dev/hda1, DEFRAGMENTED)
|
pascal@274
|
162 map (hd0,0)/boot/slitaz-cooking.iso (hd1)
|
pascal@274
|
163 map --hook
|
pascal@274
|
164 kernel (hd1)/boot/bzImage rw root=/dev/null vga=normal
|
pascal@274
|
165 initrd (hd1)/boot/rootfs.gz
|
pascal@274
|
166 $SAVEDEFAULT
|
pascal@274
|
167
|
pascal@274
|
168 EOT
|
pascal@274
|
169 false && [ -f /usr/share/boot/grub.exe.lzma ] && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
|
pascal@274
|
170 title Grub4Dos
|
pascal@274
|
171 kernel /boot/grub/grub.exe --config-file="configfile (fd0)/boot/grub/menu4dos.lst"
|
pascal@274
|
172
|
pascal@274
|
173 EOT
|
pascal@274
|
174 }
|
pascal@274
|
175
|
pascal@474
|
176 # Install grub or grub4dos on floppy
|
pascal@264
|
177 install_grub()
|
pascal@264
|
178 {
|
pascal@274
|
179 LOOP=""
|
pascal@274
|
180 GRUB_DEV=${DEVICE#/dev/}
|
pascal@274
|
181 GRUB_DEV=${GRUB_DEV%% *}
|
pascal@264
|
182 case "$DEVICE" in
|
pascal@274
|
183 floppy*)
|
pascal@274
|
184 LOOP="-o loop"
|
pascal@274
|
185 GRUB_DEV=fd0
|
pascal@274
|
186 DEVICE=boot.fd
|
pascal@274
|
187 dd if=/dev/zero of=$DEVICE bs=18k count=80;;
|
pascal@274
|
188 esac
|
pascal@274
|
189 grep -qs "^# $2 menu" /tmp/floppybox.grub.menu || mkmenu $2
|
pascal@274
|
190 case "$DEVICE" in
|
pascal@274
|
191 /dev/*|boot.fd)
|
pascal@274
|
192 yes y | mke2fs $DEVICE
|
pascal@213
|
193 mkdir /media/floppy
|
pascal@274
|
194 mount $LOOP $DEVICE /media/floppy
|
pascal@274
|
195 if [ "$2" = "grub4dos" ]; then
|
pascal@274
|
196 mkdir -p /media/floppy/boot
|
pascal@274
|
197 unlzma -c /usr/share/boot/grldr.lzma > /media/floppy/grldr
|
pascal@274
|
198 cp $1/boot/* /media/floppy/boot 2> /dev/null
|
pascal@274
|
199 cp /tmp/floppybox.grub.menu /media/floppy/menu.lst
|
pascal@274
|
200 umount -d /media/floppy
|
pascal@274
|
201 bootlace --floppy --sectors-per-track=18 --heads=2 \
|
pascal@274
|
202 --chs --ext2 $DEVICE
|
pascal@274
|
203 else
|
pascal@274
|
204 mkdir -p /media/floppy/boot/grub
|
pascal@274
|
205 cp /usr/lib/grub/i386-pc/stage? /media/floppy/boot/grub
|
pascal@274
|
206 cp -a $1/boot /media/floppy
|
pascal@274
|
207 cp /tmp/floppybox.grub.menu /media/floppy/boot/grub/menu.lst
|
pascal@274
|
208 grub-set-default --root-directory=/media/floppy 0
|
pascal@274
|
209 echo "($GRUB_DEV) $(losetup | grep $DEVICE | cut -d: -f1)" > $1/device.map
|
pascal@274
|
210 [ -n "$LOOP" ] && LOOP="--device-map=$1/device.map"
|
pascal@274
|
211 grub $LOOP --batch <<EOT
|
pascal@274
|
212 root ($GRUB_DEV)
|
pascal@274
|
213 setup ($GRUB_DEV)
|
pascal@214
|
214 quit
|
pascal@214
|
215 EOT
|
pascal@274
|
216 umount -d /media/floppy
|
pascal@274
|
217 fi ;;
|
pascal@264
|
218 cdrom*)
|
pascal@266
|
219 mkdir -p $1/boot/grub 2> /dev/null
|
pascal@274
|
220 cp /tmp/floppybox.grub.menu $1/boot/grub/menu.lst
|
pascal@274
|
221 if [ "$2" = "grub4dos" ]; then
|
pascal@274
|
222 unlzma -c /usr/share/boot/grldr.lzma > $1/boot/grub/grldr
|
pascal@274
|
223 genisoimage -R -o boot.iso -b boot/grub/grldr \
|
pascal@274
|
224 -c boot/boot.cat -no-emul-boot -boot-load-seg 0x1000 \
|
pascal@274
|
225 -hide boot/boot.cat -input-charset iso8859-1 $1
|
pascal@274
|
226 else
|
pascal@274
|
227 cp /usr/lib/grub/i386-pc/stage2_eltorito $1/boot/grub
|
pascal@274
|
228 genisoimage -R -o boot.iso -b boot/grub/stage2_eltorito \
|
pascal@274
|
229 -c boot/boot.cat -no-emul-boot -boot-load-size 4 \
|
pascal@274
|
230 -hide boot/boot.cat -input-charset iso8859-1 \
|
pascal@274
|
231 -boot-info-table $1
|
pascal@274
|
232 fi ;;
|
pascal@264
|
233 esac
|
pascal@264
|
234 }
|
pascal@264
|
235
|
pascal@474
|
236 # Build /init for floppies from iso image
|
pascal@474
|
237 buildinit()
|
pascal@474
|
238 {
|
pascal@474
|
239 mv $1/init $1/init.org
|
pascal@474
|
240 cat > $1/init <<EOTEOT
|
pascal@474
|
241 #!/bin/sh
|
pascal@474
|
242
|
pascal@474
|
243 mount -t proc proc /proc
|
pascal@474
|
244 total=\$(grep MemTotal /proc/meminfo | sed 's/[^0-9]//g')
|
pascal@474
|
245 # the floppy driver may not be included in kernel
|
pascal@474
|
246 insmod /lib/modules/*/kernel/drivers/block/floppy.ko.gz 2> /dev/null
|
pascal@474
|
247 # loram may put floppy.ko.gz module in /lib
|
pascal@474
|
248 insmod /lib/floppy.ko.gz 2> /dev/null
|
pascal@474
|
249 umount /proc
|
pascal@474
|
250 while read name min num count file md5; do
|
pascal@474
|
251 [ -e \$file ] && continue
|
pascal@474
|
252 [ \$total -lt \$min ] && break
|
pascal@474
|
253 while [ \$count -ne 0 ]; do
|
pascal@474
|
254 tmp="\$(dd if=/dev/fd0 count=1 2> /dev/null | md5sum)"
|
pascal@474
|
255 echo -n "Insert floppy \$num for \$name and press Enter or Q to skip"
|
pascal@474
|
256 while true; do
|
pascal@474
|
257 echo -n ":"
|
pascal@474
|
258 read -t 10 answer < /dev/tty0
|
pascal@474
|
259 case "\$answer" in
|
pascal@474
|
260 Q*|q*|A*|a*) break 3;;
|
pascal@474
|
261 esac
|
pascal@474
|
262 dd if=/dev/fd0 count=1 > /tmp/bs.\$\$ 2> /dev/null
|
pascal@474
|
263 [ -s /tmp/bs.\$\$ ] || continue
|
pascal@474
|
264 [ "\$(md5sum < /tmp/bs.\$\$)" != "\$tmp" ] || continue
|
pascal@474
|
265 rm -f /tmp/bs.\$\$
|
pascal@474
|
266 break
|
pascal@474
|
267 done
|
pascal@474
|
268 dd if=/dev/fd0 of=/tmp/rootfs.\$num 2> /dev/null || continue
|
pascal@474
|
269 cat /tmp/rootfs.\$num >> /tmp/rootfs
|
pascal@474
|
270 rm -f /tmp/rootfs.\$num
|
pascal@474
|
271 num=\$((\$num+1))
|
pascal@474
|
272 count=\$((\$count-1))
|
pascal@474
|
273 done
|
pascal@474
|
274 echo "\$md5 /tmp/rootfs" | md5sum -c || break
|
pascal@474
|
275 cpio -idmu < /tmp/rootfs > /dev/null 2>&1 ||
|
pascal@474
|
276 ( zcat /tmp/rootfs 2> /dev/null || unlzma -c /tmp/rootfs ) | cpio -idmu
|
pascal@474
|
277 rm -f /tmp/rootfs*
|
pascal@474
|
278 done <<EOT
|
pascal@474
|
279 $(while read line; do echo $line; done)
|
pascal@474
|
280 EOT
|
pascal@474
|
281 mv -f /init.org /init || sh
|
pascal@474
|
282 exec /init
|
pascal@474
|
283 EOTEOT
|
pascal@474
|
284 chmod +x $1/init
|
pascal@474
|
285 }
|
pascal@474
|
286
|
pascal@405
|
287 # write a 32 bits data
|
pascal@405
|
288 # usage: storelong offset data32 file
|
pascal@405
|
289 storelong()
|
pascal@405
|
290 {
|
pascal@405
|
291 printf "00000 %02X %02X %02X %02X \n" \
|
pascal@405
|
292 $(( $2 & 255 )) $(( ($2>>8) & 255 )) \
|
pascal@405
|
293 $(( ($2>>16) & 255 )) $(( ($2>>24) & 255 )) | \
|
pascal@405
|
294 hexdump -R | dd bs=1 conv=notrunc of=$3 seek=$(( $1 )) 2> /dev/null
|
pascal@405
|
295 }
|
pascal@405
|
296
|
pascal@405
|
297 # read a 32 bits data
|
pascal@405
|
298 # usage: getlong offset file
|
pascal@405
|
299 getlong()
|
pascal@405
|
300 {
|
pascal@405
|
301 dd if=$2 bs=1 skip=$(( $1 )) count=4 2> /dev/null | \
|
pascal@405
|
302 hexdump -e '"" 1/4 "%d" "\n"'
|
pascal@405
|
303 }
|
pascal@405
|
304
|
pascal@474
|
305 # output floppy images set
|
pascal@474
|
306 floppysetcat()
|
pascal@405
|
307 {
|
pascal@405
|
308 KERNEL="$1"
|
pascal@405
|
309 INITRD="$2"
|
pascal@405
|
310 shift 2
|
pascal@405
|
311 CMDLINE="$@"
|
pascal@405
|
312
|
pascal@405
|
313 # bzImage offsets
|
pascal@405
|
314 SetupSzOfs=497
|
pascal@405
|
315 SyssizeOfs=500
|
pascal@405
|
316 CodeAdrOfs=0x214
|
pascal@405
|
317 RamfsAdrOfs=0x218
|
pascal@405
|
318 RamfsLenOfs=0x21C
|
pascal@405
|
319 ArgPtrOfs=0x228
|
pascal@405
|
320
|
pascal@405
|
321 # boot+setup address
|
pascal@405
|
322 SetupBase=0x90000
|
pascal@405
|
323
|
pascal@405
|
324 stacktop=0x9E00
|
pascal@405
|
325
|
pascal@405
|
326 bs=/tmp/bs$$
|
pascal@405
|
327
|
pascal@405
|
328 # Get and patch boot sector
|
pascal@405
|
329 dd if=$KERNEL bs=512 count=1 of=$bs 2> /dev/null
|
pascal@405
|
330 uudecode <<EOT | dd of=$bs conv=notrunc 2> /dev/null
|
pascal@405
|
331 begin-base64 644 -
|
pascal@474
|
332 /L+6nWgAkAcGF4n8McC5HQDzq1sfD6mg8X1ABlfFd3ixBvOlZWaPR3gGH8ZF
|
pascal@474
|
333 +D/6l1hB6CsBvgACA3QO6HYBWwseKAJ0K1PoUgFe6GcBsCDNELAIzRBO6GYB
|
pascal@474
|
334 PAh0A4gErTk2KAJ08Og/ATwKdeCIfP6J5v9MEP9MGL/0AYFNHP+Ax0UwAJyw
|
pascal@474
|
335 D7EFtJOJRBywAYlEFJhmmNPgSGYDBWbT6GgAEAe/gAAp+JxzAgHHMdtQVujm
|
pascal@474
|
336 AF65AIC0h/5EHM0VWJ133KEaAki/HAKxCThEHHK4k80T6gAAIJCwRijIvtsB
|
pascal@474
|
337 6NMAXesjgPkTcgQ4wXdjgP4CcgQ45ndkYIH9AAZ0KgZSUVOWtAJQsQa1BMHF
|
pascal@474
|
338 BLAPIegEkCcUQCfojQD+zXXssCDNEOK06JcAmM0TYVJQKMh3ArABmDn4cgKJ
|
pascal@474
|
339 +FC0As0TlV5YWnKgT0GAxwJOdfg4wXVFiMj+xrEBOOZ1O4j0/sW2ADou8AFy
|
pascal@474
|
340 L4D9UHIqtQBgvt4B/kQMU+g6AFvoQQB1FlKYzRO4AQLNE1rQ1Dpk/nXqRgjk
|
pascal@474
|
341 deVhlY7hT4zhiehHdYoWB7AxLAO0DrsHAM0QPA1088OwDejv/6wIwHX4w79s
|
pascal@474
|
342 BLFbZQINuA0BZToNdArNFnT0mM0Wju9Hw1g6AEluc2VydCBkaXNrIDEuBw0A
|
pascal@408
|
343 AA==
|
pascal@405
|
344 ====
|
pascal@405
|
345 EOT
|
pascal@405
|
346
|
pascal@405
|
347 # Get setup
|
pascal@405
|
348 setupsz=$(getlong $SetupSzOfs $bs)
|
pascal@405
|
349 setupszb=$(( $setupsz & 255 ))
|
pascal@405
|
350 dd if=$KERNEL bs=512 skip=1 count=$setupszb 2> /dev/null >> $bs
|
pascal@405
|
351
|
pascal@405
|
352 # Store cmdline after setup
|
pascal@405
|
353 if [ -n "$CMDLINE" ]; then
|
pascal@405
|
354 echo -n "$CMDLINE" | dd bs=512 count=1 conv=sync 2> /dev/null >> $bs
|
pascal@405
|
355 storelong ArgPtrOfs $(( $SetupBase + $stacktop )) $bs
|
pascal@405
|
356 fi
|
pascal@405
|
357
|
pascal@405
|
358 # Compute initramfs size
|
pascal@405
|
359 initrdlen=0
|
pascal@405
|
360 padding=0
|
pascal@405
|
361 for i in $( echo $INITRD | sed 's/,/ /' ); do
|
pascal@405
|
362 [ -s "$i" ] || continue
|
pascal@405
|
363 initrdlen=$(( $initrdlen + $padding ))
|
pascal@405
|
364 padding=$(stat -c %s $i)
|
pascal@405
|
365 initrdlen=$(( $initrdlen + $padding ))
|
pascal@405
|
366 padding=$(( 4096 - ($padding & 4095) ))
|
pascal@405
|
367 [ $padding -eq 4096 ] && padding=0
|
pascal@405
|
368 done
|
pascal@405
|
369 Ksize=$(( $(getlong $SyssizeOfs $bs)*16 ))
|
pascal@405
|
370 Kpad=$(( (($Ksize+4095)/4096)*4096 - Ksize ))
|
pascal@405
|
371 if [ $initrdlen -ne 0 ]; then
|
pascal@405
|
372 Kbase=$(getlong $CodeAdrOfs $bs)
|
pascal@405
|
373 storelong $RamfsAdrOfs \
|
pascal@405
|
374 $(( (0x1000000 - $initrdlen) & 0xFFFF0000 )) $bs
|
pascal@405
|
375 storelong $RamfsLenOfs $initrdlen $bs
|
pascal@405
|
376 fi
|
pascal@405
|
377
|
pascal@405
|
378 # Output boot sector + setup + cmdline
|
pascal@405
|
379 dd if=$bs 2> /dev/null
|
pascal@405
|
380
|
pascal@405
|
381 # Output kernel code
|
pascal@405
|
382 dd if=$KERNEL bs=512 skip=$(( $setupszb + 1 )) 2> /dev/null
|
pascal@405
|
383
|
pascal@405
|
384 # Pad to next sector
|
pascal@405
|
385 Kpad=$(( 512 - ($(stat -c %s $KERNEL) & 511) ))
|
pascal@405
|
386 [ $Kpad -eq 512 ] || dd if=/dev/zero bs=1 count=$Kpad 2> /dev/null
|
pascal@405
|
387
|
pascal@405
|
388 # Output initramfs
|
pascal@405
|
389 padding=0
|
pascal@405
|
390 for i in $( echo $INITRD | sed 's/,/ /' ); do
|
pascal@405
|
391 [ -s "$i" ] || continue
|
pascal@405
|
392 [ $padding -ne 0 ] && dd if=/dev/zero bs=1 count=$padding
|
pascal@405
|
393 dd if=$i 2> /dev/null
|
pascal@405
|
394 padding=$(( 4096 - ($(stat -c %s $i) & 4095) ))
|
pascal@405
|
395 [ $padding -eq 4096 ] && padding=0
|
pascal@405
|
396 done
|
pascal@405
|
397
|
pascal@405
|
398 # Cleanup
|
pascal@405
|
399 rm -f $bs
|
pascal@405
|
400 }
|
pascal@405
|
401
|
pascal@474
|
402 # Create boot floppy set from kernel, initrd & cmdline
|
pascal@474
|
403 floppyset()
|
pascal@474
|
404 {
|
pascal@474
|
405 floppysetcat $@ | split -b 1440k /dev/stdin floppy$$
|
pascal@474
|
406 i=1
|
pascal@474
|
407 ls floppy$$* | while read file ; do
|
pascal@476
|
408 output=$(printf "fd%03d.img" $i)
|
pascal@474
|
409 cat $file /dev/zero | dd bs=1k count=1440 of=$output conv=sync 2> /dev/null
|
pascal@474
|
410 rm -f $file
|
pascal@474
|
411 i=$(( $i + 1 ))
|
pascal@474
|
412 done
|
pascal@474
|
413 }
|
pascal@474
|
414
|
pascal@474
|
415 # Create boot floppy set from a SliTaz ISO image
|
pascal@474
|
416 floppysetfromiso()
|
pascal@474
|
417 {
|
pascal@474
|
418 mkdir /tmp/iso$$
|
pascal@474
|
419 mount -o loop,ro $1 /tmp/iso$$
|
pascal@474
|
420 rootfs="$(ls /tmp/iso$$/boot/rootfs*.gz 2> /dev/null | tail -1)"
|
pascal@474
|
421 bzimage=/tmp/iso$$/boot/bzImage
|
pascal@474
|
422 if [ -z "$rootfs" -o ! -s $bzimage ]; then
|
pascal@474
|
423 umount -d /tmp/iso$$
|
pascal@474
|
424 rm -rf /tmp/iso$$
|
pascal@474
|
425 echo "Not a SliTaz ISO image !"
|
pascal@474
|
426 return 1
|
pascal@474
|
427 fi
|
pascal@474
|
428 mkdir -p /tmp/rootfs$$/fs
|
pascal@474
|
429 n=1
|
pascal@474
|
430 for i in $(ls /tmp/iso$$/boot/rootfs*.gz | sort -r); do
|
pascal@474
|
431 mkdir /tmp/rootfs$$/$n
|
pascal@474
|
432 ln -s $i /tmp/rootfs$$/$n
|
pascal@474
|
433 n=$(($n + 1))
|
pascal@474
|
434 done
|
pascal@474
|
435 echo "Unpack rootfs..."
|
pascal@474
|
436 ( zcat $rootfs 2> /dev/null | unlzma -c $rootfs ) | \
|
pascal@474
|
437 ( cd /tmp/rootfs$$/fs ; cpio -idm > /dev/null )
|
pascal@474
|
438 if [ $(unlzma -c $rootfs 2> /dev/null| wc -c) -gt $(stat -c %s $rootfs) ]; then
|
pascal@474
|
439 if [ $(du -ck $rootfs $bzimage | awk 'END { print $1 }') -gt 15296 ]; then
|
pascal@474
|
440 # The rootfs.gz file is too big, extract a minimum bootfs with busybox stuff
|
pascal@474
|
441 echo "Extract bootfs..."
|
pascal@474
|
442 mv /tmp/rootfs$$/fs /tmp/rootfs$$/fs0
|
pascal@474
|
443 for i in lib bin sbin usr/bin usr/sbin ; do
|
pascal@474
|
444 mkdir -p /tmp/rootfs$$/fs/$i
|
pascal@474
|
445 done
|
pascal@474
|
446 cd /tmp/rootfs$$/fs0
|
pascal@474
|
447 dir=$(echo lib/modules/*/kernel/drivers/block)
|
pascal@479
|
448 [ -d $dir ] && mkdir -p ../fs/$dir
|
pascal@474
|
449 [ -f $dir/floppy.ko.gz ] && mv $dir/floppy.ko.gz ../fs/$dir
|
pascal@474
|
450 for i in dev init mnt proc sys tmp ; do
|
pascal@474
|
451 mv $i ../fs
|
pascal@474
|
452 done
|
pascal@479
|
453 mv lib/ld-* ../fs/lib
|
pascal@479
|
454 LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so bin/busybox | \
|
pascal@479
|
455 awk '/\/lib\/lib/ { print $3 }' | while read lib ; do
|
pascal@479
|
456 while [ -L .$lib ]; do
|
pascal@479
|
457 local target
|
pascal@479
|
458 target="$(readlink ".$lib")"
|
pascal@479
|
459 case "$target" in
|
pascal@479
|
460 /*) ;;
|
pascal@479
|
461 *) target="$(dirname $lib)/$target" ;;
|
pascal@479
|
462 esac
|
pascal@479
|
463 mv ".$lib" ../fs/lib
|
pascal@479
|
464 lib="$target"
|
pascal@479
|
465 done
|
pascal@479
|
466 mv ".$lib" ../fs/lib
|
pascal@479
|
467 done
|
pascal@474
|
468 for i in $(bin/busybox | awk '{ if (s) printf "%s",$0 }
|
pascal@474
|
469 /Currently/ { s=1 }' | sed 's/,//g'); do
|
pascal@474
|
470 for j in bin sbin usr/bin usr/sbin ; do
|
pascal@474
|
471 [ -e $j/$i ] && mv $j/$i ../fs/$j/$i
|
pascal@474
|
472 done
|
pascal@474
|
473 done
|
pascal@474
|
474 mv bin/busybox ../fs/bin
|
pascal@479
|
475 [ -e ../fs/bin/cpio ] || mv bin/cpio ../fs/bin
|
pascal@474
|
476 rm -f ../1/*
|
pascal@474
|
477 find | cpio -o -H newc | lzma e ../1/rootfs.gz -si
|
pascal@474
|
478 cd - > /dev/null
|
pascal@474
|
479 rm -rf /tmp/rootfs$$/fs0
|
pascal@474
|
480 else
|
paul@477
|
481 # The rootfs.gz file fits in 15MB, no need to split it.
|
pascal@474
|
482 rm -rf /tmp/rootfs$$/1
|
pascal@474
|
483 fi
|
pascal@474
|
484 else
|
pascal@474
|
485 # This is a loram rootfs.gz, extract loram bootstrap
|
pascal@474
|
486 echo "Split loram rootfs..."
|
pascal@474
|
487 hexdump -C $rootfs | grep " 30 37 30 37 " | \
|
pascal@474
|
488 while read offset rem; do
|
pascal@474
|
489 offset=$((0x$offset / 4))
|
pascal@474
|
490 for i in 1 2 3 4; do
|
pascal@474
|
491 tag=$(dd if=$rootfs bs=4 skip=$offset count=2 2> /dev/null)
|
pascal@474
|
492 if [ "07070100" != "$tag" ]; then
|
pascal@474
|
493 offset=$(($offset + 1))
|
pascal@474
|
494 continue
|
pascal@474
|
495 fi
|
pascal@474
|
496 dd if=$rootfs skip=$(($offset / 1024)) bs=4k count=1 2> /dev/null | \
|
pascal@474
|
497 dd skip=$(($offset % 1024)) bs=4 of=/tmp/rootfs$$/1/root 2> /dev/null
|
pascal@474
|
498 dd if=$rootfs skip=$((1 + ($offset / 1024) )) bs=4k \
|
pascal@474
|
499 >> /tmp/rootfs$$/1/root 2> /dev/null
|
pascal@474
|
500 rm -f /tmp/rootfs$$/1/rootfs*
|
pascal@474
|
501 break 2
|
pascal@474
|
502 done
|
pascal@474
|
503 done
|
pascal@474
|
504 fi
|
pascal@474
|
505 # Create extra rootfs floppies
|
pascal@474
|
506 for i in /tmp/rootfs$$/[1-9]*/root* ; do
|
pascal@474
|
507 [ -f $i ] || continue
|
pascal@474
|
508 echo "Create floppies for rootfs $(basename $(dirname $i) )..."
|
pascal@474
|
509 case "$(dd if=$i bs=1 count=4 2> /dev/null)" in
|
pascal@474
|
510 0707) cat $i ;;
|
pascal@474
|
511 *) zcat $i 2> /dev/null || unlzma -c $i ;;
|
pascal@474
|
512 esac | cpio -t > $(dirname $i)/files.list
|
pascal@474
|
513 sed -i '/ blocks$/d' $(dirname $i)/files.list
|
pascal@474
|
514 x=$(readlink $i)
|
pascal@474
|
515 [ -n "$x" ] || x=$i
|
pascal@474
|
516 pad=$(( $(stat -c %s $x ) % 1474560 ))
|
pascal@474
|
517 [ $pad -ne 0 ] && pad=$(( 1474560 - $pad ))
|
pascal@474
|
518 dd if=/dev/zero bs=1 count=$pad 2> /dev/null | cat $i - | \
|
pascal@474
|
519 split -b 1440k /dev/stdin $(dirname $i)/floppy
|
pascal@474
|
520 done
|
pascal@479
|
521 selection="$(grep -s append /tmp/iso$$/boot/isolinux/common.cfg | sed 's/.*append //')"
|
pascal@474
|
522 [ -n "$selection" ] || selection="0 slitaz"
|
pascal@474
|
523 set -- $selection
|
pascal@474
|
524 selection=""
|
pascal@474
|
525 while [ -n "$2" ]; do
|
pascal@474
|
526 [ ! -d /tmp/rootfs$$/1 -a -z "$4" ] && break
|
pascal@474
|
527 case "$1" in
|
pascal@474
|
528 *G) selection="$2 $(( ${1%G} * 1024 * 1024 )) $selection" ;;
|
pascal@474
|
529 *M) selection="$2 $(( ${1%M} * 1024 )) $selection" ;;
|
pascal@474
|
530 *) selection="$2 $1 $selection" ;;
|
pascal@474
|
531 esac
|
pascal@474
|
532 shift 2
|
pascal@474
|
533 done
|
pascal@474
|
534 echo "Create /init ..."
|
pascal@474
|
535 base=100
|
pascal@474
|
536 set -- $selection
|
pascal@474
|
537 for i in /tmp/rootfs$$/[1-9]* ; do
|
pascal@474
|
538 [ -d $i ] || continue
|
pascal@474
|
539 while read file; do
|
pascal@474
|
540 [ -e $i/../fs/$file ] && continue
|
pascal@474
|
541 [ $(grep -- "$file" $i/../*/files.list | wc -l) -eq 1 ] &&
|
pascal@474
|
542 break
|
pascal@474
|
543 done < $i/files.list
|
pascal@474
|
544 printf "%s %s %03d %d %s %s\n" \
|
pascal@474
|
545 $1 $2 $base $(ls $i/floppy* | wc -l) $file \
|
pascal@474
|
546 $(cat $i/floppy* | md5sum - | awk '{print $1}')
|
pascal@474
|
547 base=$(($base + 100))
|
pascal@474
|
548 shift 2
|
pascal@474
|
549 done | buildinit /tmp/rootfs$$/fs
|
pascal@474
|
550 cmdline="$(grep append /tmp/iso$$/boot/isolinux/isolinux.cfg | tail -n 1 | sed 's/.*gz //')"
|
pascal@474
|
551 ( cd /tmp/rootfs$$/fs ; find | cpio -o -H newc ) | lzma e /tmp/rootfs$$/rootfs -si
|
pascal@474
|
552 echo "Create first stage boot floppies..."
|
pascal@474
|
553 floppyset $bzimage /tmp/rootfs$$/rootfs $cmdline
|
pascal@474
|
554 base=100
|
pascal@474
|
555 for i in /tmp/rootfs$$/[1-9]* ; do
|
pascal@474
|
556 [ -d $i ] || continue
|
pascal@474
|
557 j=0
|
pascal@474
|
558 for f in $i/floppy* ; do
|
pascal@476
|
559 mv $f $(printf "fd%03d.img" $(( $base + $j )) )
|
pascal@474
|
560 j=$(($j + 1))
|
pascal@474
|
561 done
|
pascal@474
|
562 base=$(($base + 100))
|
pascal@474
|
563 done
|
pascal@474
|
564 rm -rf /tmp/rootfs$$
|
pascal@474
|
565 umount -d /tmp/iso$$
|
pascal@474
|
566 rm -rf /tmp/iso$$
|
pascal@474
|
567 }
|
pascal@474
|
568
|
pascal@474
|
569 # Show new boot floppy set
|
pascal@474
|
570 dialogwritefloppyset()
|
pascal@474
|
571 {
|
pascal@474
|
572 if ! list_floppy check; then
|
pascal@476
|
573 du -h fd???.img
|
pascal@474
|
574 return
|
pascal@474
|
575 fi
|
pascal@474
|
576 while true; do
|
pascal@474
|
577 exec 3>&1
|
pascal@474
|
578 IMAGE=`$DIALOG --title " Write floppy image " \
|
pascal@474
|
579 --backtitle "Boot floppy set creation on $DEVICE" --clear \
|
pascal@474
|
580 --colors --radiolist "
|
pascal@474
|
581 Insert a blank floppy in drive and
|
paul@477
|
582 select the floppy image you want to write.
|
pascal@474
|
583 " 18 46 46 \
|
pascal@476
|
584 $(on="on"; for i in fd???.img; do echo "$i $(du -h $i | cut -f1) $on "; on="off"; done) 2>&1 1>&3`
|
pascal@474
|
585 retval=$?
|
pascal@474
|
586 exec 3>&-
|
pascal@474
|
587 check_retval
|
pascal@474
|
588 dd if=$IMAGE of=$DEVICE
|
pascal@474
|
589 done
|
pascal@474
|
590 }
|
pascal@474
|
591
|
pascal@474
|
592 dialognofloppyset()
|
pascal@474
|
593 {
|
pascal@474
|
594 cat << EOT
|
paul@477
|
595 The boot loader can't load the kernel and the initramfs in the first 16MB
|
paul@477
|
596 of RAM. The total size exceeds 15MB. No floppy image is created.
|
pascal@474
|
597 EOT
|
pascal@474
|
598 }
|
pascal@474
|
599
|
pascal@474
|
600 # Check for iso 9660 image
|
pascal@474
|
601 isiso()
|
pascal@474
|
602 {
|
pascal@474
|
603 mkdir /tmp/iso$$
|
pascal@474
|
604 mount -o loop,ro $1 /tmp/iso$$ 2> /dev/null
|
pascal@474
|
605 status=$?
|
pascal@474
|
606 umount -d /tmp/iso$$ 2> /dev/null
|
pascal@474
|
607 rm -rf /tmp/iso$$
|
pascal@474
|
608 return $status
|
pascal@474
|
609 }
|
pascal@474
|
610
|
pascal@474
|
611 dialogfloppyset()
|
pascal@474
|
612 {
|
pascal@474
|
613 : ${DIALOG=dialog}
|
pascal@474
|
614 while true; do
|
pascal@474
|
615 exec 3>&1
|
pascal@474
|
616 KERNEL=`$DIALOG --title " Select a Linux kernel or a SliTaz iso " \
|
pascal@474
|
617 --backtitle "Boot floppy set creation on $DEVICE" --clear \
|
pascal@474
|
618 --colors --fselect "$PWD" 10 70 \
|
pascal@474
|
619 2>&1 1>&3`
|
pascal@474
|
620 retval=$?
|
pascal@474
|
621 exec 3>&-
|
pascal@474
|
622 check_retval
|
pascal@474
|
623 [ -f $KERNEL ] && break
|
pascal@474
|
624 done
|
pascal@474
|
625 if isiso $KERNEL ; then
|
pascal@474
|
626 bootfloppybox call mkisofloppies $KERNEL
|
pascal@474
|
627 dialogwritefloppyset
|
pascal@474
|
628 return
|
pascal@474
|
629 fi
|
pascal@474
|
630 exec 3>&1
|
pascal@474
|
631 INITRD=`$DIALOG --title " Select an Initramfs " \
|
pascal@474
|
632 --backtitle "Boot floppy set creation on $DEVICE" --clear \
|
pascal@474
|
633 --colors --fselect "$PWD" 10 70 \
|
pascal@474
|
634 2>&1 1>&3`
|
pascal@474
|
635 retval=$?
|
pascal@474
|
636 exec 3>&-
|
pascal@474
|
637 check_retval
|
pascal@474
|
638 [ -f "$INITRD" ] || INITRD=""
|
pascal@474
|
639 exec 3>&1
|
pascal@474
|
640 CMDLINE=`$DIALOG --title " Enter boot command line " \
|
pascal@474
|
641 --backtitle "Boot floppy set creation on $DEVICE" --clear \
|
pascal@474
|
642 --colors --inputbox "Kernel command line" 10 70 "rw root=/dev/null autologin" \
|
pascal@474
|
643 2>&1 1>&3`
|
pascal@474
|
644 retval=$?
|
pascal@474
|
645 exec 3>&-
|
pascal@474
|
646 check_retval
|
pascal@474
|
647 bootfloppybox call mkfloppies $KERNEL $INITRD $CMDLINE &&
|
pascal@474
|
648 dialogwritefloppyset ||
|
pascal@474
|
649 dialognofloppyset
|
pascal@474
|
650 }
|
pascal@474
|
651
|
pascal@474
|
652 #
|
pascal@474
|
653 # Create floppy image set
|
pascal@474
|
654 #
|
pascal@474
|
655 export IMAGE_SET='
|
pascal@474
|
656 <window title="Image set generator" icon-name="gtk-floppy">
|
pascal@474
|
657 <vbox>
|
pascal@474
|
658 <text use-markup="true">
|
pascal@474
|
659 <label>
|
pascal@474
|
660 "
|
pascal@474
|
661 <b>Create a boot floppy set</b>
|
pascal@474
|
662 "
|
pascal@474
|
663 </label>
|
pascal@474
|
664 </text>
|
paul@477
|
665 <notebook labels="Slitaz only|Any Linux">
|
pascal@474
|
666 <frame Slitaz only (no size limit)>
|
pascal@474
|
667 <vbox>
|
pascal@474
|
668 <text wrap="false" width-chars="44" use-markup="true">
|
pascal@474
|
669 <label>
|
pascal@474
|
670 "
|
paul@477
|
671 Slitaz uses a floppy boot flavor as a first
|
paul@477
|
672 stage boot to break the tiny loader 15MB limit.
|
pascal@474
|
673 "
|
pascal@474
|
674 </label>
|
pascal@474
|
675 </text>
|
pascal@474
|
676 <hbox>
|
pascal@474
|
677 <text use-markup="true">
|
pascal@474
|
678 <label>"<b>Slitaz ISO : </b>"</label>
|
pascal@474
|
679 </text>
|
pascal@474
|
680 <entry accept="filename">
|
pascal@474
|
681 <label>Select a Slitaz ISO image</label>
|
pascal@474
|
682 <variable>ISO</variable>
|
pascal@474
|
683 </entry>
|
pascal@474
|
684 <button>
|
pascal@474
|
685 <input file stock="gtk-open"></input>
|
pascal@474
|
686 <action type="fileselect">ISO</action>
|
pascal@474
|
687 </button>
|
pascal@474
|
688 </hbox>
|
pascal@474
|
689 <hbox>
|
pascal@474
|
690 <text use-markup="true">
|
pascal@474
|
691 <label>"<b>Output directory : </b>"</label>
|
pascal@474
|
692 </text>
|
pascal@474
|
693 <entry accept="directory">
|
pascal@474
|
694 <label>Select output directory</label>
|
pascal@474
|
695 <variable>FILE_DIRECTORY</variable>
|
pascal@474
|
696 <default>/tmp</default>
|
pascal@474
|
697 </entry>
|
pascal@474
|
698 <button>
|
pascal@474
|
699 <input file stock="gtk-open"></input>
|
pascal@474
|
700 <action type="fileselect">FILE_DIRECTORY</action>
|
pascal@474
|
701 </button>
|
pascal@474
|
702 </hbox>
|
pascal@474
|
703 <hbox>
|
pascal@474
|
704 <button>
|
pascal@474
|
705 <input file icon="forward"></input>
|
pascal@474
|
706 <label>Create image set from ISO boot</label>
|
pascal@476
|
707 <action>cd $FILE_DIRECTORY; bootfloppybox call mkisofloppiesxterm $ISO</action>
|
pascal@474
|
708 <action type="closewindow">IMAGE_SET</action>
|
pascal@474
|
709 </button>
|
pascal@474
|
710 </hbox>
|
pascal@474
|
711 </vbox>
|
pascal@474
|
712 </frame>
|
paul@477
|
713 <frame Any Linux distribution (max total size 14-15MB)>
|
pascal@474
|
714 <vbox>
|
pascal@474
|
715 <text wrap="false" width-chars="44" use-markup="true">
|
pascal@474
|
716 <label>
|
pascal@474
|
717 "
|
pascal@474
|
718 The total size of the kernel and the initramfs must be
|
paul@477
|
719 lower than 14-15MB due to the tiny boot loader design.
|
pascal@474
|
720 "
|
pascal@474
|
721 </label>
|
pascal@474
|
722 </text>
|
pascal@474
|
723 <hbox>
|
pascal@474
|
724 <text use-markup="true">
|
pascal@474
|
725 <label>"<b>Kernel : </b>"</label>
|
pascal@474
|
726 </text>
|
pascal@474
|
727 <entry accept="filename">
|
pascal@474
|
728 <label>Select a linux kernel</label>
|
pascal@474
|
729 <variable>KERNEL</variable>
|
pascal@474
|
730 </entry>
|
pascal@474
|
731 <button>
|
pascal@474
|
732 <input file stock="gtk-open"></input>
|
pascal@474
|
733 <action type="fileselect">KERNEL</action>
|
pascal@474
|
734 </button>
|
pascal@474
|
735 </hbox>
|
pascal@474
|
736 <hbox>
|
pascal@474
|
737 <text use-markup="true">
|
pascal@474
|
738 <label>"<b>Initramfs : </b>"</label>
|
pascal@474
|
739 </text>
|
pascal@474
|
740 <entry accept="filename">
|
pascal@474
|
741 <label>Select an initramfs/initrd file</label>
|
pascal@474
|
742 <variable>INITRD</variable>
|
pascal@474
|
743 </entry>
|
pascal@474
|
744 <button>
|
pascal@474
|
745 <input file stock="gtk-open"></input>
|
pascal@474
|
746 <action type="fileselect">INITRD</action>
|
pascal@474
|
747 </button>
|
pascal@474
|
748 </hbox>
|
pascal@474
|
749 <hbox>
|
pascal@474
|
750 <text use-markup="true">
|
pascal@474
|
751 <label>"<b>Cmdline : </b>"</label>
|
pascal@474
|
752 </text>
|
pascal@474
|
753 <entry>
|
pascal@474
|
754 <label>Enter kernel arguments</label>
|
pascal@474
|
755 <variable>CMDLINE</variable>
|
pascal@474
|
756 <default>rw root=/dev/null autologin</default>
|
pascal@474
|
757 </entry>
|
pascal@474
|
758 </hbox>
|
pascal@474
|
759 <hbox>
|
pascal@474
|
760 <text use-markup="true">
|
pascal@474
|
761 <label>"<b>Output directory : </b>"</label>
|
pascal@474
|
762 </text>
|
pascal@474
|
763 <entry accept="directory">
|
pascal@474
|
764 <label>Select output directory</label>
|
pascal@474
|
765 <variable>OUTPUT_DIRECTORY</variable>
|
pascal@474
|
766 <default>/tmp</default>
|
pascal@474
|
767 </entry>
|
pascal@474
|
768 <button>
|
pascal@474
|
769 <input file stock="gtk-open"></input>
|
pascal@474
|
770 <action type="fileselect">OUTPUT_DIRECTORY</action>
|
pascal@474
|
771 </button>
|
pascal@474
|
772 </hbox>
|
pascal@474
|
773 <hbox>
|
pascal@474
|
774 <button>
|
pascal@474
|
775 <input file icon="forward"></input>
|
pascal@474
|
776 <label>Create image set</label>
|
pascal@476
|
777 <action>cd $OUTPUT_DIRECTORY; bootfloppybox call mkfloppies $KERNEL $INITRD $CMDLINE</action>
|
pascal@474
|
778 <action type="closewindow">IMAGE_SET</action>
|
pascal@474
|
779 </button>
|
pascal@474
|
780 </hbox>
|
pascal@474
|
781 </vbox>
|
pascal@474
|
782 </frame>
|
pascal@474
|
783 </notebook>
|
pascal@474
|
784 <hbox>
|
pascal@474
|
785 <button>
|
pascal@474
|
786 <input file icon="gtk-close"></input>
|
pascal@474
|
787 <action type="closewindow">IMAGE_SET</action>
|
pascal@474
|
788 </button>
|
pascal@474
|
789 </hbox>
|
pascal@474
|
790 </vbox>
|
pascal@474
|
791 </window>
|
pascal@474
|
792 '
|
pascal@474
|
793
|
pascal@474
|
794 #
|
pascal@474
|
795 # Read/write floppy images
|
pascal@474
|
796 #
|
pascal@474
|
797 export FLOPPY_IMAGE='
|
pascal@474
|
798 <window title="Floppy image manager" icon-name="gtk-floppy">
|
pascal@474
|
799 <vbox>
|
pascal@474
|
800 <frame Floppy disk drive>
|
pascal@474
|
801 <hbox>
|
pascal@474
|
802 <text use-markup="true">
|
pascal@474
|
803 <label>"<b>Device : </b>"</label>
|
pascal@474
|
804 </text>
|
pascal@474
|
805 <combobox>
|
pascal@474
|
806 <variable>DEVICE</variable>'
|
pascal@474
|
807 FLOPPY_DEV=""
|
pascal@474
|
808 for i in $(list_floppy); do
|
pascal@474
|
809 FLOPPY_DEV="$FLOPPY_DEV
|
pascal@474
|
810 <item>/dev/$i</item>"
|
pascal@474
|
811 done
|
pascal@474
|
812 FLOPPY_IMAGE="$FLOPPY_IMAGE$FLOPPY_DEV
|
pascal@474
|
813 </combobox>
|
pascal@474
|
814 <button>
|
pascal@474
|
815 <label>Format floppy</label>
|
pascal@474
|
816 <input file icon=\"media-floppy\"></input>
|
pascal@474
|
817 <action>fdformat -n $DEVICE</action>
|
pascal@474
|
818 </button>
|
pascal@474
|
819 </hbox>
|
pascal@474
|
820 </frame>
|
pascal@474
|
821 <frame Floppy image file>
|
pascal@474
|
822 <hbox>
|
pascal@474
|
823 <text use-markup=\"true\">
|
pascal@474
|
824 <label>\"<b>File : </b>\"</label>
|
pascal@474
|
825 </text>
|
pascal@474
|
826 <entry accept=\"filename\">
|
pascal@474
|
827 <label>Select a floppy image</label>
|
pascal@474
|
828 <variable>IMAGE</variable>
|
pascal@474
|
829 </entry>
|
pascal@474
|
830 <button>
|
pascal@474
|
831 <input file stock=\"gtk-open\"></input>
|
pascal@474
|
832 <action type=\"fileselect\">IMAGE</action>
|
pascal@474
|
833 </button>
|
pascal@474
|
834 </hbox>
|
pascal@474
|
835 </frame>
|
pascal@474
|
836 <hbox>
|
pascal@474
|
837 <button>
|
pascal@474
|
838 <input file icon=\"reload\"></input>
|
pascal@474
|
839 <label>Create image set</label>
|
pascal@474
|
840 <action type=\"launch\">IMAGE_SET</action>
|
pascal@474
|
841 </button>
|
pascal@474
|
842 <button>
|
pascal@474
|
843 <input file icon=\"go-jump\"></input>
|
pascal@474
|
844 <label>Write image to floppy</label>
|
pascal@474
|
845 <action>dd if=\$IMAGE of=\$DEVICE</action>
|
pascal@474
|
846 </button>
|
pascal@474
|
847 <button>
|
pascal@474
|
848 <input file icon=\"undo\"></input>
|
pascal@474
|
849 <label>Get floppy image</label>
|
pascal@474
|
850 <action>dd if=\$DEVICE of=\$IMAGE</action>
|
pascal@474
|
851 </button>
|
pascal@474
|
852 <button>
|
pascal@474
|
853 <input file icon=\"gtk-close\"></input>
|
pascal@474
|
854 <action type=\"closewindow\">FLOPPY_IMAGE</action>
|
pascal@474
|
855 </button>
|
pascal@474
|
856 </hbox>
|
pascal@474
|
857 </vbox>
|
pascal@474
|
858 </window>
|
pascal@474
|
859 "
|
pascal@474
|
860
|
pascal@474
|
861 gtkdialogshowfloppyset()
|
pascal@474
|
862 {
|
pascal@474
|
863 #
|
pascal@474
|
864 # Show floppy image set
|
pascal@474
|
865 #
|
pascal@474
|
866 IMAGE_SHOW='
|
pascal@474
|
867 <window title="Image set" icon-name="gtk-floppy">
|
pascal@474
|
868 <vbox>
|
pascal@474
|
869 <text use-markup="true">
|
pascal@474
|
870 <label>
|
pascal@474
|
871 "
|
pascal@474
|
872 <b>Boot floppy images</b>
|
pascal@474
|
873 "
|
pascal@474
|
874 </label>
|
pascal@474
|
875 </text>
|
pascal@474
|
876 <tree>
|
pascal@474
|
877 <width>50</width><height>140</height>
|
pascal@474
|
878 <label>Size|File</label>
|
pascal@476
|
879 <input>du -h fd???.img | sed "s/\t/|/" </input>
|
pascal@474
|
880 </tree>
|
pascal@474
|
881 <hbox>
|
pascal@474
|
882 '
|
pascal@474
|
883 [ 0$1 -gt $((15 * 1024 * 1024)) ] && IMAGE_SHOW="$IMAGE_SHOW
|
pascal@474
|
884 <frame WARNING>
|
pascal@474
|
885 <text>
|
pascal@474
|
886 <label>
|
paul@477
|
887 \"This floppy set breaks the 15MB limit ($1 bytes).
|
paul@477
|
888 It should not be able to complete the boot process.\"
|
pascal@474
|
889 </label>
|
pascal@474
|
890 </text>
|
pascal@474
|
891 </frame>
|
pascal@474
|
892 </hbox>
|
pascal@474
|
893 <hbox>
|
pascal@474
|
894 "
|
pascal@474
|
895 list_floppy check && IMAGE_SHOW="$IMAGE_SHOW
|
pascal@474
|
896 <button>
|
pascal@474
|
897 <input file icon=\"media-floppy\"></input>
|
pascal@474
|
898 <label>Manage images</label>
|
pascal@474
|
899 <action type=\"launch\">FLOPPY_IMAGE</action>
|
pascal@474
|
900 </button>
|
pascal@474
|
901 "
|
pascal@474
|
902 IMAGE_SHOW="$IMAGE_SHOW
|
pascal@474
|
903 <button>
|
pascal@474
|
904 <input file icon=\"gtk-close\"></input>
|
pascal@474
|
905 <action type=\"closewindow\">IMAGE_SET</action>
|
pascal@474
|
906 </button>
|
pascal@474
|
907 </hbox>
|
pascal@474
|
908 </vbox>
|
pascal@474
|
909 </window>
|
pascal@474
|
910 "
|
pascal@474
|
911 export IMAGE_SHOW
|
pascal@474
|
912 gtkdialog --program=IMAGE_SHOW
|
pascal@474
|
913 }
|
pascal@474
|
914
|
pascal@264
|
915 while true; do
|
pascal@264
|
916
|
pascal@264
|
917 if [ "$1" == "call" ]; then
|
pascal@264
|
918 case "$2" in
|
pascal@274
|
919 mkmenu) mkmenu $3;;
|
pascal@474
|
920 mkisofloppiesxterm)
|
pascal@474
|
921 shift 2
|
pascal@474
|
922 xterm -geometry 80x16 -title "Build boot floppies from ISO" \
|
pascal@474
|
923 -e "$0 call mkisofloppies $@ ; echo -e \"----\nENTER to continue...\" && read close"
|
pascal@474
|
924 gtkdialogshowfloppyset
|
pascal@474
|
925 ;;
|
pascal@474
|
926 mkisofloppies)
|
pascal@474
|
927 shift 2
|
pascal@474
|
928 floppysetfromiso $@
|
pascal@474
|
929 ;;
|
pascal@405
|
930 mkfloppies)
|
pascal@405
|
931 shift 2
|
pascal@474
|
932 floppyset $@
|
pascal@476
|
933 sz=$(cat fd???.img | wc -c)
|
pascal@474
|
934 if [ -n "$XAUTHORITY" ]; then
|
pascal@474
|
935 gtkdialogshowfloppyset $sz
|
pascal@474
|
936 else
|
pascal@474
|
937 if [ $sz -gt $((15 * 1024 * 1024)) ]; then
|
pascal@474
|
938 cat <<EOT
|
paul@477
|
939 This floppy set breaks the 15MB limit ($sz bytes).
|
paul@477
|
940 It should not be able to complete the boot process.
|
pascal@474
|
941 EOT
|
pascal@474
|
942 fi
|
pascal@474
|
943 fi
|
pascal@474
|
944 ;;
|
pascal@264
|
945 install)
|
pascal@264
|
946 DIR=/tmp/mkbootfloppy$$
|
pascal@264
|
947 mkdir -p $DIR
|
pascal@264
|
948 DEVICE=$4
|
pascal@264
|
949 file=$5
|
pascal@264
|
950 case "$3" in
|
pascal@474
|
951 dialog*)
|
pascal@474
|
952 shift 2
|
pascal@474
|
953 $@
|
pascal@474
|
954 ;;
|
pascal@274
|
955 grub*)
|
pascal@264
|
956 mkdir -p $DIR/boot/grub
|
pascal@274
|
957 [ -f /usr/share/boot/btmgr -a -f /usr/share/boot/memdisk.lzma ] \
|
pascal@264
|
958 && cat /usr/share/boot/btmgr /dev/zero | \
|
pascal@264
|
959 dd bs=18k count=80 | gzip -9 > \
|
pascal@264
|
960 $DIR/boot/btmgr.gz \
|
pascal@264
|
961 && unlzma -c /usr/share/boot/memdisk.lzma > \
|
pascal@264
|
962 $DIR/boot/memdisk
|
pascal@382
|
963 [ -f /usr/share/boot/plpbt.bin ] \
|
pascal@382
|
964 && cp /usr/share/boot/plpbt.bin $DIR/boot
|
pascal@274
|
965 [ -f /usr/share/boot/etherboot ] \
|
pascal@264
|
966 && cp /usr/share/boot/etherboot $DIR/boot
|
pascal@264
|
967 [ -f /boot/gpxe ]\
|
pascal@264
|
968 && cp /boot/gpxe $DIR/boot
|
pascal@274
|
969 [ -f /usr/share/boot/memtest.lzma -a \
|
pascal@274
|
970 -f /usr/share/boot/memdisk.lzma ] \
|
pascal@274
|
971 && unlzma -c /usr/share/boot/memtest.lzma | \
|
pascal@274
|
972 cat - /dev/zero | dd bs=18k count=80 | \
|
pascal@274
|
973 gzip -9 > $DIR/boot/memtest.gz \
|
pascal@274
|
974 && unlzma -c /usr/share/boot/memdisk.lzma > \
|
pascal@274
|
975 $DIR/boot/memdisk
|
pascal@274
|
976 install_grub $DIR $3
|
pascal@264
|
977 ;;
|
pascal@264
|
978 *)
|
pascal@264
|
979 case "$file" in
|
pascal@264
|
980 *.lzma) action="unlzma -c";;
|
pascal@264
|
981 *.gz) action="zcat";;
|
pascal@264
|
982 *) action="cat";;
|
pascal@264
|
983 esac
|
pascal@264
|
984 case "$DEVICE" in
|
pascal@264
|
985 /dev/*) $action $file > $DEVICE;;
|
pascal@274
|
986 flopp*) $action $file | cat - /dev/zero | \
|
pascal@274
|
987 dd bs=18k count=80 > boot.fd;;
|
pascal@264
|
988 cdrom*)
|
pascal@264
|
989 mkdir -p $DIR/boot/grub
|
pascal@264
|
990 case "$3" in
|
pascal@382
|
991 btmgr|memtest)
|
pascal@264
|
992 $action $file | cat - /dev/zero | \
|
pascal@264
|
993 dd bs=18k count=80 | \
|
pascal@264
|
994 gzip -9 > $DIR/boot/$3.gz
|
pascal@264
|
995 unlzma -c /usr/share/boot/memdisk.lzma \
|
pascal@264
|
996 > $DIR/boot/memdisk
|
pascal@274
|
997 cat > /tmp/floppybox.grub.menu << EOT
|
pascal@274
|
998 # grub menu
|
pascal@264
|
999 timeout 0
|
pascal@264
|
1000 title $3
|
pascal@264
|
1001 kernel /boot/memdisk floppy c=80 h=2 s=18
|
pascal@264
|
1002 initrd /boot/$3.gz
|
pascal@264
|
1003 EOT
|
pascal@264
|
1004 ;;
|
pascal@264
|
1005 *) $action $file > $DIR/boot/$3
|
pascal@274
|
1006 cat > /tmp/floppybox.grub.menu << EOT
|
pascal@274
|
1007 # grub menu
|
pascal@264
|
1008 timeout 0
|
pascal@264
|
1009 title $3
|
pascal@264
|
1010 kernel /boot/$3
|
pascal@264
|
1011 EOT
|
pascal@264
|
1012 ;;
|
pascal@264
|
1013 esac
|
pascal@274
|
1014 install_grub $DIR grub
|
pascal@264
|
1015 ;;
|
pascal@264
|
1016 esac
|
pascal@264
|
1017 ;;
|
pascal@264
|
1018 esac
|
pascal@264
|
1019 rm -rf $DIR
|
pascal@264
|
1020 ;;
|
pascal@220
|
1021 get-plop)
|
pascal@382
|
1022 mkdir -p /tmp/get-plop$$
|
pascal@382
|
1023 PLOP_URL=http://mirror.slitaz.org/boot/plpbt.bin
|
pascal@382
|
1024 wget -O - $PLOP_URL > /tmp/get-plop$$/plpbt.bin
|
pascal@382
|
1025 VERSION="$(strings /tmp/get-plop$$/plpbt.bin \
|
pascal@382
|
1026 | grep 'Boot Manager v' | sed 's/.* v\([0-9\.]*\) .*/\1/')"
|
pascal@382
|
1027 mkdir -p $(dirname /tmp/get-plop$$/plop-$VERSION/fs/$3)
|
pascal@382
|
1028 mv /tmp/get-plop$$/plpbt.bin \
|
pascal@382
|
1029 /tmp/get-plop$$/plop-$VERSION/fs/$3
|
pascal@285
|
1030 if [ -s /tmp/get-plop$$/plop-$VERSION/fs/$3 ]; then
|
pascal@285
|
1031 cat > /tmp/get-plop$$/plop-$VERSION/receipt <<EOT
|
pascal@220
|
1032 PACKAGE="plop"
|
pascal@285
|
1033 VERSION="$VERSION"
|
pascal@220
|
1034 CATEGORY="non-free"
|
pascal@220
|
1035 SHORT_DESC="Plop boot manager."
|
pascal@220
|
1036 WEB_SITE="http://www.plop.at/en/bootmanager.html"
|
pascal@220
|
1037 EOT
|
pascal@285
|
1038 ( cd /tmp/get-plop$$ ; tazpkg pack plop-$VERSION )
|
pascal@285
|
1039 tazpkg install /tmp/get-plop$$/plop-$VERSION.tazpkg
|
pascal@264
|
1040 fi
|
pascal@220
|
1041 rm -rf /tmp/get-plop$$
|
pascal@220
|
1042 ;;
|
pascal@214
|
1043 *) echo "Invalid command $0 $@" 1>&2
|
pascal@214
|
1044 exit 1;;
|
pascal@214
|
1045 esac
|
pascal@214
|
1046 exit 0
|
pascal@214
|
1047 fi
|
pascal@214
|
1048
|
pascal@213
|
1049 if [ -z "$XAUTHORITY" ]; then
|
pascal@213
|
1050
|
pascal@213
|
1051 : ${DIALOG=dialog}
|
pascal@213
|
1052
|
pascal@213
|
1053 DEVICE=/dev/fd0
|
pascal@474
|
1054 list_floppy check || DEVICE="floppy"
|
pascal@213
|
1055 while true; do
|
pascal@213
|
1056 exec 3>&1
|
pascal@213
|
1057 ID_SOURCE=`$DIALOG --title " Choose a boot floppy " \
|
pascal@213
|
1058 --backtitle "Boot Floppy Creation on $DEVICE" --clear \
|
pascal@213
|
1059 --extra-button --extra-label "Change floppy" \
|
pascal@213
|
1060 --colors --radiolist "
|
paul@317
|
1061 Create a floppy or a cdrom to boot a LiveCD in a PXE network...
|
pascal@264
|
1062 May need a floppy disk in drive. Erase the whole floppy disk.
|
pascal@213
|
1063 " 18 70 50\
|
pascal@474
|
1064 FloppySet "Boot Slitaz with floppies only." on \
|
pascal@474
|
1065 SmartBtmgr "Boot any partition or ATAPI CD-ROM." off \
|
pascal@382
|
1066 Plop "Boot USB harddisk floppy or CD/DVD." off \
|
pascal@220
|
1067 Etherboot "Replacement for proprietary PXE ROMs." off \
|
pascal@223
|
1068 gPXE "Boot from http://boot.slitaz.org/" off \
|
pascal@220
|
1069 Memtest86+ "Memory failures detection tool." off \
|
paul@333
|
1070 Grub4DOS "Enhanced grub version supporting NTFS." off \
|
pascal@474
|
1071 Grub "Boot loader with command shell." off \
|
pascal@474
|
1072 2>&1 1>&3`
|
pascal@213
|
1073 retval=$?
|
pascal@213
|
1074 exec 3>&-
|
pascal@213
|
1075 check_retval
|
pascal@213
|
1076 if [ "$retval" = "3" ]; then
|
pascal@213
|
1077 select_floppy
|
pascal@213
|
1078 continue;
|
pascal@213
|
1079 fi
|
pascal@213
|
1080 while read key file pkg; do
|
pascal@213
|
1081 [ "$key" = "$ID_SOURCE" ] || continue
|
pascal@213
|
1082 if [ ! -f "$file" ]; then
|
pascal@213
|
1083 $DIALOG --title " Install package " --colors \
|
pascal@213
|
1084 --backtitle "Boot Floppy Creation" --clear \
|
pascal@213
|
1085 --yes-label "Install" \
|
pascal@213
|
1086 --no-label "Quit" \
|
pascal@213
|
1087 --yesno "The package $pkg is not yet installed. Install it ?" 18 70
|
pascal@213
|
1088 retval=$?
|
pascal@220
|
1089 if [ "$pkg" = "plop" ]; then
|
pascal@220
|
1090 bootfloppybox call get-plop $file
|
pascal@220
|
1091 else
|
pascal@264
|
1092 tazpkg get-install $pkg
|
pascal@220
|
1093 fi
|
pascal@213
|
1094 fi
|
pascal@264
|
1095 bootfloppybox call install "$pkg" "$DEVICE" "$file"
|
pascal@213
|
1096 exit 0
|
pascal@213
|
1097 done <<EOT
|
pascal@474
|
1098 FloppySet /bin/dd dialogfloppyset
|
pascal@213
|
1099 SmartBtmgr /usr/share/boot/btmgr btmgr
|
pascal@382
|
1100 Plop /usr/share/boot/plpbt.bin plop
|
pascal@213
|
1101 Etherboot /usr/share/boot/etherboot etherboot
|
pascal@222
|
1102 gPXE /boot/gpxe gpxe
|
pascal@213
|
1103 Memtest86+ /usr/share/boot/memtest.lzma memtest
|
pascal@274
|
1104 Grub4DOS /usr/share/boot/grldr.lzma grub4dos
|
pascal@213
|
1105 Grub /usr/sbin/grub grub
|
pascal@213
|
1106 EOT
|
pascal@213
|
1107 done
|
pascal@213
|
1108 fi
|
pascal@264
|
1109 #
|
pascal@264
|
1110 # Describe gPXE arguments.
|
pascal@264
|
1111 #
|
pascal@264
|
1112 export HELP='
|
pascal@264
|
1113 <window title="gPXE forced url" icon-name="gtk-floppy">
|
pascal@264
|
1114 <vbox>
|
pascal@474
|
1115 <text use-markup="true">
|
pascal@264
|
1116 <label>"
|
pascal@264
|
1117 <b>Web boot parameters</b>"
|
pascal@264
|
1118 </label>
|
pascal@264
|
1119 </text>
|
pascal@264
|
1120 <frame>
|
pascal@264
|
1121 <text wrap="true" width-chars="58" use-markup="true">
|
pascal@264
|
1122 <label>
|
paul@333
|
1123 "Without parameters (i.e. with an empty Boot URL) gPXE will perform a normal PXE boot: IP configuration with DHCP and download the DHCP bootfile with TFTP.
|
pascal@264
|
1124
|
paul@317
|
1125 You can override the DHCP bootfile with a Boot URL such as <i>tftp://192.168.0.1/pxe/pxeloader</i>, <i>http://mirror.slitaz.org/pxe/pxelinux.0</i>, or <i>x-tftm://192.168.0.201//lts/vmlinuz.ltsp</i>.
|
pascal@264
|
1126
|
paul@333
|
1127 You can override IP configuration too (useful without a DHCP server), example: <i>ip=192.168.0.10/24 gw=192.168.0.1 dns=192.168.0.1 nodhcp url=http://mirror.slitaz.org/pxe/pxelinux.0</i>
|
pascal@264
|
1128
|
paul@317
|
1129 The <i>nodhcp</i> keyword avoids dhcp timeouts and the <i>url=</i> keyword is optional when the url is the only one argument.
|
pascal@337
|
1130
|
paul@350
|
1131 Comma separated URL lists are supported. The PXE client will try to load the first URL. If the load fails, it will try the next URL, and so on.
|
pascal@264
|
1132 "
|
pascal@264
|
1133 </label>
|
pascal@264
|
1134 </text>
|
pascal@264
|
1135 </frame>
|
pascal@264
|
1136 </vbox>
|
pascal@264
|
1137 </window>
|
pascal@264
|
1138 '
|
pascal@264
|
1139 #
|
pascal@130
|
1140 # Write bootfloppy image to floppy device.
|
pascal@130
|
1141 #
|
pascal@130
|
1142 BOOT_DIALOG='
|
pascal@139
|
1143 <window title="bootfloppybox" icon-name="gtk-floppy">
|
pascal@130
|
1144 <vbox>
|
pascal@130
|
1145
|
pascal@130
|
1146 <text use-markup="true">
|
pascal@130
|
1147 <label>
|
pascal@130
|
1148 "
|
pascal@130
|
1149 <b>SliTaz - Bootfloppybox</b>"
|
pascal@130
|
1150 </label>
|
pascal@130
|
1151 </text>
|
pascal@134
|
1152 <text wrap="false" width-chars="44" use-markup="true">
|
pascal@130
|
1153 <label>
|
pascal@130
|
1154 "
|
paul@333
|
1155 Create a floppy or a cdrom to boot a LiveCD in a PXE network or the WEB...
|
pascal@264
|
1156 May need a floppy disk in drive. Erase the whole floppy disk.
|
pascal@130
|
1157 "
|
pascal@130
|
1158 </label>
|
pascal@130
|
1159 </text>
|
pascal@130
|
1160
|
pascal@130
|
1161 <frame Floppy disk drive>
|
pascal@130
|
1162 <hbox>
|
pascal@130
|
1163 <text use-markup="true">
|
pascal@132
|
1164 <label>"<b>Device : </b>"</label>
|
pascal@130
|
1165 </text>
|
pascal@264
|
1166 <combobox>
|
pascal@264
|
1167 <variable>DEVICE</variable>'
|
pascal@474
|
1168 FLOPPY_DEV=""
|
pascal@474
|
1169 for i in $(list_floppy); do
|
pascal@474
|
1170 FLOPPY_DEV="$FLOPPY_DEV
|
pascal@474
|
1171 <item>/dev/$i</item>"
|
pascal@264
|
1172 done
|
pascal@474
|
1173 BOOT_DIALOG="$BOOT_DIALOG$FLOPPY_DEV
|
pascal@474
|
1174 <item>floppy image (boot.fd)</item>
|
paul@333
|
1175 <item>cdrom image (boot.iso)</item>
|
pascal@474
|
1176 </combobox>"
|
pascal@474
|
1177 if [ -n "$FLOPPY_DEV" ]; then
|
pascal@474
|
1178 tmp='
|
pascal@132
|
1179 <button>
|
pascal@132
|
1180 <label>Format floppy</label>
|
pascal@330
|
1181 <input file icon="media-floppy"></input>
|
pascal@264
|
1182 <action>case "$DEVICE" in /dev/*) fdformat -n $DEVICE;; esac</action>
|
pascal@474
|
1183 </button>'
|
pascal@474
|
1184 BOOT_DIALOG="$BOOT_DIALOG$tmp"
|
pascal@474
|
1185 fi
|
pascal@474
|
1186 tmp='
|
pascal@130
|
1187 </hbox>
|
pascal@130
|
1188 </frame>
|
pascal@474
|
1189 <notebook labels="Set|LiveCD|USB|PXE Network|WEB Network|Memory Test|Windows|Expert">
|
pascal@474
|
1190 <frame Boot floppy set (many floppies)>
|
pascal@474
|
1191 <vbox>
|
pascal@474
|
1192 <hbox>
|
pascal@474
|
1193 <text wrap="true" width-chars="58" use-markup="true">
|
pascal@474
|
1194 <label>
|
pascal@474
|
1195 "
|
paul@477
|
1196 Only people without a CD-ROM, USB and Network should use a floppy set.
|
pascal@474
|
1197 The images are built from an ISO boot or from a Linux kernel, an initramfs
|
paul@477
|
1198 and a boot command line. Non Slitaz boot floppy sets are limited to 15MB.
|
pascal@474
|
1199 "
|
pascal@474
|
1200 </label>
|
pascal@474
|
1201 </text>
|
pascal@474
|
1202 </hbox>
|
pascal@474
|
1203 <hbox>
|
pascal@474
|
1204 <button>
|
pascal@474
|
1205 <label>Create image set</label>
|
pascal@474
|
1206 <input file icon="forward"></input>
|
pascal@474
|
1207 <action type="launch">IMAGE_SET</action>
|
pascal@474
|
1208 </button>
|
pascal@474
|
1209 </hbox>
|
pascal@474
|
1210 </vbox>
|
pascal@474
|
1211 </frame>
|
pascal@130
|
1212 '
|
pascal@264
|
1213 BOOT_DIALOG="$BOOT_DIALOG$tmp"
|
pascal@130
|
1214 while read name file pkg desc; do
|
pascal@474
|
1215 tmp="<frame $name (single floppy)>
|
pascal@130
|
1216 <hbox>
|
pascal@474
|
1217 <text wrap=\"true\" width-chars=\"58\" use-markup=\"true\">
|
pascal@130
|
1218 <label>
|
pascal@130
|
1219 \"
|
pascal@130
|
1220 $(echo -e $desc)
|
pascal@130
|
1221 \"
|
pascal@130
|
1222 </label>
|
pascal@130
|
1223 </text>
|
pascal@130
|
1224 </hbox>
|
pascal@264
|
1225 <hbox>
|
pascal@130
|
1226 "
|
pascal@130
|
1227 if [ -f $file ]; then
|
pascal@274
|
1228 if [ "$pkg" = "grub" -o "$pkg" = "grub4dos" ]; then
|
pascal@135
|
1229 tmp="$tmp
|
pascal@135
|
1230 <button>
|
pascal@200
|
1231 <label>Grub menu</label>
|
pascal@200
|
1232 <input file icon=\"accessories-text-editor\"></input>
|
pascal@274
|
1233 <action>bootfloppybox call mkmenu $pkg</action>
|
pascal@214
|
1234 <action type=\"lauch\">leafpad /tmp/floppybox.grub.menu</action>
|
pascal@200
|
1235 </button>
|
pascal@135
|
1236 "
|
pascal@267
|
1237 elif [ "$pkg" = "etherboot" ]; then
|
pascal@267
|
1238 tmp="$tmp
|
pascal@267
|
1239 <button>
|
pascal@267
|
1240 <input file icon=\"browser\"></input>
|
pascal@267
|
1241 <label>Wiki</label>
|
pascal@267
|
1242 <action>firefox http://wiki.slitaz.org/doku.php?id=quickstart:pxe &</action>
|
pascal@267
|
1243 </button>
|
pascal@267
|
1244 "
|
pascal@233
|
1245 elif [ "$pkg" = "gpxe" ]; then
|
pascal@233
|
1246 tmp="$tmp
|
pascal@233
|
1247 <text wrap=\"true\" use-markup=\"true\">
|
pascal@233
|
1248 <label> \"<b>Boot URL:</b>\" </label>
|
pascal@233
|
1249 </text>
|
pascal@233
|
1250 <entry>
|
pascal@233
|
1251 <default>$(dd if=$file bs=1 skip=519 count=255 2>/dev/null | strings)</default>
|
pascal@233
|
1252 <variable>URL</variable>
|
pascal@233
|
1253 </entry>
|
pascal@264
|
1254 </hbox>
|
pascal@264
|
1255 <hbox>
|
pascal@267
|
1256 <button>
|
pascal@267
|
1257 <input file icon=\"browser\"></input>
|
pascal@267
|
1258 <label>Wiki</label>
|
pascal@267
|
1259 <action>firefox http://wiki.slitaz.org/doku.php?id=quickstart:pxe &</action>
|
pascal@267
|
1260 </button>
|
pascal@264
|
1261 <button help>
|
pascal@264
|
1262 <action type=\"launch\">HELP</action>
|
pascal@264
|
1263 </button>
|
pascal@233
|
1264 <button>
|
pascal@233
|
1265 <label>Update</label>
|
pascal@233
|
1266 <input file icon=\"reload\"></input>
|
pascal@233
|
1267 <action>echo -n \"\$URL\" | cat - /dev/zero | dd conv=notrunc bs=1 count=255 seek=519 of=$file 2>/dev/null</action>
|
pascal@233
|
1268 </button>
|
pascal@264
|
1269 "
|
pascal@264
|
1270 fi
|
pascal@267
|
1271 receipt=/var/lib/tazpkg/installed/$pkg/receipt
|
pascal@267
|
1272 if [ -f $receipt ]; then
|
pascal@267
|
1273 . $receipt
|
pascal@267
|
1274 tmp="$tmp
|
pascal@267
|
1275 <button>
|
pascal@267
|
1276 <input file icon=\"browser\"></input>
|
pascal@267
|
1277 <label>Web</label>
|
pascal@267
|
1278 <action>firefox $WEB_SITE &</action>
|
pascal@267
|
1279 </button>
|
pascal@267
|
1280 "
|
pascal@267
|
1281 fi
|
pascal@264
|
1282 tmp="$tmp
|
pascal@233
|
1283 <button>
|
pascal@233
|
1284 <label>Write floppy</label>
|
pascal@233
|
1285 <input file icon=\"forward\"></input>
|
pascal@264
|
1286 <action>bootfloppybox call install \"$pkg\" \"\$DEVICE\" \"$file\"</action>
|
pascal@233
|
1287 </button>
|
pascal@233
|
1288 </hbox>
|
pascal@233
|
1289 </frame>
|
pascal@233
|
1290 "
|
pascal@130
|
1291 else
|
pascal@264
|
1292 tmp2="tazpkg get-install $pkg --forced"
|
pascal@220
|
1293 [ "$pkg" = "plop" ] && tmp2="bootfloppybox call get-plop $file"
|
pascal@130
|
1294 tmp="$tmp
|
pascal@157
|
1295 <text wrap=\"true\" width-chars=\"34\" use-markup=\"true\">
|
pascal@130
|
1296 <label>
|
pascal@130
|
1297 \"<i>The package <b>$pkg</b> is not yet installed</i>\"
|
pascal@130
|
1298 </label>
|
pascal@130
|
1299 </text>
|
pascal@157
|
1300 <button>
|
pascal@157
|
1301 <input file icon=\"go-jump\"></input>
|
pascal@157
|
1302 <label>Install</label>
|
pascal@264
|
1303 <action>[ -f /var/lib/tazpkg/packages.list ] || tazpkg recharge</action>
|
pascal@264
|
1304 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x17 -title \"$pkg install\" -e \"$tmp2 ; sleep 2\"</action>
|
pascal@221
|
1305 <action type=\"exit\">restart</action>
|
pascal@157
|
1306 </button>
|
pascal@130
|
1307 </hbox>
|
pascal@130
|
1308 </frame>
|
pascal@130
|
1309 "
|
pascal@130
|
1310 fi
|
pascal@130
|
1311 BOOT_DIALOG="$BOOT_DIALOG$tmp"
|
pascal@130
|
1312 done <<EOT
|
pascal@474
|
1313 SmartBtmgr /usr/share/boot/btmgr btmgr This OS independent Smart Boot Manager can boot \\\\nany partition or ATAPI CD-ROM.
|
pascal@474
|
1314 Plop /usr/share/boot/plpbt.bin plop This non free Boot Manager can boot a floppy disk, hardisk, USB or \\\\nCD/DVD. Hit Ctrl-ESC for text mode.
|
pascal@474
|
1315 Etherboot /usr/share/boot/etherboot etherboot This network bootloader provides a replacement \\\\nfor proprietary PXE or NBI ROMs.
|
pascal@233
|
1316 gPXE /boot/gpxe gpxe PXE / iSCSI / AoE network bootloader.
|
pascal@130
|
1317 Memtest86+ /usr/share/boot/memtest.lzma memtest Memory failures detection tool.
|
paul@333
|
1318 Grub4DOS /usr/share/boot/grldr.lzma grub4dos Enhanced grub version supporting NTFS.
|
paul@333
|
1319 Grub /usr/sbin/grub grub General purpose boot loader with command shell.
|
pascal@130
|
1320 EOT
|
pascal@130
|
1321 tmp='
|
pascal@134
|
1322 </notebook>
|
pascal@130
|
1323 <hbox>
|
pascal@474
|
1324 '
|
pascal@474
|
1325 BOOT_DIALOG="$BOOT_DIALOG$tmp"
|
pascal@474
|
1326 if [ -e /dev/cdrom ]; then
|
pascal@474
|
1327 tmp='
|
pascal@130
|
1328 <button>
|
pascal@330
|
1329 <input file icon="media-cdrom"></input>
|
pascal@330
|
1330 <label>Burn cdrom image</label>
|
pascal@330
|
1331 <action>burnbox</action>
|
pascal@330
|
1332 </button>
|
pascal@474
|
1333 '
|
pascal@474
|
1334 BOOT_DIALOG="$BOOT_DIALOG$tmp"
|
pascal@474
|
1335 fi
|
pascal@474
|
1336 if list_floppy check; then
|
pascal@474
|
1337 tmp='
|
pascal@330
|
1338 <button>
|
pascal@330
|
1339 <input file icon="media-floppy"></input>
|
pascal@330
|
1340 <label>Manage floppy image</label>
|
pascal@330
|
1341 <action type="launch">FLOPPY_IMAGE</action>
|
pascal@330
|
1342 </button>
|
pascal@474
|
1343 '
|
pascal@474
|
1344 BOOT_DIALOG="$BOOT_DIALOG$tmp"
|
pascal@474
|
1345 fi
|
pascal@474
|
1346 tmp='
|
pascal@330
|
1347 <button>
|
pascal@130
|
1348 <input file icon="exit"></input>
|
pascal@130
|
1349 <label>Exit</label>
|
pascal@130
|
1350 <action type="exit">Exit</action>
|
pascal@130
|
1351 </button>
|
pascal@130
|
1352 </hbox>
|
pascal@130
|
1353
|
pascal@130
|
1354 </vbox>
|
pascal@130
|
1355 </window>
|
pascal@130
|
1356 '
|
pascal@130
|
1357 BOOT_DIALOG="$BOOT_DIALOG$tmp"
|
pascal@130
|
1358 export BOOT_DIALOG
|
pascal@130
|
1359
|
pascal@130
|
1360 # Only root can create floppy.
|
pascal@130
|
1361 check_root
|
pascal@221
|
1362 gtkdialog --program=BOOT_DIALOG | grep -q 'EXIT="restart"' && continue
|
pascal@214
|
1363 rm -f /tmp/floppybox.grub.menu
|
pascal@130
|
1364 exit 0
|
pascal@221
|
1365 done
|