slitaz-boot-scripts rev 472

init: mount 'SliTaz persistent /home' partition
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Jan 10 14:11:26 2022 +0000 (5 months ago)
parents 442c9f81919d
children b730a4bf981d
files etc/init.d/bootopts.sh etc/init.d/network.sh etc/init.d/system.sh init
line diff
     1.1 --- a/etc/init.d/bootopts.sh	Thu May 27 13:40:38 2021 +0000
     1.2 +++ b/etc/init.d/bootopts.sh	Mon Jan 10 14:11:26 2022 +0000
     1.3 @@ -124,7 +124,7 @@
     1.4  				[ -d /home/$USER ] && mv /home/$USER /tmp/$USER-files
     1.5  				mount /dev/$DEVID /home &&
     1.6  				case "$(/sbin/blkid | grep /dev/$DEVID:)" in
     1.7 -				*\"ntfs\"*|*\"vfat\"*)
     1.8 +				*\"ntfs\"*|*\"vfat\"*|*\"exfat\"*)
     1.9  					mount.posixovl -F /home -- -oallow_other -odefault_permissions -osuid ;;
    1.10  				esac
    1.11  				mount /home -o remount,uid=1000,gid=100 2>/dev/null
    1.12 @@ -140,6 +140,9 @@
    1.13  					mkswap /home/swap
    1.14  					add_swap_in_fstab /home/swap
    1.15  				fi
    1.16 +
    1.17 +				fs=/home/boot/rootfs.gz
    1.18 +				[ -s $fs ] && ( zcat $fs || unlzma < $fs || cat $fs ) | ( cd / ; cpio -idmu )
    1.19  			else
    1.20  				echo "Unable to find $DEVICE... "
    1.21  			fi
     2.1 --- a/etc/init.d/network.sh	Thu May 27 13:40:38 2021 +0000
     2.2 +++ b/etc/init.d/network.sh	Mon Jan 10 14:11:26 2022 +0000
     2.3 @@ -81,7 +81,7 @@
     2.4  		su -l -c "$0 netapplet" - "$user"
     2.5  	done
     2.6  	# restart if LXPanel running
     2.7 -	if [ -n "$DISPLAY" -a -n "$(which lxpanelctl)" ]; then
     2.8 +	if [ -n "$DISPLAY" ] && [ -n "$(which lxpanelctl)" ]; then
     2.9  		lxpanelctl restart
    2.10  	fi
    2.11  }
    2.12 @@ -131,7 +131,7 @@
    2.13  
    2.14  remove_network() {
    2.15  	mv -f $WPA_CONF $WPA_CONF.old
    2.16 -	cat $WPA_CONF.old | tr '\n' '\a' | sed 's|[^#]\(network={\)|\n\1|g' | \
    2.17 +	tr '\n' '\a' < $WPA_CONF.old | sed 's|[^#]\(network={\)|\n\1|g' | \
    2.18  		fgrep -v "ssid=\"$1\"" | tr '\a' '\n' > $WPA_CONF
    2.19  }
    2.20  
    2.21 @@ -254,7 +254,7 @@
    2.22  					[ -n "$WIFI_ANONYMOUS_IDENTITY" ] && echo -e "\tanonymous_identity=\"$WIFI_ANONYMOUS_IDENTITY\""
    2.23  					[ -n "$WIFI_KEY" ] && echo -e "\tpassword=\"$WIFI-KEY\""
    2.24  					[ -n "$WIFI_PHASE2" ] && echo -e "\tphase2=\"auth=$WIFI_PHASE2\""
    2.25 -					echo }
    2.26 +					echo '}'
    2.27  				} >> $WPA_CONF
    2.28  				start_wpa_supplicant '802.1x EAP' ;;
    2.29  
     3.1 --- a/etc/init.d/system.sh	Thu May 27 13:40:38 2021 +0000
     3.2 +++ b/etc/init.d/system.sh	Mon Jan 10 14:11:26 2022 +0000
     3.3 @@ -62,7 +62,7 @@
     3.4  
     3.5  # Activate an eventual swap file or partition
     3.6  if ! grep -q 'noswap' /proc/cmdline; then
     3.7 -if [ "$(blkid | grep 'TYPE="swap"')" ]; then
     3.8 +if blkid | grepi -q 'TYPE="swap"'; then
     3.9  	for swd in $(blkid | sed '/TYPE="swap"/!d;s/:.*//'); do
    3.10  		if ! grep -q "$swd	" /etc/fstab; then
    3.11  			echo "Swap memory detected on: $swd"
     4.1 --- a/init	Thu May 27 13:40:38 2021 +0000
     4.2 +++ b/init	Mon Jan 10 14:11:26 2022 +0000
     4.3 @@ -98,7 +98,7 @@
     4.4  
     4.5  
     4.6  bbmnt() {
     4.7 -	r=$(blkid 2> /dev/null | grep "$root[:\"]" | sed 's|:.*||;q')
     4.8 +	r=$(busybox blkid 2> /dev/null | grep "$root[:\"]" | sed 's|:.*||;q')
     4.9  	r=${r:-$(busybox blkid $root 2> /dev/null | sed 's|:.*||;q')}
    4.10  	r=${r:-$root}
    4.11  	if [ ! -b $r ]; then
    4.12 @@ -234,6 +234,17 @@
    4.13  [ -d /proc/sys/dev/cdrom ] &&
    4.14  	ln -s $(sed '/name/!d;s/.*:[^a-z]*//' /proc/sys/dev/cdrom/info) /dev/cdrom
    4.15  
    4.16 +dev=$(busybox fdisk -l|awk '/sectors/{d=$2}/SliTaz persistent \/home/{print d $1;quit}'|sed 's|:||')
    4.17 +if got root && [ "$dev" -a "$root" == "/dev/null" ]; then
    4.18 +	busybox blkid $dev | grep -q TYPE= || mkfs.vfat $dev
    4.19 +	mount $dev /home && case $(busybox blkid $dev) in
    4.20 +	*vfat*|*exfat*|*ntfs*)
    4.21 +		mount.posixovl -F /home -- -oallow_other -odefault_permissions -osuid
    4.22 +	esac
    4.23 +	fs=/home/boot/rootfs.gz; [ -s $fs ] && (zcat $fs || unlzma < $fs || cat $fs) | cpio -idmu
    4.24 +	[ -d /init.d ] && for i in /init.d/* ; do [ -x $i ] && . $i ; done
    4.25 +fi 2>&1 >/dev/null
    4.26 +
    4.27  if use dmraid; then
    4.28  	dmraid -s | sed '/^type/!ds/.*: *//' | ldraid
    4.29  	[ ${root:0:4} = /dev ] ||