wok-tiny rev 148
Use mkrootfs.pre_exec
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Sep 06 11:02:01 2019 +0200 (2019-09-06) |
parents | f791de00e1a2 |
children | e37956962a84 |
files | base-tiny/receipt |
line diff
1.1 --- a/base-tiny/receipt Mon Sep 02 12:56:00 2019 +0200 1.2 +++ b/base-tiny/receipt Fri Sep 06 11:02:01 2019 +0200 1.3 @@ -85,7 +85,8 @@ 1.4 </table> 1.5 <input type="checkbox" name="KEEP_MODULES" ${KEEP_MODULES:+checked="checked" }/> 1.6 Do not remove the modules files after loading modules. 1.7 -<input type="hidden" name="LOAD_MODULES" value="$(cat $1/modules | xargs)" /> 1.8 +<p> 1.9 +<input type="checkbox" name="STUPID" ${STUPID:+ckecked=ckecked }> read sector by sector (slow, stupid but safe) 1.10 EOT 1.11 } 1.12 1.13 @@ -100,6 +101,26 @@ 1.14 DHCP) DHCP="yes" 1.15 STATIC="no" 1.16 esac 1.17 + cat >> $1/boot/mkrootfs.pre_exec <<EOT 1.18 +if [ -s modules ]; then 1.19 + while read mod; do 1.20 + sed -i "s/LOAD_MODULES=./&\$mod /" etc/rcS.conf 1.21 + done < modules 1.22 + grep ^LOAD_MODULES= etc/rcS.conf >> etc/packages.conf 1.23 + cp etc/packages.conf boot/packages.conf 1.24 + rm -f modules 1.25 +fi 1.26 +EOF 1.27 + [ "$STUPID" ] && cat >> $1/boot/mkrootfs.pre_exec <<EOT 1.28 +for i in boot/bzImage boot/memtest boot/ipxe; do 1.29 + [ -s \$i ] || continue 1.30 + dd if=\$i bs=512 count=1 | \\ 1.31 + sed "s|\$(echo -en '\x64\x66\x8F\x47\x78')|\$(echo -en '\x5E\x5E\x90\x90\x90')|" | \\ 1.32 + sed "s|\$(echo -en '\x66\x8F\x47\x78')|\$(echo -en '\x5E\x5E\x90\x90')|" | \\ 1.33 + sed "s|\$(echo -en '\x77\x02\xB0\x01')|\$(echo -en '\x90\x90\xB0\x01')|" | \\ 1.34 + dd of=\$i conv=notrunc 1.35 +done 1.36 +EOT 1.37 sed -i "s/^KEEP_MODULES=.*/KEEP_MODULES=\"$KEEP_MODULES\"/" \ 1.38 $1/etc/rcS.conf 1.39 sed -i -e "s/^DNS_SERVER=.*/DNS_SERVER=\"$DNS_SERVER\"/" \ 1.40 @@ -135,7 +156,4 @@ 1.41 [ -n "$RC_LOCAL" ] && dos2unix >> $1/etc/init.d/local.sh <<EOT 1.42 $RC_LOCAL 1.43 EOT 1.44 - [ -s $1/modules ] && for i in $(cat $1/modules ; rm -f $1/modules); do 1.45 - sed -i "s/LOAD_MODULES=./&$i /" $1/etc/rcS.conf 1.46 - done 1.47 }