Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
319d05e43c | |||
6cc8c4288f |
69
Makefile
69
Makefile
@@ -16,34 +16,23 @@ RCBIN = \
|
||||
script/modules-load
|
||||
|
||||
RCSVD = \
|
||||
sv.d/root \
|
||||
sv.d/binfmt \
|
||||
sv.d/bootlogd \
|
||||
sv.d/cgroups \
|
||||
sv.d/cleanup \
|
||||
sv.d/console-setup \
|
||||
sv.d/dmesg \
|
||||
sv.d/fsck \
|
||||
sv.d/hostname \
|
||||
sv.d/hwclock \
|
||||
sv.d/kmod-static-nodes \
|
||||
sv.d/misc \
|
||||
sv.d/mount-all \
|
||||
sv.d/modules \
|
||||
sv.d/mount-fs \
|
||||
sv.d/net-lo \
|
||||
sv.d/netfs \
|
||||
sv.d/pseudofs \
|
||||
sv.d/random-seed \
|
||||
sv.d/remount-root \
|
||||
sv.d/swap \
|
||||
sv.d/sysctl \
|
||||
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
|
||||
sv.d/udev
|
||||
|
||||
# SYSINIT = \
|
||||
# 01-sysfs \
|
||||
@@ -131,42 +120,32 @@ install-rc:
|
||||
|
||||
install -d $(DESTDIR)$(RCDIR)/sysinit
|
||||
|
||||
$(LN) $(RCSVDIR)/sysfs $(DESTDIR)$(RCDIR)/sysinit/01-sysfs
|
||||
$(LN) $(RCSVDIR)/procfs $(DESTDIR)$(RCDIR)/sysinit/02-procfs
|
||||
$(LN) $(RCSVDIR)/devfs $(DESTDIR)$(RCDIR)/sysinit/03-devfs
|
||||
$(LN) $(RCSVDIR)/cgroups $(DESTDIR)$(RCDIR)/sysinit/04-cgroups
|
||||
$(LN) $(RCSVDIR)/root $(DESTDIR)$(RCDIR)/sysinit/05-root
|
||||
$(LN) $(RCSVDIR)/hostname $(DESTDIR)$(RCDIR)/sysinit/10-hostname
|
||||
$(LN) $(RCSVDIR)/pseudofs $(DESTDIR)$(RCDIR)/sysinit/01-pseudofs
|
||||
$(LN) $(RCSVDIR)/cgroups $(DESTDIR)$(RCDIR)/sysinit/02-cgroups
|
||||
$(LN) $(RCSVDIR)/kmod-static-nodes $(DESTDIR)$(RCDIR)/sysinit/03-kmod-static-nodes
|
||||
$(LN) $(RCSVDIR)/modules $(DESTDIR)$(RCDIR)/sysinit/04-modules
|
||||
$(LN) $(RCSVDIR)/tmpfiles-dev $(DESTDIR)$(RCDIR)/sysinit/05-tmpfiles-dev
|
||||
$(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)/kmod-static-nodes $(DESTDIR)$(RCDIR)/sysinit/20-kmod-static-nodes
|
||||
$(LN) $(RCSVDIR)/tmpfiles-dev $(DESTDIR)$(RCDIR)/sysinit/25-tmpfiles-dev
|
||||
$(LN) $(RCSVDIR)/udev $(DESTDIR)$(RCDIR)/sysinit/30-udev
|
||||
$(LN) $(RCSVDIR)/udev-trigger $(DESTDIR)$(RCDIR)/sysinit/31-udev-trigger
|
||||
$(LN) $(RCSVDIR)/modules $(DESTDIR)$(RCDIR)/sysinit/32-modules
|
||||
$(LN) $(RCSVDIR)/udev-settle $(DESTDIR)$(RCDIR)/sysinit/33-udev-settle
|
||||
$(LN) $(RCSVDIR)/console-setup $(DESTDIR)$(RCDIR)/sysinit/40-console-setup
|
||||
$(LN) $(RCSVDIR)/net-lo $(DESTDIR)$(RCDIR)/sysinit/45-net-lo
|
||||
$(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)/fsck $(DESTDIR)$(RCDIR)/sysinit/20-fsck
|
||||
$(LN) $(RCSVDIR)/mount-fs $(DESTDIR)$(RCDIR)/sysinit/30-mount-fs
|
||||
$(LN) $(RCSVDIR)/swap $(DESTDIR)$(RCDIR)/sysinit/31-swap
|
||||
$(LN) $(RCSVDIR)/random-seed $(DESTDIR)$(RCDIR)/sysinit/40-modules
|
||||
$(LN) $(RCSVDIR)/net-lo $(DESTDIR)$(RCDIR)/sysinit/41-net-lo
|
||||
$(LN) $(RCSVDIR)/hostname $(DESTDIR)$(RCDIR)/sysinit/42-hostname
|
||||
$(LN) $(RCSVDIR)/sysctl $(DESTDIR)$(RCDIR)/sysinit/55-sysctl
|
||||
$(LN) $(RCSVDIR)/binfmt $(DESTDIR)$(RCDIR)/sysinit/90-binfmt
|
||||
$(LN) $(RCSVDIR)/cleanup $(DESTDIR)$(RCDIR)/sysinit/99-cleanup
|
||||
|
||||
install -d $(DESTDIR)$(RCDIR)/shutdown
|
||||
|
||||
$(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)/misc $(DESTDIR)$(RCDIR)/shutdown/40-misc
|
||||
$(LN) $(RCSVDIR)/cleanup $(DESTDIR)$(RCDIR)/shutdown/20-cleanup
|
||||
$(LN) $(RCSVDIR)/swap $(DESTDIR)$(RCDIR)/shutdown/50-swap
|
||||
$(LN) $(RCSVDIR)/root $(DESTDIR)$(RCDIR)/shutdown/60-root
|
||||
$(LN) $(RCSVDIR)/remount-root $(DESTDIR)$(RCDIR)/shutdown/70-remount-root
|
||||
$(LN) $(RCSVDIR)/mount-fs $(DESTDIR)$(RCDIR)/shutdown/60-mount-fs
|
||||
|
||||
install -d $(DESTDIR)$(MANDIR)/man8
|
||||
install -m644 script/modules-load.8 $(DESTDIR)$(MANDIR)/man8
|
||||
|
@@ -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,6 +1,6 @@
|
||||
#!/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
|
||||
. @RCDIR@/rc.conf
|
||||
|
||||
@@ -36,61 +36,7 @@ cgroup1_base(){
|
||||
}
|
||||
|
||||
cgroup1_controllers(){
|
||||
${HAVE_CONTROLLER1_GROUPS} && [ -e /proc/cgroups ] && grep -qw cgroup /proc/filesystems || return 0
|
||||
while read -r name _ _ enabled _; do
|
||||
case "${enabled}" in
|
||||
1) if mountpoint -q "/sys/fs/cgroup/${name}";then continue;fi
|
||||
local x
|
||||
for x in $CGROUP_CONTROLLERS; do
|
||||
[ "${name}" = "blkio" ] && [ "${x}" = "io" ] &&
|
||||
continue 2
|
||||
[ "${name}" = "${x}" ] &&
|
||||
continue 2
|
||||
done
|
||||
mkdir "/sys/fs/cgroup/${name}"
|
||||
mount -n -t cgroup -o "${CGROUP_OPTS},${name}" "${name}" "/sys/fs/cgroup/${name}"
|
||||
;;
|
||||
esac
|
||||
done < /proc/cgroups
|
||||
return 0
|
||||
}
|
||||
|
||||
cgroup2_base(){
|
||||
grep -qw cgroup2 /proc/filesystems || return 0
|
||||
local base
|
||||
base="$(cgroup2_find_path)"
|
||||
mkdir -p "${base}"
|
||||
mount -t cgroup2 none -o "${CGROUP_OPTS},nsdelegate" "${base}" 2> /dev/null ||
|
||||
mount -t cgroup2 none -o "${CGROUP_OPTS}" "${base}"
|
||||
return 0
|
||||
}
|
||||
|
||||
cgroup2_controllers(){
|
||||
grep -qw cgroup2 /proc/filesystems || return 0
|
||||
local active cgroup_path x y
|
||||
cgroup_path="$(cgroup2_find_path)"
|
||||
[ -z "${cgroup_path}" ] && return 0
|
||||
[ -e "${cgroup_path}/cgroup.controllers" ] && read -r active < "${cgroup_path}/cgroup.controllers"
|
||||
for x in ${CGROUP_CONTROLLERS}; do
|
||||
for y in ${active}; do
|
||||
[ "$x" = "$y" ] && [ -e "${cgroup_path}/cgroup.subtree_control" ] &&
|
||||
echo "+${x}" > "${cgroup_path}/cgroup.subtree_control"
|
||||
done
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
cgroups_hybrid(){
|
||||
cgroup1_base
|
||||
cgroup2_base
|
||||
cgroup2_controllers
|
||||
cgroup1_controllers
|
||||
return 0
|
||||
}
|
||||
|
||||
cgroups_legacy(){
|
||||
cgroup1_base
|
||||
cgroup1_controllers
|
||||
...skipping...
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@@ -17,14 +17,20 @@ cleaning(){
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
stat_busy "Starting cleanup"
|
||||
stat_busy "Cleaning up"
|
||||
cleaning
|
||||
add_daemon cleanup
|
||||
stat_done
|
||||
;;
|
||||
stop)
|
||||
stat_busy "Stopping cleanup"
|
||||
halt -w || stat_die
|
||||
halt -w # Well, this actually does nothing.
|
||||
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
|
||||
stat_done
|
||||
;;
|
||||
|
@@ -22,7 +22,7 @@ config(){
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
stat_busy "Starting console-setup"
|
||||
stat_busy "Setting up console fonts and keymaps"
|
||||
config
|
||||
add_daemon console-setup
|
||||
stat_done
|
||||
@@ -32,3 +32,4 @@ case "$1" in
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@@ -1,7 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
. @RCLIBDIR@/functions
|
||||
|
||||
do_unlock_device() {
|
||||
# $1 = requested name
|
||||
# $2 = source device
|
||||
@@ -17,7 +16,7 @@ do_unlock_device() {
|
||||
b=$1
|
||||
else
|
||||
printhl "Non-LUKS partitions are not supported at the moment."
|
||||
continue
|
||||
return 1
|
||||
fi
|
||||
if [[ $4 ]]; then
|
||||
for i in ${4//,/ }; do
|
||||
@@ -29,9 +28,10 @@ do_unlock_device() {
|
||||
"keyfile-offset"*) opts+="--keyfile-offset ${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"
|
||||
continue
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
@@ -80,7 +80,6 @@ do_unlock() {
|
||||
fi
|
||||
|
||||
do_unlock_device "$name" "$device" "$password" "$options"
|
||||
esac
|
||||
failed=$?
|
||||
if (( $failed )); then
|
||||
printf "${C_FAIL}Unlocking of $1 failed.${C_CLEAR}\n"
|
||||
@@ -90,7 +89,9 @@ do_unlock() {
|
||||
|
||||
do_lock() {
|
||||
#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() {
|
||||
@@ -113,16 +114,24 @@ case "$1" in
|
||||
stat_busy "Starting encrypted devices"
|
||||
read_crypttab do_unlock
|
||||
rc=$?
|
||||
# [[ -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
|
||||
add_daemon cryptsetup
|
||||
stat_done
|
||||
;;
|
||||
stop)
|
||||
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=$?
|
||||
read_crypttab do_lock
|
||||
do_lock
|
||||
(( rc || $? )) && stat_die
|
||||
rm_daemon cryptsetup
|
||||
stat_done
|
||||
|
@@ -1,25 +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
|
||||
mkdir -p /dev/{pts,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
|
||||
|
||||
# sourcing our current rc.conf requires this to be a bash script
|
||||
. @RCLIBDIR@/functions
|
||||
|
||||
# Check local filesystems
|
||||
fsck_all() {
|
||||
if [[ -f /forcefsck ]] || in_array forcefsck $(< /proc/cmdline); then
|
||||
FORCEFSCK="-f"
|
||||
@@ -13,10 +11,9 @@ fsck_all() {
|
||||
IGNORE_MOUNTED="-M"
|
||||
fi
|
||||
|
||||
fsck -A -T -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() {
|
||||
# $1 = exit code returned by fsck
|
||||
# Ignore conditions 'FS errors corrected' and 'Cancelled by the user'
|
||||
@@ -44,11 +41,10 @@ fsck_reboot() {
|
||||
echo
|
||||
sulogin -p
|
||||
fi
|
||||
echo "Automatic reboot in progress..."
|
||||
echo "Automatic reboot in progress"
|
||||
umount -a
|
||||
mount -o remount,ro /
|
||||
reboot -f
|
||||
exit 0
|
||||
}
|
||||
|
||||
do_fsck() {
|
||||
@@ -61,27 +57,17 @@ do_fsck(){
|
||||
fsck_reboot $fsckret
|
||||
}
|
||||
|
||||
kill_all(){
|
||||
pkill --inverse -s0,1 -TERM
|
||||
sleep 1
|
||||
pkill --inverse -s0,1 -KILL
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
stat_busy "Remounting rootfs to read-only"
|
||||
mount -o remount,ro /
|
||||
stat_done
|
||||
stat_busy "Checking filesystems"
|
||||
do_fsck
|
||||
add_daemon misc
|
||||
stat_done
|
||||
;;
|
||||
stop)
|
||||
stat_busy "Running kill-all"
|
||||
kill_all
|
||||
rm_daemon misc
|
||||
add_daemon fsck
|
||||
stat_done
|
||||
;;
|
||||
*)
|
||||
echo "usage: $0 {start|stop}"
|
||||
exit 1
|
||||
echo "usage: $0 {start}"
|
||||
;;
|
||||
esac
|
@@ -9,16 +9,15 @@ config(){
|
||||
if [[ -s /etc/hostname ]]; then
|
||||
HOSTNAME=$(< /etc/hostname)
|
||||
fi
|
||||
|
||||
if [[ $HOSTNAME ]]; then
|
||||
echo "$HOSTNAME" >| /proc/sys/kernel/hostname
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
stat_busy "Starting hostname"
|
||||
config
|
||||
stat_busy "Setting hostname to $HOSTNAME"
|
||||
if [[ $HOSTNAME ]]; then
|
||||
echo "$HOSTNAME" >| /proc/sys/kernel/hostname
|
||||
fi
|
||||
add_daemon hostname
|
||||
stat_done
|
||||
;;
|
||||
|
@@ -13,13 +13,13 @@ esac
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
stat_busy "Adjusting hwclock"
|
||||
stat_busy "Adjusting hwclock to ${HARDWARECLOCK}"
|
||||
hwclock $HWCLOCK_PARAMS || stat_die
|
||||
add_daemon hwclock
|
||||
stat_done
|
||||
;;
|
||||
stop)
|
||||
stat_busy "Adjusting hwclock"
|
||||
stat_busy "Adjusting hwclock to ${HARDWARECLOCK}"
|
||||
hwclock --adjust $HWCLOCK_PARAMS || stat_die
|
||||
rm_daemon hwclock
|
||||
stat_done
|
||||
@@ -33,4 +33,3 @@ case "$1" in
|
||||
echo "usage: $0 {start|stop|restart}"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@@ -3,15 +3,16 @@
|
||||
# sourcing our current rc.conf requires this to be a bash script
|
||||
. @RCLIBDIR@/functions
|
||||
|
||||
conig(){
|
||||
[[ -d /run/tmpfiles.d ]] || mkdir /run/tmpfiles.d
|
||||
kmod static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf
|
||||
config() {
|
||||
for f in $(kmod static-nodes 2>/dev/null|awk '/Module/ {print $2}'); do
|
||||
modprobe -bq $f 2>/dev/null
|
||||
done
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
stat_busy "Starting kmod-static-nodes"
|
||||
conig
|
||||
stat_busy "Loading static kernel modules"
|
||||
config
|
||||
add_daemon kmod-static-nodes
|
||||
stat_done
|
||||
;;
|
||||
|
@@ -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
|
@@ -5,7 +5,6 @@
|
||||
|
||||
load_modules() {
|
||||
local rc=0
|
||||
|
||||
/usr/bin/modules-load
|
||||
(( rc+= $? ))
|
||||
|
||||
@@ -24,4 +23,3 @@ case "$1" in
|
||||
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 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
|
||||
start)
|
||||
stat_busy "Starting net-lo"
|
||||
stat_busy "Setting up loopback interface"
|
||||
ip link set up dev lo || stat_die
|
||||
add_daemon net-lo
|
||||
stat_done
|
||||
|
@@ -1,34 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# sourcing our current rc.conf requires this to be a bash script
|
||||
. @RCLIBDIR@/functions
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
stat_busy "Mounting network filesystems"
|
||||
mount -a -t "$NETFS"
|
||||
rc=$?
|
||||
mount -a -O _netdev
|
||||
(( rc || $? )) && stat_die
|
||||
add_daemon netfs
|
||||
stat_done
|
||||
;;
|
||||
stop)
|
||||
stat_busy "Unmounting network filesystems"
|
||||
umount -a -f -O _netdev
|
||||
rc=$?
|
||||
umount -a -f -t "$NETFS"
|
||||
(( rc || $? )) && stat_die
|
||||
rm_daemon netfs
|
||||
stat_done
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
sleep 1
|
||||
$0 start
|
||||
;;
|
||||
*)
|
||||
echo "usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
@@ -1,21 +0,0 @@
|
||||
#!/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
|
||||
}
|
||||
|
||||
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
|
||||
start)
|
||||
stat_busy "Starting random-seed"
|
||||
stat_busy "Initializing random seed"
|
||||
load_seed
|
||||
add_daemon random-seed
|
||||
stat_done
|
||||
;;
|
||||
stop)
|
||||
stat_busy "Stopping random-seed"
|
||||
stat_busy "Saving random seed"
|
||||
save_seed
|
||||
rm_daemon random-seed
|
||||
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
|
@@ -12,7 +12,7 @@ case "$1" in
|
||||
;;
|
||||
stop)
|
||||
stat_busy "Deactivating swap"
|
||||
swapoff -a || stat_die swap
|
||||
swapoff -a
|
||||
rm_daemon swap
|
||||
stat_done swap
|
||||
;;
|
||||
|
@@ -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"
|
||||
sysusers
|
||||
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
|
@@ -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"
|
||||
tmpfiles --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
|
||||
|
12
sv.d/udev.in
12
sv.d/udev.in
@@ -5,10 +5,15 @@
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
stat_busy "Starting udev daemon"
|
||||
udevd --daemon || stat_die udev
|
||||
if ! pgrep -f "runsv udevd" >/dev/null; then
|
||||
stat_busy "Starting udev and waiting for devices to settle"
|
||||
udevd --daemon
|
||||
udevadm trigger --action=add --type=subsystems
|
||||
udevadm trigger --action=add --type=devices
|
||||
udevadm settle
|
||||
stat_done
|
||||
fi
|
||||
add_daemon udev
|
||||
stat_done udev
|
||||
;;
|
||||
stop)
|
||||
stat_busy "Stopping udev"
|
||||
@@ -21,4 +26,3 @@ case "$1" in
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
Reference in New Issue
Block a user