Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
18183a020f | |||
d080a0f876 | |||
009ef13a19 | |||
793a262ba7 | |||
9399960b23 | |||
740058e9a8 | |||
03756d0913 | |||
821e832d53 | |||
883dc1b167 | |||
53fef66cbd |
@@ -6,6 +6,7 @@
|
|||||||
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
|
|
||||||
. /etc/profile.d/locale.sh
|
. /etc/profile.d/locale.sh
|
||||||
|
. @RCDIR@/rc.conf
|
||||||
|
|
||||||
# width:
|
# width:
|
||||||
calc_columns () {
|
calc_columns () {
|
||||||
@@ -60,6 +61,14 @@ stat_busy() {
|
|||||||
printf " ${C_OTHER}[${C_BUSY}busy${C_OTHER}]${C_CLEAR} "
|
printf " ${C_OTHER}[${C_BUSY}busy${C_OTHER}]${C_CLEAR} "
|
||||||
}
|
}
|
||||||
|
|
||||||
|
substat() {
|
||||||
|
printf " ${C_OTHER}${PREFIX_REG} ${C_MAIN}${1}${C_CLEAR} \n"
|
||||||
|
}
|
||||||
|
|
||||||
|
ck_verbose() {
|
||||||
|
[[ "$VERBOSE" == "on" ]]
|
||||||
|
}
|
||||||
|
|
||||||
ck_daemon() {
|
ck_daemon() {
|
||||||
[[ ! -f @RCRUNDIR@/started/$1 ]]
|
[[ ! -f @RCRUNDIR@/started/$1 ]]
|
||||||
}
|
}
|
||||||
|
@@ -26,3 +26,8 @@
|
|||||||
# /sys/fs/cgroup in hybrid or legacy mode
|
# /sys/fs/cgroup in hybrid or legacy mode
|
||||||
|
|
||||||
# HAVE_CONTROLLER1_GROUPS="true"
|
# HAVE_CONTROLLER1_GROUPS="true"
|
||||||
|
|
||||||
|
# Verbose mode
|
||||||
|
# Set to "on" to enable details
|
||||||
|
|
||||||
|
# VERBOSE="off"
|
||||||
|
@@ -12,6 +12,7 @@ mount_binfmt(){
|
|||||||
[[ -z "$(ls $path)" ]] && continue
|
[[ -z "$(ls $path)" ]] && continue
|
||||||
grep "^:" $path/* | \
|
grep "^:" $path/* | \
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
|
ck_verbose && substat "Registering $line"
|
||||||
printf "%s" "$line" > /proc/sys/fs/binfmt_misc/register || return 1
|
printf "%s" "$line" > /proc/sys/fs/binfmt_misc/register || return 1
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
# sourcing our current rc.conf requires this to be a bash script
|
# sourcing our current rc.conf requires this to be a bash script
|
||||||
. @RCLIBDIR@/functions
|
. @RCLIBDIR@/functions
|
||||||
. @RCDIR@/rc.conf
|
|
||||||
|
|
||||||
CGROUP_OPTS=nodev,noexec,nosuid
|
CGROUP_OPTS=nodev,noexec,nosuid
|
||||||
HAVE_CONTROLLER1_GROUPS=${HAVE_CONTROLLER1_GROUPS:-true}
|
HAVE_CONTROLLER1_GROUPS=${HAVE_CONTROLLER1_GROUPS:-true}
|
||||||
|
@@ -5,14 +5,18 @@
|
|||||||
|
|
||||||
cleaning(){
|
cleaning(){
|
||||||
install -m0664 -o root -g utmp /dev/null /run/utmp
|
install -m0664 -o root -g utmp /dev/null /run/utmp
|
||||||
|
ck_verbose && substat "Created /run/utmp"
|
||||||
if [ ! -e /var/log/wtmp ]; then
|
if [ ! -e /var/log/wtmp ]; then
|
||||||
install -m0664 -o root -g utmp /dev/null /var/log/wtmp
|
install -m0664 -o root -g utmp /dev/null /var/log/wtmp
|
||||||
|
ck_verbose && substat "Created /var/log/wtmp"
|
||||||
fi
|
fi
|
||||||
if [ ! -e /var/log/btmp ]; then
|
if [ ! -e /var/log/btmp ]; then
|
||||||
install -m0600 -o root -g utmp /dev/null /var/log/btmp
|
install -m0600 -o root -g utmp /dev/null /var/log/btmp
|
||||||
|
ck_verbose && substat "Created /var/log/btmp"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f /etc/nologin /forcefsck /forcequotacheck /fastboot
|
rm -f /etc/nologin /forcefsck /forcequotacheck /fastboot
|
||||||
|
ck_verbose && substat "Removed /etc/nologin, /forcefsck, /forcequotacheck, /fastboot"
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
@@ -7,6 +7,7 @@ config(){
|
|||||||
[ -r /etc/vconsole.conf ] && . /etc/vconsole.conf
|
[ -r /etc/vconsole.conf ] && . /etc/vconsole.conf
|
||||||
TTYS=${TTYS:-6}
|
TTYS=${TTYS:-6}
|
||||||
_index=0
|
_index=0
|
||||||
|
ck_verbose && [ -n "$FONT" ] && substat "Setting font to ${FONT}"
|
||||||
while [ ${_index} -le $TTYS ]; do
|
while [ ${_index} -le $TTYS ]; do
|
||||||
if [ -n "$FONT" ]; then
|
if [ -n "$FONT" ]; then
|
||||||
setfont ${FONT_MAP:+-m $FONT_MAP} ${FONT_UNIMAP:+-u $FONT_UNIMAP} \
|
setfont ${FONT_MAP:+-m $FONT_MAP} ${FONT_UNIMAP:+-u $FONT_UNIMAP} \
|
||||||
@@ -16,6 +17,7 @@ config(){
|
|||||||
_index=$((_index + 1))
|
_index=$((_index + 1))
|
||||||
done
|
done
|
||||||
if [ -n "$KEYMAP" ]; then
|
if [ -n "$KEYMAP" ]; then
|
||||||
|
ck_verbose && substat "Setting keymap to ${KEYMAP}"
|
||||||
loadkeys -q -u ${KEYMAP}
|
loadkeys -q -u ${KEYMAP}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@@ -72,7 +72,7 @@ do_unlock_device() {
|
|||||||
do_unlock() {
|
do_unlock() {
|
||||||
local name=$1 device=$2 password=$3 options=$4
|
local name=$1 device=$2 password=$3 options=$4
|
||||||
|
|
||||||
printf "${C_MAIN}Unlocking $1${C_CLEAR}\n"
|
substat "Unlocking $1"
|
||||||
|
|
||||||
if [[ ${options:0:2} =~ -. ]]; then
|
if [[ ${options:0:2} =~ -. ]]; then
|
||||||
do_unlock_device "$name" "$device" "$password" "$options"
|
do_unlock_device "$name" "$device" "$password" "$options"
|
||||||
@@ -80,7 +80,6 @@ do_unlock() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
do_unlock_device "$name" "$device" "$password" "$options"
|
do_unlock_device "$name" "$device" "$password" "$options"
|
||||||
esac
|
|
||||||
failed=$?
|
failed=$?
|
||||||
if (( $failed )); then
|
if (( $failed )); then
|
||||||
printf "${C_FAIL}Unlocking of $1 failed.${C_CLEAR}\n"
|
printf "${C_FAIL}Unlocking of $1 failed.${C_CLEAR}\n"
|
||||||
|
@@ -4,10 +4,14 @@
|
|||||||
. @RCLIBDIR@/functions
|
. @RCLIBDIR@/functions
|
||||||
|
|
||||||
mount_devfs(){
|
mount_devfs(){
|
||||||
|
ck_verbose && substat "Mounting /dev"
|
||||||
mountpoint -q /dev || mount -t devtmpfs dev /dev -o mode=0755,nosuid
|
mountpoint -q /dev || mount -t devtmpfs dev /dev -o mode=0755,nosuid
|
||||||
mkdir -p /dev/{pts,shm}
|
mkdir -p /dev/{pts,shm}
|
||||||
|
ck_verbose && substat "Mounting /dev/pts"
|
||||||
mountpoint -q /dev/pts || mount -t devpts devpts /dev/pts -o mode=0620,gid=5,nosuid,noexec
|
mountpoint -q /dev/pts || mount -t devpts devpts /dev/pts -o mode=0620,gid=5,nosuid,noexec
|
||||||
|
ck_verbose && substat "Mounting /dev/shm"
|
||||||
mountpoint -q /dev/shm || mount -t tmpfs shm /dev/shm -o mode=1777,nosuid,nodev
|
mountpoint -q /dev/shm || mount -t tmpfs shm /dev/shm -o mode=1777,nosuid,nodev
|
||||||
|
ck_verbose && substat "Mounting /run"
|
||||||
mountpoint -q /run || mount -t tmpfs run /run -o mode=0755,nosuid,nodev
|
mountpoint -q /run || mount -t tmpfs run /run -o mode=0755,nosuid,nodev
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,6 +7,8 @@ config(){
|
|||||||
if [[ -e /proc/sys/kernel/dmesg_restrict ]] &&
|
if [[ -e /proc/sys/kernel/dmesg_restrict ]] &&
|
||||||
(( $(< /proc/sys/kernel/dmesg_restrict) == 1 )); then
|
(( $(< /proc/sys/kernel/dmesg_restrict) == 1 )); then
|
||||||
install -Tm 0600 <( dmesg ) /var/log/dmesg.log
|
install -Tm 0600 <( dmesg ) /var/log/dmesg.log
|
||||||
|
ck_verbose && substat "dmesg_restrict is enabled"
|
||||||
|
ck_verbose && substat "dmesg log can only be read by root"
|
||||||
else
|
else
|
||||||
install -Tm 0644 <( dmesg ) /var/log/dmesg.log
|
install -Tm 0644 <( dmesg ) /var/log/dmesg.log
|
||||||
fi
|
fi
|
||||||
|
@@ -17,7 +17,7 @@ config(){
|
|||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
stat_busy "Starting hostname"
|
stat_busy "Setting hostname to $HOSTNAME"
|
||||||
config
|
config
|
||||||
add_daemon hostname
|
add_daemon hostname
|
||||||
stat_done
|
stat_done
|
||||||
|
@@ -13,13 +13,13 @@ esac
|
|||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
stat_busy "Adjusting hwclock"
|
stat_busy "Adjusting hwclock to ${HARDWARECLOCK}"
|
||||||
hwclock $HWCLOCK_PARAMS || stat_die
|
hwclock $HWCLOCK_PARAMS || stat_die
|
||||||
add_daemon hwclock
|
add_daemon hwclock
|
||||||
stat_done
|
stat_done
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
stat_busy "Adjusting hwclock"
|
stat_busy "Adjusting hwclock to ${HARDWARECLOCK}"
|
||||||
hwclock --adjust $HWCLOCK_PARAMS || stat_die
|
hwclock --adjust $HWCLOCK_PARAMS || stat_die
|
||||||
rm_daemon hwclock
|
rm_daemon hwclock
|
||||||
stat_done
|
stat_done
|
||||||
|
@@ -6,10 +6,13 @@
|
|||||||
# Check local filesystems
|
# Check local filesystems
|
||||||
fsck_all() {
|
fsck_all() {
|
||||||
if [[ -f /forcefsck ]] || in_array forcefsck $(< /proc/cmdline); then
|
if [[ -f /forcefsck ]] || in_array forcefsck $(< /proc/cmdline); then
|
||||||
|
ck_verbose && substat "/forcefsck found, forcing fsck"
|
||||||
FORCEFSCK="-f"
|
FORCEFSCK="-f"
|
||||||
elif [[ -f /fastboot ]] || in_array fastboot $(< /proc/cmdline); then
|
elif [[ -f /fastboot ]] || in_array fastboot $(< /proc/cmdline); then
|
||||||
|
ck_verbose && substat "/fastboot found, canceling fsck"
|
||||||
return 0
|
return 0
|
||||||
elif [[ -e /run/initramfs/root-fsck ]]; then
|
elif [[ -e /run/initramfs/root-fsck ]]; then
|
||||||
|
ck_verbose && substat "Ignoring mounted filesystems in fsck"
|
||||||
IGNORE_MOUNTED="-M"
|
IGNORE_MOUNTED="-M"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -44,7 +47,7 @@ fsck_reboot() {
|
|||||||
echo
|
echo
|
||||||
sulogin -p
|
sulogin -p
|
||||||
fi
|
fi
|
||||||
echo "Automatic reboot in progress..."
|
echo "Automatic reboot in progress"
|
||||||
umount -a
|
umount -a
|
||||||
mount -o remount,ro /
|
mount -o remount,ro /
|
||||||
reboot -f
|
reboot -f
|
||||||
@@ -62,8 +65,10 @@ do_fsck(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
kill_all(){
|
kill_all(){
|
||||||
|
ck_verbose && substat "Killing processes using SIGTERM"
|
||||||
pkill --inverse -s0,1 -TERM
|
pkill --inverse -s0,1 -TERM
|
||||||
sleep 1
|
sleep 1
|
||||||
|
ck_verbose && substat "Killing processes using SIGKILL"
|
||||||
pkill --inverse -s0,1 -KILL
|
pkill --inverse -s0,1 -KILL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3,10 +3,12 @@
|
|||||||
# sourcing our current rc.conf requires this to be a bash script
|
# sourcing our current rc.conf requires this to be a bash script
|
||||||
. @RCLIBDIR@/functions
|
. @RCLIBDIR@/functions
|
||||||
|
|
||||||
|
ck_verbose && MOUNT_VERBOSE="-v"
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
stat_busy "Starting mount-all"
|
stat_busy "Starting mount-all"
|
||||||
mount -a -t "no${NETFS//,/,no}" -O no_netdev || stat_die mount-all
|
mount -a "${MOUNT_VERBOSE}" -t "no${NETFS//,/,no}" -O no_netdev || stat_die mount-all
|
||||||
add_daemon mount-all
|
add_daemon mount-all
|
||||||
stat_done mount-all
|
stat_done mount-all
|
||||||
;;
|
;;
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
stat_busy "Starting net-lo"
|
stat_busy "Setting up loopback interface"
|
||||||
ip link set up dev lo || stat_die
|
ip link set up dev lo || stat_die
|
||||||
add_daemon net-lo
|
add_daemon net-lo
|
||||||
stat_done
|
stat_done
|
||||||
|
10
sv.d/root.in
10
sv.d/root.in
@@ -36,7 +36,15 @@ umount_fs() {
|
|||||||
mounts=("$target" "${mounts[@]}")
|
mounts=("$target" "${mounts[@]}")
|
||||||
done
|
done
|
||||||
|
|
||||||
if (( ${#mounts[*]} )); then
|
# There are differences between verbose and non-verbose method
|
||||||
|
# because iterating the array is considerably slower than the
|
||||||
|
# non-verbose method
|
||||||
|
if (( ${#mounts[*]} )) && ck_verbose; then
|
||||||
|
for ((i=0; i<${#mounts[*]}; i++)); do
|
||||||
|
substat "Unmounting ${mounts[i]}"
|
||||||
|
umount -r "${mounts[i]}" || return 1
|
||||||
|
done
|
||||||
|
elif (( ${#mounts[*]} )); then
|
||||||
umount -r "${mounts[@]}" || return 1
|
umount -r "${mounts[@]}" || return 1
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
|
@@ -3,16 +3,18 @@
|
|||||||
# sourcing our current rc.conf requires this to be a bash script
|
# sourcing our current rc.conf requires this to be a bash script
|
||||||
. @RCLIBDIR@/functions
|
. @RCLIBDIR@/functions
|
||||||
|
|
||||||
|
ck_verbose && SWAP_VERBOSE="-v"
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
stat_busy "Activating swap"
|
stat_busy "Activating swap"
|
||||||
swapon -a || stat_die swap
|
swapon -a "${SWAP_VERBOSE}" || stat_die swap
|
||||||
add_daemon swap
|
add_daemon swap
|
||||||
stat_done swap
|
stat_done swap
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
stat_busy "Deactivating swap"
|
stat_busy "Deactivating swap"
|
||||||
swapoff -a || stat_die swap
|
swapoff -a "${SWAP_VERBOSE}" || stat_die swap
|
||||||
rm_daemon swap
|
rm_daemon swap
|
||||||
stat_done swap
|
stat_done swap
|
||||||
;;
|
;;
|
||||||
|
@@ -3,10 +3,12 @@
|
|||||||
# sourcing our current rc.conf requires this to be a bash script
|
# sourcing our current rc.conf requires this to be a bash script
|
||||||
. @RCLIBDIR@/functions
|
. @RCLIBDIR@/functions
|
||||||
|
|
||||||
|
! ck_verbose && QUIET="-q"
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
stat_busy "Loading sysctl settings"
|
stat_busy "Loading sysctl settings"
|
||||||
sysctl --system || stat_die sysctl
|
sysctl "$QUIET" --system || stat_die sysctl
|
||||||
add_daemon sysctl
|
add_daemon sysctl
|
||||||
stat_done sysctl
|
stat_done sysctl
|
||||||
;;
|
;;
|
||||||
|
@@ -4,9 +4,14 @@
|
|||||||
. @RCLIBDIR@/functions
|
. @RCLIBDIR@/functions
|
||||||
|
|
||||||
mount_sysfs(){
|
mount_sysfs(){
|
||||||
|
ck_verbose && substat "Mounting /sys"
|
||||||
mountpoint -q /sys || mount -t sysfs sys /sys -o nosuid,noexec,nodev
|
mountpoint -q /sys || mount -t sysfs sys /sys -o nosuid,noexec,nodev
|
||||||
|
ck_verbose && substat "Mounting /sys/kernel/security"
|
||||||
mountpoint -q /sys/kernel/security || mount -n -t securityfs securityfs /sys/kernel/security
|
mountpoint -q /sys/kernel/security || mount -n -t securityfs securityfs /sys/kernel/security
|
||||||
[ -d /sys/firmware/efi ] && (mountpoint -q /sys/firmware/efi/efivars || mount -n -t efivarfs -o ro efivarfs /sys/firmware/efi/efivars)
|
if [ -d /sys/firmware/efi ]; then
|
||||||
|
ck_verbose && substat "Mounting /sys/firmware/efi"
|
||||||
|
(mountpoint -q /sys/firmware/efi/efivars || mount -n -t efivarfs -o ro efivarfs /sys/firmware/efi/efivars)
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
Reference in New Issue
Block a user