wok-current rev 17932

syslinux/taziso: install in Linux partition
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Apr 13 11:13:34 2015 +0200 (2015-04-13)
parents a12fb1874d30
children 5ca0054c3fba
files syslinux/stuff/iso2exe/taziso
line diff
     1.1 --- a/syslinux/stuff/iso2exe/taziso	Sun Apr 12 14:55:37 2015 +0200
     1.2 +++ b/syslinux/stuff/iso2exe/taziso	Mon Apr 13 11:13:34 2015 +0200
     1.3 @@ -115,7 +115,7 @@
     1.4  		umount /mnt/dos
     1.5  	done
     1.6  fi
     1.7 -mount.posixovl -F \$mnt -- -oallow_other -odefault_permissions -osuid
     1.8 +$([ "$2" ] || echo '# ')mount.posixovl -F \$mnt -- -oallow_other -odefault_permissions -osuid
     1.9  mount --bind \$mnt /home
    1.10  umount /proc
    1.11  exec /sbin/init
    1.12 @@ -178,7 +178,7 @@
    1.13  		umount /mnt
    1.14  	done
    1.15  fi
    1.16 -mount.posixovl -F /mnt/\$val -- -oallow_other -odefault_permissions -osuid
    1.17 +$([ "$3" ] || echo '# ')mount.posixovl -F /mnt/\$val -- -oallow_other -odefault_permissions -osuid
    1.18  mount --bind /mnt /mnt/\$val/mnt/dos
    1.19  mount -o size=0 -t tmpfs tmpfs /mnt/\$val/mnt/dos/\$val
    1.20  LDSO=\$(ls /mnt/\$val/lib/ld-* | sed q)
    1.21 @@ -199,7 +199,12 @@
    1.22  
    1.23  doinstall()
    1.24  {
    1.25 +	unset useposixovl
    1.26 +	blkid | grep $(df /mnt | sed '$!d;s/ .*/:/') | \
    1.27 +		grep -qiE "(msdos|vfat|ntfs)" && useposixovl=YES
    1.28 +
    1.29  	mkdir -p $mnt/slitaz/boot $mnt/slitaz/mnt/dos
    1.30 +	[ "$useposixovl" ] &&
    1.31  	if ! mount.posixovl -F $mnt/slitaz -- \
    1.32  		-oallow_other -odefault_permissions -osuid; then
    1.33  		echo "Can't install SliTaz. Abort."
    1.34 @@ -210,7 +215,7 @@
    1.35  	if [ "$1" ]; then
    1.36  		ls_r /media/cdrom/boot/rootfs*gz | \
    1.37  		xargs cat > $mnt/slitaz/boot/rootfs.gz
    1.38 -		tazusbinitfs $mnt/slitaz/boot/rootfs.gz
    1.39 +		tazusbinitfs $mnt/slitaz/boot/rootfs.gz $useposixovl
    1.40  		initrd=rootfs.gz
    1.41  		extraargs="/home=$(getuuid)/slitaz rdinit=/init1"
    1.42  	else
    1.43 @@ -226,7 +231,7 @@
    1.44  		done
    1.45  		cp -a /etc/locale.conf $mnt/slitaz/etc 2> /dev/null
    1.46  		cp -a /etc/keymap.conf $mnt/slitaz/etc 2> /dev/null
    1.47 -		mkinitrd $mnt/slitaz/boot/initrd $mnt/slitaz
    1.48 +		mkinitrd $mnt/slitaz/boot/initrd $mnt/slitaz $useposixovl
    1.49  		initrd=initrd
    1.50  		extraargs="mount=$(getuuid) subroot=slitaz"
    1.51  	fi
    1.52 @@ -250,7 +255,8 @@
    1.53  		$mnt/slitaz/boot/README
    1.54  	[ -d $mnt/slitaz/usr/sbin -a ! -x $mnt/slitaz/usr/sbin/mount.posixovl ] &&
    1.55  	cp $(which mount.posixovl) $mnt/slitaz/usr/sbin
    1.56 -	if grep -qs " $mnt " /proc/mounts && [ ! -d $mnt/boot/grub ]; then
    1.57 +	if "$useposixovl" && grep -qs " $mnt " /proc/mounts &&
    1.58 +	   [ ! -d $mnt/boot/grub ]; then
    1.59  		mkdir -p $mnt/boot/grub
    1.60  		echo -en "\nInstall grub in /boot/grub..."
    1.61  		cp -a /usr/lib/grub/*/* $mnt/boot/grub
    1.62 @@ -266,10 +272,6 @@
    1.63  title Microsoft Windows
    1.64  	chainloader +1
    1.65  
    1.66 -title SliTaz GNU/Linux $(cat $mnt/slitaz/etc/slitaz-release)
    1.67 -	kernel /slitaz/boot/bzimage rw root=/dev/null $extraargs autologin
    1.68 -	initrd /slitaz/boot/$initrd
    1.69 -
    1.70  EOT
    1.71  		dev=$(grep " $mnt " /proc/mounts | awk '{ print $1 }')
    1.72  		base=${dev//[0-9]/}
    1.73 @@ -282,8 +284,18 @@
    1.74  EOT
    1.75  		grub-install --no-floppy --root-directory=$mnt $base
    1.76  	fi
    1.77 +	if [ -s $mnt/boot/grub/menu.lst ] &&
    1.78 +	   ! grep -q /slitaz/boot/bzimage $mnt/boot/grub/menu.lst; then
    1.79 +		echo -en "\nUpdate /boot/grub/menu/lst..."
    1.80 +		cat >> $mnt/boot/grub/menu.lst <<EOT
    1.81 +title SliTaz GNU/Linux $(cat $mnt/slitaz/etc/slitaz-release)
    1.82 +	kernel /slitaz/boot/bzimage rw root=/dev/null $extraargs autologin
    1.83 +	initrd /slitaz/boot/$initrd
    1.84 +
    1.85 +EOT
    1.86 +	fi
    1.87  	rm -f /tmp/wait
    1.88 -	umount $mnt/slitaz
    1.89 +	[ "$useposixovl" ] && umount $mnt/slitaz
    1.90  	return 0
    1.91  }
    1.92  
    1.93 @@ -292,15 +304,15 @@
    1.94  	if [ -b "$1" ]; then
    1.95  		device=$1
    1.96  	elif [ "$1" ]; then
    1.97 -		echo "Invalid Windows partition"
    1.98 +		echo "Invalid Linux/Windows partition"
    1.99  		return 1
   1.100  	else
   1.101 -		DEV="$(blkid | grep -iE "(msdos|vfat|ntfs)" | sed 's/:.*//;s|/dev/||')"
   1.102 +		DEV="$(blkid | grep -iE "(msdos|vfat|ntfs|ext[234]|xfs|btrfs)" | sed 's/:.*//;s|/dev/||')"
   1.103  		[ "$DEV" ] || return
   1.104  	cat > /tmp/dialog$$ <<EOT
   1.105  $DIALOG --clear \
   1.106 -	--title " Select your Windows partition " \
   1.107 -	--menu "\nPlease select the Windows partition according to its known size.
   1.108 +	--title " Select your Linux/Windows partition " \
   1.109 +	--menu "\nPlease select the Linux/Windows partition according to its known size.
   1.110  The data will be kept untouched.\n" \
   1.111  	17 70 8 \
   1.112  	$(for i in $DEV ; do
   1.113 @@ -362,7 +374,7 @@
   1.114  		--title " SliTaz UMSDOS way installation " \
   1.115  		--yes-label "Install" --yesno \
   1.116  "\nSliTaz will be installed in the subdirectory \\slitaz of the current
   1.117 -DOS/Windows partition. You will see your files from /mnt/dos.\n\n
   1.118 +Linux/DOS/Windows partition. You will see your files from /mnt/dos.\n\n
   1.119  You can start SliTaz with \\slitaz\\boot\\tazboot.exe\n\n
   1.120  To uninstall SliTaz, you have only to remove this directory.
   1.121  The file \\boot.ini or \\config.sys may be modified too.\n\n
   1.122 @@ -487,7 +499,7 @@
   1.123  		--title " SliTaz TAZUSB way installation " \
   1.124  		--yes-label "Install" --yesno \
   1.125  "\nSliTaz will be installed in the subdirectory \\slitaz of the current
   1.126 -DOS/Windows partition. You will see your files from /mnt/dos.\n\n
   1.127 +Linux/DOS/Windows partition. You will see your files from /mnt/dos.\n\n
   1.128  You can start SliTaz with \\slitaz\\boot\\tazboot.exe\n\n
   1.129  To uninstall SliTaz, you have only to remove this directory.
   1.130  The file \\boot.ini or \\config.sys may be modified too.\n\n
   1.131 @@ -980,8 +992,8 @@
   1.132  
   1.133  flavdata()
   1.134  {
   1.135 -	dd if=$ISO bs=512 skip=$((1+$(get 417 $ISO 1))) count=20 2>/dev/null | \
   1.136 -	zcat 2>/dev/null
   1.137 +	[ $(get 512 $ISO) -eq 35615 ] && n=1 || n=$((1+$(get 417 $ISO 1)))
   1.138 +	dd if=$ISO bs=512 skip=$n count=20 2>/dev/null | zcat 2>/dev/null
   1.139  }
   1.140  
   1.141  hasflavinfo()