wok-current annotate syslinux/stuff/iso2exe/taziso @ rev 23951

taziso/bootusbkey: up to 2TB
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Sep 21 09:52:25 2020 +0000 (2020-09-21)
parents 1a30965ea03c
children 3a5c9f8a51f4
rev   line source
pascal@17635 1 #!/bin/sh
pascal@17635 2
pascal@23831 3 [ 0$(id -u 2>/dev/null) -eq 0 ] || exec su -c "$0 $@"
pascal@17635 4
pascal@17635 5 DIALOG=dialog
pascal@17635 6
pascal@17635 7 ddq()
pascal@17635 8 {
pascal@17635 9 dd $@ 2> /dev/null
pascal@17635 10 }
pascal@17635 11
pascal@23946 12 ddn()
pascal@23946 13 {
pascal@23946 14 ddq conv=notrunc $@
pascal@23946 15 }
pascal@23946 16
pascal@17635 17 get()
pascal@17635 18 {
pascal@21542 19 hexdump -v -s $1 -n ${4:-${3:-2}} -e "\"\" 1/${3:-2} \" %u\n\"" "$2"
pascal@17635 20 }
pascal@17635 21
pascal@17635 22 bytes2bin()
pascal@17635 23 {
pascal@17635 24 for i in $@ ; do
pascal@17635 25 printf '\\\\x%02X' $(($i&255))
pascal@17635 26 done | xargs echo -en
pascal@17635 27 }
pascal@17635 28
pascal@17635 29 words2bin()
pascal@17635 30 {
pascal@17635 31 for i in $@ ; do
pascal@17635 32 printf '\\\\x%02X\\\\x%02X' $(($i&255)) $((($i>>8)&255))
pascal@17635 33 done | xargs echo -en
pascal@17635 34 }
pascal@17635 35
pascal@23951 36 quads2bin()
pascal@23947 37 {
pascal@23947 38 for i in $@ ; do
pascal@23947 39 printf '\\\\x%02X\\\\x%02X\\\\x%02X\\\\x%02X' $(($i&255)) \
pascal@23947 40 $((($i>>8)&255)) $((($i>>16)&255)) $((($i>>24)&255))
pascal@23947 41 done | xargs echo -en
pascal@23947 42 }
pascal@23947 43
pascal@17635 44 gettazboot()
pascal@17635 45 {
pascal@21542 46 echo -e "\nCreating $(basename $1) ..."
pascal@23810 47 S=$((32+HEADERSZ))
pascal@18140 48 P=$((($S+511)/512))
pascal@18140 49 E=$((4096-(32*$P)))
pascal@23810 50 words2bin 0x5A4D $(($S%512)) $P 0 2 $E -1 -16 \
pascal@18140 51 -2 0 256 -16 28 0x6C53 0x5469 0x7A61 > $1
pascal@23810 52 uudecode - >> $1 << EOT
pascal@23810 53 HEADERCODE
pascal@23810 54 EOT
pascal@23813 55 gotcdfile linld.com
pascal@23813 56 ddq if=$file >> $1
pascal@17635 57 }
pascal@17635 58
pascal@23946 59 maybe64()
pascal@23946 60 {
pascal@23946 61 echo -n $1
pascal@23946 62 grep -q ' lm ' /proc/cpuinfo && [ -s ${1}64 ] && echo 64
pascal@23946 63 }
pascal@23946 64
pascal@23947 65 size()
pascal@23947 66 {
pascal@23951 67 stat -c %s "$1"
pascal@23951 68 }
pascal@23951 69
pascal@23951 70 sectcnt()
pascal@23951 71 {
pascal@23951 72 [ ! -b "$1" ] && echo $(($(size "$1")/512)) ||
pascal@23951 73 cat /sys/block/${1#/dev/}/size
pascal@23947 74 }
pascal@23947 75
pascal@17635 76 uncpio()
pascal@17635 77 {
pascal@23820 78 i=$1
pascal@23946 79 [ $0 = /init.exe ] && i=$(maybe64 $i)
pascal@23820 80 [ -s "$i" ] || return
pascal@23820 81 echo -en "\n Extracting $(basename $i) ..."
pascal@23820 82 case $(get 0 $i) in
pascal@17635 83 *35615) ( zcat || gunzip ) ;;
pascal@17635 84 *14333) unxz ;;
pascal@17635 85 *\ 93) unlzma ;;
pascal@17635 86 *) cat ;;
pascal@23820 87 esac < $i | ( cd ${2:-/} ; cpio -idmu > /dev/null 2>&1 )
pascal@17635 88 }
pascal@17635 89
pascal@23831 90 xdotwait=dotwait
pascal@17635 91 dotwait()
pascal@17635 92 {
pascal@17635 93 echo -n "${1:-Install filesystem}.."
pascal@23820 94 echo -n > /tmp/wait
pascal@17930 95 [ "$REQUEST_URI" ] && return
pascal@17635 96 while [ -e /tmp/wait ]; do
pascal@23820 97 echo -n "." > /dev/${tty0:-tty}
pascal@17635 98 sleep 1
pascal@17635 99 done &
pascal@17635 100 }
pascal@17635 101
pascal@17635 102 getuuid()
pascal@17635 103 {
pascal@17635 104 dev=$(mount | sed "/ $(echo $mnt | sed 's|/|\\/|g') /!d;s/ .*//;s|/dev/||;q")
pascal@17635 105 [ "$dev" ] &&
pascal@17635 106 blkid | sed "/$dev:/!d;s/.* UUID=.\\([^ ]*\\)\".*/\\1/" ||
pascal@17635 107 echo "/dev/hda1"
pascal@17635 108 }
pascal@17635 109
pascal@17635 110 tazusbinitfs()
pascal@17635 111 {
pascal@23947 112 PAD=$(($(size $1) % 4))
pascal@17635 113 [ $PAD -ne 0 ] && ddq if=/dev/zero bs=1 count=$((4 - $PAD)) >> $1
pascal@17635 114 mkdir -p /tmp/fs$$/etc /tmp/fs$$/lib /tmp/fs$$/home
pascal@21542 115 cp -a /etc/locale.conf /etc/locale.conf /tmp/fs$$/etc 2> /dev/null
pascal@17635 116 cat > /tmp/fs$$/init1 <<EOT
pascal@17635 117 #!/bin/sh
pascal@17635 118 sed -i 's|sbin/init|init2|' /init
pascal@17635 119 exec /init
pascal@17635 120 EOT
pascal@17635 121 cat > /tmp/fs$$/init2 <<EOT
pascal@17635 122 #!/bin/sh
pascal@17635 123
pascal@17635 124 mount -t proc /proc /proc
pascal@21542 125 for i in /lib/modules/*.ko* ; do insmod \$i 2> /dev/null ; done; sleep 2
pascal@17635 126 v=\$(sed '/\\/home=/!d;s|.*/home=\\([^ ]*\\).*|\\1|' /proc/cmdline /cmdline 2> /dev/null)
pascal@17635 127 mount / -o remount,rw
pascal@17635 128 mkdir /mnt/dos
pascal@17635 129 rm -f /cmdline 2> /dev/null
pascal@17635 130 mount / -o remount,ro
pascal@17635 131 mnt=/mnt/dos/\${v#*/}
pascal@17635 132 dev=\$( (blkid /dev/[sh]d* || blkid) | grep \${v%%/*} | sed 's/:.*//;q')
pascal@17635 133 echo "Mount \$dev in /mnt/dos for \$v..." | tee -a /run/boot.log
pascal@17635 134 mount \$dev /mnt/dos
pascal@17635 135 if [ ! -d /mnt/dos/slitaz ]; then
pascal@17635 136 umount /mnt/dos 2> /dev/null
pascal@17635 137 (blkid /dev/[sh]d* || blkid) | while read dev line; do
pascal@17635 138 case "\$line" in
pascal@17635 139 *ntfs*|*vfat*|*msdos*) ;;
pascal@17635 140 *) continue ;;
pascal@17635 141 esac
pascal@17635 142 mount \${dev%:} /mnt/dos
pascal@17635 143 [ -d /mnt/dos/slitaz ] && break
pascal@17635 144 umount /mnt/dos
pascal@17635 145 done
pascal@17635 146 fi
pascal@17932 147 $([ "$2" ] || echo '# ')mount.posixovl -F \$mnt -- -oallow_other -odefault_permissions -osuid
pascal@17635 148 mount --bind \$mnt /home
pascal@21542 149 mount -o size=0,ro -t tmpfs tmpfs \$mnt
pascal@17635 150 umount /proc
pascal@17635 151 exec /sbin/init
pascal@17635 152 EOT
pascal@17635 153 chmod 755 /tmp/fs$$/init?
pascal@21542 154 ln -s /sqfs/bin/gzip /bin 2> /dev/null
pascal@17635 155 ( cd /tmp/fs$$ ; find * | cpio -o -H newc ) | gzip -9 >> $1
pascal@17635 156 rm -rf /tmp/fs$$
pascal@17635 157 }
pascal@17635 158
pascal@17635 159 mkinitrd()
pascal@17635 160 {
pascal@17635 161 echo -en "\nCreating $(basename $1) "
pascal@17635 162 fs=/tmp/fs$$
pascal@17635 163 for i in bin lib dev proc tmp mnt etc ; do
pascal@17635 164 mkdir -p $fs/$i
pascal@17635 165 done
pascal@21542 166 for i in /dev/null /dev/tty /dev/tty[012] /dev/fuse /dev/[hs]d* \
pascal@21542 167 /dev/console ; do
pascal@17635 168 cp -a $2$i $fs/dev/
pascal@17635 169 done
pascal@23149 170 for i in /bin/busybox $(which mount.posixovl) $(which blkid) \
pascal@23149 171 $(which ntfs-3g); do
pascal@17635 172 cp $(LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so $i | \
pascal@17635 173 sed 's|.*=> \(.*/lib/l[^ ]*\).*|\1|;/^\//!d') $fs/lib
pascal@17635 174 cp $i $fs/bin
pascal@17635 175 done
pascal@21542 176 cp -a /sqfs/lib/ld-* /tmp/fs/lib 2> /dev/null ||
pascal@17635 177 cp -a /lib/ld-* $fs/lib
pascal@17635 178 for i in $(busybox | sed '/Current/,$!d'); do
pascal@17635 179 [ -e $fs/bin/${i%,} ] || ln -s busybox $fs/bin/${i%,}
pascal@17635 180 done
pascal@17635 181 ln -s /proc/mounts $fs/etc/mtab
pascal@17635 182 sed 's/ .*//' /proc/modules | while read mod ; do
pascal@17635 183 find /lib/modules/ | grep $mod.ko | \
pascal@17635 184 sed 's|.*|cp & $fs/lib|' | sh
pascal@17635 185 done
pascal@17635 186 cat > $fs/init <<EOT
pascal@17635 187 #!/bin/sh
pascal@17635 188
pascal@17635 189 arg()
pascal@17635 190 {
pascal@17635 191 grep -q \$1 /proc/cmdline &&
pascal@17635 192 val="\$(sed "s/.*\$1=\\([^ ]*\\).*/\\1/" < /proc/cmdline)" &&
pascal@17635 193 echo "\$2 \$val"
pascal@17635 194 }
pascal@17635 195
pascal@17635 196 mount -t proc /proc /proc
pascal@17635 197 arg debug "shell" && debug=true && set -x
pascal@17635 198 for i in /lib/*.ko* ; do insmod \$i 2> /dev/null ; done; sleep 2
pascal@17635 199 arg mount "Mount device"
pascal@23149 200 dsk=\$( (blkid /dev/[sh]d* || blkid) | grep \$val | sed 's/:.*//;q')
pascal@23149 201 mount \$dsk /mnt || mount.ntfs \$dsk /mnt
pascal@17635 202 arg subroot "Change root to directory"
pascal@17635 203 if [ -d /mnt/\$val ]; then
pascal@17635 204 umount /mnt 2> /dev/null
pascal@17635 205 (blkid /dev/[sh]d* || blkid) | while read dev line; do
pascal@17635 206 case "\$line" in
pascal@17635 207 *ntfs*|*vfat*|*msdos*) ;;
pascal@17635 208 *) continue ;;
pascal@17635 209 esac
pascal@17635 210 mount \${dev%:} /mnt
pascal@17635 211 [ -d /mnt/\$val ] && break
pascal@17635 212 umount /mnt
pascal@17635 213 done
pascal@17635 214 fi
pascal@23149 215
pascal@23149 216 $([ "$3" ] || echo -n '# ')mount.posixovl -F /mnt/\$val -- -oallow_other -odefault_permissions -osuid
pascal@17635 217 mount --bind /mnt /mnt/\$val/mnt/dos
pascal@21542 218 mount -o size=0,ro -t tmpfs tmpfs /mnt/\$val/mnt/dos/\$val
pascal@17635 219 LDSO=\$(ls /mnt/\$val/lib/ld-* | sed q)
pascal@17635 220 export LD_LIBRARY_PATH=\$val/lib:\$val/usr/lib:/lib
pascal@17635 221 [ "$debug" = "true" ] && sh
pascal@17635 222 umount /proc
pascal@17635 223 exec /bin/switch_root /mnt \${LDSO#/mnt/} \$val/usr/sbin/chroot \$val /sbin/init
pascal@17635 224 EOT
pascal@17635 225 chmod +x $fs/init
pascal@17635 226 ( cd $fs ; find * | cpio -o -H newc ) | lzma e $1 -si 2> /dev/null
pascal@17635 227 rm -rf $fs /tmp/wait
pascal@17635 228 }
pascal@17635 229
pascal@17635 230 ls_r()
pascal@17635 231 {
pascal@17635 232 ls -r $@ 2> /dev/null || ls $@
pascal@17635 233 }
pascal@17635 234
pascal@23820 235 is_loram()
pascal@23820 236 {
pascal@23820 237 [ -s /lib/modules/squashfs.ko* ]
pascal@23820 238 }
pascal@23820 239
pascal@17635 240 doinstall()
pascal@17635 241 {
pascal@17932 242 unset useposixovl
pascal@17934 243 blkid | grep $(df $mnt | sed '$!d;s/ .*/:/') | \
pascal@17932 244 grep -qiE "(msdos|vfat|ntfs)" && useposixovl=YES
pascal@19029 245 case "$mnt" in
pascal@19029 246 *mkzip*) useposixovl=YES
pascal@19029 247 esac
pascal@17635 248 mkdir -p $mnt/slitaz/boot $mnt/slitaz/mnt/dos
pascal@17932 249 [ "$useposixovl" ] &&
pascal@17635 250 if ! mount.posixovl -F $mnt/slitaz -- \
pascal@17635 251 -oallow_other -odefault_permissions -osuid; then
pascal@17635 252 echo "Can't install SliTaz. Abort."
pascal@17635 253 sleep 5
pascal@17635 254 return 1
pascal@17635 255 fi
pascal@17635 256 dotwait "Install root filesystem in /slitaz.."
pascal@17635 257 if [ "$1" ]; then
pascal@18240 258 ls_r $media/boot/rootfs*gz | \
pascal@17635 259 xargs cat > $mnt/slitaz/boot/rootfs.gz
pascal@17932 260 tazusbinitfs $mnt/slitaz/boot/rootfs.gz $useposixovl
pascal@17635 261 initrd=rootfs.gz
pascal@17635 262 extraargs="/home=$(getuuid)/slitaz rdinit=/init1"
pascal@17635 263 else
pascal@23820 264 if [ -d $media/fs ]; then
pascal@23820 265 cp -a $media/fs/. $mnt/slitaz
pascal@23820 266 elif is_loram; then
pascal@23820 267 for i in $(ls_r $media/boot/rootfs*); do
pascal@23820 268 losetup -o 124 /dev/loop7 $i
pascal@23820 269 mount -t squashfs -o ro /dev/loop7 /sqfs/mnt
pascal@23820 270 cp -a /sqfs/mnt/. $mnt/slitaz
pascal@23820 271 umount /sqfs/mnt
pascal@23820 272 losetup -d /dev/loop7
pascal@23820 273 done
pascal@23820 274 else
pascal@23820 275 for i in $(ls_r $media/boot/rootfs*gz); do
pascal@23820 276 ${uncpio:-uncpio} $i $mnt/slitaz
pascal@23820 277 done
pascal@23820 278 fi
pascal@17635 279 for i in $packages_list; do
pascal@17635 280 tazpkg get-install $i --root=$mnt/slitaz
pascal@17635 281 done
pascal@17635 282 for i in $packages_dir/*.tazpkg; do
pascal@17635 283 [ -s "$i" ] &&
pascal@17635 284 tazpkg install $i --root=$mnt/slitaz
pascal@17635 285 done
pascal@17635 286 cp -a /etc/locale.conf $mnt/slitaz/etc 2> /dev/null
pascal@17635 287 cp -a /etc/keymap.conf $mnt/slitaz/etc 2> /dev/null
pascal@17932 288 mkinitrd $mnt/slitaz/boot/initrd $mnt/slitaz $useposixovl
pascal@17635 289 initrd=initrd
pascal@17635 290 extraargs="mount=$(getuuid) subroot=slitaz"
pascal@17635 291 fi
pascal@17635 292 echo -en "\nInstall boot files..."
pascal@20158 293 for i in $media/boot/bzImage* $media/boot/*pxe* \
pascal@23946 294 $media/boot/plop.exe \
pascal@18240 295 $media/boot/isolinux/he* $media/boot/isolinux/opt* \
pascal@18240 296 $media/README $media/boot/memtest* ; do
pascal@17635 297 [ -s $i ] && cp $i $mnt/slitaz/boot
pascal@17635 298 done
pascal@21542 299 for i in $mnt/slitaz/boot/memtest $mnt/slitaz/boot/*pxe ; do
pascal@17635 300 [ $(get 0 $i 2> /dev/null || echo 0) -eq 23117 ] &&
pascal@17635 301 mv $i $i.exe
pascal@17635 302 done
pascal@20158 303 bzimage=$(cd $mnt/slitaz/boot ; ls bzimage*)
pascal@21542 304 cp /etc/keymap.conf /etc/locale.conf $mnt/slitaz/etc 2> /dev/null
pascal@20158 305 gettazboot $mnt/slitaz/boot/tazboot.exe # autoappend 64 suffix
pascal@17635 306 unix2dos > $mnt/slitaz/boot/tazboot.cmd <<EOT
pascal@23813 307 image=/slitaz/boot/bzimage
pascal@17635 308 initrd=/slitaz/boot/$initrd
pascal@23890 309 root=/dev/null $extraargs autologin
pascal@17635 310 EOT
pascal@21553 311 uudecode - <<EOT | gunzip > $mnt/slitaz/boot/slitaz.pif
pascal@21553 312 begin-base64 644 -
pascal@21553 313 H4sIAAAAAAACA8XPxUHGMBTA8X9ecb/glgFwv+FO23zeI+7ucMFhCjZgEEZh
pascal@21553 314 Ctzd4Rf3PFbtQHGLG9BmfmZqdlE/tSmw2LfePzOzWDK0OsQXpPHvFGfZBmL5
pascal@21553 315 f3Zns98NuG1BbTrbWj0OFMypSKfT4kYCurKuRleWlBEth2qUTYFBKjg746pI
pascal@21553 316 2nZaIT/v9vWwbeuqi9fPznLlSPFLLuK22/0lLT09/BDhXgWKO1f9aLKxOObE
pascal@21553 317 EhLuVvO4FksSwaH5qbHpvkle0TyzND82NK+doRVeZgGGbIw0XD2QwV9SnAN/
pascal@21553 318 ACxDxwMAAA==
pascal@21553 319 ====
pascal@21553 320 EOT
pascal@17635 321 unix2dos $mnt/slitaz/boot/he* $mnt/slitaz/boot/opt* \
pascal@17635 322 $mnt/slitaz/boot/README
pascal@17635 323 [ -d $mnt/slitaz/usr/sbin -a ! -x $mnt/slitaz/usr/sbin/mount.posixovl ] &&
pascal@17635 324 cp $(which mount.posixovl) $mnt/slitaz/usr/sbin
pascal@19033 325 if [ "$useposixovl" ] && grep -qs " $mnt " /proc/mounts &&
pascal@17932 326 [ ! -d $mnt/boot/grub ]; then
pascal@17929 327 mkdir -p $mnt/boot/grub
pascal@17930 328 echo -en "\nInstall grub in /boot/grub..."
pascal@17929 329 cp -a /usr/lib/grub/*/* $mnt/boot/grub
pascal@17929 330 cat > $mnt/boot/grub/menu.lst <<EOT
pascal@17929 331 # /boot/grub/menu.lst: GRUB boot loader configuration.
pascal@17929 332
pascal@17929 333 # By default, boot the first entry.
pascal@17929 334 default 0
pascal@17929 335
pascal@17929 336 # Boot automatically after 8 secs.
pascal@17929 337 timeout 8
pascal@17929 338
pascal@17929 339 title Microsoft Windows
pascal@17929 340 chainloader +1
pascal@17929 341
pascal@17929 342 EOT
pascal@17929 343 dev=$(grep " $mnt " /proc/mounts | awk '{ print $1 }')
pascal@17929 344 base=${dev//[0-9]/}
pascal@17929 345 dd if=$base bs=32k count=1 of=$mnt/boot/grub/$(basename $base)
pascal@17929 346 cat > $mnt/boot/grub/uninstall-grub.sh <<EOT
pascal@17929 347 #!/bin/sh
pascal@17929 348
pascal@17929 349 [ -s /boot/grub/$(basename $base) ] &&
pascal@17929 350 dd if=/boot/grub/$(basename $base) of=$base
pascal@17929 351 EOT
pascal@17929 352 grub-install --no-floppy --root-directory=$mnt $base
pascal@17929 353 fi
pascal@17932 354 if [ -s $mnt/boot/grub/menu.lst ] &&
pascal@20158 355 ! grep -q /slitaz/boot/$bzimage $mnt/boot/grub/menu.lst; then
pascal@20158 356 echo -en "\nUpdate /boot/grub/menu.lst..."
pascal@17932 357 cat >> $mnt/boot/grub/menu.lst <<EOT
pascal@17932 358 title SliTaz GNU/Linux $(cat $mnt/slitaz/etc/slitaz-release)
pascal@23890 359 kernel /slitaz/boot/$bzimage root=/dev/null $extraargs autologin
pascal@17932 360 initrd /slitaz/boot/$initrd
pascal@17932 361
pascal@17932 362 EOT
pascal@17932 363 fi
pascal@23820 364 false &&
pascal@23820 365 [ -s $mnt/boot.ini ] && ! grep -qs tazboot $mnt/boot.ini &&
pascal@23820 366 echo "Update boot.ini ..." && unix2dos >> $mnt/boot.ini <<EOT
pascal@23820 367 C:\\slitaz\\boot\\tazboot.exe="SliTaz"
pascal@23820 368 EOT
pascal@23820 369 false &&
pascal@23820 370 grep -qis menuitem $mnt/config.sys && ! grep -qi tazboot $mnt/config.sys &&
pascal@23820 371 echo "Update config.sys ..." &&
pascal@23820 372 sed -i 's/menudefault/menuitem SLITAZ, SliTaz\r\n&/' $mnt/config.sys &&
pascal@23820 373 unix2dos >> $mnt/config.sys <<EOT
pascal@23820 374 [SLITAZ]
pascal@23820 375 install=\\slitaz\\boot\\tazboot.exe
pascal@23820 376 EOT
pascal@23820 377 rm -f $tmp/wait
pascal@17932 378 [ "$useposixovl" ] && umount $mnt/slitaz
pascal@17635 379 return 0
pascal@17635 380 }
pascal@17635 381
pascal@17635 382 windev()
pascal@17635 383 {
pascal@17924 384 if [ -b "$1" ]; then
pascal@17924 385 device=$1
pascal@17928 386 elif [ "$1" ]; then
pascal@17932 387 echo "Invalid Linux/Windows partition"
pascal@17928 388 return 1
pascal@17924 389 else
pascal@17932 390 DEV="$(blkid | grep -iE "(msdos|vfat|ntfs|ext[234]|xfs|btrfs)" | sed 's/:.*//;s|/dev/||')"
pascal@17924 391 [ "$DEV" ] || return
pascal@17635 392 cat > /tmp/dialog$$ <<EOT
pascal@20771 393 $DIALOG --clear --title " Select your Linux/Windows partition " \
pascal@17932 394 --menu "\nPlease select the Linux/Windows partition according to its known size.
pascal@20771 395 The data will be kept untouched.\n" 17 70 8 \
pascal@17635 396 $(for i in $DEV ; do
pascal@17635 397 label="$(blkid | sed "/$i:/!d;s/.*://;s/[^ ]*UUID=[^ ]* //g;s/LABEL=//")"
pascal@17635 398 echo -n "/dev/$i \"$(($(cat /sys/block/*/$i/size)/2048))MB $label\" "
pascal@17635 399 done)
pascal@17635 400 EOT
pascal@17924 401 exec 3>&1
pascal@17924 402 [ $? -eq 0 ] || return
pascal@17924 403 device=$(. /tmp/dialog$$ 2>&1 1>&3)
pascal@17924 404 exec 3>&-
pascal@17924 405 rm -f /tmp/dialog$$
pascal@17924 406 fi
pascal@17635 407 mnt=/tmp/mnt$$
pascal@17635 408 mkdir -p $mnt && mount $device $mnt
pascal@17635 409 }
pascal@17635 410
pascal@17635 411 extra_packages()
pascal@17635 412 {
pascal@17635 413 packages_list=
pascal@17635 414 packages_dir=
pascal@23820 415 [ $0 = /init.exe ] && return
pascal@20771 416 $DIALOG --clear --title " Extra packages " \
pascal@17635 417 --defaultno --yesno \
pascal@20771 418 "Do you want to add extra packages ?" 7 70
pascal@17635 419 [ $? -eq 0 ] || return
pascal@17635 420 [ -s /var/lib/tazpkg/packages.txt ] || tazpkg recharge
pascal@18240 421 if [ -s $media/boot/vmlinuz-$(uname -r) ]; then
pascal@17635 422 cat > /tmp/dialog$$ <<EOT
pascal@20771 423 $DIALOG --clear --title " Select the packages " \
pascal@17635 424 --separate-output \
pascal@17635 425 --cancel-label "Skip" \
pascal@17635 426 --checklist "Please select the packages you want to install. Try with the first letter." \
pascal@18240 427 0 0 0 \\
pascal@17635 428 EOT
pascal@17635 429 awk -F\| '{ printf "%s \"%s\" off ",$1,$3 }' \
pascal@17635 430 /var/lib/tazpkg/packages.desc >> /tmp/dialog$$
pascal@17635 431 sh /tmp/dialog$$ 2> /tmp/dialog.out$$
pascal@17635 432 [ $? -eq 0 ] && packages_list="$(cat /tmp/dialog.out$$)"
pascal@17635 433 fi
pascal@17635 434 cat > /tmp/dialog$$ <<EOT
pascal@17635 435 $DIALOG --clear \
paul@17671 436 --title "Please select the directory with every custom package to install." \
pascal@20771 437 --cancel-label "Skip" --dselect $PWD 13 78
pascal@17635 438 EOT
pascal@17635 439 sh /tmp/dialog$$ 2> /tmp/dialog.out$$
pascal@17635 440 [ $? -eq 0 ] && packages_dir="$(cat /tmp/dialog.out$$)"
pascal@17635 441 rm -f /tmp/dialog$$ /tmp/dialog.out$$
pascal@17635 442 }
pascal@17635 443
pascal@17635 444 _install()
pascal@17635 445 {
pascal@17635 446 extra_packages
pascal@20771 447 $DIALOG --clear --title " SliTaz UMSDOS way installation " \
pascal@17635 448 --yes-label "Install" --yesno \
pascal@17635 449 "\nSliTaz will be installed in the subdirectory \\slitaz of the current
paul@17935 450 Linux/DOS/Windows partition. You can see your files from /mnt/dos.\n\n
pascal@17635 451 You can start SliTaz with \\slitaz\\boot\\tazboot.exe\n\n
pascal@17635 452 To uninstall SliTaz, you have only to remove this directory.
pascal@17635 453 The file \\boot.ini or \\config.sys may be modified too.\n\n
pascal@20771 454 SliTaz may run slowly on the 'UMSDOS way' installation due to the
pascal@17635 455 posixovl filesystem. The 'TAZUSB way' installation runs faster.\n\n
pascal@17635 456 To do a traditional installation with disk partitioning,
pascal@20771 457 start SliTaz Live with the 'SliTaz RAM boot' menu.\n" 19 70
pascal@17635 458 [ $? -eq 0 ] || return
pascal@17635 459 doinstall
pascal@23820 460 [ $0 = /init.exe ] || return
pascal@23820 461 [ -x $mnt/slitaz/sbin/init ] || return
pascal@23820 462 umount -d $media/cdrom
pascal@23820 463 umount_proc
pascal@23820 464 exec chroot $mnt/slitaz /sbin/init
pascal@17635 465 }
pascal@17635 466
pascal@17635 467 readtazbootconf()
pascal@17635 468 {
pascal@23813 469 kernel="$(sed '/^image=/!d;s/.*=//' $mnt/slitaz/boot/tazboot.cmd)"
pascal@17635 470 initrd="$(sed '/^initrd=/!d;s/.*=//' $mnt/slitaz/boot/tazboot.cmd)"
pascal@23813 471 cmdline="$(sed '/^image=/d;/^initrd=/d' $mnt/slitaz/boot/tazboot.cmd)"
pascal@17635 472 }
pascal@17635 473
pascal@17635 474 bootinstalled()
pascal@17635 475 {
pascal@17635 476 [ "$(which kexec)" ] || return
pascal@17635 477 [ -x $mnt/slitaz$1 ] || return
pascal@17635 478 [ -s $mnt/slitaz/boot/tazboot.cmd ] || return
pascal@17635 479 readtazbootconf
pascal@17659 480 kexec -l $kernel --initrd $initrd --command-line "$cmdline" || return
pascal@17635 481 umount $mnt
pascal@17635 482 rm -rf $mnt
pascal@18240 483 quit "kexec -e"
pascal@17635 484 }
pascal@17635 485
pascal@17635 486 mkzip()
pascal@17635 487 {
pascal@17635 488 device=
pascal@17635 489 packages_list=
pascal@17635 490 packages_dir=
pascal@19029 491 mnt=/tmp/mkzipmnt$$
pascal@17635 492 mkdir -p $mnt
pascal@17930 493 $1 $2 || return
pascal@18140 494 for i in bootlace.com grubinst.exe grldr ; do
pascal@18140 495 wget -O $mnt/slitaz/boot/$i http://mirror.slitaz.org/boot/$i
pascal@18140 496 done
pascal@17635 497 readtazbootconf
pascal@17636 498 cat > $mnt/slitaz/boot/menu.lst <<EOT
pascal@17635 499 title SliTaz
pascal@17635 500 kernel $kernel $cmdline
pascal@17635 501 initrd $initrd
pascal@17635 502
pascal@17635 503 EOT
pascal@17635 504 while read file title; do
pascal@17637 505 file=$(ls $mnt/slitaz/boot/*$file* 2> /dev/null)
pascal@17637 506 [ -s "$file" ] && cat >> $mnt/slitaz/boot/menu.lst <<EOT
pascal@17635 507 title $title
pascal@17637 508 kernel ${file#$mnt}
pascal@17635 509
pascal@17635 510 EOT
pascal@17635 511 done <<EOT
pascal@17635 512 memtest MemTest
pascal@23946 513 plop USB boot
pascal@17635 514 pxe Web boot
pascal@17635 515 EOT
pascal@17636 516 unix2dos $mnt/slitaz/boot/menu.lst
pascal@17636 517 unix2dos > $mnt/slitaz/boot/install.txt <<EOT
pascal@17659 518 For DOS users (real mode only):
pascal@17659 519
pascal@17659 520 Start SliTaz with \\slitaz\\boot\\tazboot.exe
pascal@17659 521
pascal@17659 522
pascal@17635 523 For NT/2000/XP users:
pascal@17635 524
pascal@17635 525 1- Move the files grldr and menu.lst into the root directory
pascal@17635 526
pascal@17635 527 C:\\> copy \\slitaz\\boot\\grldr \\
pascal@17635 528 C:\\> copy \\slitaz\\boot\\menu.lst \\
pascal@17635 529
pascal@17635 530 2- Remove boot.ini attributes
pascal@17635 531
pascal@17635 532 C:\\> attrib -r -h -s boot.ini
pascal@17635 533
pascal@17635 534 3- Append the following line to boot.init
pascal@17635 535
pascal@17635 536 C:\\grldr="slitaz"
pascal@17635 537
pascal@17635 538 4- Restore boot.ini attributes
pascal@17635 539
pascal@17635 540 C:\\> attrib +r +h +s boot.ini
pascal@17635 541
pascal@17635 542 See http://diddy.boot-land.net/grub4dos/files/README_GRUB4DOS.txt
pascal@18140 543 and http://xpt.sourceforge.net/techdocs/nix/disk/boot/boot07-GrubForDosInfo/ar01s03.html
pascal@17635 544 EOT
pascal@18140 545 ( cd $mnt ; echo 'See \slitaz\boot\install.txt to launch SliTaz.' | \
pascal@18670 546 zip -zr9 $(basename "$ISO" .iso).zip slitaz )
pascal@19033 547 [ "$(which advzip)" ] &&
pascal@19033 548 echo "Recompressing $(basename "$ISO" .iso).zip ..." &&
pascal@19033 549 advzip -z4 $mnt/*.zip
pascal@17635 550 mv $mnt/*.zip .
pascal@19029 551 du -h $PWD/$(basename "$ISO" .iso).zip
pascal@17636 552 umount $mnt
pascal@17636 553 rm -rf $mnt
pascal@17635 554 }
pascal@17635 555
pascal@17635 556 install()
pascal@17635 557 {
pascal@17924 558 windev $1 || return
pascal@17635 559 packages_list=
pascal@17635 560 packages_dir=
pascal@17924 561 if [ "$1" ]; then
pascal@17924 562 doinstall
pascal@17924 563 else
pascal@17924 564 _install && bootinstalled /sbin/init
pascal@17924 565 fi
pascal@17635 566 umount $mnt
pascal@17635 567 rm -rf $mnt
pascal@17635 568 }
pascal@17635 569
pascal@17635 570 inst2zip()
pascal@17635 571 {
pascal@17924 572 if [ "$1" ]; then
pascal@17930 573 mkzip doinstall
pascal@17924 574 else
pascal@17924 575 mkzip _install
pascal@17924 576 fi
pascal@17635 577 }
pascal@17635 578
pascal@17635 579 _installtaz()
pascal@17635 580 {
pascal@20771 581 $DIALOG --clear --title " SliTaz TAZUSB way installation " \
pascal@17635 582 --yes-label "Install" --yesno \
pascal@17635 583 "\nSliTaz will be installed in the subdirectory \\slitaz of the current
paul@17935 584 Linux/DOS/Windows partition. You can see your files from /mnt/dos.\n\n
pascal@17635 585 You can start SliTaz with \\slitaz\\boot\\tazboot.exe\n\n
pascal@17635 586 To uninstall SliTaz, you have only to remove this directory.
pascal@17635 587 The file \\boot.ini or \\config.sys may be modified too.\n\n
pascal@17635 588 The filesystem is loaded entirely into memory upon boot to
paul@19451 589 increase responsiveness. Only /home lands on the hard disk.\n\n
pascal@17635 590 To do a traditional installation with disk partitioning,
pascal@20771 591 start SliTaz Live with the 'SliTaz RAM boot' menu.\n" 19 70
pascal@17635 592 [ $? -eq 0 ] || return
pascal@23820 593 doinstall tazusblike || return
pascal@23820 594 [ $0 = /init.exe ] || return
pascal@23820 595 dotwait
pascal@23820 596 if [ -d /media/cdrom/fs ]; then
pascal@23820 597 cp -a /media/cdrom/fs/. /
pascal@23820 598 else
pascal@23820 599 for i in $(ls_r /media/cdrom/boot/rootfs*); do
pascal@23820 600 ${uncpio:-uncipo} $i
pascal@23820 601 done
pascal@23820 602 fi
pascal@23820 603 cp /tmp/fs/etc/* /etc 2>/dev/null
pascal@23820 604 echo "/home=$(getuuid)/slitaz" > /cmdline
pascal@23820 605 rm -f /tmp/wait
pascal@23820 606 [ -x /init1 ] || return
pascal@23820 607 umount -d /media/cdrom
pascal@23820 608 umount /mnt/slitaz
pascal@23820 609 rm -f /dev/cdrom
pascal@23820 610 umount /mnt
pascal@23820 611 mkdir /mnt/dos
pascal@23820 612 umount_proc
pascal@23820 613 exec /init1
pascal@17635 614 }
pascal@17635 615
pascal@17635 616 installtaz()
pascal@17635 617 {
pascal@17924 618 windev $1 || return
pascal@17635 619 packages_list=
pascal@17635 620 packages_dir=
pascal@17924 621 if [ "$1" ]; then
pascal@17924 622 doinstall tazusblike
pascal@17924 623 else
pascal@17924 624 _installtaz && bootinstalled /boot/bzimage
pascal@17924 625 fi
pascal@17635 626 umount $mnt
pascal@17635 627 rm -rf $mnt
pascal@17635 628 }
pascal@17635 629
pascal@17635 630 insttaz2zip()
pascal@17635 631 {
pascal@17924 632 if [ "$1" ]; then
pascal@17930 633 mkzip doinstall tazusblike
pascal@17924 634 else
pascal@17924 635 mkzip _installtaz
pascal@17924 636 fi
pascal@17635 637 }
pascal@17635 638
pascal@17635 639 bootiso()
pascal@17635 640 {
pascal@18799 641 cd /tmp
pascal@18240 642 for i in $(ls_r $media/boot/rootfs*gz); do
pascal@23946 643 i=$(maybe64 $i)
pascal@17635 644 cat $i
pascal@23947 645 n=$((4 - ($(size $i) % 4)))
pascal@17635 646 [ $n -eq 4 ] || dd if=/dev/zero bs=1 count=$n
pascal@18799 647 done > initrd$$
pascal@23890 648 cmdline="root=/dev/null autologin lang=$LANG"
pascal@18799 649 [ -s /etc/keymap.conf ] && cmdline="$cmdline kmap=$(cat /etc/keymap.conf)"
pascal@18799 650 [ -s /etc/TZ ] && cmdline="$cmdline tz=$(cat /etc/TZ)"
pascal@18799 651 rm -f cmdline initrd 2> /dev/null
pascal@18799 652 getcustomconf kexec >/dev/null
pascal@18799 653 [ -s cmdline ] && cmdline="$cmdline $(cat cmdline)" && rm cmdline
pascal@18799 654 [ -s initrd ] && cat initrd >> initrd$$ && rm initrd
pascal@23946 655 kernel=$(maybe64 $media/boot/bzImage)
pascal@17635 656 . /etc/locale.conf
pascal@18799 657 kexec -l $kernel --initrd initrd$$ --command-line "$cmdline" &&
pascal@18799 658 rm -f initrd$$
pascal@18240 659 quit "kexec -e"
pascal@17635 660 }
pascal@17635 661
pascal@17635 662 tazboot()
pascal@17635 663 {
pascal@17928 664 if [ -z "$1" ]; then
pascal@20771 665 $DIALOG --clear --title " SliTaz bootloader for DOS " \
pascal@17928 666 --yes-label "Install" --yesno \
pascal@17635 667 "\nThe file TAZBOOT.EXE will be created in the top directory. It supports
pascal@23810 668 any linux kernel, multiple initramfs and a kernel command line.\n\n
pascal@23810 669 Usage: tazboot.exe [[@commands]|[image=<bzimage>]
pascal@23810 670 [initrd=<rootfs>[,<rootfs2>...]] cmdline args ...]\n\n
pascal@23810 671 Defaults: tazboot @tazboot.cmd or tazboot image=bzImage auto\n\n\
pascal@17635 672 Examples for tazboot.cmd:\n\n\
pascal@23810 673 image=boot/bzImage\n\
pascal@17635 674 initrd=boot/rootfs4.gz,boot/rootfs3.gz,boot/rootfs2.gz,boot/rootfs1.gz\n\
pascal@23890 675 root=/dev/null autologin\n\n\
pascal@23810 676 image=\\slitaz\\vmlinuz root=/dev/sda5 ro\n" 0 0
pascal@17928 677 [ $? -eq 0 ] || return
pascal@17928 678 fi
pascal@17635 679 gettazboot tazboot.exe
pascal@19029 680 du -h $PWD/tazboot.exe
pascal@17635 681 }
pascal@17635 682
pascal@17635 683 md5()
pascal@17635 684 {
pascal@17635 685 dotwait "Checking files"
pascal@19432 686 ( cd $media ; ${md5sum:-md5sum -c md5sum*} 2>&1 | sort ) > /tmp/data
pascal@17928 687 unset md5sum
pascal@17635 688 rm -f /tmp/wait
pascal@17928 689 if [ "$1" ]; then
pascal@17924 690 cat /tmp/data
pascal@17924 691 else
pascal@20771 692 $DIALOG --clear --title " Checked files " \
pascal@18240 693 --textbox /tmp/data 0 0
pascal@17924 694 fi
pascal@17635 695 rm -f /tmp/data
pascal@17635 696 }
pascal@17635 697
pascal@17635 698 gotcdfile()
pascal@17635 699 {
pascal@18240 700 for i in "$media/$1" "$media/*/$1" "$media/*/isolinux/$1" ; do
pascal@17635 701 file=$(ls $i 2> /dev/null | sed q)
pascal@17635 702 [ -s "$file" ] && break
pascal@17635 703 done
pascal@17635 704 }
pascal@17635 705
pascal@17635 706 sha()
pascal@17635 707 {
pascal@17635 708 gotcdfile 'sha*sum*'
pascal@17635 709 sha=$(basename $file)
pascal@18240 710 md5sum="${sha%sum*}sum -c ${file#$media/}"
pascal@17928 711 md5 $@
pascal@17635 712 }
pascal@17635 713
pascal@17635 714 readme()
pascal@17635 715 {
pascal@17635 716 gotcdfile 'README*'
pascal@17924 717 if [ "$1" ]; then
pascal@17924 718 cat $file
pascal@17924 719 else
pascal@20771 720 $DIALOG --clear --title " Readme " --textbox $file 0 0
pascal@17924 721 fi
pascal@17635 722 }
pascal@17635 723
pascal@17635 724 bzimage()
pascal@17635 725 {
pascal@17928 726 if [ -z "$1" ]; then
pascal@20771 727 $DIALOG --clear --title " Create linux.exe ? " \
pascal@17924 728 --yes-label "Install" --yesno \
pascal@17635 729 "\nLinux.exe launches the linux kernel under DOS (in real mode only).
pascal@17635 730 The cmdline arguments are supported except initrd=,
pascal@17635 731 vga= (you can try 'rdev -v') and mem= (partially).
pascal@20771 732 \nExample:\nC:\\> linux.exe root=/dev/hda2 ro panic=60\n" 12 70
pascal@17924 733 [ $? -eq 0 ] || return
pascal@17924 734 fi
pascal@23946 735 cp $(maybe64 $media/boot/bzImage) linux.exe
pascal@19029 736 du -h $PWD/linux.exe
pascal@17635 737 }
pascal@17635 738
pascal@17635 739 memtest()
pascal@17635 740 {
pascal@17924 741 if [ -z "$1" ]; then
pascal@20771 742 $DIALOG --clear --title " Create memtest.exe ? " \
pascal@17924 743 --yes-label "Install" --yesno \
pascal@17635 744 "\nMemtest86 is a thorough, stand alone memory test for x86 architecture
pascal@17635 745 computers. BIOS based memory tests are a quick, cursory check and often
pascal@20771 746 miss many of the failures that are detected by Memtest86.\n" 0 0
pascal@17924 747 [ $? -eq 0 ] || return
pascal@17924 748 fi
pascal@17924 749 gotcdfile 'memtest*' && cp $file memtest.exe
pascal@19029 750 du -h $PWD/memtest.exe
pascal@17635 751 }
pascal@17635 752
pascal@17635 753 mkfat12()
pascal@17635 754 {
pascal@17635 755 [ $(($(get 0 $1) - 0x5A4D)) -eq 0 ] || return
pascal@17635 756 J=$(($(get 3 $1 1) + 0x02))
pascal@17635 757 R=$((1 + $(get 497 $1 1) + 1 + ($(get 500 $1)-1)/32))
pascal@17635 758 [ $R -lt 2500 ] || return
pascal@17635 759 [ $((($(get 500 $1)-1) & 31)) -lt 30 ] &&
pascal@17635 760 ddq if=$file bs=32 count=1 seek=$(($R*16 - 1)) of=/dev/fd0
pascal@17635 761 G="18 0 2 0 0 0 0 0"
pascal@17635 762 [ $J -gt 25 ] || G=""
pascal@17635 763 F=0
pascal@17635 764 for i in 1 2 3; do
pascal@17635 765 F=$((((2880-$R-$F-$F)*3+1023)/1024))
pascal@17635 766 done
pascal@17635 767 bytes2bin 0xEB $J 0x90 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 \
pascal@17635 768 0 2 2 $(($R%256)) $(($R/256)) 2 64 0 64 11 0xF0 $F 0 \
pascal@17635 769 $G | ddq bs=1 of=/dev/fd0
pascal@17635 770 ddq if=/dev/zero bs=512 count=$((4+$F+$F)) seek=$R of=/dev/fd0
pascal@17635 771 for i in $R $(($R+$F)) ; do
pascal@17635 772 bytes2bin 0xF0 0xFF 0xFF | ddq bs=512 seek=$i of=/dev/fd0
pascal@17635 773 done
pascal@17635 774 echo -n $(basename $1) | ddq bs=1 seek=3 count=8 of=/dev/fd0
pascal@17635 775 }
pascal@17635 776
pascal@17635 777 mkfloppy()
pascal@17635 778 {
pascal@21542 779 dotwait "Create a $(basename $1 .exe) boot floppy"
pascal@17635 780 ddq if=$1 of=/dev/fd0
pascal@17635 781 mkfat12 $1
pascal@17635 782 rm -f /tmp/wait
pascal@17635 783 }
pascal@17635 784
pascal@17635 785 fdmemtest()
pascal@17635 786 {
pascal@17924 787 if [ -z "$1" ]; then
pascal@20771 788 $DIALOG --clear --title " Create a Memtest86 boot floppy " \
pascal@17924 789 --yes-label "Create floppy" --yesno \
pascal@17635 790 "\nMemtest86 is a thorough, stand alone memory test for x86 architecture
pascal@17635 791 computers. BIOS based memory tests are a quick, cursory check and often
pascal@17635 792 miss many of the failures that are detected by Memtest86.\n\n
pascal@20771 793 Please insert a blank disk in floppy drive.\n" 0 0
pascal@17924 794 [ $? -eq 0 ] || return
pascal@17924 795 fi
pascal@17924 796 gotcdfile 'memtest*' && mkfloppy $file
pascal@17635 797 }
pascal@17635 798
pascal@17635 799 pxe()
pascal@17635 800 {
pascal@20762 801 gotcdfile '?pxe*'
pascal@17928 802 if [ -z "$1" ]; then
pascal@21542 803 $DIALOG --clear --title " Create $(basename $file .exe).exe ? " \
pascal@17928 804 --yes-label "Install" --yesno \
pascal@17635 805 "\nBoot your operating system from the internet and enjoy a full system
pascal@17635 806 working entirely in RAM with speed and stability in mind. The Linux Kernel
pascal@17635 807 and the complete SliTaz compressed root filesystem will be loaded into RAM
pascal@20771 808 from the Web using PXE and HTTP protocols.\n" 0 0
pascal@17928 809 [ $? -eq 0 ] || return
pascal@17928 810 fi
pascal@21542 811 cp $file $(basename $file .exe).exe
pascal@21542 812 du -h $PWD/$(basename $file .exe).exe
pascal@17635 813 }
pascal@17635 814
pascal@17635 815 fdpxe()
pascal@17635 816 {
pascal@17924 817 if [ -z "$1" ]; then
pascal@20771 818 $DIALOG --clear --title " Create a SliTaz Web boot floppy " \
pascal@17924 819 --yes-label "Create floppy" --yesno \
pascal@17635 820 "\nBoot your operating system from the internet and enjoy a full system
pascal@17635 821 working entirely in RAM with speed and stability in mind. The Linux Kernel
pascal@17635 822 and the complete SliTaz compressed root filesystem will be loaded into RAM
pascal@17635 823 from the Web using PXE and HTTP protocols.\n\n
pascal@20771 824 Please insert a blank disk in floppy drive.\n" 0 0
pascal@17924 825 [ $? -eq 0 ] || return
pascal@17924 826 fi
pascal@20762 827 gotcdfile '?pxe*' && mkfloppy $file
pascal@17924 828 }
pascal@17924 829
pascal@23946 830 plop()
pascal@23946 831 {
pascal@23946 832 gotcdfile 'plop.exe'
pascal@23946 833 if [ -z "$1" ]; then
pascal@23946 834 $DIALOG --clear --title " Create $(basename $file .exe).exe ? " \
pascal@23946 835 --yes-label "Install" --yesno \
pascal@23946 836 "\nBoot your operating system from a USB disk without BIOS support.\n" 0 0
pascal@23946 837 [ $? -eq 0 ] || return
pascal@23946 838 fi
pascal@23946 839 cp $file $(basename $file .exe).exe
pascal@23946 840 du -h $PWD/$(basename $file .exe).exe
pascal@23946 841 }
pascal@23946 842
pascal@23946 843 fdplop()
pascal@23946 844 {
pascal@23946 845 if [ -z "$1" ]; then
pascal@23946 846 $DIALOG --clear --title " Create a Plop boot floppy " \
pascal@23946 847 --yes-label "Create floppy" --yesno \
pascal@23946 848 "\nBoot your operating system from a USB disk without BIOS support.\n\n
pascal@23946 849 Please insert a blank disk in floppy drive.\n" 0 0
pascal@23946 850 [ $? -eq 0 ] || return
pascal@23946 851 fi
pascal@23946 852 gotcdfile 'plop.exe' && mkfloppy $file
pascal@23946 853 }
pascal@23946 854
pascal@17924 855 menuitem()
pascal@17924 856 {
pascal@17924 857 [ "$3" ] && shift
pascal@17924 858 echo -en "\"$1\" \"$2\""
pascal@17635 859 }
pascal@17635 860
pascal@17635 861 gotposixovl()
pascal@17635 862 {
pascal@19425 863 mount.posixovl 2>&1 | grep -qi usage && gotcdfile 'rootfs*.gz' &&
pascal@19425 864 menuitem "$@"
pascal@17635 865 }
pascal@17635 866
pascal@17635 867 gotposixovlzip()
pascal@17635 868 {
pascal@17635 869 [ "$(which zip)" ] && gotposixovl "$1" "$2"
pascal@17635 870 }
pascal@17635 871
pascal@23820 872 noinit()
pascal@23820 873 {
pascal@23820 874 [ $0 = /init.exe ] || menuitem "$@"
pascal@23820 875 }
pascal@23820 876
pascal@23820 877 initx()
pascal@23820 878 {
pascal@23820 879 [ $0 = /init.exe ] && menuitem "$@"
pascal@23820 880 }
pascal@23820 881
pascal@17635 882 xfile()
pascal@17635 883 {
pascal@17924 884 [ "$(which $1)" ] && menuitem "$@"
pascal@17635 885 }
pascal@17635 886
pascal@23820 887 initxfile()
pascal@23820 888 {
pascal@23820 889 [ $0 = /init.exe ] && xfile "$@"
pascal@23820 890 }
pascal@23820 891
pascal@17635 892 cdfile()
pascal@17635 893 {
pascal@17924 894 gotcdfile "$1" && menuitem "$@"
pascal@17635 895 }
pascal@17635 896
pascal@19425 897 gottazusb()
pascal@19425 898 {
pascal@19425 899 gotcdfile 'rootfs*.gz' && xfile tazusb "$@"
pascal@19425 900 }
pascal@19425 901
pascal@17659 902 isbzImage()
pascal@17659 903 {
pascal@17659 904 [ $(get 514 $file 4) -eq 1400005704 ] &&
pascal@17659 905 [ $(($(get 529 $file 1) & 1)) -eq 1 ]
pascal@17659 906 }
pascal@17659 907
pascal@17635 908 cdfilex()
pascal@17635 909 {
pascal@17924 910 gotcdfile "$1" && [ "$(which kexec)" ] && isbzImage && menuitem "$@"
pascal@17635 911 }
pascal@17635 912
pascal@17635 913 cdfilef()
pascal@17635 914 {
pascal@17635 915 [ -e /sys/block/fd0 ] && cdfile "$@"
pascal@17635 916 }
pascal@17635 917
pascal@17635 918 cdexe()
pascal@17635 919 {
pascal@17635 920 gotcdfile "$1" &&
pascal@17635 921 [ $(get 0 $file 2>/dev/null || echo 0) -eq 23117 ] &&
pascal@17924 922 menuitem "$@"
pascal@17635 923 }
pascal@17635 924
pascal@17635 925 misspkg()
pascal@17635 926 {
pascal@19029 927 for i in zip kexec-tools posixovl cdrkit cdrkit-isoinfo ; do
pascal@17635 928 [ -d /var/lib/tazpkg/installed/$i/ ] && continue
pascal@17924 929 [ "$1" != "install" ] && menuitem "$@" && return
pascal@17635 930 tazpkg get-install $i
pascal@17635 931 done
pascal@17635 932 }
pascal@17635 933
pascal@23820 934 noinitmisspkg()
pascal@23820 935 {
pascal@23820 936 [ $0 = /init.exe ] || misspkg "$@"
pascal@23820 937 }
pascal@23820 938
pascal@17635 939 missing()
pascal@17635 940 {
pascal@17635 941 misspkg install
pascal@17635 942 }
pascal@17635 943
pascal@17635 944 ishybrid()
pascal@17635 945 {
pascal@18670 946 [ $(get 510 "$ISO") -eq 43605 ] || return
pascal@18670 947 C=$((2048*$(get $(((17*2048) + 71)) "$ISO" 4)))
pascal@18670 948 [ $(get $C "$ISO" 4) -eq 1 ] || return
pascal@18670 949 [ $(get $(($C+30)) "$ISO" 4) -eq $((0x88AA55)) ] || return
pascal@18670 950 C=$((2048*$(get $(($C+40)) "$ISO" 4)))
pascal@18670 951 [ $(get $(($C+64)) "$ISO" 4) -eq 1886961915 ] && menuitem "$@"
pascal@17635 952 }
pascal@17635 953
pascal@17635 954 isiso()
pascal@17635 955 {
pascal@18670 956 [ $(get 32769 "$ISO" 4) -eq 808469571 ] && menuitem "$@"
pascal@18140 957 }
pascal@18140 958
pascal@18034 959 burnable()
pascal@18034 960 {
pascal@19510 961 [ "$(sed '/Can wr.*1$/!d' /proc/sys/dev/cdrom/info 2> /dev/null)" ] &&
pascal@19510 962 menuitem "$@"
pascal@18034 963 }
pascal@18034 964
pascal@18034 965 blankable()
pascal@18034 966 {
pascal@19510 967 [ "$(sed '/Can wr.*RW.*1$/!d' /proc/sys/dev/cdrom/info 2> /dev/null)" ] &&
pascal@19510 968 menuitem "$@"
pascal@18034 969 }
pascal@18034 970
pascal@18034 971 burniso()
pascal@18034 972 {
pascal@18034 973 wodim -v speed=$(fgrep "drive speed" /proc/sys/dev/cdrom/info | cut -f3) \
pascal@18034 974 -eject -multi "$ISO"
pascal@18034 975 }
pascal@18034 976
pascal@18034 977 blankcd()
pascal@18034 978 {
pascal@18034 979 wodim -v -blank=fast
pascal@17635 980 }
pascal@17635 981
pascal@18675 982 customsector()
pascal@18675 983 {
pascal@19324 984 local c=$(echo $(get 32848 "$ISO" 4))
pascal@19324 985 hascustomconf $(($c+16)) && echo $(($c+16)) || echo $c
pascal@18675 986 }
pascal@18675 987
pascal@23831 988 xhascustomconf=hascustomconf
pascal@18675 989 hascustomconf()
pascal@18675 990 {
pascal@19324 991 [ "$(ddq bs=2k skip=${1:-$(customsector)} if="$ISO" | ddq bs=1 count=6)" \
pascal@20892 992 = "#!boot" ]
pascal@18675 993 }
pascal@18675 994
pascal@18675 995 gotcustomconf()
pascal@18675 996 {
pascal@18675 997 hascustomconf && menuitem "$@"
pascal@18675 998 }
pascal@18675 999
pascal@19425 1000 hasflavor()
pascal@19425 1001 {
pascal@23946 1002 [ -x /usr/bin/tazlito ] && [ -s $(maybe64 $media/boot/bzImage) ] && menuitem "$@"
pascal@19425 1003 }
pascal@19425 1004
pascal@17635 1005 gotisomd5()
pascal@17635 1006 {
pascal@17635 1007 [ "$(which md5sum 2> /dev/null)" ] &&
pascal@18670 1008 [ $(get 0 "$ISO") -eq 23117 ] &&
pascal@18670 1009 [ $(get 18 "$ISO") -ne 0 ] && menuitem "$@"
pascal@17635 1010 }
pascal@17635 1011
pascal@18675 1012 getcustomconf()
pascal@18675 1013 {
pascal@18675 1014 ddq bs=2k skip=$(customsector) if="$ISO" | while read line; do
pascal@18675 1015 case "$line" in
pascal@18675 1016 \#!boot*) ;;
pascal@18675 1017 append=*) echo ${line#append=} > cmdline && ls -l $PWD/cmdline ;;
pascal@18675 1018 initrd:*) cnt=${line#initrd:}
pascal@18675 1019 { ddq bs=512 count=$(($cnt / 512));
pascal@18675 1020 ddq bs=1 count=$(($cnt % 512)); } > initrd &&
pascal@18675 1021 ls -l $PWD/initrd
pascal@18675 1022 break ;;
pascal@20771 1023 *) break ;;
pascal@18675 1024 esac
pascal@18675 1025 done
pascal@18675 1026 [ "$1" ] && return 0
pascal@18675 1027 echo -e "\rPress RETURN to continue."
pascal@18675 1028 read n
pascal@18675 1029 }
pascal@18675 1030
pascal@17635 1031 isomd5()
pascal@17635 1032 {
pascal@17635 1033 dotwait "Checking iso image"
pascal@18670 1034 [ "$(ddq if="$ISO" bs=2k skip=16 \
pascal@20892 1035 count=$(($(get 32848 "$ISO" 4)-16)) | md5sum)" = \
pascal@18670 1036 "$(ddq if="$ISO" bs=16 count=1 skip=2047 | od -N 16 -t x1 -An | \
pascal@17635 1037 sed 's/ //g') -" ] && echo "OK" || echo "ERROR"
pascal@17635 1038 echo -en "\rChecking iso hybrid boot..."
pascal@18671 1039 n=$(($(get 2 "$ISO")-1+($(get 4 "$ISO")-1)*512))
pascal@17635 1040 if [ $n -lt 40000 -a $n -gt 32768 ]; then
pascal@18670 1041 s=$(get 0 "$ISO" 2 $n | awk '{ i+= $0 } END { print i }')
pascal@18670 1042 [ $(((1+$s+$(get $(($n+1)) "$ISO" 1)) % 65536)) -eq 0 ] &&
pascal@17635 1043 echo "OK" || echo "ERROR"
pascal@17635 1044 fi
pascal@18675 1045 if hascustomconf; then
pascal@18672 1046 echo -en "\rChecking iso custom config..."
pascal@18672 1047 TMP=/tmp/$(basename $0)$$md5
pascal@18675 1048 md5="$(ddq bs=2k skip=$(customsector) if="$ISO" | while read line; do
pascal@18670 1049 case "$line" in
pascal@18672 1050 \#!boot*) echo ${line#*boot } > $TMP ;;
pascal@18670 1051 append=*) echo $line ;;
pascal@18670 1052 initrd:*) echo $line
pascal@18675 1053 cnt=${line#initrd:}
pascal@18675 1054 ddq bs=512 count=$((cnt / 512))
pascal@18675 1055 ddq bs=1 count=$((cnt % 512))
pascal@18670 1056 break ;;
pascal@20771 1057 *) break ;;
pascal@18670 1058 esac
pascal@18670 1059 done | md5sum | cut -c1-32)"
pascal@20892 1060 [ "$md5" = "$(cat $TMP)" ] && echo "OK" || echo "ERROR"
pascal@18672 1061 rm -f $TMP
pascal@18670 1062 fi
pascal@17635 1063 rm -f /tmp/wait
pascal@17928 1064 [ "$1" ] && return 0
pascal@17635 1065 echo -e "\rPress RETURN to continue."
pascal@17635 1066 read n
pascal@17635 1067 }
pascal@17635 1068
pascal@17635 1069 usbdev()
pascal@17635 1070 {
pascal@17635 1071 dotwait "Wait 5 seconds for USB devices"
pascal@17635 1072 sleep 5
pascal@17635 1073 rm -f /tmp/wait
pascal@17635 1074 DEV="$(grep -l 1 /sys/block/*/removable | \
pascal@17635 1075 sed 's|/sys/block/\(.*\)/removable|\1|')"
pascal@17635 1076 [ "$DEV" ] || return
pascal@17635 1077 cat > /tmp/dialog$$ <<EOT
pascal@20771 1078 $DIALOG --clear --title " Select your USB key " \
pascal@17635 1079 --menu "\nPlease select the USB key according to its known size.\n\n" \
pascal@18240 1080 0 0 0 \
pascal@17635 1081 $(for i in $DEV ; do
pascal@23946 1082 grep -qs 1 /sys/block/$i/ro ||
pascal@17635 1083 echo -n "/dev/$i \"$(($(cat /sys/block/$i/size)/2048))MB $(cat /sys/block/$i/device/model 2> /dev/null)\" "
pascal@17635 1084 done) \
pascal@17635 1085
pascal@17635 1086 EOT
pascal@17635 1087 exec 3>&1
pascal@17635 1088 device=$(. /tmp/dialog$$ 2>&1 1>&3)
pascal@17635 1089 rm -f /tmp/dialog$$
pascal@17635 1090 retval=$?
pascal@17635 1091 exec 3>&-
pascal@17635 1092 rm -f /tmp/dialog$$
pascal@17635 1093 [ $retval -eq 0 ]
pascal@17635 1094 }
pascal@17635 1095
pascal@17635 1096 tazusbmsg()
pascal@17635 1097 {
pascal@17635 1098 [ "$(which tazusb 2> /dev/null)" ] || return
pascal@17635 1099 echo "You should choose 'USB key read/write installation' to be
pascal@17635 1100 able to save the package updates or your own configuration and data files.\n\n"
pascal@17635 1101 }
pascal@17635 1102
pascal@23947 1103 gpt_crc32()
pascal@23947 1104 {
pascal@23947 1105 t0=00000000; t1=77073096; t2=EE0E612C; t3=990951BA;
pascal@23947 1106 t4=076DC419; t5=706AF48F; t6=E963A535; t7=9E6495A3;
pascal@23947 1107 t8=0EDB8832; t9=79DCB8A4; t10=E0D5E91E; t11=97D2D988;
pascal@23947 1108 t12=09B64C2B; t13=7EB17CBD; t14=E7B82D07; t15=90BF1D91;
pascal@23947 1109 t16=1DB71064; t17=6AB020F2; t18=F3B97148; t19=84BE41DE;
pascal@23947 1110 t20=1ADAD47D; t21=6DDDE4EB; t22=F4D4B551; t23=83D385C7;
pascal@23947 1111 t24=136C9856; t25=646BA8C0; t26=FD62F97A; t27=8A65C9EC;
pascal@23947 1112 t28=14015C4F; t29=63066CD9; t30=FA0F3D63; t31=8D080DF5;
pascal@23947 1113 t32=3B6E20C8; t33=4C69105E; t34=D56041E4; t35=A2677172;
pascal@23947 1114 t36=3C03E4D1; t37=4B04D447; t38=D20D85FD; t39=A50AB56B;
pascal@23947 1115 t40=35B5A8FA; t41=42B2986C; t42=DBBBC9D6; t43=ACBCF940;
pascal@23947 1116 t44=32D86CE3; t45=45DF5C75; t46=DCD60DCF; t47=ABD13D59;
pascal@23947 1117 t48=26D930AC; t49=51DE003A; t50=C8D75180; t51=BFD06116;
pascal@23947 1118 t52=21B4F4B5; t53=56B3C423; t54=CFBA9599; t55=B8BDA50F;
pascal@23947 1119 t56=2802B89E; t57=5F058808; t58=C60CD9B2; t59=B10BE924;
pascal@23947 1120 t60=2F6F7C87; t61=58684C11; t62=C1611DAB; t63=B6662D3D;
pascal@23947 1121 t64=76DC4190; t65=01DB7106; t66=98D220BC; t67=EFD5102A;
pascal@23947 1122 t68=71B18589; t69=06B6B51F; t70=9FBFE4A5; t71=E8B8D433;
pascal@23947 1123 t72=7807C9A2; t73=0F00F934; t74=9609A88E; t75=E10E9818;
pascal@23947 1124 t76=7F6A0DBB; t77=086D3D2D; t78=91646C97; t79=E6635C01;
pascal@23947 1125 t80=6B6B51F4; t81=1C6C6162; t82=856530D8; t83=F262004E;
pascal@23947 1126 t84=6C0695ED; t85=1B01A57B; t86=8208F4C1; t87=F50FC457;
pascal@23947 1127 t88=65B0D9C6; t89=12B7E950; t90=8BBEB8EA; t91=FCB9887C;
pascal@23947 1128 t92=62DD1DDF; t93=15DA2D49; t94=8CD37CF3; t95=FBD44C65;
pascal@23947 1129 t96=4DB26158; t97=3AB551CE; t98=A3BC0074; t99=D4BB30E2;
pascal@23947 1130 t100=4ADFA541; t101=3DD895D7; t102=A4D1C46D; t103=D3D6F4FB;
pascal@23947 1131 t104=4369E96A; t105=346ED9FC; t106=AD678846; t107=DA60B8D0;
pascal@23947 1132 t108=44042D73; t109=33031DE5; t110=AA0A4C5F; t111=DD0D7CC9;
pascal@23947 1133 t112=5005713C; t113=270241AA; t114=BE0B1010; t115=C90C2086;
pascal@23947 1134 t116=5768B525; t117=206F85B3; t118=B966D409; t119=CE61E49F;
pascal@23947 1135 t120=5EDEF90E; t121=29D9C998; t122=B0D09822; t123=C7D7A8B4;
pascal@23947 1136 t124=59B33D17; t125=2EB40D81; t126=B7BD5C3B; t127=C0BA6CAD;
pascal@23947 1137 t128=EDB88320; t129=9ABFB3B6; t130=03B6E20C; t131=74B1D29A;
pascal@23947 1138 t132=EAD54739; t133=9DD277AF; t134=04DB2615; t135=73DC1683;
pascal@23947 1139 t136=E3630B12; t137=94643B84; t138=0D6D6A3E; t139=7A6A5AA8;
pascal@23947 1140 t140=E40ECF0B; t141=9309FF9D; t142=0A00AE27; t143=7D079EB1;
pascal@23947 1141 t144=F00F9344; t145=8708A3D2; t146=1E01F268; t147=6906C2FE;
pascal@23947 1142 t148=F762575D; t149=806567CB; t150=196C3671; t151=6E6B06E7;
pascal@23947 1143 t152=FED41B76; t153=89D32BE0; t154=10DA7A5A; t155=67DD4ACC;
pascal@23947 1144 t156=F9B9DF6F; t157=8EBEEFF9; t158=17B7BE43; t159=60B08ED5;
pascal@23947 1145 t160=D6D6A3E8; t161=A1D1937E; t162=38D8C2C4; t163=4FDFF252;
pascal@23947 1146 t164=D1BB67F1; t165=A6BC5767; t166=3FB506DD; t167=48B2364B;
pascal@23947 1147 t168=D80D2BDA; t169=AF0A1B4C; t170=36034AF6; t171=41047A60;
pascal@23947 1148 t172=DF60EFC3; t173=A867DF55; t174=316E8EEF; t175=4669BE79;
pascal@23947 1149 t176=CB61B38C; t177=BC66831A; t178=256FD2A0; t179=5268E236;
pascal@23947 1150 t180=CC0C7795; t181=BB0B4703; t182=220216B9; t183=5505262F;
pascal@23947 1151 t184=C5BA3BBE; t185=B2BD0B28; t186=2BB45A92; t187=5CB36A04;
pascal@23947 1152 t188=C2D7FFA7; t189=B5D0CF31; t190=2CD99E8B; t191=5BDEAE1D;
pascal@23947 1153 t192=9B64C2B0; t193=EC63F226; t194=756AA39C; t195=026D930A;
pascal@23947 1154 t196=9C0906A9; t197=EB0E363F; t198=72076785; t199=05005713;
pascal@23947 1155 t200=95BF4A82; t201=E2B87A14; t202=7BB12BAE; t203=0CB61B38;
pascal@23947 1156 t204=92D28E9B; t205=E5D5BE0D; t206=7CDCEFB7; t207=0BDBDF21;
pascal@23947 1157 t208=86D3D2D4; t209=F1D4E242; t210=68DDB3F8; t211=1FDA836E;
pascal@23947 1158 t212=81BE16CD; t213=F6B9265B; t214=6FB077E1; t215=18B74777;
pascal@23947 1159 t216=88085AE6; t217=FF0F6A70; t218=66063BCA; t219=11010B5C;
pascal@23947 1160 t220=8F659EFF; t221=F862AE69; t222=616BFFD3; t223=166CCF45;
pascal@23947 1161 t224=A00AE278; t225=D70DD2EE; t226=4E048354; t227=3903B3C2;
pascal@23947 1162 t228=A7672661; t229=D06016F7; t230=4969474D; t231=3E6E77DB;
pascal@23947 1163 t232=AED16A4A; t233=D9D65ADC; t234=40DF0B66; t235=37D83BF0;
pascal@23947 1164 t236=A9BCAE53; t237=DEBB9EC5; t238=47B2CF7F; t239=30B5FFE9;
pascal@23947 1165 t240=BDBDF21C; t241=CABAC28A; t242=53B39330; t243=24B4A3A6;
pascal@23947 1166 t244=BAD03605; t245=CDD70693; t246=54DE5729; t247=23D967BF;
pascal@23947 1167 t248=B3667A2E; t249=C4614AB8; t250=5D681B02; t251=2A6F2B94;
pascal@23947 1168 t252=B40BBE37; t253=C30C8EA1; t254=5A05DF1B; t255=2D02EF8D;
pascal@23947 1169 crc=$((0xFFFFFFFF))
pascal@23950 1170 dd if=$device bs=1 skip=$(($1)) count=$(($2)) 2> /dev/null | \
pascal@23947 1171 od -v -w1 -t u1 -An | {
pascal@23947 1172 while read n; do
pascal@23947 1173 local x=$((($crc ^ $n) & 255))
pascal@23947 1174 eval x=0x\$t$x
pascal@23947 1175 crc=$(((($crc >> 8) & 0x00FFFFFF) ^ $x))
pascal@23947 1176 done
pascal@23947 1177 echo $(($crc ^ 0xFFFFFFFF))
pascal@23947 1178 }
pascal@23947 1179 }
pascal@23947 1180
pascal@17635 1181 usbbootkey()
pascal@17635 1182 {
pascal@17924 1183 if [ -b "$1" ]; then
pascal@17924 1184 device=$1
pascal@17928 1185 elif [ "$1" ]; then
pascal@17928 1186 echo "Invalid USB key device"
pascal@20771 1187 return 1
pascal@17924 1188 else
pascal@20771 1189 $DIALOG --clear --title " Create a USB boot key " \
pascal@17924 1190 --yes-label "Continue" --yesno \
pascal@17635 1191 "\nThe USB key will be used like a CD-ROM. You will not be able to write
pascal@17635 1192 any data on the boot partition.\n\n
pascal@17635 1193 An extra FAT32 partition will be created with the remaining free space.\n\n
pascal@20771 1194 $(tazusbmsg)Please plug your USB stick in now.\n" 16 70
pascal@17924 1195 [ $? -eq 0 ] || return
pascal@17924 1196 usbdev || return
pascal@23946 1197 fi
pascal@17635 1198
pascal@23946 1199 # perform dd in progress bar
pascal@23951 1200 max=$(($(sectcnt "$ISO")/2048))
pascal@23946 1201 i=0; while [ $i -le $max ]; do
pascal@23946 1202 ddq if="$ISO" bs=1024k count=1 skip=$i seek=$i of=$device
pascal@23946 1203 echo $((($i*100)/$max))
pascal@23946 1204 i=$(($i+1))
pascal@23946 1205 done | dialog --gauge " The ISO image transfer can be long. Please wait..." \
pascal@23946 1206 6 70 0 > /dev/tty 2>&1
pascal@17635 1207
pascal@23947 1208 # GPT partition + fat32 format for the remaining space
pascal@23951 1209 sectors=$(($(sectcnt $device)-1))
pascal@23951 1210 quads2bin $sectors | ddq bs=1 seek=458 of=$device # pmbr
pascal@23951 1211 quads2bin 0 | ddq bs=1 seek=$((512+16)) of=$device
pascal@23951 1212 quads2bin $(($sectors-2)) 0 | ddq bs=1 seek=$((512+48)) of=$device
pascal@23947 1213 uudecode - <<EOT | gunzip | ddn bs=128 seek=9 of=$device # partiton fat32
pascal@23947 1214 begin-base64 644 -
pascal@23947 1215 H4sIAAAAAAACA1u04MLrpzuNXdoPZGzbrjbz+C/fHwyfEro9Z7E93Fi5/8sH
pascal@23947 1216 BhzAiSGRoZghkyGZQYEhBcguAWIFhgIgWQRkZ4JxPkMeAyEAAOuEo7uAAAAA
pascal@23947 1217 ====
pascal@23947 1218 EOT
pascal@23951 1219 last=$(sectcnt "$ISO")
pascal@23947 1220 custom=$((4*$(get 32848 $device 4)))
pascal@23947 1221 [ $custom -gt $(($last-4)) ] && last=$(($custom+4)) # room for cmdline
pascal@23951 1222 quads2bin $last 0 | ddq bs=1 seek=$((1024+128+32)) of=$device # vfat first address
pascal@23951 1223 quads2bin $(($sectors-2)) 0 | ddq bs=1 seek=$((1024+128+40)) of=$device # vfat last address
pascal@23951 1224 quads2bin $(gpt_crc32 1024 $(($(get 596 $device 4)*$(get 592 $device 4)))) | \
pascal@23951 1225 ddq bs=1 seek=$((512+88)) of=$device # CRC32 partitions
pascal@23951 1226 ddn of=$device if=$device bs=512 skip=1 seek=$sectors count=1
pascal@23951 1227 ddn of=$device if=$device bs=512 skip=2 seek=$(($sectors-1)) count=1
pascal@23951 1228 quads2bin $sectors 0 1 0 | ddq bs=1 seek=$(($sectors*512+24)) of=$device # my gpt, alt gpt
pascal@23951 1229 quads2bin 1 0 $sectors 0 | ddq bs=1 seek=$((512+24)) of=$device # my gpt, alt gpt
pascal@23951 1230 quads2bin $(($sectors-1)) 0 | ddq bs=1 seek=$(($sectors*512+72)) of=$device
pascal@23951 1231 i=$(get 524 $device 4)
pascal@23951 1232 quads2bin $(gpt_crc32 $(($sectors*512)) $i) | \
pascal@23951 1233 ddq bs=1 seek=$(($sectors*512+16)) of=$device # CRC32 header
pascal@23951 1234 quads2bin $(gpt_crc32 512 $i) | ddq bs=1 seek=$((512+16)) of=$device # CRC32 header
pascal@23947 1235 partprobe $device
pascal@23947 1236 homedev=/dev/$(basename /sys/block/${device#/dev/}/${device#/dev/}*2)
pascal@23947 1237 mkdosfs -n 'SLITAZ HOME' $homedev
pascal@23946 1238
pascal@23946 1239 # update boot/exe crc16
pascal@23950 1240 words2bin 0 | ddq bs=1 seek=18 of=$device
pascal@23950 1241 i=$(($(get 2 $device) - 1 + ($(get 4 $device) - 1)*512))
pascal@23946 1242 i=$(($(od -v -N $i -t u2 -w2 -An $device | \
pascal@23946 1243 awk '{ i+= $0 } END { print (i % 65536) }') \
pascal@23946 1244 + $(get $(($i+1)) $device 1)))
pascal@23946 1245 words2bin $(( (-$i -1) % 65536 )) | ddq bs=1 seek=18 of=$device
pascal@23947 1246
pascal@23947 1247 $DIALOG --clear --title " Set /home persistent " \
pascal@23947 1248 --yes-label "Continue" --yesno \
pascal@23950 1249 "\nThe USB key will run fully in ram. The datas will be lost after each reboot.\n\n
pascal@23950 1250 This option will mount /home on the USB key vfat during the boot process.\n\n
pascal@23950 1251 Your own data will be saved, but the system stay not upgradable.\n" 16 70
pascal@23947 1252 if [ $? -eq 0 ]; then
pascal@23947 1253 data="append=home=$(blkid $homedev | sed 's|.* UUID="||;s|".*||') kmap=$(cat /etc/keymap.conf) lang=${LANG%.UTF*} tz=$(cat /etc/TZ) loadfs"
pascal@23947 1254 cat <<EOT | ddn bs=512 seek=$custom of=$device
pascal@23947 1255 #!boot $(echo "$data" | md5sum | sed 's/ .*//')
pascal@23947 1256 $data
pascal@23947 1257 --
pascal@23947 1258 EOT
pascal@23947 1259 fi
pascal@17635 1260 }
pascal@17635 1261
pascal@17635 1262 usbkey()
pascal@17635 1263 {
pascal@20771 1264 $DIALOG --clear --title " Create a SliTaz USB key " \
pascal@17635 1265 --yes-label "Continue" --yesno \
pascal@17635 1266 "\nUnlike a hard drive install, the filesystem is kept in a compressed
pascal@17635 1267 rootfs.gz. The filesystem is loaded entirely into memory upon boot.
pascal@17635 1268 This should increase responsiveness, protect the filesystem against
pascal@17635 1269 accidental corruption and reduce read/writes to the USB drive.
pascal@17635 1270 Once setup, the tazusb utility can rewrite the root filesystem
pascal@20771 1271 with any changes you have made since booting up,
pascal@17635 1272 giving the effective benefits of a hard drive install.\n\n
pascal@17635 1273 /home is mounted on boot using the UUID of your particular flash drive.
pascal@17635 1274 Unlike a device name, the UUID has the benefit of never changing from machine
pascal@17635 1275 to machine.\n\n
pascal@20771 1276 Please plug your USB stick in now.\n" 19 70
pascal@17635 1277 [ $? -eq 0 ] || return
pascal@17635 1278 usbdev || return
pascal@17635 1279 exec 3>&1
pascal@17635 1280 format=`$DIALOG --clear \
pascal@17635 1281 --title " Select the filesystem " \
pascal@17635 1282 --radiolist "\nPlease select the filesystem type to create.\n\n\
pascal@20771 1283 The filesystem creation will erase all the data in the USB key." 14 70 4 \
pascal@17635 1284 "none" "Do not erase the USB key" on \
pascal@17635 1285 "ext3" "Ext3 journaling filesystem" off \
pascal@17635 1286 "ext2" "Ext2 filesystem" off \
pascal@17635 1287 "fat32" "Windows FAT32 filesystem" off \
pascal@17635 1288 2>&1 1>&3`
pascal@17635 1289 retval=$?
pascal@17635 1290 exec 3>&-
pascal@17635 1291 [ $retval -eq 0 ] || return
pascal@17635 1292 [ "$format" != "none" ] && tazusb format $device "SliTaz" $format
pascal@18670 1293 tazusb gen-iso2usb "$ISO" $device
pascal@17635 1294 }
pascal@17635 1295
pascal@17931 1296 flavdata()
pascal@17931 1297 {
pascal@18670 1298 [ $(get 1024 "$ISO") -eq 35615 ] && n=2 || n=$((1+$(get 417 "$ISO" 1)))
pascal@19425 1299 [ $n -eq 4 ] && n=20
pascal@20724 1300 [ $(get $(($n*512)) "$ISO") -eq 35615 ] || n=13
pascal@19510 1301 ddq if="$ISO" bs=512 skip=$n count=20 | zcat 2>/dev/null
pascal@17931 1302 }
pascal@17931 1303
pascal@17931 1304 hasflavinfo()
pascal@17931 1305 {
pascal@23946 1306 [ "$(flavdata | ddq bs=1 count=7)" = "0707010" ] && menuitem "$@"
pascal@17931 1307 }
pascal@17931 1308
pascal@17931 1309 showfavinfo()
pascal@17931 1310 {
pascal@17931 1311 mkdir -p /tmp/data
pascal@17931 1312 flavdata | ( cd /tmp/data ; cpio -i )
pascal@17931 1313 file=/tmp/data/info
pascal@17931 1314 cat /tmp/data/*desc > $file
pascal@18627 1315 if [ -s /tmp/data/*receipt ]; then
pascal@18627 1316 echo "=== receipt ==="
pascal@18627 1317 cat /tmp/data/*receipt
pascal@18627 1318 fi >> $file
pascal@17931 1319 for i in /tmp/data/*list* ; do
pascal@17931 1320 echo "=== extra ${i#*list} files"
pascal@17931 1321 cat $i
pascal@17931 1322 done >> $file
pascal@17931 1323 if [ "$1" ]; then
pascal@17931 1324 cat $file
pascal@17931 1325 else
pascal@20771 1326 $DIALOG --clear --title " Flavor info " \
pascal@18240 1327 --textbox $file 0 0
pascal@17931 1328 fi
pascal@17931 1329 rm -rf /tmp/data
pascal@17931 1330 }
pascal@17931 1331
pascal@18626 1332 flavor()
pascal@18626 1333 {
pascal@18626 1334 name="$(flavdata | cpio -t 2> /dev/null | sed 's/.[a-z]*$//;q')"
pascal@18626 1335 echo "Create ${name:=flavor}.flavor..."
pascal@18670 1336 tazlito iso2flavor "$ISO" $name
pascal@18771 1337 ls -l $name.flavor 2> /dev/null && return
pascal@18771 1338 sleep 5
pascal@18771 1339 [ "$1" ] && return
pascal@18771 1340 echo -e "\rPress RETURN to continue."
pascal@18771 1341 read n
pascal@18626 1342 }
pascal@18626 1343
pascal@20892 1344 if [ "$1" = "--build" ]; then #install-begin
pascal@23810 1345 uuencode -m - < header.com | sed -e '/^HEADERCODE$/r/dev/stdin' \
pascal@23947 1346 -e "s|HEADERSZ|$(size header.com)|" -e '/^HEADERCODE$/d' -i $0
pascal@18151 1347 uuencode -m - < ifmem.bin | sed -e '/^ifmemcode$/r/dev/stdin' \
pascal@18151 1348 -e '/^ifmemcode$/d' -i $0
pascal@18140 1349 uuencode -m - < bootloader.bin | sed -e '/^bootloader$/r/dev/stdin' \
pascal@18140 1350 -e '/^bootloader$/d' -e '/install-begin$/,/install-end$/d' -i $0
pascal@18140 1351 exit
pascal@18140 1352 fi #install-end
pascal@18140 1353 parse_isolinux()
pascal@18140 1354 {
pascal@18140 1355 awk 'BEGIN { IGNORECASE=1 }
pascal@18145 1356 function multi(n)
pascal@18145 1357 {
pascal@18145 1358 auto=$n
pascal@18145 1359 for (--n; n < NF; n+=2) {
pascal@18145 1360 s=$n
pascal@18145 1361 if (s ~ /M$/) s = substr(s,0,length(s)-1)
pascal@18145 1362 else s /= 1024
pascal@18145 1363 sizes=int(s) " " sizes
pascal@18145 1364 }
pascal@18145 1365 next
pascal@18145 1366 }
pascal@18140 1367 {
pascal@18140 1368 if ($1 == "LABEL") {
pascal@18140 1369 label=$2
pascal@18140 1370 if (auto == "") auto=label
pascal@18140 1371 }
pascal@18140 1372 if ($1 == "KERNEL" || $1 == "COM32") kernel[label]=$2
pascal@18140 1373 if ($1 == "INITRD") initrd[label]=$2
pascal@18140 1374 if ($1 == "APPEND") {
pascal@18140 1375 i=2
pascal@18145 1376 if (kernel[label] ~ "ifmem.c32") multi(3)
pascal@18140 1377 if (kernel[label] ~ "c32box.c32") {
pascal@18140 1378 if ($2 == "linux") { kernel[label]=$3; i=4 }
pascal@18145 1379 if ($2 == "ifmem") multi(4)
pascal@18140 1380 }
pascal@18140 1381 if (kernel[label] ~ "ifcpu64.c32") { auto=$4; next }
pascal@18140 1382 while (i <= NF) {
pascal@18140 1383 if ($i ~ "^initrd=") initrd[label]=substr($i,8)
pascal@18140 1384 else cmdline[label]=cmdline[label] " " $i
pascal@18140 1385 i++
pascal@18140 1386 }
pascal@18140 1387 }
pascal@18140 1388 }
pascal@18140 1389 END {
pascal@18140 1390 print "KERNEL=\"" kernel[auto] "\""
pascal@18140 1391 print "INITRD=\"" initrd[auto] "\""
pascal@18140 1392 print "CMDLINE=\"" substr(cmdline[auto],2) "\""
pascal@18145 1393 print "SIZES=\"" sizes "\""
pascal@18140 1394 }'
pascal@18140 1395 }
pascal@18140 1396
pascal@18140 1397 locase()
pascal@18140 1398 {
pascal@18140 1399 echo "$1" | tr [A-Z] [a-z]
pascal@18140 1400 }
pascal@18140 1401
pascal@18151 1402 ifmemcode()
pascal@18151 1403 {
pascal@18151 1404 uudecode <<EOT
pascal@18151 1405 ifmemcode
pascal@18151 1406 EOT
pascal@18151 1407 }
pascal@18151 1408
pascal@18140 1409 floppyset()
pascal@18140 1410 {
pascal@19425 1411 gotcdfile 'isolinux.cfg'
pascal@19432 1412 $0 include $file | parse_isolinux > /tmp/var$$
pascal@18140 1413 . /tmp/var$$
pascal@19425 1414 [ -z "$KERNEL" ] && echo "Can't parse isolinux.cfg" && return
pascal@18240 1415 for i in $media/$KERNEL $(dirname $file)/$KERNEL $media/$(locase $KERNEL) \
pascal@18240 1416 $(dirname $file)/$(locase $KERNEL); do
pascal@19433 1417 i="$(ls $i* | sed q)"
pascal@19433 1418 [ -n "$i" ] && KERNEL=$i && break
pascal@18240 1419 done
pascal@20771 1420 rm -f /tmp/var$$
pascal@18240 1421 [ $(get 514 $KERNEL 4) -eq 1400005704 ] || return
pascal@18240 1422 n=$(($(get 497 $KERNEL 1)+1))
pascal@18240 1423 ddq bs=512 count=$n if=$KERNEL of=/tmp/fd$$
pascal@23946 1424 uudecode <<EOT | ddn of=/tmp/fd$$
pascal@18140 1425 bootloader
pascal@18140 1426 EOT
pascal@18140 1427 pos=$(($n*512))
pascal@18140 1428 if [ -n "$CMDLINE" ]; then
pascal@18140 1429 echo -n "$CMDLINE" | ddq bs=512 count=1 conv=sync >> /tmp/fd$$
pascal@23946 1430 bytes2bin $n | ddn bs=1 seek=497 of=/tmp/fd$$
pascal@23946 1431 words2bin $pos | ddn bs=1 seek=34 of=/tmp/fd$$
pascal@18240 1432 [ $(get 518 $KERNEL 4) -ge 514 ] &&
pascal@23946 1433 words2bin 32768 9 | ddn bs=1 seek=552 of=/tmp/fd$$
pascal@18140 1434 fi
pascal@18140 1435 syssize=$(echo $(get 500 /tmp/fd$$ 4))
pascal@18240 1436 ddq bs=512 skip=$n if=$KERNEL | cat - /dev/zero | \
pascal@18155 1437 ddq bs=512 count=$((($syssize+31)/32)) conv=sync >> /tmp/fd$$
pascal@23947 1438 base=$(size /tmp/fd$$)
pascal@18140 1439 len=
pascal@18140 1440 if [ "$INITRD" ]; then
pascal@18140 1441 l=0
pascal@18140 1442 for i in ${INITRD//,/ }; do
pascal@18240 1443 for j in $media/$i $(dirname $KERNEL)/$i $media/$(locase $i) \
pascal@18240 1444 $(dirname $KERNEL)/$(locase $i); do
pascal@19433 1445 j="$(ls $j* | sed q)"
pascal@19433 1446 [ -n "$j" ] && i=$j && break
pascal@18240 1447 done
pascal@18240 1448 ddq if=$i >> /tmp/fd$$
pascal@23947 1449 l=$(($l+$(size $i)))
pascal@18140 1450 r=$((4 - ($l % 4)))
pascal@18140 1451 if [ $r -ne 4 ]; then
pascal@18140 1452 ddq if=/dev/zero bs=1 count=$r >> /tmp/fd$$
pascal@18140 1453 l=$(($l + $r))
pascal@18140 1454 fi
pascal@18143 1455 case "$i:$INITRD" in
pascal@18143 1456 *rootfs.gz:*rootfs.gz,*) continue # loram
pascal@18140 1457 esac
pascal@18140 1458 len="$len $l"; l=0
pascal@18140 1459 done
pascal@18143 1460 rdadrs=${RDADRS:-$(((($syssize*16)+0x1F0000) & -4096))}
pascal@23951 1461 quads2bin $rdadrs | ddn bs=1 seek=536 of=/tmp/fd$$
pascal@18140 1462 fi
pascal@18140 1463 n=$(echo $len | wc -w)
pascal@18140 1464 if [ $((494 - $(get 494 /tmp/fd$$))) -ge $(($n * 4)) ]; then
pascal@18140 1465 i=$(($(get 494 /tmp/fd$$)))
pascal@23946 1466 bytes2bin $(($i + ($n*4) - 256)) | ddn bs=1 \
pascal@23946 1467 seek=496 of=/tmp/fd$$
pascal@18140 1468 else
pascal@18140 1469 i=$(($pos + 0x1FC - ($n*4)))
pascal@23946 1470 bytes2bin $(($i % 256)) $((i / 256)) 252 | ddn bs=1 \
pascal@23946 1471 seek=494 of=/tmp/fd$$
pascal@18151 1472 s=$(($i - 2*$(echo "$SIZES" | wc -w)))
pascal@18151 1473 p=$(($s - $(ifmemcode | wc -c)))
pascal@23946 1474 ifmemcode | ddn bs=1 seek=$p of=/tmp/fd$$
pascal@23946 1475 words2bin $SIZES | ddn bs=1 seek=$s of=/tmp/fd$$
pascal@18151 1476 bytes2bin 154 $(($p%256)) $(($p/256)) 0 144 | \
pascal@23946 1477 ddn bs=1 seek=60 of=/tmp/fd$$
pascal@18140 1478 fi
pascal@18140 1479 for r in $len ; do
pascal@23951 1480 quads2bin $r | ddn bs=1 seek=$i of=/tmp/fd$$
pascal@18140 1481 i=$(($i + 4))
pascal@18140 1482 done
pascal@18140 1483 split -b 1440k /tmp/fd$$ fd$$
pascal@18140 1484 rm -f /tmp/fd$$
pascal@18140 1485 n=1; i=0; r=0
pascal@18140 1486 set -- $len
pascal@18140 1487 ls fd$$* | while read file ; do
pascal@18140 1488 if [ $i -gt $(($1+$base)) ]; then
pascal@18140 1489 shift
pascal@18140 1490 r=$(($r+100)); n=0; i=0; base=0
pascal@18140 1491 fi
pascal@18140 1492 ddq of=$file bs=18k seek=80 count=0
pascal@18140 1493 i=$(($i+1474560))
pascal@18140 1494 printf "mv %s fd%03d.img\n" $file $(($r+$n))
pascal@18140 1495 n=$(($n+1))
pascal@18140 1496 done | sh
pascal@19029 1497 du -ch $PWD/fd???.img
pascal@18140 1498 }
pascal@18140 1499
pascal@17635 1500 quit()
pascal@17635 1501 {
pascal@18240 1502 umount -d $media
pascal@18240 1503 rmdir $media
pascal@18240 1504 ${1:-exit}
pascal@17635 1505 }
pascal@17635 1506
pascal@19008 1507 infoiso()
pascal@19008 1508 {
pascal@19008 1509 isoinfo -d -i "$ISO" > /tmp/isoinfo$$
pascal@19008 1510 if [ -x "$(which iso2exe)" ]; then
pascal@19008 1511 echo "----"
pascal@20159 1512 blkid "$ISO" | while read args; do
pascal@20159 1513 set -- $args
pascal@20159 1514 while [ -n "$2" ]; do
pascal@20159 1515 case "$2" in
pascal@20159 1516 *UUID*|PT*) echo $2;;
pascal@20159 1517 esac
pascal@20159 1518 shift
pascal@20159 1519 done
pascal@20159 1520 done
pascal@20159 1521 if ! fdisk -l "$ISO" | grep -q 'valid partition'; then
pascal@20159 1522 fdisk -l "$ISO" | grep heads
pascal@20159 1523 fdisk -l "$ISO" | sed 's/^ *[^ ]* *//;s/ */ /g;$!d'
pascal@20159 1524 fi
pascal@20159 1525 echo "----"
pascal@19008 1526 iso2exe -l "$ISO"
pascal@19008 1527 fi >> /tmp/isoinfo$$
pascal@19008 1528 if [ "$1" ]; then
pascal@19008 1529 cat /tmp/isoinfo$$
pascal@19008 1530 else
pascal@20771 1531 $DIALOG --clear --title " Info ISO " \
pascal@19008 1532 --textbox /tmp/isoinfo$$ 0 0
pascal@19008 1533 fi
pascal@19008 1534 rm -f /tmp/isoinfo$$
pascal@19008 1535 }
pascal@19008 1536
pascal@18289 1537 isotitle()
pascal@18289 1538 {
pascal@18778 1539 echo "$(blkid "$ISO" | sed 's/.*LABEL="\([^"]*\).*/\1/') $(stat \
pascal@18778 1540 -c %y $media/.|sed 's/ .*//') $(basename "$ISO")"
pascal@18289 1541 }
pascal@18289 1542
pascal@23820 1543 if [ $0 = /init.exe ]; then
pascal@23820 1544
pascal@23820 1545 case "${ISO##*/}$(getarg mode)" in
pascal@23820 1546 *install*|*INSTALL*) install;;
pascal@23820 1547 *live*|*LIVE*) live;;
pascal@23820 1548 *text*|*TEXT*) text;;
pascal@23820 1549 esac
pascal@23820 1550 dmesg > /tmp/dmesg
pascal@23820 1551
pascal@23820 1552 else
pascal@23820 1553
pascal@20892 1554 if [ "$1" = "include" ]; then
pascal@19432 1555 [ -s "$2" ] && cd $(dirname "$2") && awk -v exe=$0 \
pascal@19432 1556 '{ if ($1 == "include") system(exe " include " $2); else print }' <"$2"
pascal@19432 1557 exit
pascal@19432 1558 fi
pascal@18034 1559 ISO="${1:-/dev/null}"
pascal@23951 1560 while [ -L "$ISO" ]; do
pascal@23951 1561 media="$(readlink "$ISO")"
pascal@23951 1562 case "$media" in
pascal@23951 1563 /*) ISO="$media" ;;
pascal@23951 1564 *) ISO="$(dirname "$ISO")/$media" ;;
pascal@23951 1565 esac
pascal@23951 1566 done
pascal@23951 1567 [ "${ISO:0:1}" != "/" ] && ISO="$(cd $(dirname "$ISO"); echo $PWD/$(basename "$ISO"))"
pascal@17635 1568 [ -z "$(isiso 2> /dev/null)" ] && echo "Usage : $0 file.iso" && exit 1
pascal@18666 1569 media=/tmp/media$$
pascal@18240 1570 mkdir -p $media
pascal@18670 1571 mount -o loop,ro "$ISO" $media
pascal@17635 1572
pascal@20892 1573 if [ "$2" = "list" ]; then
pascal@17928 1574 sed '/^\$(.*") \\/!d;s/^\$(\(.*\)").*/\1"/' $0 | while read line; do
pascal@17928 1575 eval $line
pascal@17928 1576 echo
pascal@17928 1577 done | sed '/^$/d;/"usbkey"/d'
pascal@17928 1578 quit
pascal@17928 1579 fi
pascal@17924 1580 if grep -q "^$2()" $0; then
pascal@17924 1581 exe=$2
pascal@17924 1582 shift 2
pascal@18140 1583 if [ -n "$(eval $(grep "\"$exe\"" $0 | sed \
pascal@18140 1584 '/^\$/!d;s/.(\(.*\)[\t ]*".*"[\t ]*".*/\1/'))" ]; then
pascal@18289 1585 isotitle
pascal@17924 1586 grep "\"$exe\"" $0 | sed '/^\$/!d;s/.*"[\t ]*"\(.*\)".*/\1/'
pascal@18140 1587 echo ----
pascal@17924 1588 $exe "$@"
pascal@17924 1589 fi
pascal@17924 1590 quit
pascal@17924 1591 fi
pascal@23820 1592 fi
pascal@17924 1593
pascal@17635 1594 while true; do
pascal@23820 1595 keymap="$(cat /etc/keymap.conf 2>/dev/null)"
pascal@23820 1596 locale="$(sed '/^LANG=/!d;s/.*=//' /etc/locale.conf 2>/dev/null)"
pascal@17635 1597 cat > /tmp/dialog$$ <<EOT
pascal@21092 1598 $DIALOG --clear --title " $(isotitle) " --menu "" 28 70 30 \
pascal@23820 1599 $(initxfile tazkeymap "tazkeymap" "Select keyboard (${keymap:-none})") \
pascal@23820 1600 $(initxfile tazlocale "tazlocale" "Select locale (${locale:-none})") \
pascal@23820 1601 $(initx "live" "Linux RAM boot (full desktop)") \
pascal@23820 1602 $(initx "text" "Linux RAM boot") \
pascal@17635 1603 $(cdfile 'README*' "readme" "Show the README file") \
pascal@18675 1604 $(gotcustomconf "getcustomconf" "Get custom config") \
pascal@17635 1605 $(gotisomd5 "isomd5" "Check the ISO image") \
pascal@17635 1606 $(cdfile 'md5sum*' "md5" "Check the ISO files") \
pascal@17635 1607 $(cdfile 'sha*sum*' "sha" "Check the ISO files") \
pascal@19008 1608 $(xfile isoinfo "infoiso" "ISO image info") \
pascal@23946 1609 $(cdfilex 'bzImage*' "bootiso" "Boot the ISO image") \
pascal@18034 1610 $(burnable "burniso" "Burn the ISO image") \
pascal@18034 1611 $(blankable "blankcd" "Blank the CD/DVD") \
pascal@17635 1612 $(gotposixovl "install" "Hard disk installation (UMSDOS way)") \
pascal@17635 1613 $(gotposixovl "installtaz" "Hard disk installation (TAZUSB way)") \
pascal@17635 1614 $(gotposixovlzip "inst2zip" "ZIP installation archive (UMSDOS way)") \
pascal@17635 1615 $(gotposixovlzip "insttaz2zip" "ZIP installation archive (TAZUSB way)") \
pascal@19425 1616 $(gottazusb "usbkey" "USB key read/write installation") \
pascal@23947 1617 $(ishybrid "usbbootkey" "USB boot key (not upgradable)") \
paul@17935 1618 $(hasflavinfo "showfavinfo" "Show flavor extra info") \
pascal@19425 1619 $(hasflavor "flavor" "Get flavor file") \
pascal@18140 1620 $(cdfile isolinux.cfg "floppyset" "Boot floppy set") \
pascal@23810 1621 $(cdfile linld.com "tazboot" "Get tazboot.exe Linux loader") \
pascal@23946 1622 $(cdexe 'bzImage*' "bzimage" "Get linux DOS/EXE file") \
pascal@17635 1623 $(cdexe 'memtest*' "memtest" "Get Memtest86 DOS/EXE file") \
pascal@17635 1624 $(cdfilef 'memtest*' "fdmemtest" "Create a Memtest86 boot floppy") \
pascal@20724 1625 $(cdexe '?pxe*' "pxe" "Get SliTaz Web boot DOS/EXE utility") \
pascal@20724 1626 $(cdfilef '?pxe*' "fdpxe" "Create a SliTaz Web boot floppy") \
pascal@23946 1627 $(cdexe 'plop.exe' "plop" "Get USB boot DOS/EXE utility") \
pascal@23946 1628 $(cdfilef 'plop.exe' "fdplop" "Create a USB boot floppy") \
pascal@23820 1629 $(initxfile reboot "restart" "Restart the computer") \
pascal@23820 1630 $(initxfile poweroff "stop" "Power off") \
pascal@23820 1631 $(initx "bootlog" "Linux boot messages") \
pascal@23820 1632 $(initx "shell" "Shell prompt") \
pascal@23820 1633 $(noinitmisspkg "missing" "Install packages to get more options") \
pascal@23820 1634 $(noinit "quit" "Quit this utility")
pascal@17635 1635 EOT
pascal@17635 1636 exec 3>&1
pascal@17635 1637 value=$(. /tmp/dialog$$ 2>&1 1>&3)
pascal@17635 1638 retval=$?
pascal@17635 1639 exec 3>&-
pascal@17635 1640 rm -f /tmp/dialog$$
pascal@23820 1641 [ $retval -ne 0 ] && [ $0 != /init.exe ] && quit
pascal@17635 1642 $value
pascal@17635 1643 done