Mercurial > vanilla
view core/rc/rc.init @ 579:40e182c90640
compression/gzip: rename from lib/gzip
author | David Demelier <markand@malikania.fr> |
---|---|
date | Mon, 08 Jul 2019 20:23:00 +0200 |
parents | 3c0d8d9fe11e |
children | dbd752e285f6 |
line wrap: on
line source
#!/bin/sh # # /etc/rc.init: system initialization script # # Copyright (c) 2019 David Demelier <markand@malikania.fr> # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # if [ -f /etc/rc.conf ]; then . /etc/rc.conf fi if [ "${BANNER:-yes}" = "yes" ]; then printf "\nWelcome to \033[33;1mVanilla Linux\033[0m\n\n" fi if [ -n "$HOSTNAME" ]; then echo "Setting hostname: $HOSTNAME" /bin/hostname "$HOSTNAME" fi echo "Setting kernel parameters" /bin/sysctl -p >/dev/null 2>&1 echo -n "Mounting filesystems: " if ! /bin/mountpoint /dev >/dev/null 2>&1; then /bin/mount -t devtmpfs devtmpfs /dev >/dev/null 2>&1 echo -n "/dev " fi if ! /bin/mountpoint /proc >/dev/null 2>&1; then /bin/mount -t proc proc /proc >/dev/null 2>&1 echo -n "/proc " fi if ! /bin/mountpoint /sys >/dev/null 2>&1; then /bin/mount -t sysfs sysfs /sys >/dev/null 2>&1 echo -n "/sys " fi if ! /bin/mountpoint /run >/dev/null 2>&1; then /bin/mount -t tmpfs tmpfs /run >/dev/null 2>&1 echo -n "/run " fi echo "done" # Clean pid files before starting any services. find /var/run -type f -name "*.pid" -delete # # Start a device service. Both eudev and busybox's mdev are supported but only # one at a time must be enabled. # if [ -x /etc/rc.d/udevd ] && [ -x /etc/rc.d/busybox.mdev ]; then echo "Warning: both /etc/rc.d/udevd and /etc/rc.d/busybox.mdev are enabled" 1>&2 echo "Warning: using udevd instead" 1>&2 fi if [ -x /etc/rc.d/udevd ]; then /etc/rc.d/udevd start elif [ -x /etc/rc.d/busybox.mdev ]; then /etc/rc.d/busybox.mdev start fi # Make sure / is ro in case of initrd. /bin/mount -o remount,ro / # If /etc/forcefsck is there, force check. if [ -f /etc/forcefsck ]; then force="-f" fi /bin/fsck $force -A -T -C -a >/dev/null 2>&1 if [ "$?" -gt 1 ]; then echo "* Filesystem check failed" /bin/sulogin -p /bin/reboot fi # Remount / and enable swap as the system is ready. /bin/mount -o remount,rw / /bin/swapon -a # Update shared library caches. /bin/ldconfig if [ -n "$TIMEZONE" ] && [ "$TIMEZONE" != "UTC" ]; then echo -n "Setting timezone: " if [ -f /share/zoneinfo/$TIMEZONE ]; then /bin/ln -sf /share/zoneinfo/$TIMEZONE /etc/localtime echo "$TIMEZONE." else echo "$TIMEZONE not found" fi fi # Console font and keymap. if [ -n "$FONT" ]; then echo "Setting font: $FONT" /bin/setfont $FONT fi if [ -n "$KEYMAP" ]; then echo "Setting keymap: $KEYMAP" /bin/loadkeys $KEYMAP fi # Cleanup some files. rm -f /etc/forcefsck # # When running Vanilla busybox's init which has no inittab support, run # /etc/rc.start to bring up user defined services. Since runlevels are also # unsupported, we specify the maximum number which is 5. # # sysvinit defines INIT_VERSION environment variable which is not present in # busybox init. # if [ -z "$INIT_VERSION" ]; then if [ -x /etc/rc.start ]; then /etc/rc.start 5 fi if [ -x /etc/rc.local ]; then /etc/rc.local fi fi