wok rev 18774

syslinux/iso2exe: load custom config in /init
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jan 01 10:37:57 2016 +0100 (2016-01-01)
parents 73b721a72d57
children ea9f391548cf
files syslinux/stuff/iso2exe/init
line diff
     1.1 --- a/syslinux/stuff/iso2exe/init	Thu Dec 31 16:02:37 2015 +0100
     1.2 +++ b/syslinux/stuff/iso2exe/init	Fri Jan 01 10:37:57 2016 +0100
     1.3 @@ -691,13 +691,13 @@
     1.4  
     1.5  gotcustomconf()
     1.6  {
     1.7 -	hascustomconf && menuitem "$@"
     1.8 +	hascustomconf && echo -en "\"$1\"	\"$2\""
     1.9  }
    1.10  
    1.11  getcustomconf()
    1.12  {
    1.13 -	cd /mnt
    1.14 -	ddq bs=2k skip=$(customsector) if="$ISO" | while read line; do
    1.15 +	cd ${1:-/mnt}
    1.16 +	ddq bs=2k skip=$(customsector) if="/mnt/$ISO" | while read line; do
    1.17  		case "$line" in
    1.18  		\#!boot*) ;;
    1.19  		append=*) echo ${line#append=} > cmdline && ls -l cmdline ;;
    1.20 @@ -710,8 +710,7 @@
    1.21  		esac
    1.22  	done
    1.23  	cd - > /dev/null
    1.24 -	echo -e "\rPress RETURN to continue."
    1.25 -	read n
    1.26 +	[ -z "$1" ] && echo -e "\rPress RETURN to continue." && read n
    1.27  }
    1.28  
    1.29  gotisomd5()
    1.30 @@ -1091,8 +1090,17 @@
    1.31  
    1.32  text()
    1.33  {
    1.34 +	init=
    1.35 +	cmdline="$(cat /proc/cmdline)"
    1.36 +	if hascustomconf; then
    1.37 +		getcustomconf /tmp > /dev/null
    1.38 +		[ -s /tmp/cmdline ] &&
    1.39 +			cmdline="$cmdline $(cat /tmp/cmdline)" &&
    1.40 +			init="$(sed '/rdinit=/!d;s/.*rdinit=\([^ ]*\).*/\1/' < /tmp/cmdline)"
    1.41 +		[ -s /tmp/initrd ] && uncpio /tmp/initrd
    1.42 +	fi
    1.43  	dosync
    1.44 -	exec /init
    1.45 +	exec ${init:-/init} $cmdline
    1.46  }
    1.47  
    1.48  live()