Initial commit
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: alignment
|
||||
# Required-Start: mountkernfs
|
||||
# Required-Stop: mountkernfs
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
### END INIT INFO
|
||||
|
||||
if [ -e /proc/cpu/alignment ]; then
|
||||
echo "3" > /proc/cpu/alignment
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: banner
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
### END INIT INFO
|
||||
|
||||
if [ ! -e /dev/tty ]; then
|
||||
/bin/mknod -m 0666 /dev/tty c 5 0
|
||||
fi
|
||||
|
||||
if ( > /dev/tty0 ) 2>/dev/null; then
|
||||
vtmaster=/dev/tty0
|
||||
elif ( > /dev/vc/0 ) 2>/dev/null; then
|
||||
vtmaster=/dev/vc/0
|
||||
elif ( > /dev/console ) 2>/dev/null; then
|
||||
vtmaster=/dev/console
|
||||
else
|
||||
vtmaster=/dev/null
|
||||
fi
|
||||
echo > $vtmaster
|
||||
echo "Please wait: booting..." > $vtmaster
|
||||
@@ -0,0 +1,88 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: bootmisc
|
||||
# Required-Start: $local_fs mountvirtfs
|
||||
# Required-Stop: $local_fs
|
||||
# Default-Start: S
|
||||
# Default-Stop: 0 6
|
||||
# Short-Description: Misc and other.
|
||||
### END INIT INFO
|
||||
|
||||
TIMESTAMP_FILE=/etc/timestamp
|
||||
|
||||
. /etc/default/rcS
|
||||
[ -f /etc/default/timestamp ] && . /etc/default/timestamp
|
||||
#
|
||||
# Put a nologin file in /etc to prevent people from logging in before
|
||||
# system startup is complete.
|
||||
#
|
||||
if test "$DELAYLOGIN" = yes
|
||||
then
|
||||
echo "System bootup in progress - please wait" > /etc/nologin
|
||||
cp /etc/nologin /etc/nologin.boot
|
||||
fi
|
||||
|
||||
#
|
||||
# Set pseudo-terminal access permissions.
|
||||
#
|
||||
if test -c /dev/ttyp0
|
||||
then
|
||||
chmod 666 /dev/tty[p-za-e][0-9a-f]
|
||||
chown root:tty /dev/tty[p-za-e][0-9a-f]
|
||||
fi
|
||||
|
||||
#
|
||||
# Apply /proc settings if defined
|
||||
#
|
||||
SYSCTL_CONF="/etc/sysctl.conf"
|
||||
if [ -f "${SYSCTL_CONF}" ]
|
||||
then
|
||||
if [ -x "/sbin/sysctl" ]
|
||||
then
|
||||
# busybox sysctl does not support -q
|
||||
VERBOSE_REDIR="1>/dev/null"
|
||||
if [ "${VERBOSE}" != "no" ]; then
|
||||
VERBOSE_REDIR="1>&1"
|
||||
fi
|
||||
eval /sbin/sysctl -p "${SYSCTL_CONF}" $VERBOSE_REDIR
|
||||
else
|
||||
echo "To have ${SYSCTL_CONF} applied during boot, install package <procps>."
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Update /etc/motd.
|
||||
#
|
||||
if test "$EDITMOTD" != no
|
||||
then
|
||||
uname -a > /etc/motd.tmp
|
||||
sed 1d /etc/motd >> /etc/motd.tmp
|
||||
mv /etc/motd.tmp /etc/motd
|
||||
fi
|
||||
|
||||
#
|
||||
# This is as good a place as any for a sanity check
|
||||
#
|
||||
# Set the system clock from hardware clock
|
||||
# If the timestamp is more recent than the current time,
|
||||
# use the timestamp instead.
|
||||
test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh start
|
||||
if test -e "$TIMESTAMP_FILE"
|
||||
then
|
||||
SYSTEMDATE=`date -u +%4Y%2m%2d%2H%2M%2S`
|
||||
read TIMESTAMP < "$TIMESTAMP_FILE"
|
||||
if [ ${TIMESTAMP} -gt $SYSTEMDATE ]; then
|
||||
# format the timestamp as date expects it (2m2d2H2M4Y.2S)
|
||||
TS_YR=${TIMESTAMP%??????????}
|
||||
TS_SEC=${TIMESTAMP#????????????}
|
||||
TS_FIRST12=${TIMESTAMP%??}
|
||||
TS_MIDDLE8=${TS_FIRST12#????}
|
||||
date -u ${TS_MIDDLE8}${TS_YR}.${TS_SEC}
|
||||
test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh stop
|
||||
fi
|
||||
fi
|
||||
: exit 0
|
||||
@@ -0,0 +1,54 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: checkfs
|
||||
# Required-Start: checkroot
|
||||
# Required-Stop:
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
# Short-Description: Check all other file systems
|
||||
### END INIT INFO
|
||||
|
||||
. /etc/default/rcS
|
||||
|
||||
#
|
||||
# Check the rest of the filesystems.
|
||||
#
|
||||
if test ! -f /fastboot
|
||||
then
|
||||
if test -f /forcefsck
|
||||
then
|
||||
force="-f"
|
||||
else
|
||||
force=""
|
||||
fi
|
||||
if test "$FSCKFIX" = yes
|
||||
then
|
||||
fix="-y"
|
||||
else
|
||||
fix="-a"
|
||||
fi
|
||||
spinner="-C"
|
||||
case "$TERM" in
|
||||
dumb|network|unknown|"") spinner="" ;;
|
||||
esac
|
||||
test "`uname -m`" = "s390" && spinner="" # This should go away
|
||||
test "$VERBOSE" != no && echo "Checking all filesystems..."
|
||||
fsck $spinner -R -A $fix $force
|
||||
if test "$?" -gt 1
|
||||
then
|
||||
echo
|
||||
echo "fsck failed. Please repair manually."
|
||||
echo
|
||||
echo "CONTROL-D will exit from this shell and continue system startup."
|
||||
echo
|
||||
# Start a single user shell on the console
|
||||
/sbin/sulogin $CONSOLE
|
||||
fi
|
||||
fi
|
||||
rm -f /fastboot /forcefsck
|
||||
|
||||
: exit 0
|
||||
@@ -0,0 +1,152 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: checkroot
|
||||
# Required-Start: udev
|
||||
# Required-Stop:
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
# Short-Description: Check to root file system.
|
||||
### END INIT INFO
|
||||
|
||||
. /etc/default/rcS
|
||||
|
||||
#
|
||||
# Set SULOGIN in /etc/default/rcS to yes if you want a sulogin to be spawned
|
||||
# from this script *before anything else* with a timeout, like SCO does.
|
||||
#
|
||||
test "$SULOGIN" = yes && sulogin -t 30 $CONSOLE
|
||||
|
||||
#
|
||||
# Read /etc/fstab.
|
||||
#
|
||||
exec 9< /etc/fstab
|
||||
rootmode=rw
|
||||
rootopts=rw
|
||||
rootcheck=$ENABLE_ROOTFS_FSCK
|
||||
swap_on_md=no
|
||||
devfs=
|
||||
while read fs mnt type opts dump pass junk <&9
|
||||
do
|
||||
case "$fs" in
|
||||
""|\#*)
|
||||
continue;
|
||||
;;
|
||||
/dev/md*)
|
||||
# Swap on md device.
|
||||
test "$type" = swap && swap_on_md=yes
|
||||
;;
|
||||
/dev/*)
|
||||
;;
|
||||
*)
|
||||
# Might be a swapfile.
|
||||
test "$type" = swap && swap_on_md=yes
|
||||
;;
|
||||
esac
|
||||
test "$type" = devfs && devfs="$fs"
|
||||
test "$mnt" != / && continue
|
||||
rootopts="$opts"
|
||||
test "$pass" = 0 -o "$pass" = "" && rootcheck=no
|
||||
case "$opts" in
|
||||
ro|ro,*|*,ro|*,ro,*)
|
||||
rootmode=ro
|
||||
;;
|
||||
esac
|
||||
done
|
||||
exec 0>&9 9>&-
|
||||
|
||||
# Check for conflicting configurations
|
||||
if [ "$rootmode" = "ro" -a "$ROOTFS_READ_ONLY" = "no" ] || \
|
||||
[ "$rootmode" = "rw" -a "$ROOTFS_READ_ONLY" = "yes" ]; then
|
||||
echo ""
|
||||
echo "WARN: conflicting configurations in /etc/fstab and /etc/default/rcS"
|
||||
echo " regarding the writability of rootfs. Please fix one of them."
|
||||
echo ""
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Activate the swap device(s) in /etc/fstab. This needs to be done
|
||||
# before fsck, since fsck can be quite memory-hungry.
|
||||
#
|
||||
test "$VERBOSE" != no && echo "Activating swap"
|
||||
[ -x /sbin/swapon ] && swapon -a
|
||||
|
||||
#
|
||||
# Check the root filesystem.
|
||||
#
|
||||
if test -f /fastboot || test "$rootcheck" = "no"
|
||||
then
|
||||
test $rootcheck = yes && echo "Fast boot, no filesystem check"
|
||||
else
|
||||
#
|
||||
# Ensure that root is quiescent and read-only before fsck'ing.
|
||||
#
|
||||
mount -n -o remount,ro /
|
||||
if test $? = 0
|
||||
then
|
||||
if test -f /forcefsck
|
||||
then
|
||||
force="-f"
|
||||
else
|
||||
force=""
|
||||
fi
|
||||
if test "$FSCKFIX" = yes
|
||||
then
|
||||
fix="-y"
|
||||
else
|
||||
fix="-a"
|
||||
fi
|
||||
spinner="-C"
|
||||
case "$TERM" in
|
||||
dumb|network|unknown|"") spinner="" ;;
|
||||
esac
|
||||
test `uname -m` = s390 && spinner="" # This should go away
|
||||
test "$VERBOSE" != no && echo "Checking root filesystem..."
|
||||
fsck $spinner $force $fix /
|
||||
#
|
||||
# If there was a failure, drop into single-user mode.
|
||||
#
|
||||
# NOTE: "failure" is defined as exiting with a return code of
|
||||
# 2 or larger. A return code of 1 indicates that filesystem
|
||||
# errors were corrected but that the boot may proceed.
|
||||
#
|
||||
if test "$?" -gt 1
|
||||
then
|
||||
# Surprise! Re-directing from a HERE document (as in
|
||||
# "cat << EOF") won't work, because the root is read-only.
|
||||
echo
|
||||
echo "fsck failed. Please repair manually and reboot. Please note"
|
||||
echo "that the root filesystem is currently mounted read-only. To"
|
||||
echo "remount it read-write:"
|
||||
echo
|
||||
echo " # mount -n -o remount,rw /"
|
||||
echo
|
||||
echo "CONTROL-D will exit from this shell and REBOOT the system."
|
||||
echo
|
||||
# Start a single user shell on the console
|
||||
/sbin/sulogin $CONSOLE
|
||||
reboot -f
|
||||
fi
|
||||
else
|
||||
echo "*** ERROR! Cannot fsck root fs because it is not mounted read-only!"
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# If the root filesystem was not marked as read-only in /etc/fstab,
|
||||
# remount the rootfs rw but do not try to change mtab because it
|
||||
# is on a ro fs until the remount succeeded. Then clean up old mtabs
|
||||
# and finally write the new mtab.
|
||||
#
|
||||
mount -n -o remount,$rootmode /
|
||||
if test "$rootmode" = rw
|
||||
then
|
||||
ln -sf /proc/mounts /dev/mtab
|
||||
fi
|
||||
|
||||
: exit 0
|
||||
@@ -0,0 +1,5 @@
|
||||
# GID of the `tty' group
|
||||
TTYGRP=5
|
||||
|
||||
# Set to 600 to have `mesg n' be the default
|
||||
TTYMODE=620
|
||||
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: devpts
|
||||
# Required-Start: udev
|
||||
# Required-Stop:
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
# Short-Description: Mount /dev/pts file systems.
|
||||
### END INIT INFO
|
||||
|
||||
. /etc/default/devpts
|
||||
|
||||
if grep -q devpts /proc/filesystems
|
||||
then
|
||||
#
|
||||
# Create multiplexor device.
|
||||
#
|
||||
test -c /dev/ptmx || mknod -m 666 /dev/ptmx c 5 2
|
||||
|
||||
#
|
||||
# Mount /dev/pts if needed.
|
||||
#
|
||||
if ! grep -q devpts /proc/mounts
|
||||
then
|
||||
mkdir -p /dev/pts
|
||||
mount -t devpts devpts /dev/pts -ogid=${TTYGRP},mode=${TTYMODE}
|
||||
fi
|
||||
fi
|
||||
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: dmesg
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
### END INIT INFO
|
||||
|
||||
if [ -f /var/log/dmesg ]; then
|
||||
if LOGPATH=$(which logrotate); then
|
||||
$LOGPATH -f /etc/logrotate-dmesg.conf
|
||||
else
|
||||
mv -f /var/log/dmesg /var/log/dmesg.old
|
||||
fi
|
||||
fi
|
||||
dmesg -s 131072 > /var/log/dmesg
|
||||
@@ -0,0 +1,94 @@
|
||||
# -*-Shell-script-*-
|
||||
#
|
||||
# functions This file contains functions to be used by most or all
|
||||
# shell scripts in the /etc/init.d directory.
|
||||
#
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
NORMAL="\\033[0;39m" # Standard console grey
|
||||
SUCCESS="\\033[1;32m" # Success is green
|
||||
WARNING="\\033[1;33m" # Warnings are yellow
|
||||
FAILURE="\\033[1;31m" # Failures are red
|
||||
INFO="\\033[1;36m" # Information is light cyan
|
||||
BRACKET="\\033[1;34m" # Brackets are blue
|
||||
|
||||
# NOTE: The pidofproc () doesn't support the process which is a script unless
|
||||
# the pidof supports "-x" option. If you want to use it for such a
|
||||
# process:
|
||||
# 1) If there is no "pidof -x", replace the "pidof $1" with another
|
||||
# command like(for core-image-minimal):
|
||||
# ps | awk '/'"$1"'/ {print $1}'
|
||||
# Or
|
||||
# 2) If there is "pidof -x", replace "pidof" with "pidof -x".
|
||||
#
|
||||
# pidofproc - print the pid of a process
|
||||
# $1: the name of the process
|
||||
pidofproc () {
|
||||
|
||||
# pidof output null when no program is running, so no "2>/dev/null".
|
||||
pid=`pidof $1`
|
||||
status=$?
|
||||
case $status in
|
||||
0)
|
||||
echo $pid
|
||||
return 0
|
||||
;;
|
||||
127)
|
||||
echo "ERROR: command pidof not found" >&2
|
||||
exit 127
|
||||
;;
|
||||
*)
|
||||
return $status
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
machine_id() { # return the machine ID
|
||||
awk 'BEGIN { FS=": " } /Hardware/ \
|
||||
{ gsub(" ", "_", $2); print tolower($2) } ' </proc/cpuinfo
|
||||
}
|
||||
|
||||
killproc() { # kill the named process(es)
|
||||
pid=`pidofproc $1` && kill $pid
|
||||
}
|
||||
|
||||
status() {
|
||||
local pid
|
||||
if [ "$#" = 0 ]; then
|
||||
echo "Usage: status {program}"
|
||||
return 1
|
||||
fi
|
||||
pid=`pidofproc $1`
|
||||
if [ -n "$pid" ]; then
|
||||
echo "$1 (pid $pid) is running..."
|
||||
return 0
|
||||
else
|
||||
echo "$1 is stopped"
|
||||
fi
|
||||
return 3
|
||||
}
|
||||
|
||||
success() {
|
||||
echo -n -e "${BRACKET}[${SUCCESS} OK ${BRACKET}]${NORMAL}"
|
||||
return 0
|
||||
}
|
||||
|
||||
failure() {
|
||||
local rc=$*
|
||||
echo -n -e "${BRACKET}[${FAILURE} FAIL ${BRACKET}]${NORMAL}"
|
||||
return $rc
|
||||
}
|
||||
|
||||
warning() {
|
||||
local rc=$*
|
||||
echo -n -e "${BRACKET}[${WARNING} WARN ${BRACKET}]${NORMAL}"
|
||||
return $rc
|
||||
}
|
||||
|
||||
passed() {
|
||||
local rc=$*
|
||||
echo -n -e "${BRACKET}[${SUCCESS} PASS ${BRACKET}]${NORMAL}"
|
||||
return $rc
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: halt
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Default-Start:
|
||||
# Default-Stop: 0
|
||||
# Short-Description: Execute the halt command.
|
||||
# Description:
|
||||
### END INIT INFO
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
# See if we need to cut the power.
|
||||
if test -x /etc/init.d/ups-monitor
|
||||
then
|
||||
/etc/init.d/ups-monitor poweroff
|
||||
fi
|
||||
|
||||
# Don't shut down drives if we're using RAID.
|
||||
hddown="-h"
|
||||
if grep -qs '^md.*active' /proc/mdstat
|
||||
then
|
||||
hddown=""
|
||||
fi
|
||||
|
||||
halt SED_HALTARGS -p $hddown
|
||||
|
||||
: exit 0
|
||||
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: hostname
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
# Short-Description: Set hostname based on /etc/hostname
|
||||
### END INIT INFO
|
||||
HOSTNAME=$(/bin/hostname)
|
||||
|
||||
hostname -b -F /etc/hostname 2> /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
# Busybox hostname doesn't support -b so we need implement it on our own
|
||||
if [ -f /etc/hostname ];then
|
||||
hostname `cat /etc/hostname`
|
||||
elif [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" -o ! -z "`echo $HOSTNAME | sed -n '/^[0-9]*\.[0-9].*/p'`" ] ; then
|
||||
hostname localhost
|
||||
fi
|
||||
@@ -0,0 +1,9 @@
|
||||
# see "man logrotate" for details
|
||||
# rotate dmesg, and keep 5 versions.
|
||||
|
||||
/var/log/dmesg {
|
||||
create
|
||||
rotate 5
|
||||
nodateext
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: mountall
|
||||
# Required-Start: mountvirtfs
|
||||
# Required-Stop:
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
# Short-Description: Mount all filesystems.
|
||||
# Description:
|
||||
### END INIT INFO
|
||||
|
||||
. /etc/default/rcS
|
||||
|
||||
#
|
||||
# Mount local filesystems in /etc/fstab. For some reason, people
|
||||
# might want to mount "proc" several times, and mount -v complains
|
||||
# about this. So we mount "proc" filesystems without -v.
|
||||
#
|
||||
test "$VERBOSE" != no && echo "Mounting local filesystems..."
|
||||
mount -at nonfs,nosmbfs,noncpfs 2>/dev/null
|
||||
|
||||
|
||||
# We might have mounted something over /run; see if
|
||||
# /dev/initctl is present. Look for
|
||||
# /sbin/init.sysvinit to verify that sysvinit (and
|
||||
# not busybox or systemd) is installed as default init).
|
||||
INITCTL="/dev/initctl"
|
||||
if [ ! -p "$INITCTL" ] && [ "${INIT_SYSTEM}" = "sysvinit" ]; then
|
||||
# Create new control channel
|
||||
rm -f "$INITCTL"
|
||||
mknod -m 600 "$INITCTL" p
|
||||
|
||||
# Reopen control channel.
|
||||
PID="$(pidof -s /sbin/init || echo 1)"
|
||||
[ -n "$PID" ] && kill -s USR1 "$PID"
|
||||
fi
|
||||
|
||||
#
|
||||
# Execute swapon command again, in case we want to swap to
|
||||
# a file on a now mounted filesystem.
|
||||
#
|
||||
[ -x /sbin/swapon ] && swapon -a
|
||||
|
||||
: exit 0
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: mountnfs
|
||||
# Required-Start: $local_fs $network $rpcbind
|
||||
# Required-Stop:
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
### END INIT INFO
|
||||
|
||||
#
|
||||
# Run in a subshell because of I/O redirection.
|
||||
#
|
||||
test -f /etc/fstab && (
|
||||
|
||||
#
|
||||
# Read through fstab line by line. If it is NFS, set the flag
|
||||
# for mounting NFS filesystems. If any NFS partition is found and it
|
||||
# not mounted with the nolock option, we start the rpcbind.
|
||||
#
|
||||
rpcbind=no
|
||||
mount_nfs=no
|
||||
mount_smb=no
|
||||
mount_ncp=no
|
||||
mount_cifs=no
|
||||
while read device mountpt fstype options
|
||||
do
|
||||
case "$device" in
|
||||
""|\#*)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$options" in
|
||||
*noauto*)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "$fstype" = nfs
|
||||
then
|
||||
mount_nfs=yes
|
||||
case "$options" in
|
||||
*nolock*)
|
||||
;;
|
||||
*)
|
||||
rpcbind=yes
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test "$fstype" = smbfs
|
||||
then
|
||||
mount_smb=yes
|
||||
fi
|
||||
if test "$fstype" = ncpfs
|
||||
then
|
||||
mount_ncp=yes
|
||||
fi
|
||||
if test "$fstype" = cifs
|
||||
then
|
||||
mount_cifs=yes
|
||||
fi
|
||||
done
|
||||
|
||||
exec 0>&1
|
||||
|
||||
if test "$rpcbind" = yes
|
||||
then
|
||||
if test -x /usr/sbin/rpcbind
|
||||
then
|
||||
service rpcbind status > /dev/null
|
||||
if [ $? != 0 ]; then
|
||||
echo -n "Starting rpcbind..."
|
||||
start-stop-daemon --start --quiet --exec /usr/sbin/rpcbind
|
||||
sleep 2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$mount_nfs" = yes || test "$mount_smb" = yes || test "$mount_ncp" = yes || test "$mount_cifs" = yes
|
||||
then
|
||||
echo "Mounting remote filesystems..."
|
||||
test "$mount_nfs" = yes && mount -a -t nfs
|
||||
test "$mount_smb" = yes && mount -a -t smbfs
|
||||
test "$mount_ncp" = yes && mount -a -t ncpfs
|
||||
test "$mount_cifs" = yes && mount -a -t cifs
|
||||
fi
|
||||
|
||||
) < /etc/fstab
|
||||
|
||||
: exit 0
|
||||
|
||||
@@ -0,0 +1,277 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: volatile
|
||||
# Required-Start: $local_fs
|
||||
# Required-Stop: $local_fs
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
# Short-Description: Populate the volatile filesystem
|
||||
### END INIT INFO
|
||||
|
||||
# Get ROOT_DIR
|
||||
DIRNAME="$(dirname "$0")"
|
||||
ROOT_DIR="$(echo "$DIRNAME" | sed -ne 's:/etc/.*::p')"
|
||||
|
||||
[ -e "${ROOT_DIR}/etc/default/rcS" ] && . "${ROOT_DIR}/etc/default/rcS"
|
||||
# When running populate-volatile.sh at rootfs time, disable cache.
|
||||
[ -n "$ROOT_DIR" ] && VOLATILE_ENABLE_CACHE=no
|
||||
# If rootfs is read-only, disable cache.
|
||||
[ "$ROOTFS_READ_ONLY" = "yes" ] && VOLATILE_ENABLE_CACHE=no
|
||||
|
||||
CFGDIR="${ROOT_DIR}/etc/default/volatiles"
|
||||
TMPROOT="${ROOT_DIR}/var/volatile/tmp"
|
||||
COREDEF="00_core"
|
||||
|
||||
[ "${VERBOSE}" != "no" ] && echo "Populating volatile Filesystems."
|
||||
|
||||
create_file() {
|
||||
EXEC=""
|
||||
if [ -z "$2" ]; then
|
||||
EXEC="
|
||||
touch \"$1\";
|
||||
"
|
||||
else
|
||||
EXEC="
|
||||
cp \"$2\" \"$1\";
|
||||
"
|
||||
fi
|
||||
EXEC="
|
||||
${EXEC}
|
||||
chown ${TUSER}:${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\";
|
||||
chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" "
|
||||
|
||||
test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build
|
||||
|
||||
if [ -e "$1" ]; then
|
||||
[ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
|
||||
else
|
||||
if [ -z "$ROOT_DIR" ]; then
|
||||
eval "$EXEC"
|
||||
else
|
||||
# Creating some files at rootfs time may fail and should fail,
|
||||
# but these failures should not be logged to make sure the do_rootfs
|
||||
# process doesn't fail. This does no harm, as this script will
|
||||
# run on target to set up the correct files and directories.
|
||||
eval "$EXEC" > /dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
mk_dir() {
|
||||
EXEC="
|
||||
mkdir -p \"$1\";
|
||||
chown ${TUSER}:${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\";
|
||||
chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" "
|
||||
|
||||
test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build
|
||||
if [ -e "$1" ]; then
|
||||
[ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
|
||||
else
|
||||
if [ -z "$ROOT_DIR" ]; then
|
||||
eval "$EXEC"
|
||||
else
|
||||
# For the same reason with create_file(), failures should
|
||||
# not be logged.
|
||||
eval "$EXEC" > /dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
link_file() {
|
||||
EXEC="
|
||||
if [ -L \"$2\" ]; then
|
||||
[ \"\$(readlink \"$2\")\" != \"$1\" ] && { rm -f \"$2\"; ln -sf \"$1\" \"$2\"; };
|
||||
elif [ -d \"$2\" ]; then
|
||||
if awk '\$2 == \"$2\" {exit 1}' /proc/mounts; then
|
||||
cp -a $2/* $1 2>/dev/null;
|
||||
cp -a $2/.[!.]* $1 2>/dev/null;
|
||||
rm -rf \"$2\";
|
||||
ln -sf \"$1\" \"$2\";
|
||||
fi
|
||||
else
|
||||
ln -sf \"$1\" \"$2\";
|
||||
fi
|
||||
"
|
||||
|
||||
test "$VOLATILE_ENABLE_CACHE" = yes && echo " $EXEC" >> /etc/volatile.cache.build
|
||||
|
||||
if [ -z "$ROOT_DIR" ]; then
|
||||
eval "$EXEC"
|
||||
else
|
||||
# For the same reason with create_file(), failures should
|
||||
# not be logged.
|
||||
eval "$EXEC" > /dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
check_requirements() {
|
||||
cleanup() {
|
||||
rm "${TMP_INTERMED}"
|
||||
rm "${TMP_DEFINED}"
|
||||
rm "${TMP_COMBINED}"
|
||||
}
|
||||
|
||||
CFGFILE="$1"
|
||||
|
||||
TMP_INTERMED="${TMPROOT}/tmp.$$"
|
||||
TMP_DEFINED="${TMPROOT}/tmpdefined.$$"
|
||||
TMP_COMBINED="${TMPROOT}/tmpcombined.$$"
|
||||
|
||||
sed 's@\(^:\)*:.*@\1@' "${ROOT_DIR}/etc/passwd" | sort | uniq > "${TMP_DEFINED}"
|
||||
grep -v "^#" "${CFGFILE}" | cut -s -d " " -f 2 > "${TMP_INTERMED}"
|
||||
cat "${TMP_DEFINED}" "${TMP_INTERMED}" | sort | uniq > "${TMP_COMBINED}"
|
||||
NR_DEFINED_USERS="$(wc -l < "${TMP_DEFINED}")"
|
||||
NR_COMBINED_USERS="$(wc -l < "${TMP_COMBINED}")"
|
||||
|
||||
[ "${NR_DEFINED_USERS}" -ne "${NR_COMBINED_USERS}" ] && {
|
||||
echo "Undefined users:"
|
||||
diff "${TMP_DEFINED}" "${TMP_COMBINED}" | grep "^>"
|
||||
cleanup
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
sed 's@\(^:\)*:.*@\1@' "${ROOT_DIR}/etc/group" | sort | uniq > "${TMP_DEFINED}"
|
||||
grep -v "^#" "${CFGFILE}" | cut -s -d " " -f 3 > "${TMP_INTERMED}"
|
||||
cat "${TMP_DEFINED}" "${TMP_INTERMED}" | sort | uniq > "${TMP_COMBINED}"
|
||||
|
||||
NR_DEFINED_GROUPS="$(wc -l < "${TMP_DEFINED}")"
|
||||
NR_COMBINED_GROUPS="$(wc -l < "${TMP_COMBINED}")"
|
||||
|
||||
[ "${NR_DEFINED_GROUPS}" -ne "${NR_COMBINED_GROUPS}" ] && {
|
||||
echo "Undefined groups:"
|
||||
diff "${TMP_DEFINED}" "${TMP_COMBINED}" | grep "^>"
|
||||
cleanup
|
||||
return 1
|
||||
}
|
||||
|
||||
# Add checks for required directories here
|
||||
|
||||
cleanup
|
||||
return 0
|
||||
}
|
||||
|
||||
apply_cfgfile() {
|
||||
CFGFILE="$1"
|
||||
SKIP_REQUIREMENTS="$2"
|
||||
|
||||
[ "${VERBOSE}" != "no" ] && echo "Applying ${CFGFILE}"
|
||||
|
||||
[ "${SKIP_REQUIREMENTS}" = "yes" ] || check_requirements "${CFGFILE}" || {
|
||||
echo "Skipping ${CFGFILE}"
|
||||
return 1
|
||||
}
|
||||
|
||||
sed 's/#.*//' "${CFGFILE}" | \
|
||||
while read -r TTYPE TUSER TGROUP TMODE TNAME TLTARGET; do
|
||||
test -z "${TLTARGET}" && continue
|
||||
TNAME=${ROOT_DIR}${TNAME}
|
||||
[ "${VERBOSE}" != "no" ] && echo "Checking for -${TNAME}-."
|
||||
|
||||
[ "${TTYPE}" = "l" ] && {
|
||||
TSOURCE="$TLTARGET"
|
||||
[ "${VERBOSE}" != "no" ] && echo "Creating link -${TNAME}- pointing to -${TSOURCE}-."
|
||||
link_file "${TSOURCE}" "${TNAME}"
|
||||
continue
|
||||
}
|
||||
|
||||
[ "${TTYPE}" = "b" ] && {
|
||||
TSOURCE="$TLTARGET"
|
||||
[ "${VERBOSE}" != "no" ] && echo "Creating mount-bind -${TNAME}- from -${TSOURCE}-."
|
||||
mount --bind "${TSOURCE}" "${TNAME}"
|
||||
EXEC="
|
||||
mount --bind \"${TSOURCE}\" \"${TNAME}\""
|
||||
test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build
|
||||
continue
|
||||
}
|
||||
|
||||
[ -L "${TNAME}" ] && {
|
||||
[ "${VERBOSE}" != "no" ] && echo "Found link."
|
||||
NEWNAME=$(ls -l "${TNAME}" | sed -e 's/^.*-> \(.*\)$/\1/')
|
||||
if echo "${NEWNAME}" | grep -v "^/" >/dev/null; then
|
||||
TNAME="$(echo "${TNAME}" | sed -e 's@\(.*\)/.*@\1@')/${NEWNAME}"
|
||||
[ "${VERBOSE}" != "no" ] && echo "Converted relative linktarget to absolute path -${TNAME}-."
|
||||
else
|
||||
TNAME="${NEWNAME}"
|
||||
[ "${VERBOSE}" != "no" ] && echo "Using absolute link target -${TNAME}-."
|
||||
fi
|
||||
}
|
||||
|
||||
case "${TTYPE}" in
|
||||
"f") [ "${VERBOSE}" != "no" ] && echo "Creating file -${TNAME}-."
|
||||
TSOURCE="$TLTARGET"
|
||||
[ "${TSOURCE}" = "none" ] && TSOURCE=""
|
||||
create_file "${TNAME}" "${TSOURCE}"
|
||||
;;
|
||||
"d") [ "${VERBOSE}" != "no" ] && echo "Creating directory -${TNAME}-."
|
||||
mk_dir "${TNAME}"
|
||||
# Add check to see if there's an entry in fstab to mount.
|
||||
;;
|
||||
*) [ "${VERBOSE}" != "no" ] && echo "Invalid type -${TTYPE}-."
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
clearcache=0
|
||||
exec 9</proc/cmdline
|
||||
while read -r line <&9
|
||||
do
|
||||
case "$line" in
|
||||
*clearcache*) clearcache=1
|
||||
;;
|
||||
*) continue
|
||||
;;
|
||||
esac
|
||||
done
|
||||
exec 9>&-
|
||||
|
||||
if test -e "${ROOT_DIR}/etc/volatile.cache" -a "$VOLATILE_ENABLE_CACHE" = "yes" -a "x$1" != "xupdate" -a "x$clearcache" = "x0"
|
||||
then
|
||||
sh "${ROOT_DIR}/etc/volatile.cache"
|
||||
else
|
||||
rm -f "${ROOT_DIR}/etc/volatile.cache" "${ROOT_DIR}/etc/volatile.cache.build"
|
||||
|
||||
# Apply the core file with out checking requirements. ${TMPROOT} is
|
||||
# needed by check_requirements but is setup by this file, so it must be
|
||||
# processed first and without being checked.
|
||||
[ -e "${CFGDIR}/${COREDEF}" ] && apply_cfgfile "${CFGDIR}/${COREDEF}" "yes"
|
||||
|
||||
# Fast path: check_requirements is slow and most of the time doesn't
|
||||
# find any problems. If there are a lot of config files, it is much
|
||||
# faster to to concatenate them all together and process them once to
|
||||
# avoid the overhead of calling check_requirements repeatedly
|
||||
TMP_FILE="${TMPROOT}/tmp_volatile.$$"
|
||||
rm -f "$TMP_FILE"
|
||||
|
||||
CFGFILES="$(ls -1 "${CFGDIR}" | grep -v "^${COREDEF}\$" | sort)"
|
||||
for file in ${CFGFILES}; do
|
||||
cat "${CFGDIR}/${file}" >> "$TMP_FILE"
|
||||
done
|
||||
|
||||
if check_requirements "$TMP_FILE"
|
||||
then
|
||||
apply_cfgfile "$TMP_FILE" "yes"
|
||||
else
|
||||
# Slow path: One or more config files failed requirements.
|
||||
# Process each one individually so the offending one can be
|
||||
# skipped
|
||||
for file in ${CFGFILES}; do
|
||||
apply_cfgfile "${CFGDIR}/${file}"
|
||||
done
|
||||
fi
|
||||
rm "$TMP_FILE"
|
||||
|
||||
[ -e "${ROOT_DIR}/etc/volatile.cache.build" ] && sync && mv "${ROOT_DIR}/etc/volatile.cache.build" "${ROOT_DIR}/etc/volatile.cache"
|
||||
fi
|
||||
|
||||
if [ -z "${ROOT_DIR}" ] && [ -f /etc/ld.so.cache ] && [ ! -f /var/run/ld.so.cache ]
|
||||
then
|
||||
ln -s /etc/ld.so.cache /var/run/ld.so.cache
|
||||
fi
|
||||
@@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
. /etc/default/rcS
|
||||
|
||||
[ "$ROOTFS_READ_ONLY" = "no" ] && exit 0
|
||||
|
||||
is_on_read_only_partition () {
|
||||
DIRECTORY=$1
|
||||
dir=`readlink -f $DIRECTORY`
|
||||
while true; do
|
||||
if [ ! -d "$dir" ]; then
|
||||
echo "ERROR: $dir is not a directory"
|
||||
exit 1
|
||||
else
|
||||
for flag in `awk -v dir=$dir '{ if ($2 == dir) { print "FOUND"; split($4,FLAGS,",") } }; \
|
||||
END { for (f in FLAGS) print FLAGS[f] }' < /proc/mounts`; do
|
||||
[ "$flag" = "FOUND" ] && partition="read-write"
|
||||
[ "$flag" = "ro" ] && { partition="read-only"; break; }
|
||||
done
|
||||
if [ "$dir" = "/" -o -n "$partition" ]; then
|
||||
break
|
||||
else
|
||||
dir=`dirname $dir`
|
||||
fi
|
||||
fi
|
||||
done
|
||||
[ "$partition" = "read-only" ] && echo "yes" || echo "no"
|
||||
}
|
||||
|
||||
if [ "$1" = "start" ] ; then
|
||||
if [ `is_on_read_only_partition /var/lib` = "yes" ]; then
|
||||
grep -q "tmpfs /var/volatile" /proc/mounts || mount /var/volatile
|
||||
mkdir -p /var/volatile/lib
|
||||
mkdir -p /var/volatile/.lib-work
|
||||
# Try to mount using overlay, which is much faster than copying
|
||||
# files. If that fails, fallback to the slower copy
|
||||
if ! mount -t overlay overlay -olowerdir=/var/lib,upperdir=/var/volatile/lib,workdir=/var/volatile/.lib-work /var/lib > /dev/null 2>&1; then
|
||||
cp -a /var/lib/* /var/volatile/lib
|
||||
mount --bind /var/volatile/lib /var/lib
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: reboot
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Default-Start:
|
||||
# Default-Stop: 6
|
||||
# Short-Description: Execute the reboot command.
|
||||
# Description:
|
||||
### END INIT INFO
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
echo -n "Rebooting... "
|
||||
reboot SED_HALTARGS
|
||||
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: rmnologin
|
||||
# Required-Start: $remote_fs $all
|
||||
# Required-Stop:
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop:
|
||||
# Short-Description: Remove /etc/nologin at boot
|
||||
# Description: This script removes the /etc/nologin file as the
|
||||
# last step in the boot process, if DELAYLOGIN=yes.
|
||||
# If DELAYLOGIN=no, /etc/nologin was not created by
|
||||
# bootmisc earlier in the boot process.
|
||||
### END INIT INFO
|
||||
|
||||
if test -f /etc/nologin.boot
|
||||
then
|
||||
rm -f /etc/nologin /etc/nologin.boot
|
||||
fi
|
||||
|
||||
: exit 0
|
||||
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: save-rtc
|
||||
# Required-Start:
|
||||
# Required-Stop: $local_fs hwclock
|
||||
# Default-Start: S
|
||||
# Default-Stop: 0 6
|
||||
# Short-Description: Store system clock into file
|
||||
# Description:
|
||||
### END INIT INFO
|
||||
|
||||
TIMESTAMP_FILE=/etc/timestamp
|
||||
|
||||
[ -f /etc/default/timestamp ] && . /etc/default/timestamp
|
||||
|
||||
# Update the timestamp
|
||||
date -u +%4Y%2m%2d%2H%2M%2S 2>/dev/null > "$TIMESTAMP_FILE"
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: sendsigs
|
||||
# Required-Start:
|
||||
# Required-Stop: umountnfs
|
||||
# Default-Start:
|
||||
# Default-Stop: 0 6
|
||||
# Short-Description: Kill all remaining processes.
|
||||
# Description:
|
||||
### END INIT INFO
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
# Kill all processes.
|
||||
echo "Sending all processes the TERM signal..."
|
||||
killall5 -15
|
||||
sleep 5
|
||||
echo "Sending all processes the KILL signal..."
|
||||
killall5 -9
|
||||
|
||||
: exit 0
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: single
|
||||
# Required-Start: $local_fs $all killprocs
|
||||
# Required-Stop:
|
||||
# Default-Start: 1
|
||||
# Default-Stop:
|
||||
# Short-Description: executed by init(8) upon entering runlevel 1 (single).
|
||||
### END INIT INFO
|
||||
|
||||
PATH="/sbin:/bin:/usr/sbin:/usr/bin"
|
||||
|
||||
# Kill all processes.
|
||||
echo "Sending all processes the TERM signal..."
|
||||
killall5 -15
|
||||
sleep 5
|
||||
echo "Sending all processes the KILL signal..."
|
||||
killall5 -9
|
||||
|
||||
# We start update here, since we just killed it.
|
||||
test -x /sbin/update && update
|
||||
|
||||
echo "Entering single-user mode..."
|
||||
exec init -t1 S
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
[ -z "$SUSHELL" ] && SUSHELL=/bin/sh
|
||||
|
||||
exec $SUSHELL
|
||||
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: mountvirtfs
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
# Short-Description: Mount kernel virtual file systems.
|
||||
# Description: Mount initial set of virtual filesystems the kernel
|
||||
# provides and that are required by everything.
|
||||
### END INIT INFO
|
||||
|
||||
if [ -e /proc ] && ! [ -e /proc/mounts ]; then
|
||||
mount -t proc proc /proc
|
||||
fi
|
||||
|
||||
if [ -e /sys ] && grep -q sysfs /proc/filesystems && ! [ -e /sys/class ]; then
|
||||
mount -t sysfs sysfs /sys
|
||||
fi
|
||||
|
||||
if [ -e /sys/kernel/debug ] && grep -q debugfs /proc/filesystems; then
|
||||
mount -t debugfs debugfs /sys/kernel/debug
|
||||
fi
|
||||
|
||||
if [ -e /sys/kernel/config ] && grep -q configfs /proc/filesystems; then
|
||||
mount -t configfs configfs /sys/kernel/config
|
||||
fi
|
||||
|
||||
if [ -e /sys/firmware/efi/efivars ] && grep -q efivarfs /proc/filesystems; then
|
||||
mount -t efivarfs efivarfs /sys/firmware/efi/efivars
|
||||
fi
|
||||
|
||||
if ! [ -e /dev/zero ] && [ -e /dev ] && grep -q devtmpfs /proc/filesystems; then
|
||||
mount -n -t devtmpfs devtmpfs /dev
|
||||
fi
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: umountfs
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Default-Start:
|
||||
# Default-Stop: 0 6
|
||||
# Short-Description: Turn off swap and unmount all local file systems.
|
||||
# Description:
|
||||
### END INIT INFO
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
echo "Deactivating swap..."
|
||||
[ -x /sbin/swapoff ] && swapoff -a
|
||||
|
||||
# We leave /proc mounted.
|
||||
echo "Unmounting local filesystems..."
|
||||
grep -q /mnt/ram /proc/mounts && mount -o remount,ro /mnt/ram
|
||||
mount -o remount,ro /
|
||||
|
||||
umount -f -a -r > /dev/null 2>&1
|
||||
|
||||
: exit 0
|
||||
@@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: umountnfs
|
||||
# Required-Start:
|
||||
# Required-Stop: umountfs
|
||||
# Should-Stop: $network $portmap
|
||||
# Default-Start:
|
||||
# Default-Stop: 0 6
|
||||
# Short-Description: Unmount all network filesystems
|
||||
### END INIT INFO
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
# Write a reboot record to /var/log/wtmp before unmounting
|
||||
halt -w
|
||||
|
||||
echo "Unmounting remote filesystems..."
|
||||
|
||||
test -f /etc/fstab && (
|
||||
|
||||
#
|
||||
# Read through fstab line by line and unount network file systems
|
||||
#
|
||||
while read device mountpt fstype options
|
||||
do
|
||||
if test "$fstype" = nfs || test "$fstype" = smbfs || test "$fstype" = ncpfs || test "$fstype" = cifs
|
||||
then
|
||||
umount -f $mountpt
|
||||
fi
|
||||
done
|
||||
) < /etc/fstab
|
||||
|
||||
: exit 0
|
||||
@@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: urandom
|
||||
# Required-Start: $local_fs mountvirtfs
|
||||
# Required-Stop: $local_fs
|
||||
# Default-Start: S
|
||||
# Default-Stop: 0 6
|
||||
# Short-Description: Save and restore the random seed
|
||||
# Description: Save the random seed on shutdown and restore it on boot,
|
||||
# to ensure that the seed isn't predicable on startup
|
||||
# (because the boot process is predictable)
|
||||
### END INIT INFO
|
||||
|
||||
test -c /dev/urandom || exit 0
|
||||
|
||||
RANDOM_SEED_FILE=/var/lib/urandom/random-seed
|
||||
|
||||
. /etc/default/rcS
|
||||
[ -f /etc/default/urandom ] && . /etc/default/urandom
|
||||
|
||||
case "$1" in
|
||||
start|"")
|
||||
test "$VERBOSE" != no && echo "Initializing random number generator..."
|
||||
# Load and then save 512 bytes, which is the size of the entropy
|
||||
# pool. Also load the current date, in case the seed file is
|
||||
# empty.
|
||||
( date +%s.%N; [ -f "$RANDOM_SEED_FILE" ] && cat "$RANDOM_SEED_FILE" ) \
|
||||
>/dev/urandom
|
||||
rm -f "$RANDOM_SEED_FILE"
|
||||
umask 077
|
||||
dd if=/dev/urandom of=$RANDOM_SEED_FILE count=1 \
|
||||
>/dev/null 2>&1 || echo "urandom start: failed."
|
||||
umask 022
|
||||
;;
|
||||
stop)
|
||||
# Carry a random seed from shut-down to start-up;
|
||||
# see documentation in linux/drivers/char/random.c
|
||||
test "$VERBOSE" != no && echo "Saving random seed..."
|
||||
umask 077
|
||||
dd if=/dev/urandom of=$RANDOM_SEED_FILE count=1 \
|
||||
>/dev/null 2>&1 || echo "urandom stop: failed."
|
||||
;;
|
||||
*)
|
||||
echo "Usage: urandom {start|stop}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,37 @@
|
||||
# This configuration file lists filesystem objects that should get verified
|
||||
# during startup and be created if missing.
|
||||
#
|
||||
# Entries have the following format:
|
||||
# <type> <owner> <group> <mode> <path> <linksource>
|
||||
# where the items are separated by whitespace !
|
||||
#
|
||||
# The # character introduces a comment lasting until end of line.
|
||||
# Blank lines are ignored.
|
||||
#
|
||||
# <type> : d|f|l|b : (d)irectory|(f)ile|(l)ink|(b)ind
|
||||
#
|
||||
# A linking example:
|
||||
# l root root 0777 /var/test /tmp/testfile
|
||||
# f root root 0644 /var/test none
|
||||
#
|
||||
# Understanding links:
|
||||
# When populate-volatile is to verify/create a directory or file, it will first
|
||||
# check it's existence. If a link is found to exist in the place of the target,
|
||||
# the path of the target is replaced with the target the link points to.
|
||||
# Thus, if a link is in the place to be verified, the object will be created
|
||||
# in the place the link points to instead.
|
||||
# This explains the order of "link before object" as in the example above, where
|
||||
# a link will be created at /var/test pointing to /tmp/testfile and due to this
|
||||
# link the file defined as /var/test will actually be created as /tmp/testfile.
|
||||
d root root 1777 /run/lock none
|
||||
d root root 0755 /var/volatile/log none
|
||||
d root root 1777 /var/volatile/tmp none
|
||||
l root root 1777 /var/lock /run/lock
|
||||
l root root 0755 /var/run /run
|
||||
l root root 1777 /var/tmp /var/volatile/tmp
|
||||
l root root 1777 /tmp /var/tmp
|
||||
d root root 0755 /var/lock/subsys none
|
||||
f root root 0664 /var/log/wtmp none
|
||||
f root root 0664 /var/run/utmp none
|
||||
l root root 0644 /etc/resolv.conf /var/run/resolv.conf
|
||||
f root root 0644 /var/run/resolv.conf none
|
||||
Reference in New Issue
Block a user