wok-current rev 21801
linld/iso2exe: remove non slitaz dos boot
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Aug 10 18:47:30 2019 +0200 (2019-08-10) |
parents | c25206bfb95e |
children | 2ca609c01117 |
files | linld/stuff/src/TAZBOOT.CPP linld/stuff/src/pipehole.awk syslinux/stuff/iso2exe/init |
line diff
1.1 --- a/linld/stuff/src/TAZBOOT.CPP Sat Aug 10 14:24:44 2019 +0200 1.2 +++ b/linld/stuff/src/TAZBOOT.CPP Sat Aug 10 18:47:30 2019 +0200 1.3 @@ -67,7 +67,7 @@ 1.4 { 1.5 const char *init = " rdinit=/init.exe", *mode="menu"; 1.6 char c; 1.7 - static char rootfs[16], fallback[16], isknoppix, noauto; 1.8 + static char rootfs[16], fallback[16], noauto; 1.9 unsigned long magic; 1.10 struct isostate *x=&isostate; 1.11 1.12 @@ -76,20 +76,12 @@ 1.13 base_himem = memtop() /2; 1.14 //if (base_himem >= _64m) base_himem = _64m; 1.15 if (* ((char *) &base_himem +3) >= 4) ((short *)&base_himem)[1] = _64m/_64k; 1.16 - isoopen("boot") != -1 || 1.17 - isoopen("live") != -1 || // debian 1.18 - isoopen("casper") != -1; // ubuntu 1.19 + isoopen("boot"); 1.20 if (iso[1] && !strcmp(mode = iso[1], "text")) 1.21 init = ""; 1.22 - do { 1.23 - if ((isoopen(mode) != -1 && ++noauto != 0) || // custom 1.24 - isoopen("bzImage") != -1 || // SliTaz 1.25 - isoopen("vmlinuz") != -1 || // misc 1.26 - (isoopen("linux") != -1 && ++isknoppix != 0)) { 1.27 - magic = kver2ul(isokernel()); 1.28 - break; 1.29 - } 1.30 - } while (isoopen("isolinux") != -1); // Knoppix 1.31 + if (isoopen(mode) == -1 || ++noauto == 0) // custom 1.32 + isoopen("bzImage"); // SliTaz 1.33 + magic = kver2ul(isokernel()); 1.34 for (c = 0, x->curdirsize = 0xFFFF; isoreaddir() != -1;) { 1.35 if (strstr(x->filename, ".gz")) 1.36 strcpy(fallback, x->filename); 1.37 @@ -99,7 +91,7 @@ 1.38 strcpy(rootfs, x->filename); 1.39 } 1.40 1.41 - strcatb(buf_cmdline,"rw root=/dev/null autologin bootfrom="); 1.42 + strcatb(buf_cmdline,"autologin bootfrom="); 1.43 strcat(buf_cmdline,*iso); 1.44 if (magic < 0x20630) 1.45 init = ""; // Does not support multiple initramfs 1.46 @@ -116,15 +108,10 @@ 1.47 } 1.48 } 1.49 else if (magic != 0) { 1.50 - char *initrdfilename = fallback; 1.51 static const unsigned long initrddesc = 18L; 1.52 1.53 - if (rootfs[0]) { 1.54 - initrdfilename = rootfs; 1.55 - if (rootfs[6] != '.' && isoopen("rootfs.gz") != -1) 1.56 - addinitrd(); // for loram 1.57 - } 1.58 - if (isoopen(initrdfilename) != -1) { 1.59 + if (isoopen("rootfs.gz") != -1 || 1.60 + isoopen(rootfs[0] ? rootfs : fallback) != -1) { 1.61 addinitrd(); 1.62 } 1.63 if (*init && isolseek(&initrddesc) != 0) { 1.64 @@ -141,13 +128,6 @@ 1.65 strcat(buf_cmdline,(char *)ultoa(magic)); 1.66 } 1.67 load_initrds(); 1.68 - if (isknoppix) { 1.69 - char *s = *iso; 1.70 - if (s[1] == ':') 1.71 - s += 2; 1.72 - for (; *s; s++) 1.73 - if (*s == '\\') *s = '/'; 1.74 - } 1.75 close(x->fd); 1.76 boot_kernel(); 1.77 }
2.1 --- a/linld/stuff/src/pipehole.awk Sat Aug 10 14:24:44 2019 +0200 2.2 +++ b/linld/stuff/src/pipehole.awk Sat Aug 10 18:47:30 2019 +0200 2.3 @@ -202,7 +202,7 @@ 2.4 } # file == "iso9660.cpp" 2.5 if (file == "iso9660.cpp" || file == "tazboot.cpp") { 2.6 if (/do s\+\+; while/) isiso=3 2.7 - if (/for \(p = s; \*s && \*s \!=/) isiso=3 2.8 + if (/for \(p = s; \*s && \*s \!=/) isiso=3 # tazboot/main 2.9 if (isiso == 3) { # ISO9660.LST, TAZBOOT.LST 2.10 sub(/cmp byte ptr \[.i\]/,"sub al") 2.11 if (/mov byte ptr \[bp-5\],al/) $0=" push ax" 2.12 @@ -243,11 +243,11 @@ 2.13 } 2.14 } # file == "iso9660.cpp" 2.15 if (/endp/) { xlabel = ""; goto2=0 } 2.16 - if (/isoopen\(s\+7\)/ && xlabel == "") goto2=1 2.17 - if (/_vid_mode,ax/ && xlabel == "") goto2=1 2.18 - if (/_initrd_name,si/ && xlabel == "") goto2=1 2.19 - if (/_base_himem\+2,/ && xlabel == "@") goto2=1 2.20 - if (/DGROUP:_skip_alloc/ && xlabel == "@") goto2=1 2.21 + if (/isoopen\(s\+7\)/ && xlabel == "") goto2=1 # tazboot/bootiso 2.22 + if (/_vid_mode,ax/ && xlabel == "") goto2=1 # tazboot/main 2.23 + if (/_initrd_name,si/ && xlabel == "") goto2=1 # tazboot/main 2.24 + if (/_base_himem\+2,/ && xlabel == "@") goto2=1 # tazboot/bootiso tazboot/main 2.25 + if (/DGROUP:_skip_alloc/ && xlabel == "@") goto2=1 # tazboot/bootiso tazboot/main 2.26 if (/puts\(cmdline\)/ && xlabel == "@@") goto2=1 2.27 if (goto2 == 1 && /jmp/) { # TAZBOOT.LST && LINLD.LST 2.28 print $NF xlabel "@:" 2.29 @@ -257,6 +257,29 @@ 2.30 $0=$0 xlabel 2.31 if (goto2++ == 1) xlabel=xlabel "@" 2.32 } 2.33 + if (file == "tazboot.cpp" && /close\(x/) isotazboot=16 2.34 + if (isotazboot == 160) { # TAZBOOT.LST 2.35 + $0="; " $0 2.36 + if (/ret/) isotazboot=0 2.37 + } 2.38 + if (isotazboot == 16) { # TAZBOOT.LST 2.39 + if (/@.@/) { 2.40 + isotazboot=160 2.41 + next 2.42 + } 2.43 + } 2.44 + if (file == "tazboot.cpp" && /jne @@2/) isotazboot=15 2.45 + if (isotazboot == 15) { # TAZBOOT.LST 2.46 + if (/@.@/) { 2.47 + print " pop di" 2.48 + print " pop si" 2.49 + print " mov sp,bp" 2.50 + print " pop bp" 2.51 + print " ret" 2.52 + next 2.53 + } 2.54 + if (/skip_alloc/) isotazboot=0 2.55 + } 2.56 if (/if\(\*s>=/) isotazboot=14 2.57 if (isotazboot == 14) { # LINLD.LST 2.58 if (/jmp/) { 2.59 @@ -264,24 +287,24 @@ 2.60 isotazboot=0 2.61 } 2.62 } 2.63 - if (file == "tazboot.cpp" && /; s \+= 4/) isotazboot=13 2.64 + if (file == "tazboot.cpp" && /; s \+= 4/) isotazboot=13 # tazboot/main 2.65 if (isotazboot == 13) { # TAZBOOT.LST 2.66 if (/si,4/) $0=" lea bx,[si+4]" 2.67 if (/bx,si/) next 2.68 if (/DGROUP:_topmem/ || /set_iso/) isotazboot=0 2.69 } 2.70 - if (file == "tazboot.cpp" && /case 0x652F:/) isotazboot=12 2.71 + if (file == "tazboot.cpp" && /case 0x652F:/) isotazboot=12 # tazboot/main 2.72 if (isotazboot == 12) { # TAZBOOT.LST 2.73 sub(/si,word/,"bx,word") 2.74 if (/short/) isotazboot=0 2.75 } 2.76 - if (/return load_kernel/) isotazboot=11 2.77 + if (/return load_kernel/) isotazboot=11 # tazboot/isokernel 2.78 if (isotazboot == 11) { # TAZBOOT.LST 2.79 sub(/call/,"jmp") 2.80 if (/ret/ || /pop/) next 2.81 if (/endp/) isotazboot=0 2.82 } 2.83 - if (/cmdline=s\+=3/ || /magic \!= 0/ || /&root_dev =/) { isotazboot=10; j="" } 2.84 + if (/cmdline=s\+=3/ || /magic \!= 0/ || /&root_dev =/) { isotazboot=10; j="" } # ,tazboot/bootiso,tazboot/main 2.85 if (isotazboot == 10) { # TAZBOOT.LST && LINLD.LST 2.86 if (/je/ || /jne/) { j=$1; next } 2.87 if (/jmp/) { 2.88 @@ -290,39 +313,39 @@ 2.89 isotazboot=0 2.90 } 2.91 } 2.92 - if (/static const unsigned long initrddesc = 18L/) isotazboot=9 2.93 + if (/static const unsigned long initrddesc = 18L/) isotazboot=9 # tazboot/bootiso 2.94 if (isotazboot == 9) { # TAZBOOT.LST 2.95 if (/,0/) { 2.96 split($4,y,",") 2.97 print " mov bx,offset " y[1] 2.98 + sub(/DGROUP:.*,/,"[bx],") 2.99 } 2.100 - if (/DGROUP:.*\+6,46/) { 2.101 - sub(/DGROUP:.*\+6,/,"[bx+6],") 2.102 - isotazboot=0 2.103 - } 2.104 - if (/mov/) $0=" mov si,bx" 2.105 - sub(/DGROUP:.*,/,"[bx],") 2.106 + if (/mov/ && $3 == y[1]) next 2.107 + if (/je/) next 2.108 + if (/jmp/) sub(/jmp/,"jne") 2.109 + sub(/ax,offset/,"bx,offset") 2.110 + if (/bx,ax/) { isotazboot=0; next } 2.111 } 2.112 - if (/isoopen\(s\+7\) != -1/) isotazboot=8 2.113 + if (/isoopen\(s\+7\) != -1/) isotazboot=8 # tazboot/bootiso 2.114 if (isotazboot == 8) { # TAZBOOT.LST 2.115 - if (/ax,si/) next 2.116 - sub(/ax,ax/,"si,si") 2.117 + sub(/\[bx/,"[si") 2.118 + if (/bx,si/) next 2.119 if (/magic/) isotazboot=0 2.120 } 2.121 - if (/\+\+isknoppix/) isotazboot=7 2.122 + if (/isoopen\(\"bzImage\"\)/) isotazboot=7 # tazboot/bootiso 2.123 if (isotazboot == 7) { # TAZBOOT.LST 2.124 if (/inc/ || /,al/) next 2.125 if (/al,byte/) sub (/mov al,/,"inc ") 2.126 if (/isokernel/) isotazboot=0 2.127 } 2.128 - if (/if \(c\) s\+\+;/) isotazboot=6 2.129 + if (/if \(c\) s\+\+;/) isotazboot=6 # tazboot/main 2.130 if (isotazboot == 6) { # TAZBOOT.LST 2.131 if (/cmp/) { 2.132 $0=" cmp al,0" 2.133 isotazboot=0 2.134 } 2.135 } 2.136 - if (/static void next_chunk/) isotazboot=5 2.137 + if (/static void next_chunk/) isotazboot=5 # tazboot/next_chunk 2.138 if (isotazboot == 501) { 2.139 if (/ret/) { 2.140 print "@1@86:" 2.141 @@ -350,7 +373,7 @@ 2.142 } 2.143 if (/ax,-4/) isotazboot++ 2.144 } 2.145 - if (/0x7FF0/) isotazboot=4 2.146 + if (/0x7FF0/) isotazboot=4 # tazboot/bootiso 2.147 if (isotazboot == 4) { # TAZBOOT.LST 2.148 if (/ax,word ptr/) { 2.149 print " mov ax,32752" 2.150 @@ -363,22 +386,21 @@ 2.151 sub(/,cx/,",ax") 2.152 if (/@addinitrd\$qv/) isotazboot=0 2.153 } 2.154 - if (/c = x->filename/) isotazboot=3 2.155 + if (/c = x->filename/) isotazboot=3 # tazboot/bootiso 2.156 if (isotazboot == 3) { # TAZBOOT.LST 2.157 if (/ax,/) $0=" xchg ax,bx" 2.158 if (/\]$/) next 2.159 if (/@strcpy\$qpxzct1/) isotazboot=0 2.160 } 2.161 - if (/base_himem = memtop/) isotazboot=2 2.162 + if (/base_himem = memtop/) isotazboot=2 # tazboot/bootiso 2.163 if (isotazboot == 2) { # TAZBOOT.LST 2.164 - if (/@6@226/ || /mov ax,1/ || /@6@254/ || /xor ax,ax/) next 2.165 - if (/word ptr \[bx\+2\],0/) { 2.166 + if (/word ptr \[si\+2\],0/) { 2.167 print s; hold=0 2.168 - print " mov bx,word ptr [bx+2]" 2.169 + print " mov bx,word ptr [si+2]" 2.170 $0=" or bx,bx" 2.171 } 2.172 if (/\[bp-4\],ax/) sub(/ax/,"bx") 2.173 - if (/ax,word ptr \[bx\+2\]/ || /bx,ax/) next 2.174 + if (/ax,word ptr \[si\+2\]/ || /bx,ax/) next 2.175 if (/_base_himem\+2,dx/) { 2.176 print " mov bx,offset DGROUP:_base_himem+2" 2.177 } 2.178 @@ -387,7 +409,7 @@ 2.179 sub(/DGROUP:_base_himem\+3,/,"[bx+1],") 2.180 if (/@strcmp\$qpxzct1/) isotazboot=0 2.181 } 2.182 - if (/static void addinitrd/) isotazboot=100 2.183 + if (/static void addinitrd/) isotazboot=100 # tazboot/addinitrd 2.184 if (isotazboot == 100) { # TAZBOOT.LST 2.185 if (/cx,ax/) { 2.186 print " mov si,offset _isostate+8"
3.1 --- a/syslinux/stuff/iso2exe/init Sat Aug 10 14:24:44 2019 +0200 3.2 +++ b/syslinux/stuff/iso2exe/init Sat Aug 10 18:47:30 2019 +0200 3.3 @@ -4,7 +4,7 @@ 3.4 3.5 ddq() 3.6 { 3.7 - dd $@ 2> /dev/null 3.8 + dd $@ 2>/dev/null 3.9 } 3.10 3.11 get() 3.12 @@ -41,15 +41,15 @@ 3.13 while [ "$1" ]; do 3.14 case "$1" in 3.15 --title) title=" \x1B[30;47m$2\x1B[37;40m\n" 3.16 - echo -e $title; shift ;; 3.17 - --yes-label) label="$2" ; shift ;; 3.18 + echo -e $title; shift;; 3.19 + --yes-label) label="$2"; shift;; 3.20 --textbox) 3.21 xless "$2" "\nPress RETURN to continue." 3.22 break;; 3.23 --gauge) 3.24 t=" " 3.25 echo -e "$t$2\n" 3.26 - while read pct ; do 3.27 + while read pct; do 3.28 s=" " 3.29 s="$s$pct%$s" 3.30 pct=$((($pct*63)/100)) 3.31 @@ -66,7 +66,7 @@ 3.32 ''|Y*|y*|1) return 0;; 3.33 N*|n*|2|0) return 1;; 3.34 esac 3.35 - done ;; 3.36 + done;; 3.37 --menu|--radiolist) 3.38 [ "$1" = "--menu" ] && shft=2 || shft=3 3.39 label="" 3.40 @@ -79,12 +79,12 @@ 3.41 echo "$((n++)) $2" 3.42 shift $shft 3.43 done >> /tmp/data 3.44 - while ! grep -q "^$n " /tmp/data ; do 3.45 + while ! grep -q "^$n " /tmp/data; do 3.46 clear 3.47 xless /tmp/data 3.48 echo -en "\n <- Enter the selection number\r" 3.49 read n 3.50 - done 2> /dev/null 3.51 + done 2>/dev/null 3.52 rm -f /tmp/data 3.53 [ $n -eq 0 ] && return 1 3.54 eval echo -n \$key_$n 1>&2 3.55 @@ -98,27 +98,27 @@ 3.56 { 3.57 mount -t proc /proc /proc 3.58 mount -t sysfs /sys /sys 3.59 - udevd --daemon 2> /dev/null && udevadm trigger && sleep 5 3.60 + udevd --daemon 2>/dev/null && udevadm trigger && sleep 5 3.61 } 3.62 3.63 umount_proc() 3.64 { 3.65 - killall udevd 2> /dev/null 3.66 - umount /sys/fs/fuse/connections 2> /dev/null 3.67 + killall udevd 2>/dev/null 3.68 + umount /sys/fs/fuse/connections 2>/dev/null 3.69 umount /sys 3.70 umount /proc 3.71 } 3.72 3.73 bytes2bin() 3.74 { 3.75 - for i in $@ ; do 3.76 + for i in $@; do 3.77 printf '\\\\x%02X' $(($i&255)) 3.78 done | xargs echo -en 3.79 } 3.80 3.81 words2bin() 3.82 { 3.83 - for i in $@ ; do 3.84 + for i in $@; do 3.85 printf '\\\\x%02X\\\\x%02X' $(($i&255)) $((($i>>8)&255)) 3.86 done | xargs echo -en 3.87 } 3.88 @@ -146,7 +146,7 @@ 3.89 getiso() 3.90 { 3.91 mkdir -p /media/cdrom 3.92 - for dev in /sys/block/?d?/?d??* ; do 3.93 + for dev in /sys/block/?d?/?d??*; do 3.94 mount /dev/$(basename $dev) /mnt 3.95 if checkmagic /mnt/$ISO; then 3.96 mount -o loop,ro /mnt/$ISO /media/cdrom 3.97 @@ -154,20 +154,22 @@ 3.98 return 0 3.99 fi 3.100 umount /mnt 3.101 - done 2> /dev/null 3.102 + done 2>/dev/null 3.103 return 1 3.104 } 3.105 3.106 uncpio() 3.107 { 3.108 - [ -s "$1" ] || return 3.109 - echo -en "\n Extracting $(basename $1) ..." 3.110 - case $(get 0 $1) in 3.111 - *35615) ( zcat || gunzip ) ;; 3.112 - *14333) unxz ;; 3.113 - *\ 93) unlzma ;; 3.114 - *) cat ;; 3.115 - esac < $1 | ( cd ${2:-/} ; cpio -idmu > /dev/null 2>&1 ) 3.116 + i=$1 3.117 + grep -q ' lm ' /proc/cpuinfo && [ -s ${i}64 ] && i=${i}64 3.118 + [ -s "$i" ] || return 3.119 + echo -en "\n Extracting $(basename $i) ..." 3.120 + case $(get 0 $i) in 3.121 + *35615) ( zcat || gunzip );; 3.122 + *14333) unxz;; 3.123 + *\ 93) unlzma;; 3.124 + *) cat;; 3.125 + esac < $i | ( cd ${2:-/}; cpio -idmu > /dev/null 2>&1 ) 3.126 } 3.127 3.128 dotwait() 3.129 @@ -191,7 +193,7 @@ 3.130 PAD=$(($(stat -c %s $1) % 4)) 3.131 [ $PAD -ne 0 ] && ddq if=/dev/zero bs=1 count=$((4 - $PAD)) >> $1 3.132 mkdir -p /tmp/fs/etc /tmp/fs/lib /tmp/fs/home 3.133 - cp /etc/keymap.conf /etc/locale.conf /tmp/fs/etc 2> /dev/null 3.134 + cp /etc/keymap.conf /etc/locale.conf /tmp/fs/etc 2>/dev/null 3.135 cat > /tmp/fs/init1 <<EOT 3.136 #!/bin/sh 3.137 sed -i 's|sbin/init|init2|' /init 3.138 @@ -201,11 +203,11 @@ 3.139 #!/bin/sh 3.140 3.141 mount -t proc /proc /proc 3.142 -for i in /lib/modules/*.ko* ; do insmod \$i 2> /dev/null ; done; sleep 2 3.143 -v=\$(sed '/\\/home=/!d;s|.*/home=\\([^ ]*\\).*|\\1|' /proc/cmdline /cmdline 2> /dev/null) 3.144 +for i in /lib/modules/*.ko*; do insmod \$i 2>/dev/null; done; sleep 2 3.145 +v=\$(sed '/\\/home=/!d;s|.*/home=\\([^ ]*\\).*|\\1|' /proc/cmdline /cmdline 2>/dev/null) 3.146 mount / -o remount,rw 3.147 mkdir /mnt/dos 3.148 -rm -f /cmdline 2> /dev/null 3.149 +rm -f /cmdline 2>/dev/null 3.150 mount / -o remount,ro 3.151 mnt=/mnt/dos/\${v#*/} 3.152 dev=\$( (blkid /dev/[sh]d* || blkid) | grep \${v%%/*} | sed 's/:.*//;q') 3.153 @@ -219,18 +221,18 @@ 3.154 EOT 3.155 chmod 755 /tmp/fs/init? 3.156 cp -a /tmp/fs/* / 3.157 - ln -s /sqfs/bin/gzip /bin 2> /dev/null 3.158 - ( cd /tmp/fs ; find * | cpio -o -H newc ) | gzip -9 >> $1 3.159 + ln -s /sqfs/bin/gzip /bin 2>/dev/null 3.160 + ( cd /tmp/fs; find * | cpio -o -H newc ) | gzip -9 >> $1 3.161 } 3.162 3.163 mkinitrd() 3.164 { 3.165 echo 3.166 dotwait "Creating $(basename $1) " 3.167 - for i in bin lib dev proc tmp mnt etc ; do 3.168 + for i in bin lib dev proc tmp mnt etc; do 3.169 mkdir -p /tmp/fs/$i 3.170 done 3.171 - for i in /dev/console /dev/null /dev/tty /dev/tty[012] /dev/fuse /dev/[hs]d* ; do 3.172 + for i in /dev/console /dev/null /dev/tty /dev/tty[012] /dev/fuse /dev/[hs]d*; do 3.173 cp -a $i /tmp/fs$i 3.174 done 3.175 for i in /bin/busybox $(which mount.posixovl) $(which blkid); do 3.176 @@ -238,13 +240,13 @@ 3.177 sed 's|.*=> \(.*/lib/l[^ ]*\).*|\1|;/^\//!d') /tmp/fs/lib 3.178 cp $i /tmp/fs/bin 3.179 done 3.180 - cp -a /sqfs/lib/ld-* /tmp/fs/lib 2> /dev/null || 3.181 + cp -a /sqfs/lib/ld-* /tmp/fs/lib 2>/dev/null || 3.182 cp -a /lib/ld-* /tmp/fs/lib 3.183 for i in $(busybox | sed '/Current/,$!d'); do 3.184 [ -e /tmp/fs/bin/${i%,} ] || ln -s busybox /tmp/fs/bin/${i%,} 3.185 done 3.186 ln -s /proc/mounts /tmp/fs/etc/mtab 3.187 - sed 's/ .*//' /proc/modules | while read mod ; do 3.188 + sed 's/ .*//' /proc/modules | while read mod; do 3.189 find /lib/modules/ | grep $mod.ko | \ 3.190 sed 's|.*|cp & /tmp/fs/lib|' | sh 3.191 done 3.192 @@ -259,7 +261,7 @@ 3.193 } 3.194 3.195 mount -t proc /proc /proc 3.196 -for i in /lib/*.ko* ; do insmod \$i 2> /dev/null ; done; sleep 2 3.197 +for i in /lib/*.ko*; do insmod \$i 2>/dev/null; done; sleep 2 3.198 arg mount "Mount device" 3.199 mount \$( (blkid /dev/[sh]d* || blkid) | grep \$val | sed 's/:.*//;q') /mnt 3.200 arg subroot "Change root to directory" 3.201 @@ -272,7 +274,7 @@ 3.202 exec /bin/switch_root /mnt \${LDSO#/mnt/} \$val/usr/sbin/chroot \$val /sbin/init 3.203 EOT 3.204 chmod +x /tmp/fs/init 3.205 - ( cd /tmp/fs ; find * | cpio -o -H newc ) | lzma e $1 -si 2> /dev/null 3.206 + ( cd /tmp/fs; find * | cpio -o -H newc ) | lzma e $1 -si 2>/dev/null 3.207 rm -rf /tmp/fs /tmp/wait 3.208 } 3.209 3.210 @@ -283,7 +285,7 @@ 3.211 3.212 ls_r() 3.213 { 3.214 - ls -r $@ 2> /dev/null || ls $@ 3.215 + ls -r $@ 2>/dev/null || ls $@ 3.216 } 3.217 3.218 doinstall() 3.219 @@ -300,7 +302,7 @@ 3.220 if [ -d /media/cdrom/fs ]; then 3.221 ( cd /mnt/slitaz/fs; find | cpio -o -H newc ) | gzip -9 3.222 else 3.223 - ls_r /media/cdrom/boot/rootfs*gz | xargs cat 3.224 + ls_r /media/cdrom/boot/rootfs* | xargs cat 3.225 fi > /mnt/slitaz/boot/rootfs.gz 3.226 tazusbinitfs /mnt/slitaz/boot/rootfs.gz 3.227 initrd=rootfs.gz 3.228 @@ -308,8 +310,8 @@ 3.229 else 3.230 if [ -d /media/cdrom/fs ]; then 3.231 cp -a /media/cdrom/fs/. /mnt/slitaz 3.232 - elif is_loram ; then 3.233 - for i in $(ls_r /media/cdrom/boot/rootfs*gz); do 3.234 + elif is_loram; then 3.235 + for i in $(ls_r /media/cdrom/boot/rootfs*); do 3.236 losetup -o 124 /dev/loop7 $i 3.237 mount -t squashfs -o ro /dev/loop7 /sqfs/mnt 3.238 cp -a /sqfs/mnt/. /mnt/slitaz 3.239 @@ -317,7 +319,7 @@ 3.240 losetup -d /dev/loop7 3.241 done 3.242 else 3.243 - for i in $(ls_r /media/cdrom/boot/rootfs*gz); do 3.244 + for i in $(ls_r /media/cdrom/boot/rootfs*); do 3.245 uncpio $i /mnt/slitaz 3.246 done 3.247 fi 3.248 @@ -328,14 +330,14 @@ 3.249 echo -en "\nInstall boot files..." 3.250 for i in /media/cdrom/boot/bzImage /media/cdrom/boot/*pxe* \ 3.251 /media/cdrom/boot/isolinux/he* /media/cdrom/boot/isolinux/opt* \ 3.252 - /media/cdrom/README /media/cdrom/boot/memtest* ; do 3.253 + /media/cdrom/README /media/cdrom/boot/memtest*; do 3.254 [ -s $i ] && cp $i /mnt/slitaz/boot 3.255 done 3.256 - for i in /mnt/slitaz/boot/memtest /mnt/slitaz/boot/*pxe ; do 3.257 - [ $(get 0 $i 2> /dev/null || echo 0) -eq 23117 ] && 3.258 + for i in /mnt/slitaz/boot/memtest /mnt/slitaz/boot/*pxe; do 3.259 + [ $(get 0 $i 2>/dev/null || echo 0) -eq 23117 ] && 3.260 mv $i $i.exe 3.261 done 3.262 - cp /etc/keymap.conf /etc/locale.conf /mnt/slitaz/etc 2> /dev/null 3.263 + cp /etc/keymap.conf /etc/locale.conf /mnt/slitaz/etc 2>/dev/null 3.264 gettazboot /mnt/slitaz/boot/tazboot.exe 3.265 unix2dos > /mnt/slitaz/boot/tazboot.cmd <<EOT 3.266 kernel=/slitaz/boot/bzimage 3.267 @@ -413,11 +415,11 @@ 3.268 if [ -d /media/cdrom/fs ]; then 3.269 cp -a /media/cdrom/fs/. / 3.270 else 3.271 - for i in $(ls_r /media/cdrom/boot/rootfs*gz); do 3.272 + for i in $(ls_r /media/cdrom/boot/rootfs*); do 3.273 uncpio $i 3.274 done 3.275 fi 3.276 - cp /tmp/fs/etc/* /etc 2> /dev/null 3.277 + cp /tmp/fs/etc/* /etc 2>/dev/null 3.278 echo "/home=$(getuuid)/slitaz" > /cmdline 3.279 rm -f /tmp/wait 3.280 [ -x /init1 ] || return 3.281 @@ -454,7 +456,7 @@ 3.282 md5() 3.283 { 3.284 dotwait "Checking files" 3.285 - ( cd /media/cdrom ; ${1:-md5sum -c md5sum*} | sort ) > /tmp/data 3.286 + ( cd /media/cdrom; ${1:-md5sum -c md5sum*} | sort ) > /tmp/data 3.287 rm -f /tmp/wait 3.288 $DIALOG --clear --title " Checked files " --textbox /tmp/data 24 78 3.289 rm -f /tmp/data 3.290 @@ -463,8 +465,8 @@ 3.291 gotcdfile() 3.292 { 3.293 for i in "/media/cdrom/$1" "/media/cdrom/*/$1" \ 3.294 - "/media/cdrom/*/isolinux/$1" ; do 3.295 - file=$(ls $i 2> /dev/null | sed q) 3.296 + "/media/cdrom/*/isolinux/$1"; do 3.297 + file=$(ls $i 2>/dev/null | sed q) 3.298 [ -s "$file" ] && break 3.299 done 3.300 } 3.301 @@ -529,7 +531,7 @@ 3.302 0 2 2 $(($R%256)) $(($R/256)) 2 64 0 64 11 0xF0 $F 0 \ 3.303 $G | ddq bs=1 of=/dev/fd0 3.304 ddq if=/dev/zero bs=512 count=$((4+$F+$F)) seek=$R of=/dev/fd0 3.305 - for i in $R $(($R+$F)) ; do 3.306 + for i in $R $(($R+$F)); do 3.307 bytes2bin 0xF0 0xFF 0xFF | ddq bs=512 seek=$i of=/dev/fd0 3.308 done 3.309 echo -n $(basename $1) | ddq bs=1 seek=3 count=8 of=/dev/fd0 3.310 @@ -624,13 +626,13 @@ 3.311 fddata() 3.312 { 3.313 [ -e /sys/block/fd0 ] && 3.314 - [ $(get 26 /mnt/$ISO 1 2> /dev/null || echo 0) -ne 0 ] && 3.315 + [ $(get 26 /mnt/$ISO 1 2>/dev/null || echo 0) -ne 0 ] && 3.316 echo -en "\"$1\" \"$2\"" 3.317 } 3.318 3.319 ishybrid() 3.320 { 3.321 - [ $(get 510 $ISO 2> /dev/null || echo 0) -eq 43605 ] || return 3.322 + [ $(get 510 $ISO 2>/dev/null || echo 0) -eq 43605 ] || return 3.323 C=$((2048*$(get $(((17*2048) + 71)) /mnt/$ISO 4))) 3.324 [ $(get $C /mnt/$ISO 4) -eq 1 ] || return 3.325 [ $(get $(($C+30)) /mnt/$ISO 4) -eq $((0x88AA55)) ] || return 3.326 @@ -641,13 +643,13 @@ 3.327 3.328 burnable() 3.329 { 3.330 - [ "$(sed '/Can wr.*1$/!d' /proc/sys/dev/cdrom/info 2> /dev/null)" ] && 3.331 + [ "$(sed '/Can wr.*1$/!d' /proc/sys/dev/cdrom/info 2>/dev/null)" ] && 3.332 [ "$(which wodim)" ] && echo -en "\"$1\" \"$2\"" 3.333 } 3.334 3.335 blankable() 3.336 { 3.337 - [ "$(sed '/Can wr.*RW.*1$/!d' /proc/sys/dev/cdrom/info 2> /dev/null)" ] && 3.338 + [ "$(sed '/Can wr.*RW.*1$/!d' /proc/sys/dev/cdrom/info 2>/dev/null)" ] && 3.339 [ "$(which wodim)" ] && echo -en "\"$1\" \"$2\"" 3.340 } 3.341 3.342 @@ -683,14 +685,14 @@ 3.343 cd ${1:-/mnt} 3.344 ddq bs=2k skip=$(customsector) if="/mnt/$ISO" | while read line; do 3.345 case "$line" in 3.346 - \#!boot*) ;; 3.347 - append=*) echo ${line#append=} > cmdline && ls -l cmdline ;; 3.348 + \#!boot*);; 3.349 + append=*) echo ${line#append=} > cmdline && ls -l cmdline;; 3.350 initrd:*) cnt=${line#initrd:} 3.351 { ddq bs=512 count=$(($cnt / 512)); 3.352 ddq bs=1 count=$(($cnt % 512)); } > initrd && 3.353 ls -l initrd 3.354 - break ;; 3.355 - *) break ;; 3.356 + break;; 3.357 + *) break;; 3.358 esac 3.359 done 3.360 cd - > /dev/null 3.361 @@ -699,7 +701,7 @@ 3.362 3.363 gotisomd5() 3.364 { 3.365 - [ "$(which md5sum 2> /dev/null)" ] && 3.366 + [ "$(which md5sum 2>/dev/null)" ] && 3.367 [ $(get 0 /mnt/$ISO) -eq 23117 ] && 3.368 [ $(get 18 /mnt/$ISO) -ne 0 ] && echo -en "\"$1\" \"$2\"" 3.369 } 3.370 @@ -723,14 +725,14 @@ 3.371 TMP=/tmp/$(basename $0)$$md5 3.372 md5="$(ddq bs=2k skip=$(customsector) if=/mnt/$ISO | while read line; do 3.373 case "$line" in 3.374 - \#!boot*) echo ${line#*boot } > $TMP ;; 3.375 - append=*) echo $line ;; 3.376 + \#!boot*) echo ${line#*boot } > $TMP;; 3.377 + append=*) echo $line;; 3.378 initrd:*) echo $line 3.379 cnt=${line#initrd:} 3.380 ddq bs=512 count=$((cnt / 512)) 3.381 ddq bs=1 count=$((cnt % 512)) 3.382 - break ;; 3.383 - *) break ;; 3.384 + break;; 3.385 + *) break;; 3.386 esac 3.387 done | md5sum | cut -c1-32)" 3.388 [ "$md5" = "$(cat $TMP)" ] && echo "OK" || echo "ERROR" 3.389 @@ -877,7 +879,7 @@ 3.390 bytes2bin 154 $(($p%256)) $(($p/256)) 0 144 | \ 3.391 ddq bs=1 conv=notrunc seek=60 of=/tmp/fd$$ 3.392 fi 3.393 - for r in $len ; do 3.394 + for r in $len; do 3.395 words2bin $(($r & 0xFFFF)) $(($r >> 16)) | ddq conv=notrunc \ 3.396 bs=1 seek=$i count=4 of=/tmp/fd$$ 3.397 i=$(($i + 4)) 3.398 @@ -886,7 +888,7 @@ 3.399 rm -f /tmp/fd$$ 3.400 n=1; i=0; r=0 3.401 set -- $len 3.402 - ls fd$$* | while read file ; do 3.403 + ls fd$$* | while read file; do 3.404 if [ $i -gt $(($1+$base)) ]; then 3.405 shift 3.406 r=$(($r+100)); n=0; i=0; base=0 3.407 @@ -931,8 +933,8 @@ 3.408 $DIALOG --clear --title " Select your USB key " \ 3.409 --menu "\nPlease select the USB key according to its known size.\n\n" \ 3.410 14 70 4 \ 3.411 - $(for i in $DEV ; do 3.412 - echo -n "/dev/$i \"$(($(cat /sys/block/$i/size)/2048))MB $(cat /sys/block/$i/device/model 2> /dev/null)\" " 3.413 + $(for i in $DEV; do 3.414 + echo -n "/dev/$i \"$(($(cat /sys/block/$i/size)/2048))MB $(cat /sys/block/$i/device/model 2>/dev/null)\" " 3.415 done) 3.416 EOT 3.417 exec 3>&1 3.418 @@ -944,7 +946,7 @@ 3.419 3.420 tazusbmsg() 3.421 { 3.422 - [ "$(which tazusb 2> /dev/null)" ] || return 3.423 + [ "$(which tazusb 2>/dev/null)" ] || return 3.424 echo "You should choose 'USB key read/write installation' to be 3.425 able to save the package updates or your own configuration and data files.\n\n" 3.426 } 3.427 @@ -963,7 +965,7 @@ 3.428 ### perform dd in progress bar 3.429 max=$(($(cat /sys/block/loop0/size)/2048)) 3.430 i=0; ddq if=/mnt/$ISO bs=1024k | ( 3.431 - while ddq bs=1024k count=1 ; do 3.432 + while ddq bs=1024k count=1; do 3.433 i=$(($i + 1)) 3.434 [ $i -gt $max ] && break 3.435 echo $((($i*100)/$max)) | dialog --gauge \ 3.436 @@ -985,7 +987,7 @@ 3.437 words2bin 0 $((0x101+$cx)) 0x3F0B $((32+$m)) \ 3.438 $ll $lh $(($n & 0xFFFF)) $(($n >> 16)) | \ 3.439 ddq bs=1 seek=$((462-$p)) of=$device 3.440 - if [ "$(which mkdosfs 2> /dev/null)" ]; then 3.441 + if [ "$(which mkdosfs 2>/dev/null)" ]; then 3.442 losetup -o $((512*$ofs)) /dev/loop2 $device 3.443 mkdosfs -n "SLITAZ BOOT" /dev/loop2 3.444 words2bin $(($ofs & 0xFFFF)) $(($ofs >> 16)) | \ 3.445 @@ -1034,17 +1036,18 @@ 3.446 mount_loram() 3.447 { 3.448 is_loram || return 3.449 - insmod /lib/modules/squashfs.ko* 2> /dev/null 3.450 + insmod /lib/modules/squashfs.ko* 2>/dev/null 3.451 if [ -d /media/cdrom/fs ]; then 3.452 ln -s /media/cdrom/fs /sqfs 3.453 else 3.454 mkdir /sqfs 3.455 - mount -o loop,ro -t squashfs /rootfs*.gz /sqfs 3.456 + losetup -o 124 /dev/loop6 $(ls_r /media/cdrom/boot/rootfs?*.* | sed q) 3.457 + mount -r /dev/loop6 /sqfs 3.458 fi 3.459 cp -a /sqfs/dev/fuse /sqfs/dev/tty[12] /sqfs/dev/[hs]d* /dev 3.460 - ln -s /sqfs/lib/* lib 3.461 + ln -s /sqfs/lib/* lib 2>/dev/null 3.462 ln -fs /sqfs/usr /sqfs/var / 3.463 - mkdir /etc && cp /sqfs/etc/dialogrc /etc 2> /dev/null 3.464 + mkdir /etc && cp /sqfs/etc/dialogrc /etc 2>/dev/null 3.465 } 3.466 3.467 umount_loram() 3.468 @@ -1052,7 +1055,8 @@ 3.469 is_loram || return 3.470 rm /var /usr 3.471 umount -d /sqfs 3.472 - rmdir /sqfs 2> /dev/null || rm -f /sqfs 3.473 + rmdir /sqfs 2>/dev/null || rm -f /sqfs 3.474 + rm -rf /etc 3.475 } 3.476 3.477 dosync() 3.478 @@ -1067,6 +1071,7 @@ 3.479 3.480 text() 3.481 { 3.482 + uncpio $(ls_r /media/cdrom/boot/rootfs?*.* | sed q) 3.483 init= 3.484 cmdline="$(cat /proc/cmdline)" 3.485 if hascustomconf; then 3.486 @@ -1078,7 +1083,6 @@ 3.487 fi 3.488 dosync 3.489 sed -i 's/ || exit//' /init 3.490 - [ -s /etc/inittab ] || rm -rf /etc 3.491 exec ${init:-/init} $cmdline 3.492 } 3.493 3.494 @@ -1086,8 +1090,7 @@ 3.495 { 3.496 n=0 3.497 dotwait "Extract filesystem..." 3.498 - for i in $(ls_r /media/cdrom/boot/rootfs*gz); do 3.499 - grep -q ' lm ' /proc/cpuinfo && [ -s ${i}64 ] && i=${i}64 3.500 + for i in $(ls_r /media/cdrom/boot/rootfs*); do 3.501 [ $((n++)) -eq 0 ] || uncpio $i 3.502 done 3.503 rm -f /tmp/wait 3.504 @@ -1141,10 +1144,10 @@ 3.505 showfavinfo() 3.506 { 3.507 mkdir -p /tmp/data 3.508 - flavdata | ( cd /tmp/data ; cpio -i ) 3.509 + flavdata | ( cd /tmp/data; cpio -i ) 3.510 file=/tmp/data/info 3.511 cat /tmp/data/*desc > $file 3.512 - for i in /tmp/data/*list* ; do 3.513 + for i in /tmp/data/*list*; do 3.514 echo "=== extra ${i#*list} files" 3.515 cat $i 3.516 done >> $file 3.517 @@ -1155,47 +1158,47 @@ 3.518 flavor() 3.519 { 3.520 cd /mnt 3.521 - name="$(flavdata | cpio -t 2> /dev/null | sed 's/.[a-z]*$//;q')" 3.522 + name="$(flavdata | cpio -t 2>/dev/null | sed 's/.[a-z]*$//;q')" 3.523 echo "Create ${name:=flavor}.flavor..." 3.524 tazlito iso2flavor "/mnt/$ISO" $name 3.525 - ls -l $name.flavor 2> /dev/null || sleep 5 3.526 + ls -l $name.flavor 2>/dev/null || sleep 5 3.527 cd - > /dev/null 3.528 } 3.529 3.530 shell() 3.531 { 3.532 trap text 2 3.533 - getty -n -l /bin/ash 38400 tty1 2> /dev/null || sh 3.534 + getty -n -l /bin/ash 38400 tty1 2>/dev/null || sh 3.535 } 3.536 3.537 BIN=bin/mount.posixovl 3.538 [ -x /usr/s$BIN ] || mv /bin/mount.posixovl.iso2exe \ 3.539 -/usr/s$BIN 2> /dev/null || mv /bin/mount.posixovl.iso2exe /$BIN 2> /dev/null 3.540 +/usr/s$BIN 2>/dev/null || mv /bin/mount.posixovl.iso2exe /$BIN 2>/dev/null 3.541 mount_proc 3.542 -for i in /sys/block/*/dev /sys/block/*/*/dev ; do 3.543 +for i in /sys/block/*/dev /sys/block/*/*/dev; do 3.544 [ -s "$i" ] || continue 3.545 n=${i%/dev} 3.546 n=/dev/${n##*/} 3.547 [ -e $n ] && continue 3.548 mknod $n b $(sed 's/:/ /' < $i) 3.549 -done 3.550 +done 2>/dev/null 3.551 ISO="$(getarg bootfrom | sed 's/.://;s|\\|/|g')" 3.552 -getiso || text 2> /dev/null 3.553 +getiso 2>/dev/null || text 3.554 mount_loram 3.555 case "${ISO##*/}$(getarg mode)" in 3.556 -*install*|*INSTALL*) install ;; 3.557 -*live*|*LIVE*) live ;; 3.558 -*text*|*TEXT*) text ;; 3.559 +*install*|*INSTALL*) install;; 3.560 +*live*|*LIVE*) live;; 3.561 +*text*|*TEXT*) text;; 3.562 esac 3.563 -which $DIALOG 2> /dev/null || DIALOG=tinydialog 3.564 +which $DIALOG 2>/dev/null || DIALOG=tinydialog 3.565 dmesg > /tmp/dmesg 3.566 3.567 isotitle="$(blkid /mnt/$ISO | sed 's/.*LABEL="\([^"]*\).*/\1/') $(stat \ 3.568 -c %y /media/cdrom | sed 's/ .*//') $(basename $ISO)" 3.569 while true; do 3.570 trap shell 2 3.571 - keymap="$(cat /etc/keymap.conf 2> /dev/null)" 3.572 - locale="$(sed '/^LANG=/!d;s/.*=//' /etc/locale.conf 2> /dev/null)" 3.573 + keymap="$(cat /etc/keymap.conf 2>/dev/null)" 3.574 + locale="$(sed '/^LANG=/!d;s/.*=//' /etc/locale.conf 2>/dev/null)" 3.575 cat > /tmp/dialog <<EOT 3.576 $DIALOG --clear --title " ${isotitle:-Welcome to Linux} " \ 3.577 --menu "" 23 70 17 \