Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
319d05e43c |
93
Makefile
93
Makefile
@@ -16,34 +16,23 @@ RCBIN = \
|
|||||||
script/modules-load
|
script/modules-load
|
||||||
|
|
||||||
RCSVD = \
|
RCSVD = \
|
||||||
sv.d/root \
|
sv.d/binfmt \
|
||||||
sv.d/binfmt \
|
sv.d/cgroups \
|
||||||
sv.d/binfmt.d \
|
sv.d/cleanup \
|
||||||
sv.d/bootlogd \
|
sv.d/console-setup \
|
||||||
sv.d/cleanup \
|
sv.d/fsck \
|
||||||
sv.d/console-setup \
|
sv.d/hostname \
|
||||||
sv.d/dmesg \
|
sv.d/hwclock \
|
||||||
sv.d/hostname \
|
sv.d/kmod-static-nodes \
|
||||||
sv.d/hwclock \
|
sv.d/modules \
|
||||||
sv.d/kmod-static-nodes \
|
sv.d/mount-fs \
|
||||||
sv.d/misc \
|
sv.d/net-lo \
|
||||||
sv.d/mount-all \
|
sv.d/pseudofs \
|
||||||
sv.d/net-lo \
|
sv.d/random-seed \
|
||||||
sv.d/random-seed \
|
sv.d/swap \
|
||||||
sv.d/remount-root \
|
sv.d/sysctl \
|
||||||
sv.d/swap \
|
sv.d/tmpfiles-dev \
|
||||||
sv.d/sysctl \
|
sv.d/udev
|
||||||
sv.d/sysusers \
|
|
||||||
sv.d/tmpfiles-dev \
|
|
||||||
sv.d/tmpfiles-setup \
|
|
||||||
sv.d/udev \
|
|
||||||
sv.d/udev-trigger \
|
|
||||||
sv.d/udev-settle \
|
|
||||||
sv.d/modules \
|
|
||||||
sv.d/sysfs \
|
|
||||||
sv.d/devfs \
|
|
||||||
sv.d/procfs \
|
|
||||||
sv.d/cgroups
|
|
||||||
|
|
||||||
# SYSINIT = \
|
# SYSINIT = \
|
||||||
# 01-sysfs \
|
# 01-sysfs \
|
||||||
@@ -131,44 +120,32 @@ install-rc:
|
|||||||
|
|
||||||
install -d $(DESTDIR)$(RCDIR)/sysinit
|
install -d $(DESTDIR)$(RCDIR)/sysinit
|
||||||
|
|
||||||
$(LN) $(RCSVDIR)/sysfs $(DESTDIR)$(RCDIR)/sysinit/01-sysfs
|
$(LN) $(RCSVDIR)/pseudofs $(DESTDIR)$(RCDIR)/sysinit/01-pseudofs
|
||||||
$(LN) $(RCSVDIR)/procfs $(DESTDIR)$(RCDIR)/sysinit/02-procfs
|
$(LN) $(RCSVDIR)/cgroups $(DESTDIR)$(RCDIR)/sysinit/02-cgroups
|
||||||
$(LN) $(RCSVDIR)/devfs $(DESTDIR)$(RCDIR)/sysinit/03-devfs
|
$(LN) $(RCSVDIR)/kmod-static-nodes $(DESTDIR)$(RCDIR)/sysinit/03-kmod-static-nodes
|
||||||
$(LN) $(RCSVDIR)/cgroups $(DESTDIR)$(RCDIR)/sysinit/04-cgroups
|
$(LN) $(RCSVDIR)/modules $(DESTDIR)$(RCDIR)/sysinit/04-modules
|
||||||
$(LN) $(RCSVDIR)/root $(DESTDIR)$(RCDIR)/sysinit/05-root
|
$(LN) $(RCSVDIR)/tmpfiles-dev $(DESTDIR)$(RCDIR)/sysinit/05-tmpfiles-dev
|
||||||
$(LN) $(RCSVDIR)/hostname $(DESTDIR)$(RCDIR)/sysinit/10-hostname
|
$(LN) $(RCSVDIR)/udev $(DESTDIR)$(RCDIR)/sysinit/06-udev
|
||||||
|
$(LN) $(RCSVDIR)/console-setup $(DESTDIR)$(RCDIR)/sysinit/10-console-setup
|
||||||
$(LN) $(RCSVDIR)/hwclock $(DESTDIR)$(RCDIR)/sysinit/15-hwclock
|
$(LN) $(RCSVDIR)/hwclock $(DESTDIR)$(RCDIR)/sysinit/15-hwclock
|
||||||
$(LN) $(RCSVDIR)/kmod-static-nodes $(DESTDIR)$(RCDIR)/sysinit/20-kmod-static-nodes
|
$(LN) $(RCSVDIR)/fsck $(DESTDIR)$(RCDIR)/sysinit/20-fsck
|
||||||
$(LN) $(RCSVDIR)/tmpfiles-dev $(DESTDIR)$(RCDIR)/sysinit/25-tmpfiles-dev
|
$(LN) $(RCSVDIR)/mount-fs $(DESTDIR)$(RCDIR)/sysinit/30-mount-fs
|
||||||
$(LN) $(RCSVDIR)/udev $(DESTDIR)$(RCDIR)/sysinit/30-udev
|
$(LN) $(RCSVDIR)/swap $(DESTDIR)$(RCDIR)/sysinit/31-swap
|
||||||
$(LN) $(RCSVDIR)/udev-trigger $(DESTDIR)$(RCDIR)/sysinit/31-udev-trigger
|
$(LN) $(RCSVDIR)/random-seed $(DESTDIR)$(RCDIR)/sysinit/40-modules
|
||||||
$(LN) $(RCSVDIR)/modules $(DESTDIR)$(RCDIR)/sysinit/32-modules
|
$(LN) $(RCSVDIR)/net-lo $(DESTDIR)$(RCDIR)/sysinit/41-net-lo
|
||||||
$(LN) $(RCSVDIR)/udev-settle $(DESTDIR)$(RCDIR)/sysinit/33-udev-settle
|
$(LN) $(RCSVDIR)/hostname $(DESTDIR)$(RCDIR)/sysinit/42-hostname
|
||||||
$(LN) $(RCSVDIR)/console-setup $(DESTDIR)$(RCDIR)/sysinit/40-console-setup
|
$(LN) $(RCSVDIR)/sysctl $(DESTDIR)$(RCDIR)/sysinit/55-sysctl
|
||||||
$(LN) $(RCSVDIR)/net-lo $(DESTDIR)$(RCDIR)/sysinit/45-net-lo
|
$(LN) $(RCSVDIR)/binfmt $(DESTDIR)$(RCDIR)/sysinit/90-binfmt
|
||||||
$(LN) $(RCSVDIR)/misc $(DESTDIR)$(RCDIR)/sysinit/50-misc
|
|
||||||
$(LN) $(RCSVDIR)/remount-root $(DESTDIR)$(RCDIR)/sysinit/55-remount-root
|
|
||||||
$(LN) $(RCSVDIR)/mount-all $(DESTDIR)$(RCDIR)/sysinit/60-mount-all
|
|
||||||
$(LN) $(RCSVDIR)/swap $(DESTDIR)$(RCDIR)/sysinit/65-swap
|
|
||||||
$(LN) $(RCSVDIR)/random-seed $(DESTDIR)$(RCDIR)/sysinit/70-random-seed
|
|
||||||
$(LN) $(RCSVDIR)/tmpfiles-setup $(DESTDIR)$(RCDIR)/sysinit/75-tmpfiles-setup
|
|
||||||
$(LN) $(RCSVDIR)/sysusers $(DESTDIR)$(RCDIR)/sysinit/80-sysusers
|
|
||||||
$(LN) $(RCSVDIR)/dmesg $(DESTDIR)$(RCDIR)/sysinit/85-dmesg
|
|
||||||
$(LN) $(RCSVDIR)/sysctl $(DESTDIR)$(RCDIR)/sysinit/90-sysctl
|
|
||||||
$(LN) $(RCSVDIR)/binfmt $(DESTDIR)$(RCDIR)/sysinit/95-binfmt
|
|
||||||
$(LN) $(RCSVDIR)/binfmt.d $(DESTDIR)$(RCDIR)/sysinit/97-binfmt.d
|
|
||||||
$(LN) $(RCSVDIR)/cleanup $(DESTDIR)$(RCDIR)/sysinit/99-cleanup
|
$(LN) $(RCSVDIR)/cleanup $(DESTDIR)$(RCDIR)/sysinit/99-cleanup
|
||||||
|
|
||||||
install -d $(DESTDIR)$(RCDIR)/shutdown
|
install -d $(DESTDIR)$(RCDIR)/shutdown
|
||||||
|
|
||||||
$(LN) $(RCSVDIR)/random-seed $(DESTDIR)$(RCDIR)/shutdown/10-random-seed
|
$(LN) $(RCSVDIR)/random-seed $(DESTDIR)$(RCDIR)/shutdown/10-random-seed
|
||||||
$(LN) $(RCSVDIR)/cleanup $(DESTDIR)$(RCDIR)/shutdown/20-cleanup
|
$(LN) $(RCSVDIR)/hwclock $(DESTDIR)$(RCDIR)/shutdown/15-hwclock
|
||||||
$(LN) $(RCSVDIR)/udev $(DESTDIR)$(RCDIR)/shutdown/30-udev
|
$(LN) $(RCSVDIR)/udev $(DESTDIR)$(RCDIR)/shutdown/30-udev
|
||||||
$(LN) $(RCSVDIR)/hwclock $(DESTDIR)$(RCDIR)/shutdown/35-hwclock
|
$(LN) $(RCSVDIR)/cleanup $(DESTDIR)$(RCDIR)/shutdown/20-cleanup
|
||||||
$(LN) $(RCSVDIR)/misc $(DESTDIR)$(RCDIR)/shutdown/40-misc
|
|
||||||
$(LN) $(RCSVDIR)/swap $(DESTDIR)$(RCDIR)/shutdown/50-swap
|
$(LN) $(RCSVDIR)/swap $(DESTDIR)$(RCDIR)/shutdown/50-swap
|
||||||
$(LN) $(RCSVDIR)/root $(DESTDIR)$(RCDIR)/shutdown/60-root
|
$(LN) $(RCSVDIR)/mount-fs $(DESTDIR)$(RCDIR)/shutdown/60-mount-fs
|
||||||
$(LN) $(RCSVDIR)/remount-root $(DESTDIR)$(RCDIR)/shutdown/70-remount-root
|
|
||||||
|
|
||||||
install -d $(DESTDIR)$(MANDIR)/man8
|
install -d $(DESTDIR)$(MANDIR)/man8
|
||||||
install -m644 script/modules-load.8 $(DESTDIR)$(MANDIR)/man8
|
install -m644 script/modules-load.8 $(DESTDIR)$(MANDIR)/man8
|
||||||
|
@@ -1,18 +1,18 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# This is run by the kernel after the last task is removed from a
|
# This is run by the kernel after the last task is removed from a
|
||||||
# control group in the artix hierarchy.
|
# control group in the openrc hierarchy.
|
||||||
|
|
||||||
# Copyright (c) 2007-2015 The OpenRC Authors.
|
# Copyright (c) 2007-2015 The OpenRC Authors.
|
||||||
# See the Authors file at the top-level directory of this distribution and
|
# See the Authors file at the top-level directory of this distribution and
|
||||||
# https://github.com/OpenRC/artix/blob/master/AUTHORS
|
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
|
||||||
#
|
#
|
||||||
# This file is part of OpenRC. It is subject to the license terms in
|
# This file is part of OpenRC. It is subject to the license terms in
|
||||||
# the LICENSE file found in the top-level directory of this
|
# the LICENSE file found in the top-level directory of this
|
||||||
# distribution and at https://github.com/OpenRC/artix/blob/master/LICENSE
|
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
|
||||||
# This file may not be copied, modified, propagated, or distributed
|
# This file may not be copied, modified, propagated, or distributed
|
||||||
# except according to the terms contained in the LICENSE file.
|
# except according to the terms contained in the LICENSE file.
|
||||||
|
|
||||||
cgroup=/sys/fs/cgroup/artix
|
cgroup=/sys/fs/cgroup/openrc
|
||||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||||
if [ -d ${cgroup}/"$1" ]; then
|
if [ -d ${cgroup}/"$1" ]; then
|
||||||
rmdir ${cgroup}/"$1"
|
rmdir ${cgroup}/"$1"
|
||||||
|
@@ -201,11 +201,7 @@ run_shutdown(){
|
|||||||
calc_columns
|
calc_columns
|
||||||
|
|
||||||
# disable colors on broken terminals
|
# disable colors on broken terminals
|
||||||
if [[ -z "$TERM" || "$TERM" = "dumb" ]]; then
|
TERM_COLORS=$(tput colors 2>/dev/null)
|
||||||
TERM_COLORS=$(tput colors -T linux 2>/dev/null)
|
|
||||||
else
|
|
||||||
TERM_COLORS=$(tput colors 2>/dev/null)
|
|
||||||
fi
|
|
||||||
if (( $? != 3 )); then
|
if (( $? != 3 )); then
|
||||||
case $TERM_COLORS in
|
case $TERM_COLORS in
|
||||||
*[!0-9]*) USECOLOR="";;
|
*[!0-9]*) USECOLOR="";;
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
# "hybrid" mounts cgroups version 2 on /sys/fs/cgroup/unified and
|
# "hybrid" mounts cgroups version 2 on /sys/fs/cgroup/unified and
|
||||||
# cgroups version 1 on /sys/fs/cgroup
|
# cgroups version 1 on /sys/fs/cgroup
|
||||||
|
|
||||||
# CGROUP_MODE="unified"
|
# CGROUP_MODE="hybrid"
|
||||||
|
|
||||||
# This is a list of controllers which should be enabled for cgroups version 2.
|
# This is a list of controllers which should be enabled for cgroups version 2.
|
||||||
# If hybrid mode is being used, controllers listed here will not be
|
# If hybrid mode is being used, controllers listed here will not be
|
||||||
@@ -26,9 +26,3 @@
|
|||||||
# /sys/fs/cgroup in hybrid or legacy mode
|
# /sys/fs/cgroup in hybrid or legacy mode
|
||||||
|
|
||||||
# HAVE_CONTROLLER1_GROUPS="true"
|
# HAVE_CONTROLLER1_GROUPS="true"
|
||||||
|
|
||||||
# This switch controls whether or not /tmp will be cleaned.
|
|
||||||
# /tmp will only be cleaned if it is set to "y". Generally it is recommended to
|
|
||||||
# mount /tmp as tmpfs.
|
|
||||||
|
|
||||||
# CLEANTMP="n"
|
|
||||||
|
@@ -1,17 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# sourcing our current rc.conf requires this to be a bash script
|
|
||||||
. @RCLIBDIR@/functions
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
stat_busy "Running binfmt.d"
|
|
||||||
/usr/lib/artix/binfmt.sh || stat_die binfmt.d
|
|
||||||
add_daemon binfmt.d
|
|
||||||
stat_done binfmt.d
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "usage: $0 {start|once}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
@@ -7,16 +7,10 @@ mount_binfmt(){
|
|||||||
mountpoint -q /proc/sys/fs/binfmt_misc || \
|
mountpoint -q /proc/sys/fs/binfmt_misc || \
|
||||||
mount -t binfmt_misc binfmt /proc/sys/fs/binfmt_misc || return 1
|
mount -t binfmt_misc binfmt /proc/sys/fs/binfmt_misc || return 1
|
||||||
|
|
||||||
for files in /proc/sys/fs/binfmt_misc/*; do
|
|
||||||
[ "$files" = /proc/sys/fs/binfmt_misc/register ] && continue
|
|
||||||
[ "$files" = /proc/sys/fs/binfmt_misc/status ] && continue
|
|
||||||
echo -1 > "$files"
|
|
||||||
done
|
|
||||||
|
|
||||||
for path in /usr/lib/binfmt.d /etc/binfmt.d /run/binfmt.d; do
|
for path in /usr/lib/binfmt.d /etc/binfmt.d /run/binfmt.d; do
|
||||||
[[ ! -d $path ]] && continue
|
[[ ! -d $path ]] && continue
|
||||||
[[ -z "$(ls $path)" ]] && continue
|
[[ -z "$(ls $path)" ]] && continue
|
||||||
grep -h "^:" $path/* | \
|
grep "^:" $path/* | \
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
printf "%s" "$line" > /proc/sys/fs/binfmt_misc/register || return 1
|
printf "%s" "$line" > /proc/sys/fs/binfmt_misc/register || return 1
|
||||||
done
|
done
|
||||||
@@ -33,13 +27,8 @@ case "$1" in
|
|||||||
add_daemon binfmt
|
add_daemon binfmt
|
||||||
stat_done binfmt
|
stat_done binfmt
|
||||||
;;
|
;;
|
||||||
once)
|
|
||||||
stat_busy "Running binfmt"
|
|
||||||
mount_binfmt || stat_die binfmt
|
|
||||||
stat_done
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
echo "usage: $0 {start|once}"
|
echo "usage: $0 {start}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@@ -1,34 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# sourcing our current rc.conf requires this to be a bash script
|
|
||||||
. @RCLIBDIR@/functions
|
|
||||||
|
|
||||||
start_bootlogd(){
|
|
||||||
bootlogd -p /run/bootlogd.pid -l /var/log/boot.log || return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
stop_bootlogd(){
|
|
||||||
[[ -f /run/bootlogd.pid ]] || return 0
|
|
||||||
touch /var/log/boot.log
|
|
||||||
kill $(< /run/bootlogd.pid)
|
|
||||||
rm -f /run/bootlogd.pid
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
stat_busy "Starting bootlogd"
|
|
||||||
start_bootlogd || stat_die bootlogd
|
|
||||||
add_daemon bootlogd
|
|
||||||
stat_done bootlogd
|
|
||||||
;;
|
|
||||||
stop)
|
|
||||||
stat_busy "Stopping bootlogd"
|
|
||||||
stop_bootlogd || stat_die bootlogd
|
|
||||||
rm_daemon bootlogd
|
|
||||||
stat_done bootlogd
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "usage: $0 {start|stop}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
@@ -1,12 +1,72 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# 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
|
||||||
|
HAVE_CONTROLLER1_GROUPS=${HAVE_CONTROLLER1_GROUPS:-true}
|
||||||
|
CGROUP_MODE=${CGROUP_MODE:-hybrid}
|
||||||
|
CGROUP_CONTROLLERS=""
|
||||||
|
|
||||||
|
cgroup2_find_path(){
|
||||||
|
if grep -qw cgroup2 /proc/filesystems; then
|
||||||
|
case "${CGROUP_MODE}" in
|
||||||
|
hybrid) printf "/sys/fs/cgroup/unified" ;;
|
||||||
|
unified) printf "/sys/fs/cgroup" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
cgroup1_base(){
|
||||||
|
grep -qw cgroup /proc/filesystems || return 0
|
||||||
|
if ! mountpoint -q /sys/fs/cgroup; then
|
||||||
|
local opts="${CGROUP_OPTS},mode=755,size=${rc_cgroupsize:-10m}"
|
||||||
|
mount -n -t tmpfs -o "${opts}" cgroup_root /sys/fs/cgroup
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! mountpoint -q /sys/fs/cgroup/openrc; then
|
||||||
|
local agent="@RCLIBDIR@/cgroup-release-agent"
|
||||||
|
mkdir /sys/fs/cgroup/openrc
|
||||||
|
mount -n -t cgroup -o none,${CGROUP_OPTS},name=openrc,release_agent="$agent" openrc /sys/fs/cgroup/openrc
|
||||||
|
printf 1 > /sys/fs/cgroup/openrc/notify_on_release
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
cgroup1_controllers(){
|
||||||
|
...skipping...
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
cgroups_unified(){
|
||||||
|
cgroup2_base
|
||||||
|
cgroup2_controllers
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
mount_cgroups(){
|
||||||
|
case "${CGROUP_MODE}" in
|
||||||
|
hybrid) cgroups_hybrid ;;
|
||||||
|
legacy) cgroups_legacy ;;
|
||||||
|
unified) cgroups_unified ;;
|
||||||
|
esac
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
mount_cgs(){
|
||||||
|
if [ -d /sys/fs/cgroup ];then
|
||||||
|
mount_cgroups
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
stat_busy "Mounting cgroups filesystem"
|
stat_busy "Mounting cgroups filesystem"
|
||||||
/usr/lib/artix/mount-cgroups.sh|| stat_die cgroups
|
mount_cgs || stat_die cgroups
|
||||||
add_daemon cgroups
|
add_daemon cgroups
|
||||||
stat_done cgroups
|
stat_done cgroups
|
||||||
;;
|
;;
|
||||||
|
@@ -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
|
|
||||||
|
|
||||||
cleaning(){
|
cleaning(){
|
||||||
install -m0664 -o root -g utmp /dev/null /run/utmp
|
install -m0664 -o root -g utmp /dev/null /run/utmp
|
||||||
@@ -14,20 +13,24 @@ cleaning(){
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f /etc/nologin /forcefsck /forcequotacheck /fastboot
|
rm -f /etc/nologin /forcefsck /forcequotacheck /fastboot
|
||||||
|
|
||||||
[ "$CLEANTMP" = y ] && rm -rf /tmp/*
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
stat_busy "Starting cleanup"
|
stat_busy "Cleaning up"
|
||||||
cleaning
|
cleaning
|
||||||
add_daemon cleanup
|
add_daemon cleanup
|
||||||
stat_done
|
stat_done
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
stat_busy "Stopping cleanup"
|
halt -w # Well, this actually does nothing.
|
||||||
halt -w || stat_die
|
stat_busy "Sending TERM signal to processes"
|
||||||
|
pkill --inverse -s0,1 -TERM
|
||||||
|
sleep 1
|
||||||
|
stat_done
|
||||||
|
stat_busy "Sending KILL signal to processes"
|
||||||
|
pkill --inverse -s0,1 -KILL
|
||||||
|
sleep 1
|
||||||
rm_daemon cleanup
|
rm_daemon cleanup
|
||||||
stat_done
|
stat_done
|
||||||
;;
|
;;
|
||||||
|
@@ -22,7 +22,7 @@ config(){
|
|||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
stat_busy "Starting console-setup"
|
stat_busy "Setting up console fonts and keymaps"
|
||||||
config
|
config
|
||||||
add_daemon console-setup
|
add_daemon console-setup
|
||||||
stat_done
|
stat_done
|
||||||
@@ -32,3 +32,4 @@ case "$1" in
|
|||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. @RCLIBDIR@/functions
|
. @RCLIBDIR@/functions
|
||||||
|
|
||||||
do_unlock_device() {
|
do_unlock_device() {
|
||||||
# $1 = requested name
|
# $1 = requested name
|
||||||
# $2 = source device
|
# $2 = source device
|
||||||
@@ -17,7 +16,7 @@ do_unlock_device() {
|
|||||||
b=$1
|
b=$1
|
||||||
else
|
else
|
||||||
printhl "Non-LUKS partitions are not supported at the moment."
|
printhl "Non-LUKS partitions are not supported at the moment."
|
||||||
continue
|
return 1
|
||||||
fi
|
fi
|
||||||
if [[ $4 ]]; then
|
if [[ $4 ]]; then
|
||||||
for i in ${4//,/ }; do
|
for i in ${4//,/ }; do
|
||||||
@@ -29,9 +28,10 @@ do_unlock_device() {
|
|||||||
"keyfile-offset"*) opts+="--keyfile-offset ${i##*=}" ;;
|
"keyfile-offset"*) opts+="--keyfile-offset ${i##*=}" ;;
|
||||||
"key-slot"*) opts+="-S ${i##*=}" ;;
|
"key-slot"*) opts+="-S ${i##*=}" ;;
|
||||||
*)
|
*)
|
||||||
printhl "The option is not currently supported at the moment."
|
printhl "The option '${i%%=*}' is not currently supported at the moment."
|
||||||
|
printhl "Partition '$2' cannot be unlocked."
|
||||||
printhl "Please add an issue to https://github.com/artix-linux/runit-rc"
|
printhl "Please add an issue to https://github.com/artix-linux/runit-rc"
|
||||||
continue
|
return 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@@ -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"
|
||||||
@@ -90,7 +89,9 @@ do_unlock() {
|
|||||||
|
|
||||||
do_lock() {
|
do_lock() {
|
||||||
#status "Detaching encrypted device ${1}"
|
#status "Detaching encrypted device ${1}"
|
||||||
cryptsetup luksClose "$1" >/dev/null
|
for v in $(dmsetup ls --target crypt --exec "dmsetup info -c --noheadings -o open,name"); do
|
||||||
|
[ ${v%%:*} = "0" ] && cryptsetup --debug close ${v##*:}
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
read_crypttab() {
|
read_crypttab() {
|
||||||
@@ -113,16 +114,24 @@ case "$1" in
|
|||||||
stat_busy "Starting encrypted devices"
|
stat_busy "Starting encrypted devices"
|
||||||
read_crypttab do_unlock
|
read_crypttab do_unlock
|
||||||
rc=$?
|
rc=$?
|
||||||
vgchange --sysinit -a y >/dev/null
|
# [[ -f /run/sv.d/started/lvm2 ]] && vgchange --sysinit -a y >/dev/null
|
||||||
|
# Using the above, $? will return >0, which results in stat_die.
|
||||||
|
if [[ -f /run/sv.d/started/lvm2 ]]; then
|
||||||
|
vgchange --sysinit -a y >/dev/null
|
||||||
|
fi
|
||||||
(( rc || $? )) && stat_die
|
(( rc || $? )) && stat_die
|
||||||
add_daemon cryptsetup
|
add_daemon cryptsetup
|
||||||
stat_done
|
stat_done
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
stat_busy "Stopping encrypted devices"
|
stat_busy "Stopping encrypted devices"
|
||||||
vgchange --sysinit -a n &>/dev/null
|
#[[ -f /run/sv.d/started/lvm2 ]] && vgchange --sysinit -a n &>/dev/null
|
||||||
|
# Using the above, $? will return >0, which results in stat_die.
|
||||||
|
if [[ -f /run/sv.d/started/lvm2 ]]; then
|
||||||
|
vgchange --sysinit -a y >/dev/null
|
||||||
|
fi
|
||||||
rc=$?
|
rc=$?
|
||||||
read_crypttab do_lock
|
do_lock
|
||||||
(( rc || $? )) && stat_die
|
(( rc || $? )) && stat_die
|
||||||
rm_daemon cryptsetup
|
rm_daemon cryptsetup
|
||||||
stat_done
|
stat_done
|
||||||
|
@@ -1,49 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# sourcing our current rc.conf requires this to be a bash script
|
|
||||||
. @RCLIBDIR@/functions
|
|
||||||
|
|
||||||
mount_devfs(){
|
|
||||||
mountpoint -q /dev || mount -t devtmpfs dev /dev -o mode=0755,nosuid
|
|
||||||
|
|
||||||
# seed /dev with some things that might be needed (for example,
|
|
||||||
# xudev doesn't do this compared to eudev), code from OpenRC
|
|
||||||
|
|
||||||
# creating /dev/console, /dev/tty and /dev/tty1 to be able to write
|
|
||||||
# to $CONSOLE with/without bootsplash before udevd creates it
|
|
||||||
[ -c /dev/console ] || mknod -m 600 /dev/console c 5 1
|
|
||||||
[ -c /dev/tty1 ] || mknod -m 620 /dev/tty1 c 4 1
|
|
||||||
[ -c /dev/tty ] || mknod -m 666 /dev/tty c 5 0
|
|
||||||
|
|
||||||
# udevd will dup its stdin/stdout/stderr to /dev/null
|
|
||||||
# and we do not want a file which gets buffered in ram
|
|
||||||
[ -c /dev/null ] || mknod -m 666 /dev/null c 1 3
|
|
||||||
|
|
||||||
# so udev can add its start-message to dmesg
|
|
||||||
[ -c /dev/kmsg ] || mknod -m 660 /dev/kmsg c 1 11
|
|
||||||
|
|
||||||
# extra symbolic links not provided by default
|
|
||||||
[ -e /dev/fd ] || ln -snf /proc/self/fd /dev/fd
|
|
||||||
[ -e /dev/stdin ] || ln -snf /proc/self/fd/0 /dev/stdin
|
|
||||||
[ -e /dev/stdout ] || ln -snf /proc/self/fd/1 /dev/stdout
|
|
||||||
[ -e /dev/stderr ] || ln -snf /proc/self/fd/2 /dev/stderr
|
|
||||||
[ -e /proc/kcore ] && ln -snf /proc/kcore /dev/core
|
|
||||||
|
|
||||||
mkdir -p /dev/pts /dev/shm
|
|
||||||
mountpoint -q /dev/pts || mount -t devpts devpts /dev/pts -o mode=0620,gid=5,nosuid,noexec
|
|
||||||
mountpoint -q /dev/shm || mount -t tmpfs shm /dev/shm -o mode=1777,nosuid,nodev
|
|
||||||
mountpoint -q /run || mount -t tmpfs run /run -o mode=0755,nosuid,nodev
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
stat_busy "Mounting dev filesystem"
|
|
||||||
mount_devfs
|
|
||||||
add_daemon devfs
|
|
||||||
stat_done
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "usage: $0 {start}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
@@ -1,26 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# sourcing our current rc.conf requires this to be a bash script
|
|
||||||
. @RCLIBDIR@/functions
|
|
||||||
|
|
||||||
config(){
|
|
||||||
if [[ -e /proc/sys/kernel/dmesg_restrict ]] &&
|
|
||||||
(( $(< /proc/sys/kernel/dmesg_restrict) == 1 )); then
|
|
||||||
install -Tm 0600 <( dmesg ) /var/log/dmesg.log
|
|
||||||
else
|
|
||||||
install -Tm 0644 <( dmesg ) /var/log/dmesg.log
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
stat_busy "Saving dmesg log"
|
|
||||||
config
|
|
||||||
add_daemon dmesg
|
|
||||||
stat_done
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "usage: $0 {start|stop}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
@@ -1,9 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# sourcing our current rc.conf requires this to be a bash script
|
|
||||||
. @RCLIBDIR@/functions
|
. @RCLIBDIR@/functions
|
||||||
|
|
||||||
# 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
|
||||||
FORCEFSCK="-f"
|
FORCEFSCK="-f"
|
||||||
@@ -13,10 +11,9 @@ fsck_all() {
|
|||||||
IGNORE_MOUNTED="-M"
|
IGNORE_MOUNTED="-M"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fsck -A -T -M -C${FSCK_FD} -a -t no${NETFS//,/,no},noopts=_netdev ${IGNORE_MOUNTED} -- ${FORCEFSCK}
|
fsck -A -T -a -t no${NETFS//,/,no},noopts=_netdev ${IGNORE_MOUNTED} ${FORCEFSCK}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Single-user login and/or automatic reboot after fsck (if needed)
|
|
||||||
fsck_reboot() {
|
fsck_reboot() {
|
||||||
# $1 = exit code returned by fsck
|
# $1 = exit code returned by fsck
|
||||||
# Ignore conditions 'FS errors corrected' and 'Cancelled by the user'
|
# Ignore conditions 'FS errors corrected' and 'Cancelled by the user'
|
||||||
@@ -44,14 +41,13 @@ 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
|
||||||
exit 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
do_fsck(){
|
do_fsck() {
|
||||||
if [[ -x $(type -P fsck) ]]; then
|
if [[ -x $(type -P fsck) ]]; then
|
||||||
fsck_all >|"${FSCK_OUT:-/dev/stdout}" 2>|"${FSCK_ERR:-/dev/stdout}"
|
fsck_all >|"${FSCK_OUT:-/dev/stdout}" 2>|"${FSCK_ERR:-/dev/stdout}"
|
||||||
declare -r fsckret=$?
|
declare -r fsckret=$?
|
||||||
@@ -61,27 +57,17 @@ do_fsck(){
|
|||||||
fsck_reboot $fsckret
|
fsck_reboot $fsckret
|
||||||
}
|
}
|
||||||
|
|
||||||
kill_all(){
|
|
||||||
pkill --inverse -s0,1 -TERM
|
|
||||||
sleep 1
|
|
||||||
pkill --inverse -s0,1 -KILL
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
|
stat_busy "Remounting rootfs to read-only"
|
||||||
|
mount -o remount,ro /
|
||||||
|
stat_done
|
||||||
stat_busy "Checking filesystems"
|
stat_busy "Checking filesystems"
|
||||||
do_fsck
|
do_fsck
|
||||||
add_daemon misc
|
add_daemon fsck
|
||||||
stat_done
|
stat_done
|
||||||
;;
|
;;
|
||||||
stop)
|
|
||||||
stat_busy "Running kill-all"
|
|
||||||
kill_all
|
|
||||||
rm_daemon misc
|
|
||||||
stat_done
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
echo "usage: $0 {start|stop}"
|
echo "usage: $0 {start}"
|
||||||
exit 1
|
;;
|
||||||
;;
|
|
||||||
esac
|
esac
|
@@ -9,16 +9,15 @@ config(){
|
|||||||
if [[ -s /etc/hostname ]]; then
|
if [[ -s /etc/hostname ]]; then
|
||||||
HOSTNAME=$(< /etc/hostname)
|
HOSTNAME=$(< /etc/hostname)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $HOSTNAME ]]; then
|
|
||||||
echo "$HOSTNAME" >| /proc/sys/kernel/hostname
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
stat_busy "Starting hostname"
|
|
||||||
config
|
config
|
||||||
|
stat_busy "Setting hostname to $HOSTNAME"
|
||||||
|
if [[ $HOSTNAME ]]; then
|
||||||
|
echo "$HOSTNAME" >| /proc/sys/kernel/hostname
|
||||||
|
fi
|
||||||
add_daemon hostname
|
add_daemon hostname
|
||||||
stat_done
|
stat_done
|
||||||
;;
|
;;
|
||||||
|
@@ -1,26 +1,26 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. @RCLIBDIR@/functions
|
. @RCLIBDIR@/functions
|
||||||
. @RCDIR@/rc.conf
|
|
||||||
|
|
||||||
|
HWCLOCK_PARAMS="--systz"
|
||||||
HARDWARECLOCK=${HARDWARECLOCK:-UTC}
|
HARDWARECLOCK=${HARDWARECLOCK:-UTC}
|
||||||
|
|
||||||
case $HARDWARECLOCK in
|
case $HARDWARECLOCK in
|
||||||
UTC) HWCLOCK_PARAMS+=" --utc" ;;
|
UTC) HWCLOCK_PARAMS+=" --utc --noadjfile" ;;
|
||||||
localtime) HWCLOCK_PARAMS+=" --localtime" ;;
|
localtime) HWCLOCK_PARAMS+=" --localtime --noadjfile" ;;
|
||||||
*) HWCLOCK_PARAMS="";;
|
*) HWCLOCK_PARAMS="";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
stat_busy "Adjusting hwclock"
|
stat_busy "Adjusting hwclock to ${HARDWARECLOCK}"
|
||||||
hwclock --systz $HWCLOCK_PARAMS --noadjfile || 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 --systohc $HWCLOCK_PARAMS || stat_die
|
hwclock --adjust $HWCLOCK_PARAMS || stat_die
|
||||||
rm_daemon hwclock
|
rm_daemon hwclock
|
||||||
stat_done
|
stat_done
|
||||||
;;
|
;;
|
||||||
@@ -33,4 +33,3 @@ case "$1" in
|
|||||||
echo "usage: $0 {start|stop|restart}"
|
echo "usage: $0 {start|stop|restart}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@@ -3,20 +3,21 @@
|
|||||||
# 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
|
||||||
|
|
||||||
conig(){
|
config() {
|
||||||
[[ -d /run/tmpfiles.d ]] || mkdir /run/tmpfiles.d
|
for f in $(kmod static-nodes 2>/dev/null|awk '/Module/ {print $2}'); do
|
||||||
kmod static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf
|
modprobe -bq $f 2>/dev/null
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
stat_busy "Starting kmod-static-nodes"
|
stat_busy "Loading static kernel modules"
|
||||||
conig
|
config
|
||||||
add_daemon kmod-static-nodes
|
add_daemon kmod-static-nodes
|
||||||
stat_done
|
stat_done
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "usage: $0 {start}"
|
echo "usage: $0 {start}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@@ -1,22 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
. @RCLIBDIR@/functions
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
stat_busy "Starting monitoring of LVM2 groups"
|
|
||||||
vgchange --monitor y >/dev/null || stat_die
|
|
||||||
add_daemon lvm-monitoring
|
|
||||||
stat_done
|
|
||||||
;;
|
|
||||||
stop)
|
|
||||||
stat_busy "Stopping monitoring of LVM2 groups"
|
|
||||||
vgchange --monitor n || stat_die
|
|
||||||
rm_daemon lvm-monitoring
|
|
||||||
stat_done
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "usage: $0 {start|stop}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
22
sv.d/lvm.in
22
sv.d/lvm.in
@@ -1,22 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
. @RCLIBDIR@/functions
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
stat_busy "Starting LVM2 groups"
|
|
||||||
vgchange --sysinit -a y >/dev/null || stat_die
|
|
||||||
add_daemon lvm
|
|
||||||
stat_done
|
|
||||||
;;
|
|
||||||
stop)
|
|
||||||
stat_busy "Stopping LVM2 groups"
|
|
||||||
vgchange --sysinit -a n &>/dev/null || stat_die
|
|
||||||
rm_daemon lvm
|
|
||||||
stat_done
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "usage: $0 {start|stop}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
@@ -4,12 +4,11 @@
|
|||||||
. @RCLIBDIR@/functions
|
. @RCLIBDIR@/functions
|
||||||
|
|
||||||
load_modules() {
|
load_modules() {
|
||||||
local rc=0
|
local rc=0
|
||||||
|
/usr/bin/modules-load
|
||||||
|
(( rc+= $? ))
|
||||||
|
|
||||||
/usr/bin/modules-load
|
return $rc
|
||||||
(( rc+=$? ))
|
|
||||||
|
|
||||||
return $rc
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@@ -24,4 +23,3 @@ case "$1" in
|
|||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@@ -1,17 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# sourcing our current rc.conf requires this to be a bash script
|
|
||||||
. @RCLIBDIR@/functions
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
stat_busy "Starting mount-all"
|
|
||||||
mount -a -t "no${NETFS//,/,no}" -O no_netdev || stat_die mount-all
|
|
||||||
add_daemon mount-all
|
|
||||||
stat_done mount-all
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "usage: $0 {start}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
27
sv.d/mount-fs.in
Normal file
27
sv.d/mount-fs.in
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. @RCLIBDIR@/functions
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
stat_busy "Mounting / read-write"
|
||||||
|
mount -o remount,rw / || stat_die mount-fs
|
||||||
|
stat_done
|
||||||
|
stat_busy "Mounting all non-network filesystems"
|
||||||
|
mount -a -t "nosysfs,nonfs,nonfs4,nosmbfs,nocifs" -O no_netdev || stat_die mount-fs
|
||||||
|
add_daemon mount-fs
|
||||||
|
stat_done
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
stat_busy "Unmounting filesystems"
|
||||||
|
umount -r -a -t nosysfs,noproc,nodevtmpfs,notmpfs
|
||||||
|
stat_done
|
||||||
|
stat_busy "Remounting / read-only"
|
||||||
|
mount -o remount,ro /
|
||||||
|
stat_done
|
||||||
|
sync
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "usage: $0 {start|stop}"
|
||||||
|
;;
|
||||||
|
esac
|
@@ -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
|
||||||
|
@@ -1,32 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# sourcing our current rc.conf requires this to be a bash script
|
|
||||||
. @RCLIBDIR@/functions
|
|
||||||
|
|
||||||
mount_procfs(){
|
|
||||||
grep -v '^#' /etc/fstab | grep /proc | {
|
|
||||||
read -r spec file vfstype mntopts x
|
|
||||||
if ! mountpoint -q /proc; then
|
|
||||||
if [ "$spec" -a "$file" -a "$vfstype" -a "$mntopts" ]; then
|
|
||||||
mount -t "$vfstype" "$spec" "$file" -o "$mntopts"
|
|
||||||
else
|
|
||||||
mount -t proc proc /proc
|
|
||||||
fi
|
|
||||||
elif [ "$spec" -a "$file" -a "$vfstype" -a "$mntopts" ] && mountpoint -q /proc; then
|
|
||||||
mount -t "$vfstype" "$spec" "$file" -o "remount,$mntopts"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
stat_busy "Mounting proc filesystem"
|
|
||||||
mount_procfs
|
|
||||||
add_daemon procfs
|
|
||||||
stat_done
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "usage: $0 {start}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
50
sv.d/pseudofs.in
Normal file
50
sv.d/pseudofs.in
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# sourcing our current rc.conf requires this to be a bash script
|
||||||
|
. @RCLIBDIR@/functions
|
||||||
|
|
||||||
|
mount_procfs(){
|
||||||
|
mountpoint -q /proc || mount -t proc proc /proc -o nosuid,noexec,nodev
|
||||||
|
}
|
||||||
|
|
||||||
|
mount_sysfs() {
|
||||||
|
mountpoint -q /sys || mount -t sysfs sys /sys -o nosuid,noexec,nodev
|
||||||
|
mountpoint -q /sys/kernel/security || mount -n -t securityfs securityfs /sys/kernel/security
|
||||||
|
if [ -d /sys/firmware/efi ]; then
|
||||||
|
mountpoint -q /sys/firmware/efi/efivars || mount -n -t efivarfs -o ro efivarfs /sys/firmware/efi/efivars
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
mount_runfs() {
|
||||||
|
mountpoint -q /run || mount -o mode=0755,nosuid,nodev -t tmpfs run /run
|
||||||
|
mkdir -p /run/{runit,lvm,user,lock,log}
|
||||||
|
}
|
||||||
|
|
||||||
|
mount_devfs() {
|
||||||
|
mountpoint -q /dev || mount -o mode=0755,nosuid -t devtmpfs dev /dev
|
||||||
|
mkdir -p -m0755 /dev/{pts,shm}
|
||||||
|
mountpoint -q /dev/pts || mount -o mode=0620,gid=5,nosuid,noexec -n -t devpts devpts /dev/pts
|
||||||
|
mountpoint -q /dev/shm || mount -o mode=1777,nosuid,nodev -n -t tmpfs shm /dev/shm
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
stat_busy "Mounting proc filesystem"
|
||||||
|
mount_procfs
|
||||||
|
stat_done
|
||||||
|
stat_busy "Mounting sys filesystem"
|
||||||
|
mount_sysfs
|
||||||
|
stat_done
|
||||||
|
stat_busy "Mounting run filesystem"
|
||||||
|
mount_runfs
|
||||||
|
stat_done
|
||||||
|
stat_busy "Mounting devfs"
|
||||||
|
mount_devfs
|
||||||
|
stat_done
|
||||||
|
add_daemon pseudofs
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "usage: $0 {start}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
@@ -14,13 +14,13 @@ save_seed(){
|
|||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
stat_busy "Starting random-seed"
|
stat_busy "Initializing random seed"
|
||||||
load_seed
|
load_seed
|
||||||
add_daemon random-seed
|
add_daemon random-seed
|
||||||
stat_done
|
stat_done
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
stat_busy "Stopping random-seed"
|
stat_busy "Saving random seed"
|
||||||
save_seed
|
save_seed
|
||||||
rm_daemon random-seed
|
rm_daemon random-seed
|
||||||
stat_done
|
stat_done
|
||||||
|
@@ -1,24 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# sourcing our current rc.conf requires this to be a bash script
|
|
||||||
. @RCLIBDIR@/functions
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
stat_busy "Remounting root filesystem rw"
|
|
||||||
mount -o remount,rw / || stat_die remount-root
|
|
||||||
add_daemon remount-root
|
|
||||||
stat_done remount-root
|
|
||||||
;;
|
|
||||||
stop)
|
|
||||||
stat_busy "Remounting root filesystem ro"
|
|
||||||
mount -o remount,ro / || stat_die remount-root
|
|
||||||
sync
|
|
||||||
rm_daemon remount-root
|
|
||||||
stat_done remount-root
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "usage: $0 {start|stop}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
63
sv.d/root.in
63
sv.d/root.in
@@ -1,63 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# sourcing our current rc.conf requires this to be a bash script
|
|
||||||
. @RCLIBDIR@/functions
|
|
||||||
|
|
||||||
mount_fs(){
|
|
||||||
findmnt / --options ro &>/dev/null || mount -o remount,ro / || return 1
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
# umount_fs(){
|
|
||||||
# umount -r -a -t nosysfs,noproc,nodevtmpfs,notmpfs
|
|
||||||
# }
|
|
||||||
|
|
||||||
umount_fs() {
|
|
||||||
findmnt -mrunRo TARGET,FSTYPE,OPTIONS / | {
|
|
||||||
while read -r target fstype options; do
|
|
||||||
# interpret the ascii chars, such as \x20 (space)
|
|
||||||
printf -v target '%b' "$target"
|
|
||||||
# match only targeted fstypes
|
|
||||||
if [[ $1 && $1 != "$fstype" ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
# do not unmount API filesystems
|
|
||||||
if [[ $target = /@(proc|sys|run|dev|dev/pts) ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
# avoid networked devices
|
|
||||||
IFS=, read -ra opts <<< "$options"
|
|
||||||
if in_array _netdev "${opts[@]}"; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
mounts=("$target" "${mounts[@]}")
|
|
||||||
done
|
|
||||||
|
|
||||||
if (( ${#mounts[*]} )); then
|
|
||||||
umount -r "${mounts[@]}" || return 1
|
|
||||||
fi
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
stat_busy "Mounting filesystems"
|
|
||||||
mount_fs || stat_die root
|
|
||||||
add_daemon root
|
|
||||||
stat_done root
|
|
||||||
;;
|
|
||||||
stop)
|
|
||||||
stat_busy "Unounting filesystems"
|
|
||||||
umount_fs || stat_die root
|
|
||||||
rm_daemon root
|
|
||||||
stat_done root
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "usage: $0 {start|stop}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
@@ -9,13 +9,13 @@ case "$1" in
|
|||||||
swapon -a || stat_die swap
|
swapon -a || 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
|
||||||
rm_daemon swap
|
rm_daemon swap
|
||||||
stat_done swap
|
stat_done swap
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "usage: $0 {start|stop}"
|
echo "usage: $0 {start|stop}"
|
||||||
exit 1
|
exit 1
|
||||||
|
@@ -1,23 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# sourcing our current rc.conf requires this to be a bash script
|
|
||||||
. @RCLIBDIR@/functions
|
|
||||||
|
|
||||||
mount_sysfs(){
|
|
||||||
mountpoint -q /sys || mount -t sysfs sys /sys -o nosuid,noexec,nodev
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
stat_busy "Mounting sys filesystem"
|
|
||||||
mount_sysfs
|
|
||||||
add_daemon sysfs
|
|
||||||
stat_done
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "usage: $0 {start}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
@@ -1,17 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# sourcing our current rc.conf requires this to be a bash script
|
|
||||||
. @RCLIBDIR@/functions
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
stat_busy "Starting sysusers"
|
|
||||||
esysusers
|
|
||||||
add_daemon sysusers
|
|
||||||
stat_done
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "usage: $0 {start}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
@@ -1,35 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# sourcing our current rc.conf requires this to be a bash script
|
|
||||||
. @RCLIBDIR@/functions
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
stat_busy "Setting timezone"
|
|
||||||
zonefile=/usr/share/zoneinfo/$TIMEZONE
|
|
||||||
|
|
||||||
# [[ $TIMEZONE ]] || return 1
|
|
||||||
|
|
||||||
if [[ ! -L /etc/localtime && /etc/localtime -ef $zonefile ]]; then
|
|
||||||
ln -sf "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
|
|
||||||
fi
|
|
||||||
add_daemon timezone
|
|
||||||
stat_done
|
|
||||||
;;
|
|
||||||
stop)
|
|
||||||
stat_busy "Setting timezone"
|
|
||||||
zonefile=/usr/share/zoneinfo/$TIMEZONE
|
|
||||||
|
|
||||||
# [[ $TIMEZONE ]] || return 1
|
|
||||||
|
|
||||||
if [[ ! -L /etc/localtime && /etc/localtime -ef $zonefile ]]; then
|
|
||||||
ln -sf "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
|
|
||||||
fi
|
|
||||||
rm_daemon timezone
|
|
||||||
stat_done
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "usage: $0 {start|stop}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
@@ -6,7 +6,7 @@
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
stat_busy "Starting tmpfiles-dev"
|
stat_busy "Starting tmpfiles-dev"
|
||||||
etmpfiles --prefix=/dev --create --boot || stat_die tmpfiles-dev
|
tmpfiles --prefix=/dev --create --boot || stat_die tmpfiles-dev
|
||||||
add_daemon tmpfiles-dev
|
add_daemon tmpfiles-dev
|
||||||
stat_done tmpfiles-dev
|
stat_done tmpfiles-dev
|
||||||
;;
|
;;
|
||||||
|
@@ -1,17 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# sourcing our current rc.conf requires this to be a bash script
|
|
||||||
. @RCLIBDIR@/functions
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
stat_busy "Starting tmpfiles-setup"
|
|
||||||
etmpfiles --exclude-prefix=/dev --create --remove --boot || stat_die tmpfiles-setup
|
|
||||||
add_daemon tmpfiles-setup
|
|
||||||
stat_done tmpfiles-setup
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "usage: $0 {start}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
@@ -1,19 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# sourcing our current rc.conf requires this to be a bash script
|
|
||||||
. @RCLIBDIR@/functions
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
stat_busy "Waiting for udev uevents to be processed"
|
|
||||||
udevadm settle || stat_die udev-settle
|
|
||||||
calc_columns
|
|
||||||
add_daemon udev-settle
|
|
||||||
stat_done udev-settle
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "usage: $0 {start}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
@@ -1,21 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# sourcing our current rc.conf requires this to be a bash script
|
|
||||||
. @RCLIBDIR@/functions
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
stat_busy "Triggering udev uevents"
|
|
||||||
udevadm trigger --action=add --type=subsystems
|
|
||||||
ret=$?
|
|
||||||
udevadm trigger --action=add --type=devices
|
|
||||||
(( ret || $? )) && stat_die udev-trigger
|
|
||||||
add_daemon udev-trigger
|
|
||||||
stat_done udev-trigger
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "usage: $0 {start}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
23
sv.d/udev.in
23
sv.d/udev.in
@@ -5,23 +5,24 @@
|
|||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
stat_busy "Starting udev daemon"
|
if ! pgrep -f "runsv udevd" >/dev/null; then
|
||||||
udevd --daemon || stat_die udev
|
stat_busy "Starting udev and waiting for devices to settle"
|
||||||
# Note: This is only needed for initialization, udev will
|
udevd --daemon
|
||||||
# be controlled by runit on stage 2.
|
udevadm trigger --action=add --type=subsystems
|
||||||
|
udevadm trigger --action=add --type=devices
|
||||||
|
udevadm settle
|
||||||
|
stat_done
|
||||||
|
fi
|
||||||
add_daemon udev
|
add_daemon udev
|
||||||
stat_done udev
|
;;
|
||||||
;;
|
|
||||||
stop)
|
stop)
|
||||||
stat_busy "Stopping udev"
|
stat_busy "Stopping udev"
|
||||||
# check whether udevd might still be running.
|
udevadm control --exit || stat_die udev
|
||||||
! pgrep -f "udevd" >/dev/null 2>&1 || udevadm control --exit || stat_die udev
|
|
||||||
rm_daemon udev
|
rm_daemon udev
|
||||||
stat_done udev
|
stat_done udev
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "usage: $0 {start|stop}"
|
echo "usage: $0 {start|stop}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user