wok-6.x rev 16041

syslinux/iso2exe: fix 'a la umsdos' install
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Mar 09 14:09:57 2014 +0000 (2014-03-09)
parents 311ad10166ae
children e4cda1000ec7
files ffmpeg-git/receipt shell-detector/receipt syslinux/stuff/iso2exe/boot.c syslinux/stuff/iso2exe/bootlinux.c syslinux/stuff/iso2exe/init
line diff
     1.1 --- a/ffmpeg-git/receipt	Sun Mar 09 11:49:44 2014 +0100
     1.2 +++ b/ffmpeg-git/receipt	Sun Mar 09 14:09:57 2014 +0000
     1.3 @@ -1,7 +1,7 @@
     1.4  # SliTaz package receipt.
     1.5  
     1.6  PACKAGE="ffmpeg-git"
     1.7 -VERSION="snapshot"
     1.8 +VERSION="20140308"
     1.9  CATEGORY="multimedia"
    1.10  SHORT_DESC="Record, convert and stream audio and video (Devel version)."
    1.11  MAINTAINER="pankso@slitaz.org"
     2.1 --- a/shell-detector/receipt	Sun Mar 09 11:49:44 2014 +0100
     2.2 +++ b/shell-detector/receipt	Sun Mar 09 14:09:57 2014 +0000
     2.3 @@ -1,7 +1,7 @@
     2.4  # SliTaz package receipt.
     2.5  
     2.6  PACKAGE="shell-detector"
     2.7 -VERSION="current"
     2.8 +VERSION="20140308"
     2.9  CATEGORY="network"
    2.10  SHORT_DESC="Web shell detection tool."
    2.11  MAINTAINER="pascal.bellard@slitaz.org"
     3.1 --- a/syslinux/stuff/iso2exe/boot.c	Sun Mar 09 11:49:44 2014 +0100
     3.2 +++ b/syslinux/stuff/iso2exe/boot.c	Sun Mar 09 14:09:57 2014 +0000
     3.3 @@ -44,7 +44,9 @@
     3.4  	if (magic < 0x20630)
     3.5  		init = ""; // Does not support multiple initramfs
     3.6  	if (magic > 0) {
     3.7 -		fmt = "rw root=/dev/null%s iso=%s magic=%lu mode=%s";
     3.8 +		fmt = "rw root=/dev/null%s iso=%s magic=%lu mode=%s autologin";
     3.9 +		if (rootfs[6] != '.' && !isoopen("rootfs.gz"))
    3.10 +			loadinitrd();	// for loram
    3.11  		isoopen(rootfs);
    3.12  		loadinitrd();
    3.13  		if (*init) {
     4.1 --- a/syslinux/stuff/iso2exe/bootlinux.c	Sun Mar 09 11:49:44 2014 +0100
     4.2 +++ b/syslinux/stuff/iso2exe/bootlinux.c	Sun Mar 09 14:09:57 2014 +0000
     4.3 @@ -91,8 +91,7 @@
     4.4  #define ZIMAGE_SUPPORT
     4.5  
     4.6  #ifdef ZIMAGE_SUPPORT
     4.7 -static int zimage = 0;
     4.8 -static unsigned zimage_base;
     4.9 +static unsigned zimage = 0;
    4.10  static unsigned getss(void)
    4.11  {
    4.12  #asm
    4.13 @@ -230,9 +229,8 @@
    4.14  			}
    4.15  			if (!setup_version || !(buffer[LOADFLAGS] & 1)) {
    4.16  #ifdef ZIMAGE_SUPPORT
    4.17 -				zimage = 1;
    4.18 -				zimage_base = getss() + 0x1000L;
    4.19 -				mem.base = zimage_base * 16L; 
    4.20 +				zimage = getss() + 0x1000;
    4.21 +				mem.base = zimage * 16L; 
    4.22  				if (mem.base + syssize > SETUP_SEGMENT*16L - 32)
    4.23  					die("Out of memory");
    4.24  #else
    4.25 @@ -332,11 +330,12 @@
    4.26  	mov	sp, #CMDLINE_OFFSET
    4.27  #endasm
    4.28  #ifdef ZIMAGE_SUPPORT
    4.29 -	if (zimage) {
    4.30  #asm
    4.31 +	mov	bx, _zimage
    4.32 +	or	bx, bx
    4.33 +	jz	notzimage
    4.34  		mov	eax, _mem
    4.35  		shr	eax, #4		// top
    4.36 -		mov	bx, _zimage_base
    4.37  		mov	dx, #0x1000
    4.38  		push	cs
    4.39  		pop	ds
    4.40 @@ -361,8 +360,8 @@
    4.41  		inc	dx
    4.42  		cmp	ax,bx
    4.43  		jne	sysmove
    4.44 +notzimage:
    4.45  #endasm
    4.46 -	}
    4.47  #endif
    4.48  #asm
    4.49  	push	ss
     5.1 --- a/syslinux/stuff/iso2exe/init	Sun Mar 09 11:49:44 2014 +0100
     5.2 +++ b/syslinux/stuff/iso2exe/init	Sun Mar 09 14:09:57 2014 +0000
     5.3 @@ -13,6 +13,21 @@
     5.4  	sed "/$1=/!d;s/.*$1=\\([^ ]*\\).*/\\1/" /proc/cmdline
     5.5  }
     5.6  
     5.7 +mount_proc()
     5.8 +{
     5.9 +	mount -t proc /proc /proc
    5.10 +	mount -t sysfs /sys /sys
    5.11 +	udevd --daemon 2> /dev/null && udevadm trigger && sleep 5
    5.12 +}
    5.13 +
    5.14 +umount_proc()
    5.15 +{
    5.16 +	killall udevd 2> /dev/null
    5.17 +	umount /sys/fs/fuse/connections 2> /dev/null
    5.18 +	umount /sys
    5.19 +	umount /proc
    5.20 +}
    5.21 +
    5.22  gettazboot()
    5.23  {
    5.24  	echo "Creating $(basename $1) ..."
    5.25 @@ -61,7 +76,7 @@
    5.26  getuuid()
    5.27  {
    5.28  	dev=$(mount | sed '/ \/mnt /!d;s/ .*//;s|/dev/||;q')
    5.29 -	blkid | sed "/$dev:/!d;s/.*UUID=.\\([^ ]*\\)\".*/\\1/"
    5.30 +	blkid | sed "/$dev:/!d;s/.* UUID=.\\([^ ]*\\)\".*/\\1/"
    5.31  }
    5.32  
    5.33  mkinitrd()
    5.34 @@ -70,7 +85,7 @@
    5.35  	for i in bin lib dev proc tmp mnt etc ; do
    5.36  		mkdir -p /tmp/fs/$i
    5.37  	done
    5.38 -	for i in /dev/console /dev/null /dev/tty /dev/tty1 /dev/fuse \
    5.39 +	for i in /dev/console /dev/null /dev/tty /dev/tty1 /dev/tty2 /dev/fuse \
    5.40  		 /dev/hd* /dev/sd* ; do
    5.41  		cp -a $i /tmp/fs$i
    5.42  	done
    5.43 @@ -84,6 +99,10 @@
    5.44  		[ -e /tmp/fs/bin/${i%,} ] || ln -s busybox /tmp/fs/bin/${i%,}
    5.45  	done
    5.46  	ln -s /proc/mounts /tmp/fs/etc/mtab
    5.47 +	sed 's/ .*//' /proc/modules | while read mod ; do
    5.48 +		find /lib/modules/ | grep $mod.ko | \
    5.49 +			sed 's|.*|cp & /tmp/fs/lib|' | sh
    5.50 +	done
    5.51  	cat > /tmp/fs/init <<EOT
    5.52  #!/bin/sh
    5.53  
    5.54 @@ -95,14 +114,17 @@
    5.55  }
    5.56  
    5.57  mount -t proc /proc /proc
    5.58 +  arg debug "shell" && debug=true && set -x
    5.59 +for i in /lib/*.ko* ; do insmod \$i ; done; sleep 2
    5.60  arg mount "Mount device"
    5.61  mount \$( (blkid /dev/?d* || blkid) | grep \$val | sed 's/:.*//;q') /mnt
    5.62  arg subroot "Change root to directory"
    5.63 -mount.posixovl -F /mnt/\$val
    5.64 +mount.posixovl -F /mnt/\$val -- -oallow_other -odefault_permissions -osuid
    5.65  mount --bind /mnt /mnt/\$val/mnt/dos
    5.66  LDSO=\$(ls /mnt/\$val/lib/ld-* | sed q)
    5.67 +export LD_LIBRARY_PATH=\$val/lib:\$val/usr/lib:/lib
    5.68 +  [ "$debug" = "true" ] && sh
    5.69  umount /proc
    5.70 -export LD_LIBRARY_PATH=\$val/lib:\$val/usr/lib:/lib
    5.71  exec /bin/switch_root /mnt \${LDSO#/mnt/} \$val/usr/sbin/chroot \$val /sbin/init
    5.72  EOT
    5.73  	chmod +x /tmp/fs/init
    5.74 @@ -115,16 +137,26 @@
    5.75  	[ -s /lib/squashfs.ko* ]
    5.76  }
    5.77  
    5.78 +ls_r()
    5.79 +{
    5.80 +	ls -r $@ 2> /dev/null || ls $@
    5.81 +}
    5.82 +
    5.83  doinstall()
    5.84  {
    5.85  	mkdir -p /mnt/slitaz/boot /mnt/slitaz/mnt/dos
    5.86 -	mount.posixovl -F /mnt/slitaz || return
    5.87 -	echo "Install root filesystem..."
    5.88 +	if ! mount.posixovl -F /mnt/slitaz -- \
    5.89 +		-oallow_other -odefault_permissions -osuid; then
    5.90 +		echo "Can't install SliTaz. Abort."
    5.91 +		sleep 5
    5.92 +		return 1
    5.93 +	fi
    5.94 +	echo "Install root filesystem in /slitaz..."
    5.95  	if [ -n "$1" ]; then
    5.96  		if [ -d /media/cdrom/fs ]; then
    5.97  			( cd /mnt/slitaz/fs; find | cpio -o -H newc ) | gzip -9
    5.98  		else
    5.99 -			ls -r /media/cdrom/boot/rootfs* | xargs cat
   5.100 +			ls_r /media/cdrom/boot/rootfs* | xargs cat
   5.101  		fi > /mnt/slitaz/boot/rootfs.gz
   5.102  		mkdir /mnt/slitaz/home
   5.103  		initrd=rootfs.gz
   5.104 @@ -137,13 +169,13 @@
   5.105  				[ -s $(basename $i) ] && continue
   5.106  				cpio -i $i
   5.107  			done
   5.108 -			for i in $(ls -r /media/cdrom/boot/rootfs*); do
   5.109 +			for i in $(ls_r /media/cdrom/boot/rootfs*); do
   5.110  				mount -o loop,ro $i /sqfs/mnt
   5.111  				cp -a /sqfs/mnt/. /mnt/slitaz
   5.112  				umount -d /sqfs/mnt
   5.113  			done
   5.114  		else
   5.115 -			for i in $(ls -r /media/cdrom/boot/rootfs*); do
   5.116 +			for i in $(ls_r /media/cdrom/boot/rootfs*); do
   5.117  				uncpio $i /mnt/slitaz
   5.118  			done
   5.119  		fi
   5.120 @@ -159,24 +191,29 @@
   5.121  	done
   5.122  	gettazboot /mnt/slitaz/boot/tazboot.exe
   5.123  	unix2dos > /mnt/slitaz/boot/tazboot.cmd <<EOT
   5.124 -kernel=\\slitaz\\boot\\bzimage
   5.125 -initrd=\\slitaz\\boot\\$initrd
   5.126 +kernel=/slitaz/boot/bzimage
   5.127 +initrd=/slitaz/boot/$initrd
   5.128  rw root=/dev/null $extraargs autologin
   5.129  EOT
   5.130  	unix2dos /mnt/slitaz/boot/he* /mnt/slitaz/boot/opt* \
   5.131  		/mnt/slitaz/boot/README
   5.132  	[ -d /mnt/slitaz/usr/sbin -a ! -x /mnt/slitaz/usr/sbin/mount.posixovl ] &&
   5.133  	cp $(which mount.posixovl) /mnt/slitaz/usr/sbin
   5.134 -	! grep -qs tazboot /mnt/boot.ini && unix2dos >> /mnt/boot.ini <<EOT
   5.135 +false &&
   5.136 +	! grep -qs tazboot /mnt/boot.ini && echo "Update boot.ini ..." &&
   5.137 +	unix2dos >> /mnt/boot.ini <<EOT
   5.138  C:\\slitaz\\boot\\tazboot.exe="SliTaz"
   5.139  EOT
   5.140 -	grep -qs menuitem /mnt/config.sys && !grep -q tazboot /mnt/config.sys &&
   5.141 -	sed -i 's/menudefault=/menuitem=slitaz,SliTaz\n&/' /mnt/config.sys &&
   5.142 -	cat >> /mnt/config.sys <<EOT
   5.143 -[slitaz]
   5.144 -device=\\slitaz\\boot\\tazboot.exe
   5.145 +	grep -qs menuitem /mnt/config.sys && ! grep -q tazboot /mnt/config.sys &&
   5.146 +	echo "Update config.sys ..." &&
   5.147 +	sed -i 's/menudefault=/menuitem=slitaz,SliTaz\r\n&/' /mnt/config.sys &&
   5.148 +	echo -e "[slitaz]\r" >> /mnt/config.sys &&
   5.149 +	echo "Update autoexec.bat ..." &&
   5.150 +	unix2dos >> /mnt/autoexec.bat <<EOT
   5.151 +:slitaz
   5.152 +\\slitaz\\boot\\tazboot.exe
   5.153  EOT
   5.154 -	unix2dos /mnt/config.sys 2> /dev/null
   5.155 +	return 0
   5.156  }
   5.157  
   5.158  install()
   5.159 @@ -195,10 +232,10 @@
   5.160  start SliTaz Live with 'SliTaz RAM boot' menu.\n
   5.161  " 19 70
   5.162  	[ $? -eq 0 ] || return
   5.163 -	doinstall
   5.164 -	[ -x /sbin/init ] || return
   5.165 +	doinstall || return
   5.166 +	[ -x /mnt/slitaz/sbin/init ] || return
   5.167  	umount -d /media/cdrom
   5.168 -	umount /proc
   5.169 +	umount_proc
   5.170  	exec chroot /mnt/slitaz /sbin/init
   5.171  }
   5.172  
   5.173 @@ -218,11 +255,11 @@
   5.174  start SliTaz Live with 'SliTaz RAM boot' menu.\n
   5.175  " 19 70
   5.176  	[ $? -eq 0 ] || return
   5.177 -	doinstall tazusblike
   5.178 +	doinstall tazusblike || return
   5.179  	if [ -d /media/cdrom/fs ]; then
   5.180  		zcat /mnt/slitaz/boot/rootfs.gz | cpio -idmu
   5.181  	else
   5.182 -		for i in $(ls -r /media/cdrom/boot/rootfs*); do
   5.183 +		for i in $(ls_r /media/cdrom/boot/rootfs*); do
   5.184  			( zcat $i 2> /dev/null || unlzma -c $i ) | cpio -idmu
   5.185  		done
   5.186  	fi
   5.187 @@ -230,7 +267,7 @@
   5.188  	umount -d /media/cdrom
   5.189  	mount --move /mnt /mnt/dos
   5.190  	ln -s /mnt/dos/slitaz/home /home
   5.191 -	umount /proc
   5.192 +	umount_proc
   5.193  	exec /sbin/init
   5.194  }
   5.195  
   5.196 @@ -338,6 +375,12 @@
   5.197  	dd if=/media/cdrom/boot/?pxe of=/dev/fd0
   5.198  }
   5.199  
   5.200 +gotposixovl()
   5.201 +{
   5.202 +	mount.posixovl 2>&1 | grep -qi usage && 
   5.203 +	echo -en "\"$1\"	\"$2\""
   5.204 +}
   5.205 +
   5.206  xfile()
   5.207  {
   5.208  	[ -n "$(which $1)" ] && echo -en "\"$2\"	\"$3\""
   5.209 @@ -481,14 +524,14 @@
   5.210  	umount_loram
   5.211  	umount -d /media/cdrom
   5.212  	umount /mnt
   5.213 -	umount /proc
   5.214 +	umount_proc
   5.215  	exec /init
   5.216  }
   5.217  
   5.218  live()
   5.219  {
   5.220  	n=0
   5.221 -	for i in $(ls -r /media/cdrom/boot/rootfs*); do
   5.222 +	for i in $(ls_r /media/cdrom/boot/rootfs* 2> /dev/null); do
   5.223  		[ $((n++)) -eq 0 ] || uncpio $i
   5.224  	done
   5.225  	text
   5.226 @@ -516,16 +559,16 @@
   5.227  BIN=bin/mount.posixovl
   5.228  [ -x /usr/s$BIN ] || mv /bin/mount.posixovl.iso2exe \
   5.229  /usr/s$BIN 2> /dev/null || mv /bin/mount.posixovl.iso2exe /$BIN
   5.230 -mount -t proc /proc /proc
   5.231 +mount_proc
   5.232  ISO="$(getarg iso | sed 's/.://;s|\\|/|g')"
   5.233  getiso
   5.234  mount_loram
   5.235 -case "$(basename $ISO | tr [A-Z] [a-z])$(getarg mode)" in
   5.236 +case "${ISO##*/}$(getarg mode)" in
   5.237  *install*)	install ;;
   5.238  *live*)		live ;;
   5.239  *text*)		text ;;
   5.240  esac
   5.241 -which $DIALOG || live
   5.242 +which $DIALOG 2> /dev/null || live
   5.243  dmesg > /tmp/dmesg
   5.244  
   5.245  while true; do
   5.246 @@ -533,16 +576,16 @@
   5.247  $DIALOG  --clear \
   5.248  	--title " Welcome to SliTaz " \
   5.249  	--menu "" 21 70 15 \
   5.250 -			"live"		"SliTaz RAM boot" \
   5.251 +$(cdfile boot/bzImage	"live"		"SliTaz RAM boot") \
   5.252  			"text"		"SliTaz RAM boot (text mode only)" \
   5.253  $(cdfile README		"readme"	"Show the README file") \
   5.254  $(cdfile md5sum		"md5"		"Check ISO files") \
   5.255 -$(xfile mount.posixovl	"install"	"Hard disk installation (UMSDOS way)") \
   5.256 -$(xfile mount.posixovl	"installtaz"	"Hard disk installation (TAZUSB way)") \
   5.257 +$(gotposixovl		"install"	"Hard disk installation (UMSDOS way)") \
   5.258 +$(gotposixovl		"installtaz"	"Hard disk installation (TAZUSB way)") \
   5.259  $(xfile tazusb		"usbkey"	"USB key read/write installation") \
   5.260 -			"usbbootkey"	"USB boot key (read only)" \
   5.261 +$(cdfile boot/bzImage	"usbbootkey"	"USB boot key (read only)") \
   5.262  $(fddata		"fdbootstrap"	"Floppy bootstrap") \
   5.263 -			"tazboot"	"Get tazboot.exe Linux loader" \
   5.264 +$(cdfile boot/bzImage	"tazboot"	"Get tazboot.exe Linux loader") \
   5.265  $(cdexe boot/memtest	"memtest"	"Get Memtest86") \
   5.266  $(cdfile boot/memtest	"fdmemtest"	"Create a Memtest86 boot floppy") \
   5.267  $(cdexe boot/gpxe	"pxe"		"Get SliTaz Web boot utility") \