view core/sysvinit/rc.init @ 302:4eb3d13af993

x11/xinit: initial import, closes #1371
author David Demelier <markand@malikania.fr>
date Mon, 25 Mar 2019 12:44:04 +0100
parents 36f3ab3945d7
children 01b5d3175215
line wrap: on
line source

#
# /etc/rc.init: system initialization script
#

if [ -f /etc/rc.conf ]; then
	source /etc/rc.conf
fi

if [ -n "$HOSTNAME" ] && [ -x /usr/bin/hostname ]; then
	echo "Setting hostname: $HOSTNAME"
	/usr/bin/hostname "$HOSTNAME"
fi

if [ -x /usr/sbin/sysctl ]; then
	echo "Setting kernel parameters."
	/usr/sbin/sysctl -p >/dev/null 2>&1
fi

if [ -x /usr/bin/mountpoint ]; then
	echo -n "Mounting filesystems: "

	if ! /usr/bin/mountpoint /proc >/dev/null 2>&1; then
		/usr/bin/mount -t proc none /proc >/dev/null 2>&1
		echo -n "/proc "
	fi

	if ! /usr/bin/mountpoint /sys >/dev/null 2>&1; then
		/usr/bin/mount -t sysfs none /sys >/dev/null 2>&1
		echo -n "/sys "
	fi

	echo "done."
fi

if [ -x /usr/sbin/fsck ]; then
	# Make sure / is ro in case of initrd.
	/usr/bin/mount -o remount,ro /

	# If /etc/forcefsck is there, force check.
	if [ -f /etc/forcefsck ]; then
		force="-f"
	fi

	/usr/sbin/fsck $force -A -T -C -a >/dev/null 2>&1

	if [ "$?" -gt 1 ]; then
		echo "* Filesystem check failed"
		/usr/sbin/sulogin -p
	fi
fi

# Remount / and enable swap as the system is ready.
/usr/bin/mount -o remount,rw /
/usr/sbin/swapon -a

if [ -n "$TIMEZONE" ]; then
	echo -n "Setting timezone: "

	if [ -f /usr/share/zoneinfo/$TIMEZONE ]; then
		/usr/bin/ln -sf /usr/share/zoneinfo/$TIMEZONE /etc/localtime
		echo "$TIMEZONE."
	else
		echo "$TIMEZONE not found."
	fi
fi

# cleanup some files.
rm -f /etc/forcefsck