# HG changeset patch # User Pascal Bellard # Date 1420231576 -3600 # Node ID 2c2a6dd5ba40517b6d49dc18ce941efaf1f4723b # Parent 3cbe0810030ebbe0e9b4228773269f23de88ad53 syslinux/iso2exe: speedup crc diff -r 3cbe0810030e -r 2c2a6dd5ba40 syslinux/stuff/iso2exe/boot.c --- a/syslinux/stuff/iso2exe/boot.c Fri Jan 02 18:34:02 2015 +0000 +++ b/syslinux/stuff/iso2exe/boot.c Fri Jan 02 21:46:16 2015 +0100 @@ -17,8 +17,8 @@ kernel=boot/bzImage\n\ initrd=boot/rootfs4.gz,boot/rootfs3.gz,boot/rootfs2.gz,boot/rootfs1.gz,\\slitaz\\extrafs.gz\n\ rw root=/dev/null vga=normal autologin\n\n\ - kernel=\\slitaz\\vmlinuz\n\ - root=/dev/sda5 ro\n",iso,iso,iso); + kernel=\\slitaz\\elks\n\ + root=/dev/bda1 ro\n",iso,iso,iso); exit(1); } @@ -39,7 +39,6 @@ do { if (!isoopen(mode) || // custom !isoopen("bzImage") || // SliTaz - !isoopen("linux24") || // dsl !isoopen("vmlinuz") || // misc (!isoopen("linux") && ++isknoppix)) { magic = loadkernel(); diff -r 3cbe0810030e -r 2c2a6dd5ba40 syslinux/stuff/iso2exe/init --- a/syslinux/stuff/iso2exe/init Fri Jan 02 18:34:02 2015 +0000 +++ b/syslinux/stuff/iso2exe/init Fri Jan 02 21:46:16 2015 +0100 @@ -9,8 +9,8 @@ get() { - od -j $1 -N ${3:-2} -t u${3:-2} -An $2 2> /dev/null || - hexdump -s $1 -n ${3:-2} -e "\"\" 1/${3:-2} \"%d\"" $2 + od -j $1 -N ${4:-${3:-2}} -t u${3:-2} -An $2 2> /dev/null || + hexdump -v -s $1 -n ${4:-${3:-2}} -e "\"\" 1/${3:-2} \" %d\"" $2 } getarg() @@ -48,8 +48,8 @@ --yesno) while true; do clear - echo "$2" | sed 's/\\n/\n/g' - echo -en "\n <- 1:${label:-Yes} 2:Cancel\r" + echo "$2" | sed 's/\\n\\n/\\n/g;s/\\n/\n/g' + echo -en " <- 1:${label:-Yes} 2:Cancel\r" read x case "$x" in ''|Y*|y*|1) return 0;; @@ -57,15 +57,16 @@ esac done ;; --menu|--radiolist) - label="$2" + [ "$1" == "--menu" ] && shft=2 || shft=3 + label="" + [ "$2" ] && label="\n$2" shift 5 - echo -e "$title\n$label\n0 Cancel" > /tmp/data + echo -e "$title$label\n0 Cancel" > /tmp/data n=1 while [ "$1" ]; do eval key_$n='$1' echo "$((n++)) $2" - case "$3" in on|off) shift;; esac - shift 2 + shift $shft done >> /tmp/data while ! grep -q "^$n " /tmp/data ; do clear @@ -454,6 +455,15 @@ rm -f /tmp/data } +gotcdfile() +{ + for i in /media/cdrom/$1 /media/cdrom/*/$1 \ + /media/cdrom/*/isolinux/$1 ; do + file=$(ls $i 2> /dev/null | sed q) + [ -s "$file" ] && break + done +} + sha() { gotcdfile sha*sum* @@ -549,9 +559,8 @@ pxe() { gotcdfile ?pxe - pxe=$(ls $file) $DIALOG --clear \ - --title " Create $(basename $pxe).exe ? " \ + --title " Create $(basename $file).exe ? " \ --yes-label "Install" --yesno \ "\nBoot your operating system from the internet and enjoy a full system working entirely in RAM with speed and stability in mind. The Linux Kernel @@ -559,7 +568,7 @@ from the Web using PXE and HTTP protocols.\n " 12 70 [ $? -eq 0 ] || return - cp $pxe /mnt/$(basename $pxe).exe + cp $file /mnt/$(basename $file).exe } fdpxe() @@ -587,14 +596,6 @@ [ "$(which $1)" ] && echo -en "\"$2\" \"$3\"" } -gotcdfile() -{ - for file in /media/cdrom/$1 /media/cdrom/*/$1 \ - /media/cdrom/*/isolinux/$1 ; do - [ -s $file ] && break - done -} - cdfile() { gotcdfile "$1" && echo -en "\"$2\" \"$3\"" @@ -605,6 +606,11 @@ [ "$(which kexec)" ] && cdfile "$@" } +cdfilef() +{ + [ -e /sys/block/fd0 ] && cdfile "$@" +} + cdexe() { gotcdfile "$1" && @@ -614,10 +620,21 @@ fddata() { + [ -e /sys/block/fd0 ] && [ $(get 28 /mnt/$ISO 1 2> /dev/null || echo 0) -ne 0 ] && echo -en "\"$1\" \"$2\"" } +ishybrid() +{ + C=$((2048*$(get $(((17*2048) + 71)) /mnt/$ISO 4))) + [ $(get $C /mnt/$ISO 4) -eq 1 ] || return + [ $(get $(($C+30)) /mnt/$ISO 4) -eq $((0x88AA55)) ] || return + C=$((2048*$(get $(($C+40)) /mnt/$ISO 4))) + [ $(get $(($C+64)) /mnt/$ISO 4) -eq 1886961915 ] && + echo -en "\"$1\" \"$2\"" +} + fdbootstrap() { sz=$((512 * $(echo $(get 28 /mnt/$ISO 1)))) @@ -645,21 +662,32 @@ rm -f /tmp/wait DEV="$(grep -l 1 /sys/block/*/removable | \ sed 's|/sys/block/\(.*\)/removable|\1|')" + grep -qs 1 /sys/block/$DEV/ro && return [ "$DEV" ] || return - exec 3>&1 - device=`$DIALOG --clear \ + cat > /tmp/dialog < /dev/null)\" " done) \ - 2>&1 1>&3` + +EOT + exec 3>&1 + device=$(. /tmp/dialog 2>&1 1>&3) retval=$? exec 3>&- [ $retval -eq 0 ] } +tazusbmsg() +{ + [ "$(which tazusb 2> /dev/null)" ] || return + echo "You should choose 'USB key read/write installation' to be +able to save the package updates or your own configuration and data files.\n\n" +} + usbbootkey() { $DIALOG --clear \ @@ -668,15 +696,13 @@ "\nThe USB key will be used like a CD-ROM. You will not be able to write any data on the boot partition.\n\n An extra FAT32 partition will be created with the remaining free space.\n\n -You should choose 'USB key read/write installation' to be -able to save the package updates or your own configuration and data files.\n\n -Please plug your USB stick in now.\n +$(tazusbmsg)Please plug your USB stick in now.\n " 16 70 [ $? -eq 0 ] || return usbdev || return # perform dd in progess bar - max=$(($(stat -c %s /mnt/$ISO)/1024/1024)) + max=$(($(cat /sys/block/loop0/size)/2048)) i=0; ddq if=/mnt/$ISO bs=1024k | ( while ddq bs=1024k count=1 ; do i=$(($i + 1)) @@ -687,7 +713,7 @@ done ) > $device # partition + fat32 format for the remining space - od -j 466 -N 12 -t u2 -An $device | { read dx cx ol oh ll lh + get 446 $device 2 12 | { read dx cx ol oh ll lh if [ $dx -eq $((0x3F17)) ]; then cx=$(($cx & 0xFF00)) ofs=$(($ll+($lh<<16))) @@ -828,6 +854,7 @@ shell() { + trap text 2 getty -n -l /bin/ash 38400 tty1 || sh } @@ -847,6 +874,7 @@ dmesg > /tmp/dmesg while true; do + trap shell 2 keymap="$(cat /etc/keymap.conf 2> /dev/null)" locale="$(sed '/^LANG=/!d;s/.*=//' /etc/locale.conf 2> /dev/null)" cat > /tmp/dialog <