summaryrefslogblamecommitdiffstats
path: root/core/rootfs/rootfs-stage31/data/inc/setup_stage32
blob: bab1cda16b8e2a7785dfaa8afce13fc17ba5a441 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14













                                                                         

                                                                             
































                                                                                                                          









                                                                                                                           
#!/bin/ash
#
#	This script sets up the stage 3.2.
#		- downloads/mounts stage32.sqfs
#		- merge it with current rootfs through aufs
#		- will not download, if the "nfs=" is used in the
#		  kernel command line
#
#########################################################################
#
# first check if an NFS-share was given per command line
#
if [ -n "$NFS" ]; then
	echo "Mounting stage 3.2 as NFS..."
	busybox mount -n -t nfs -o ro,async,nolock "${NFS}" /rorootfs \
		|| drop_shell "Problem mounting NFS-Directory from ${NFS}." \
		|| return 1
	return 0
fi

#########################################################################
#
#				MAIN PART
#

echo "Setting up stage 3.2 ..."

STAGE32_TARGET_PATH="/stage32.sqfs"
STAGE32_MOUNT_POINT="/rorootfs"

# try to download it
download "${SLX_BASE_PATH}/stage32.sqfs" "$STAGE32_TARGET_PATH" || drop_shell "Could not download stage32!"

# "Delete" addon hook-script in aufs view
touch "${FUTURE_ROOT}/.wh.addon-init"

# try to mount it at STAGE32_MOUNT_POINT
echo "Mounting stage 3.2 as SquashFS..."
busybox mount -n -t squashfs "$STAGE32_TARGET_PATH" "$STAGE32_MOUNT_POINT" || drop_shell "Problem mounting Squashfs."

echo "Building aufs ..."
busybox mount -n -t aufs -o "br:${FUTURE_ROOT}:${STAGE32_MOUNT_POINT}=ro" none /mnt || drop_shell "Problem building aufs."
mkdir -p /mnt/opt/openslx/uniontmp /mnt/tmp
#busybox mount -n --move "$FUTURE_ROOT" /mnt/opt/openslx/uniontmp || drop_shell "Problem moving uniontmp." # Move needed?
FUTURE_ROOT="/mnt"

# Move network stuff
cp /etc/hostname /etc/hosts   "${FUTURE_ROOT}/etc/"
cp /etc/resolv.conf   "${FUTURE_ROOT}/opt/openslx/"

# if booting with splash, suppress kernel output in stage32
if [ $SPLASH -eq 1 ]; then
	if grep -q -E "^ *kernel.printk" "${FUTURE_ROOT}/usr/lib/sysctl.d/50-default.conf"; then
		sed -i 's/^ *kernel\.printk.*/kernel\.printk = 1 1 0 1/g' "${FUTURE_ROOT}/usr/lib/sysctl.d/50-default.conf"
	else
		echo "kernel.printk = 1 1 0 1" >> "${FUTURE_ROOT}/usr/lib/sysctl.d/50-default.conf"
	fi
fi