96 Commits

Author SHA1 Message Date
0071bc2ce0 bundle udevd 2021-04-13 23:41:15 +07:00
96a0aefa1d rc.local.start: make sure to run /etc/rc.local only once 2020-09-05 16:27:13 +07:00
7aa0d2f443 +x 2020-09-05 11:47:26 +07:00
bf99596e5e add compatibility for existing users 2020-09-05 07:44:27 +07:00
397b46ff3f runit-artix: move rc.local and rc.shutdown to sysconfdir 2020-08-25 08:02:23 +07:00
ee63bf4a06 2/3: remove all deprecated files and add new OpenRC compatibility 2020-08-25 08:00:11 +07:00
bcd456603b 3: actually run rc.shutdown instead of rc.local, oops 2020-08-25 07:58:05 +07:00
Érico Rolim
c75de34303 ctrlaltdel: trigger a reboot properly.
/run/runit/{stopit,reboot} should have their perms set to 100 by
ctrlaltdel, before runit signals itself with SIGCONT, in order to
trigger a reboot. This script can be changed by a user to perform
different actions. The comments in it explain what each file is for.

Patch created for Void, imported to Artix.
2020-08-03 23:01:04 +07:00
Érico Rolim
6453301c3b 3: remove /run/runit/reboot handling.
runit uses the permissions in the /etc/runit/reboot file to determine
whether it's going to perform a halt or reboot action. This conditional
in 3 meant that touching the reboot file, even with 000 perms, would
lead to a reboot, which goes agains what is expected according to the
runit documentation.

Patch made for Void, imported to Artix.
2020-08-03 23:00:29 +07:00
Érico Rolim
454078d6a0 1: only create /run/runit directory.
The 100 permission in /run/runit/stopit made it so that signaling runit
with SIGCONT would shut the system down. To achieve the correct
behavior, we should create the stopit and reboot files with 000 perms,
and allow their permissions to be set correctly by calls to `init 0` or
`init 6` or by /etc/runit/ctrlaltdel.

Patch created for Void, imported to Artix.
2020-08-03 22:59:27 +07:00
05801e2283 don't install rc.local -- let users create their own 2020-01-08 15:58:01 +07:00
f84f50c4e9 fix deprecation message 2020-01-01 09:49:40 +07:00
10bdc1aa58 better message 2020-01-01 09:41:28 +07:00
2b66059dbf Move any local files from /etc/rc/rc.local to /etc/rc.local 2019-12-30 22:35:25 +07:00
8eec042261 Add rc.shutdown 2019-03-08 20:16:37 +07:00
8f195fc564 Actually run the sv exit command 2019-02-12 21:16:59 +07:00
6278014c67 Add back support for /etc/rc/rc.local 2018-07-29 23:03:57 +07:00
bdb730a244 README 2018-05-22 09:47:52 +07:00
udeved
427bb5a772 makefile: rm left over rc seds 2018-05-15 13:36:29 +00:00
udeved
f9bf9fb275 remove rc 2018-05-15 13:18:46 +00:00
artoo
4882f52aba Merge pull request #9 from artix-linux/cleanup
latest dev versions cleaned up
2018-05-14 14:47:37 +02:00
udeved
ef17862551 rc-sv: add root check for non list actions 2018-05-13 17:54:22 +00:00
udeved
e148344dfa latest dev versions cleaned up 2018-05-13 15:02:02 +00:00
e8ad706b7b Drop dmraid support since mdadm-over-initramfs should implement it 2018-05-09 21:54:50 +07:00
5d16b77bdb Decouple LVM2 stage1 scripts to its own package 2018-05-09 07:22:56 +07:00
cea6a58cba Decouple cryptsetup initscripts to its own package 2018-05-09 07:16:43 +07:00
d2ebd92f24 Further fix for binfmt
Skip if directory doesn't exist or directory is empty.
Previous implementation was actually successful, but it always returns
1, probably because the loop expects all directories to exist.
2018-05-07 20:58:31 +07:00
4908b26a2d Enable btrfs only if USEBTRFS=yes 2018-05-07 14:24:37 +07:00
fdb0488f1e Fix issues with listing binfmt files 2018-05-07 11:08:52 +07:00
1aeedd0019 Remove /forcefsck and others during cleanup 2018-05-07 10:36:52 +07:00
0db3224e90 Add binfmt support 2018-05-06 20:25:53 +07:00
9527ccc8d0 Only read /etc/vconsole.conf if file exists 2018-05-06 19:46:18 +07:00
fb122c1beb Read from /etc/vconsole.conf for console_setup 2018-05-06 18:31:26 +07:00
8b47e238b9 Enable btrfs support 2018-05-06 18:27:45 +07:00
c9126a652a Make cleanup.sh the very last script to run by stage1 2018-05-06 11:13:45 +07:00
udeved
89b99e475d tmpfiles --clean is not implemented in opentmpfiles; remove the call 2018-05-06 01:14:01 +00:00
udeved
9befe99ed5 merge master 2018-05-05 23:27:57 +00:00
udeved
d36f9e6952 make clean up a sysinit module
rm unused
2018-05-05 23:24:56 +00:00
7852ea0ee3 sysctl: use sysctl --system 2018-05-06 06:12:39 +07:00
cf1c3912e7 Remove /forcefsck and others after boot
After testing, this file wasn't removed after boot, so I had to remove
it manually.
2018-05-06 06:03:29 +07:00
udeved
9cd7ec066b 1: move cleanup in rc 2018-05-05 21:57:53 +00:00
udeved
0df2f865bb rc: don't attempt to remove /tmp, consider /tmp to be mounted tmpfs
give the boot log file a*.log file extension
2018-05-05 21:57:17 +00:00
b3c76e6a59 Mount efivarfs only if EFI is detected 2018-05-05 21:08:11 +07:00
8847aa38b4 Force processes to be killed anyway 2018-05-05 21:06:05 +07:00
161c96b8fa Add license 2018-05-05 20:04:03 +07:00
990661bfd9 Split up getty-runit to its own make 2018-05-05 17:55:05 +07:00
bf732c4905 Move stages to rc, remove HASSYSV flag 2018-05-05 17:38:23 +07:00
24306e68c1 log console messages with bootlogd 2018-05-05 17:23:30 +07:00
9ae595db4f Move sysctl to functions 2018-05-05 17:14:50 +07:00
1eaaac7428 Add sysctl init to stage1 initscript 2018-05-05 17:03:47 +07:00
c9e84492fb Make stage 2 init-agnostic 2018-05-05 17:02:59 +07:00
9e4fd67db6 Add cleanup sysinit to stage1 2018-05-05 17:01:43 +07:00
d47df45f50 Remount RO before deactivating cryptsetup and LVM2 2018-05-05 15:26:25 +07:00
0665f7630b Remove Void shutdown binaries (now handled by artix-sysvcompat) 2018-05-05 13:48:48 +07:00
9a9003b255 sync immediately after remount ro 2018-05-05 13:45:08 +07:00
udeved
a67af1e82b fix bootlogd 2018-05-05 03:49:12 +00:00
udeved
b0238301c9 makefile: add HASSYSV param 2018-05-05 02:09:16 +02:00
udeved
c28ea35b41 merge makefiles 2018-05-05 02:01:09 +02:00
7f0feca5b2 Merge branch 'rc-modules' 2018-05-05 06:05:23 +07:00
a47df21b08 Remove unmount tmpfs
runit needs to read /run during shutdown
2018-05-05 06:00:40 +07:00
989a323867 Fix unmount command 2018-05-05 05:55:19 +07:00
3139aa4609 Fix cryptsetup lock on shutdown 2018-05-05 05:30:11 +07:00
7cad901c86 Fix issues with command not found 2018-05-05 05:24:51 +07:00
d145dce79a Integrate some hooks into initscripts 2018-05-05 05:06:54 +07:00
fd63fdca89 Add back securityfs and efivarfs 2018-05-05 04:48:11 +07:00
7d09c40c88 Add sysinit.d and shutdown.d to makefile 2018-05-05 04:30:42 +07:00
d3a6d855ca Integrate rc.sysinit and rc.shutdown in stage1 and 3 2018-05-05 04:21:17 +07:00
5c42be6143 Use crypt.awk instead 2018-05-05 03:45:20 +07:00
90b1e1c301 typo 2018-05-05 03:22:53 +07:00
udeved
65768e39ea wip 2018-05-04 21:55:50 +02:00
ed2bb8edd7 Add efivarfs 2018-05-05 02:52:00 +07:00
a44aab979b Merge old Arch rc functions to runit-artix 2018-05-04 13:55:32 +07:00
udeved
1e6537cb5c makefile: sed RCDIR 2018-05-03 18:49:47 +02:00
udeved
1250ac8e8f provide rc makefile 2018-05-03 18:41:33 +02:00
udeved
9aed8d1e97 split out rc 2018-05-03 16:18:00 +02:00
udeved
46604a1cb9 rename services->sv 2018-05-03 12:25:19 +02:00
udeved
d8dfa64afc create /var/log/boot 2018-05-03 12:20:22 +02:00
udeved
0b464e9da9 runit.conf: fix sed target 2018-05-03 12:01:51 +02:00
udeved
4dcecb7d45 integrate rc scripts in runit stages 2018-05-03 11:53:22 +02:00
20a1ca16bc Update Makefile
- Move back non-sysv packages in /usr/bin
- Split off sysv-compatible binaries into 'install_sysv'
2018-03-28 21:54:05 +07:00
82bf65d4fa Move remaining shutdown services to its own place 2018-03-27 19:39:43 +07:00
f8a8bc673b Separate shutdown services 2018-03-26 16:45:26 +07:00
65e0733db7 README 2018-01-12 17:23:51 +07:00
d9721360b1 clean up /tmp 2018-01-11 18:10:16 +07:00
Daniel Néri
a3bcf72edb core-services/01-static-devnodes.sh: Honour modprobe blacklists 2018-01-11 12:18:02 +07:00
f3b0b94b3b Add opentmpfiles 2018-01-11 12:11:00 +07:00
Faule Socke
d100216548 Fixed sysctl-file processing order
To avoid local administrator settings getting overwritten by vendor
settings.

Since Artix doesn't have the same issue as Void, this patch can be
applied with no problem.
2018-01-11 11:41:20 +07:00
953c999ccf Various Runit changes (#5)
* Move runit binaries to a dedicated directory

* Adjust options for cp command during install (#71)

* Add opensysusers initscript compatiblity
2018-01-07 12:23:25 -03:00
253e6b1c5e Add an option on whether to use OpenRC or runit as its service manager (#4)
* Add an option on whether to use OpenRC or runit as its service manager

* Move runlevels boot and default to stage2
2018-01-07 12:22:17 -03:00
Chris Cromer
3f8be91085 Merge pull request #2 from Megver83/master
Add OpenRC support for managing services
2017-12-08 16:42:00 -03:00
Chris Cromer
8aebbc7784 Merge pull request #1 from konimex/master
Add openrc cgroup + patches from Void
2017-12-08 16:38:02 -03:00
David P
cd027fc19e Add OpenRC support for managing services 2017-11-20 15:05:18 -03:00
Olivier Mauras
207a4e6ebc core-services/00-pseudofs.sh: Add securityfs mountpoint - Needed for LSM support 2017-10-21 08:45:36 +07:00
Alain Kalker
3fd1449a1f Fix another always succeeding test 2017-10-21 08:44:47 +07:00
Aloz1
6b361ce618 deactivate_crypt should not try to close encrypted volumes that are still mounted during shutdown
* deactivate_crypt should not try to close encrypted volumes that are still mounted during shutdown.

When shutting down or rebooting a system with full disk encryption (as per https://wiki.voidlinux.eu/install_LVM_LUKS and https://wiki.voidlinux.eu/install_LVM_LUKS_on_UEFI_GPT), deactivate_crypt will irrespectively try and close all encrypted partitions, including '/'. On some systems, (including my own) this causes lockups on shutdown or reboot.

This commit ensures that only encrypted volumes with nothing mounted are closed (which should only be '/' at that point in shutdown).

* Reduced if statement to a one liner
2017-10-21 08:43:23 +07:00
c327918eb2 Add openrc cgroup 2017-08-28 00:15:04 +07:00
93 changed files with 321 additions and 946 deletions

28
1
View File

@@ -1,28 +0,0 @@
#!/bin/sh
# vim: set ts=4 sw=4 et:
PATH=/usr/bin:/usr/sbin
. /etc/runit/functions
msg "Welcome to Artix Linux!"
[ -r /etc/runit/rc.conf ] && . /etc/runit/rc.conf
# Start core services: one-time system tasks.
detect_virt
for f in /etc/runit/core-services/*.sh; do
[ -r $f ] && . $f
done
dmesg >/var/log/dmesg.log
if [ $(sysctl -n kernel.dmesg_restrict 2>/dev/null) -eq 1 ]; then
chmod 0600 /var/log/dmesg.log
else
chmod 0644 /var/log/dmesg.log
fi
mkdir -p /run/runit
install -m100 /dev/null /run/runit/stopit
msg "Initialization complete, running stage 2..."

59
3
View File

@@ -1,59 +0,0 @@
#!/bin/sh
# vim: set ts=4 sw=4 et:
PATH=/usr/bin:/usr/sbin
. /etc/runit/functions
detect_virt
[ -r /etc/runit/rc.conf ] && . /etc/runit/rc.conf
if [ -e /run/runit/reboot ]; then
chmod 100 /run/runit/reboot
fi
echo
msg "Waiting for services to stop..."
sv force-stop /run/runit/service/*
sv exit /run/runit/service/*
[ -x /etc/runit/rc.shutdown ] && /etc/runit/rc.shutdown
msg "Saving random seed..."
( umask 077; bytes=$(cat /proc/sys/kernel/random/poolsize) || bytes=512; dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=$bytes >/dev/null 2>&1 )
if [ -z "$VIRTUALIZATION" -a -n "$HARDWARECLOCK" ]; then
hwclock --systohc ${HARDWARECLOCK:+--$(echo $HARDWARECLOCK |tr A-Z a-z)}
fi
halt -w # for utmp
if [ -z "$VIRTUALIZATION" ]; then
msg "Stopping udev..."
udevadm control --exit
fi
msg "Sending TERM signal to processes..."
pkill --inverse -s0,1 -TERM
sleep 1
msg "Sending KILL signal to processes..."
pkill --inverse -s0,1 -KILL
if [ -z "$VIRTUALIZATION" ]; then
msg "Unmounting filesystems, disabling swap..."
swapoff -a
umount -r -a -t nosysfs,noproc,nodevtmpfs,notmpfs
msg "Remounting rootfs read-only..."
mount -o remount,ro /
fi
sync
if [ -z "$VIRTUALIZATION" ]; then
deactivate_vgs
deactivate_crypt
if [ -e /run/runit/reboot ] && command -v kexec >/dev/null; then
msg "Triggering kexec..."
kexec -e 2>/dev/null
# not reached when kexec was successful.
fi
fi

24
COPYING Normal file
View File

@@ -0,0 +1,24 @@
Copyright (C) 2018 Muhammad Herdiansyah
Copyright (C) 2018 Artix Linux Developers
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

236
Makefile
View File

@@ -1,44 +1,200 @@
PREFIX ?= /usr SYSCONFDIR = /etc
SCRIPTS= 1 2 3 ctrlaltdel PREFIX ?= /usr
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man
LIBDIR = $(PREFIX)/lib
RCLIBDIR = $(LIBDIR)/rc
all: ########### runit ###########
$(CC) $(CFLAGS) halt.c -o halt $(LDFLAGS)
$(CC) $(CFLAGS) pause.c -o pause $(LDFLAGS)
install: RCDIR = $(SYSCONFDIR)/rc
install -d ${DESTDIR}${PREFIX}/bin RUNITDIR = $(SYSCONFDIR)/runit
install -m755 halt ${DESTDIR}${PREFIX}/bin/halt-runit SVDIR = $(RUNITDIR)/sv
install -m755 pause ${DESTDIR}${PREFIX}/bin/pause-runit RUNSVDIR = $(RUNITDIR)/runsvdir
install -m755 shutdown ${DESTDIR}${PREFIX}/bin/shutdown-runit SERVICEDIR = /etc/service
install -m755 modules-load ${DESTDIR}${PREFIX}/bin/modules-load RUNDIR = /run/runit
install -m755 zzz ${DESTDIR}${PREFIX}/bin/zzz-runit TMPFILESDIR = $(LIBDIR)/tmpfiles.d
ln -sf halt-runit ${DESTDIR}${PREFIX}/bin/poweroff-runit
ln -sf halt-runit ${DESTDIR}${PREFIX}/bin/reboot-runit
install -d ${DESTDIR}${PREFIX}/share/man/man1
install -m644 pause.1 ${DESTDIR}${PREFIX}/share/man/man1
install -d ${DESTDIR}${PREFIX}/share/man/man8
install -m644 zzz.8 ${DESTDIR}${PREFIX}/share/man/man8/zzz-runit.8
install -m644 shutdown.8 ${DESTDIR}${PREFIX}/share/man/man8/shutdown-runit.8
install -m644 halt.8 ${DESTDIR}${PREFIX}/share/man/man8/halt-runit.8
install -m644 modules-load.8 ${DESTDIR}${PREFIX}/share/man/man8
ln -sf halt-runit.8 ${DESTDIR}${PREFIX}/share/man/man8/poweroff-runit.8
ln -sf halt-runit.8 ${DESTDIR}${PREFIX}/share/man/man8/reboot-runit.8
install -d ${DESTDIR}/etc/runit/sv
install -d ${DESTDIR}/etc/runit/runsvdir
install -d ${DESTDIR}/etc/runit/core-services
install -m644 core-services/*.sh ${DESTDIR}/etc/runit/core-services
install -m755 ${SCRIPTS} ${DESTDIR}/etc/runit
install -m644 functions $(DESTDIR)/etc/runit
install -m644 crypt.awk ${DESTDIR}/etc/runit
install -m644 rc.conf ${DESTDIR}/etc/runit
install -m755 rc.local ${DESTDIR}/etc/runit
install -m755 rc.shutdown ${DESTDIR}/etc/runit
ln -sf /run/runit/reboot ${DESTDIR}/etc/runit/
ln -sf /run/runit/stopit ${DESTDIR}/etc/runit/
cp -aP runsvdir/* ${DESTDIR}/etc/runit/runsvdir/
cp -aP services/* ${DESTDIR}/etc/runit/sv/
clean:
-rm -f halt pause
.PHONY: all install clean TMPFILES = misc/tmpfile.conf
BIN = script/zzz src/pause
STAGES = \
script/1 \
script/2 \
script/3 \
script/ctrlaltdel
RCLOCAL = script/rc.local.start script/rc.shutdown.stop
UDEV = $(wildcard sv/udevd/*)
AGETTY_CONSOLE = $(wildcard sv/agetty-console/*)
AGETTY_CONSOLE_S = supervise.agetty-console
AGETTY_GENERIC = $(wildcard sv/agetty-generic/*)
AGETTY_SERIAL = $(wildcard sv/agetty-serial/*)
AGETTY_TTY1 = $(wildcard sv/agetty-tty1/*)
AGETTY_TTY1_S = supervise.agetty-tty1
AGETTY_TTY2 = $(wildcard sv/agetty-tty2/*)
AGETTY_TTY2_S = supervise.agetty-tty2
AGETTY_TTY3 = $(wildcard sv/agetty-tty3/*)
AGETTY_TTY3_S = supervise.agetty-tty3
AGETTY_TTY4 = $(wildcard sv/agetty-tty4/*)
AGETTY_TTY4_S = supervise.agetty-tty4
AGETTY_TTY5 = $(wildcard sv/agetty-tty5/*)
AGETTY_TTY5_S = supervise.agetty-tty5
AGETTY_TTY6 = $(wildcard sv/agetty-tty6/*)
AGETTY_TTY6_S = supervise.agetty-tty6
AGETTY_TTYAMA0 = $(wildcard sv/agetty-ttyAMA0/*)
AGETTY_TTYAMA0_S = supervise.agetty-ttyAMA0
AGETTY_TTYS0 = $(wildcard sv/agetty-ttyS0/*)
AGETTY_TTYS0_S = supervise.agetty-ttyS0
AGETTY_TTYUSB0 = $(wildcard sv/agetty-ttyUSB0/*)
AGETTY_TTYUSB0_S = supervise.agetty-ttyUSB0
AGETTY_SULOGIN = $(wildcard sv/sulogin/*)
AGETTY_SULOGIN_S = supervise.sulogin
AGETTY_SYMS = \
agetty-tty1 \
agetty-tty2 \
agetty-tty3 \
agetty-tty4 \
agetty-tty5 \
agetty-tty6
SULOGIN_SYM = sulogin
########### end ###########
LN = ln -sf
CP = cp -R --no-dereference --preserve=mode,links -v
RM = rm -f
RMD = rm -fr --one-file-system
M4 = m4 -P
CHMODAW = chmod a-w
CHMODX = chmod +x
EDIT = sed \
-e "s|@RCDIR[@]|$(RCDIR)|g" \
-e "s|@RUNITDIR[@]|$(RUNITDIR)|g" \
-e "s|@SERVICEDIR[@]|$(SERVICEDIR)|g" \
-e "s|@RUNSVDIR[@]|$(RUNSVDIR)|g" \
-e "s|@RUNDIR[@]|$(RUNDIR)|g" \
-e "s|@SYSCONFDIR[@]|$(SYSCONFDIR)|g" \
-e "s|@RCLIBDIR[@]|$(RCLIBDIR)|g"
%: %.in Makefile
@echo "GEN $@"
@$(RM) "$@"
@$(M4) $@.in | $(EDIT) >$@
@$(CHMODAW) "$@"
@$(CHMODX) "$@"
all: all-runit
all-runit: $(STAGES) $(RCLOCAL)
$(CC) $(CFLAGS) src/pause.c -o src/pause $(LDFLAGS)
install-runit:
install -d $(DESTDIR)$(RUNITDIR)
install -m755 $(STAGES) $(DESTDIR)$(RUNITDIR)
install -d $(DESTDIR)$(RUNSVDIR)/single
install -d $(DESTDIR)$(RUNSVDIR)/default
$(LN) default $(DESTDIR)$(RUNSVDIR)/current
$(LN) $(RUNDIR)/reboot $(DESTDIR)$(RUNITDIR)/
$(LN) $(RUNDIR)/stopit $(DESTDIR)$(RUNITDIR)/
install -d $(DESTDIR)$(SYSCONFDIR)/local.d
install -m755 $(RCLOCAL) $(DESTDIR)$(SYSCONFDIR)/local.d
install -d $(DESTDIR)$(BINDIR)
install -m755 $(BIN) $(DESTDIR)$(BINDIR)
install -d $(DESTDIR)$(TMPFILESDIR)
install -m755 $(TMPFILES) $(DESTDIR)$(TMPFILESDIR)/runit.conf
install -d $(DESTDIR)$(SVDIR)/udevd
install -Dm755 $(UDEV) $(DESTDIR)$(SVDIR)/udevd
install -d $(DESTDIR)$(SVDIR)/agetty-console
install -Dm755 $(AGETTY_CONSOLE) $(DESTDIR)$(SVDIR)/agetty-console
$(LN) $(RUNDIR)/$(AGETTY_CONSOLE_S) $(DESTDIR)$(SVDIR)/agetty-console/supervise
install -d $(DESTDIR)$(SVDIR)/agetty-generic
install -Dm755 $(AGETTY_GENERIC) $(DESTDIR)$(SVDIR)/agetty-generic
install -d $(DESTDIR)$(SVDIR)/agetty-serial
install -Dm755 $(AGETTY_SERIAL) $(DESTDIR)$(SVDIR)/agetty-serial
install -d $(DESTDIR)$(SVDIR)/agetty-tty1
install -Dm755 $(AGETTY_TTY1) $(DESTDIR)$(SVDIR)/agetty-tty1
$(LN) $(RUNDIR)/$(AGETTY_TTY1_S) $(DESTDIR)$(SVDIR)/agetty-tty1/supervise
#
install -d $(DESTDIR)$(SVDIR)/agetty-tty2
install -Dm755 $(AGETTY_TTY2) $(DESTDIR)$(SVDIR)/agetty-tty2
$(LN) $(RUNDIR)/$(AGETTY_TTY2_S) $(DESTDIR)$(SVDIR)/agetty-tty2/supervise
install -d $(DESTDIR)$(SVDIR)/agetty-tty3
install -Dm755 $(AGETTY_TTY3) $(DESTDIR)$(SVDIR)/agetty-tty3
$(LN) $(RUNDIR)/$(AGETTY_TTY3_S) $(DESTDIR)$(SVDIR)/agetty-tty3/supervise
install -d $(DESTDIR)$(SVDIR)/agetty-tty4
install -Dm755 $(AGETTY_TTY4) $(DESTDIR)$(SVDIR)/agetty-tty4
$(LN) $(RUNDIR)/$(AGETTY_TTY4_S) $(DESTDIR)$(SVDIR)/agetty-tty4/supervise
install -d $(DESTDIR)$(SVDIR)/agetty-tty5
install -Dm755 $(AGETTY_TTY5) $(DESTDIR)$(SVDIR)/agetty-tty5
$(LN) $(RUNDIR)/$(AGETTY_TTY5_S) $(DESTDIR)$(SVDIR)/agetty-tty5/supervise
install -d $(DESTDIR)$(SVDIR)/agetty-tty6
install -Dm755 $(AGETTY_TTY6) $(DESTDIR)$(SVDIR)/agetty-tty6
$(LN) $(RUNDIR)/$(AGETTY_TTY6_S) $(DESTDIR)$(SVDIR)/agetty-tty6/supervise
install -d $(DESTDIR)$(SVDIR)/agetty-ttyAMA0
install -Dm755 $(AGETTY_TTYAMA0) $(DESTDIR)$(SVDIR)/agetty-ttyAMA0
$(LN) $(RUNDIR)/$(AGETTY_TTYAMA0_S) $(DESTDIR)$(SVDIR)/agetty-ttyAMA0/supervise
install -d $(DESTDIR)$(SVDIR)/agetty-ttyS0
install -Dm755 $(AGETTY_TTYS0) $(DESTDIR)$(SVDIR)/agetty-ttyS0
$(LN) $(RUNDIR)/$(AGETTY_TTYS0_S) $(DESTDIR)$(SVDIR)/agetty-ttyS0/supervise
install -d $(DESTDIR)$(SVDIR)/agetty-ttyUSB0
install -Dm755 $(AGETTY_TTYUSB0) $(DESTDIR)$(SVDIR)/agetty-ttyUSB0
$(LN) $(RUNDIR)/$(AGETTY_TTYUSB0_S) $(DESTDIR)$(SVDIR)/agetty-ttyUSB0/supervise
install -d $(DESTDIR)$(SVDIR)/sulogin
install -Dm755 $(AGETTY_SULOGIN) $(DESTDIR)$(SVDIR)/sulogin
$(LN) $(RUNDIR)/$(AGETTY_SULOGIN_S) $(DESTDIR)$(SVDIR)/sulogin/supervise
for g in $(AGETTY_SYMS); do $(LN) $(SVDIR)/$$g $(DESTDIR)$(RUNSVDIR)/default/$$g; done
for g in $(SULOGIN_SYM); do $(LN) $(SVDIR)/$$g $(DESTDIR)$(RUNSVDIR)/single/$$g; done
install -d $(DESTDIR)$(MANDIR)/man1
install -m644 man/pause.1 $(DESTDIR)$(MANDIR)/man1
install -d $(DESTDIR)$(MANDIR)/man8
install -m644 man/zzz.8 $(DESTDIR)$(MANDIR)/man8/zzz.8
install: install-runit
clean-runit:
-$(RM) src/pause $(STAGES) $(RCLOCAL)
clean: clean-runit
.PHONY: all install clean install-runit clean-runit

View File

@@ -1,24 +1,17 @@
## Runit init scripts for Artix Linux ## Supplemental files for runit in Artix
This repository contains the runit init scripts for the Artix Linux These files are supplements for runit implementation in Artix Linux.
distribution.
This work is based on Void Linux's
[runit-void](https://github.com/voidlinux/void-runit). Patches to Void
Linux's repo will also be applied here.
## Dependencies ## Dependencies
- A POSIX shell
- A POSIX awk
- procps-ng (needs pkill -s0,1)
- runit - runit
- runit-rc (https://github.com/artix-linux/runit-rc)
### How to use it ### How to use it
To see enabled services for "current" runlevel: To see enabled services for "current" runlevel:
$ ls -l /var/service $ ls -l /run/runit/service
To see available runlevels (default and single, which just runs sulogin): To see available runlevels (default and single, which just runs sulogin):
@@ -26,23 +19,21 @@ To see available runlevels (default and single, which just runs sulogin):
To enable and start a service into the "current" runlevel: To enable and start a service into the "current" runlevel:
# ln -s /etc/runit/sv/<service> /var/service # ln -s /etc/runit/sv/<service> /run/runit/service
To disable and remove a service: To disable and remove a service:
# rm -f /var/service/<service> # rm -f /run/runit/service/<service>
To view status of all services for "current" runlevel: To view status of all services for "current" runlevel:
# sv status /var/service/* # sv status /run/runit/service/*
Feel free to send patches and contribute with improvements! Feel free to send patches and contribute with improvements!
## Copyright ## Copyright
runit-cromnix is in the public domain. Some codes are based on void-runit, which is licensed under CC0-1.0
To the extent possible under law, the creator of this work has waived The rest of runit-artix is licensed under the terms as described in the
all copyright and related or neighboring rights to this work. COPYING file.
http://creativecommons.org/publicdomain/zero/1.0/

View File

@@ -1,15 +0,0 @@
# vim: set ts=4 sw=4 et:
msg "Mounting pseudo-filesystems..."
mountpoint -q /proc || mount -o nosuid,noexec,nodev -t proc proc /proc
mountpoint -q /sys || mount -o nosuid,noexec,nodev -t sysfs sys /sys
mountpoint -q /run || mount -o mode=0755,nosuid,nodev -t tmpfs run /run
mountpoint -q /dev || mount -o mode=0755,nosuid -t devtmpfs dev /dev
mkdir -p -m0755 /run/runit /run/lvm /run/user /run/lock /run/log /dev/pts /dev/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
if [ -z "$VIRTUALIZATION" ]; then
mountpoint -q /sys/fs/cgroup || mount -o mode=0755 -t tmpfs cgroup /sys/fs/cgroup
awk '$4 == 1 { system("mountpoint -q /sys/fs/cgroup/" $1 " || { mkdir -p /sys/fs/cgroup/" $1 " && mount -t cgroup -o " $1 " cgroup /sys/fs/cgroup/" $1 " ;}" ) }' /proc/cgroups
fi

View File

@@ -1,6 +0,0 @@
# Some kernel modules must be loaded before starting udev(7).
# Load them by looking at the output of `kmod static-nodes`.
for f in $(kmod static-nodes 2>/dev/null|awk '/Module/ {print $2}'); do
modprobe -q $f 2>/dev/null
done

View File

@@ -1,9 +0,0 @@
# vim: set ts=4 sw=4 et:
[ -n "$VIRTUALIZATION" ] && return 0
# Do not try to load modules if kernel does not support them.
[ ! -e /proc/modules ] && return 0
msg "Loading kernel modules..."
modules-load -v | tr '\n' ' ' | sed 's:insmod [^ ]*/::g; s:\.ko\(\.gz\)\? ::g'
echo

View File

@@ -1,19 +0,0 @@
# vim: set ts=4 sw=4 et:
[ -n "$VIRTUALIZATION" ] && return 0
if [ -x /usr/lib/systemd/systemd-udevd ]; then
_udevd=/usr/lib/systemd/systemd-udevd
elif [ -x /sbin/udevd -o -x /bin/udevd ]; then
_udevd=udevd
else
msg_warn "cannot find udevd!"
fi
if [ -n "${_udevd}" ]; then
msg "Starting udev and waiting for devices to settle..."
${_udevd} --daemon
udevadm trigger --action=add --type=subsystems
udevadm trigger --action=add --type=devices
udevadm settle
fi

View File

@@ -1,26 +0,0 @@
# vim: set ts=4 sw=4 et:
[ -n "$VIRTUALIZATION" ] && return 0
TTYS=${TTYS:-12}
if [ -n "$FONT" ]; then
msg "Setting up TTYs font to '${FONT}'..."
_index=0
while [ ${_index} -le $TTYS ]; do
setfont ${FONT_MAP:+-m $FONT_MAP} ${FONT_UNIMAP:+-u $FONT_UNIMAP} \
$FONT -C "/dev/tty${_index}"
_index=$((_index + 1))
done
fi
if [ -n "$KEYMAP" ]; then
msg "Setting up keymap to '${KEYMAP}'..."
loadkeys -q -u ${KEYMAP}
fi
if [ -n "$HARDWARECLOCK" ]; then
msg "Setting up RTC to '${HARDWARECLOCK}'..."
TZ=$TIMEZONE hwclock --systz \
${HARDWARECLOCK:+--$(echo $HARDWARECLOCK |tr A-Z a-z) --noadjfile} || emergency_shell
fi

View File

@@ -1,70 +0,0 @@
# vim: set ts=4 sw=4 et:
[ -n "$VIRTUALIZATION" ] && return 0
msg "Remounting rootfs read-only..."
mount -o remount,ro / || emergency_shell
if [ -x /sbin/dmraid -o -x /bin/dmraid ]; then
msg "Activating dmraid devices..."
dmraid -i -ay
fi
if [ -x /bin/btrfs ]; then
msg "Activating btrfs devices..."
btrfs device scan || emergency_shell
fi
if [ -x /sbin/vgchange -o -x /bin/vgchange ]; then
msg "Activating LVM devices..."
vgchange --sysinit -a y || emergency_shell
fi
if [ -e /etc/crypttab ]; then
msg "Activating encrypted devices..."
awk -f /etc/runit/crypt.awk /etc/crypttab
if [ -x /sbin/vgchange -o -x /bin/vgchange ]; then
msg "Activating LVM devices for dm-crypt..."
vgchange --sysinit -a y || emergency_shell
fi
fi
if [ -e /etc/zfs/zpool.cache -a -x /usr/bin/zfs ]; then
msg "Activating ZFS devices..."
zpool import -c /etc/zfs/zpool.cache -N -a
msg "Mounting ZFS file systems..."
zfs mount -a
msg "Sharing ZFS file systems..."
zfs share -a
# NOTE(dh): ZFS has ZVOLs, block devices on top of storage pools.
# In theory, it would be possible to use these as devices in
# dmraid, btrfs, LVM and so on. In practice it's unlikely that
# anybody is doing that, so we aren't supporting it for now.
fi
[ -f /fastboot ] && FASTBOOT=1
[ -f /forcefsck ] && FORCEFSCK="-f"
for arg in $(cat /proc/cmdline); do
case $arg in
fastboot) FASTBOOT=1;;
forcefsck) FORCEFSCK="-f";;
esac
done
if [ -z "$FASTBOOT" ]; then
msg "Checking filesystems:"
fsck -A -T -a -t noopts=_netdev $FORCEFSCK
if [ $? -gt 1 ]; then
emergency_shell
fi
fi
msg "Mounting rootfs read-write..."
mount -o remount,rw / || emergency_shell
msg "Mounting all non-network filesystems..."
mount -a -t "nosysfs,nonfs,nonfs4,nosmbfs,nocifs" -O no_netdev || emergency_shell

View File

@@ -1,6 +0,0 @@
# vim: set ts=4 sw=4 et:
[ -n "$VIRTUALIZATION" ] && return 0
msg "Initializing swap..."
swapon -a || emergency_shell

View File

@@ -1,21 +0,0 @@
# vim: set ts=4 sw=4 et:
msg "Initializing random seed..."
cp /var/lib/random-seed /dev/urandom >/dev/null 2>&1 || true
( umask 077; bytes=$(cat /proc/sys/kernel/random/poolsize) || bytes=512; dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=$bytes >/dev/null 2>&1 )
msg "Setting up loopback interface..."
ip link set up dev lo
[ -r /etc/hostname ] && read -r HOSTNAME < /etc/hostname
if [ -n "$HOSTNAME" ]; then
msg "Setting up hostname to '${HOSTNAME}'..."
printf "%s" "$HOSTNAME" > /proc/sys/kernel/hostname
else
msg_warn "Didn't setup a hostname!"
fi
if [ -n "$TIMEZONE" ]; then
msg "Setting up timezone to '${TIMEZONE}'..."
ln -sf "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
fi

View File

@@ -1,16 +0,0 @@
# vim: set ts=4 sw=4 et:
if [ -x /sbin/sysctl -o -x /bin/sysctl ]; then
msg "Loading sysctl(8) settings..."
for i in /run/sysctl.d/*.conf \
/etc/sysctl.d/*.conf \
/usr/local/lib/sysctl.d/*.conf \
/usr/lib/sysctl.d/*.conf \
/etc/sysctl.conf; do
if [ -e "$i" ]; then
printf '* Applying %s ...\n' "$i"
sysctl -p "$i"
fi
done
fi

View File

@@ -1,11 +0,0 @@
# vim: set ts=4 sw=4 et:
install -m0664 -o root -g utmp /dev/null /run/utmp
if [ ! -e /var/log/wtmp ]; then
install -m0664 -o root -g utmp /dev/null /var/log/wtmp
fi
if [ ! -e /var/log/btmp ]; then
install -m0600 -o root -g utmp /dev/null /var/log/btmp
fi
install -dm1777 /tmp/.X11-unix /tmp/.ICE-unix
rm -f /etc/nologin /forcefsck /forcequotacheck /fastboot

103
crypt.awk
View File

@@ -1,103 +0,0 @@
/^#/ || /^$/ { next }
NF>4 { print "a valid crypttab has max 4 cols not " NF >"/dev/stderr"; next }
{
# decode the src variants
split($2, o_src, "=")
if (o_src[1] == "UUID") ("blkid -l -o device -t " $2) | getline src;
else src=o_src[1];
# no password or none is given, ask fo it
if ( NF == 2 ) {
ccmd="cryptsetup luksOpen " src " " $1;
system(ccmd);
ccmd="";
}
else if (NF == 3 ) {
dest=$1
key=$3
split($3, po, "=");
if ( po[1] == "none") ccmd="cryptsetup luksOpen " src " " dest;
else ccmd="cryptsetup luksOpen -d " key " " src" " dest;
system(ccmd);
ccmd="";
}
else {
# the option field is not empty parse the options
dest=$1
key=$3
split($4, opts, ",");
commonopts="";
swapopts="";
luksopts="";
for(i in opts) {
split(opts[i], para, "=");
par=para[1];
val=para[2];
if ( par == "readonly" || par == "read-only") commonopts=commonopts "-r ";
else if ( par == "discard" ) commonopts=commonopts "--allow-discards ";
else if ( par == "tries" ) commonopts=commonopts "-T " val " ";
else if ( par == "swap" ) makeswap="y";
else if ( par == "cipher" ) swapopts=swapopts "-c " val " ";
else if ( par == "size" ) swapopts=swapopts "-s " val " ";
else if ( par == "hash" ) swapopts=swapopts "-h " val " ";
else if ( par == "offset" ) swapopts=swapopts "-o " val " ";
else if ( par == "skip" ) swapopts=swapopts "-p " val " ";
else if ( par == "verify" ) swapopts=swapopts "-y ";
#else if ( par == "noauto" )
#else if ( par == "nofail" )
#else if ( par == "plain" )
#else if ( par == "timeout" )
#else if ( par == "tmp" )
else if ( par == "luks" ) use_luks="y";
else if ( par == "keyscript" ) {use_keyscript="y"; keyscript=val;}
else if ( par == "keyslot" || par == "key-slot" ) luksopts=luksopts "-S " val " ";
else if ( par == "keyfile-size" ) luksopts=luksopts "-l " val " ";
else if ( par == "keyfile-offset" ) luksopts=luksopts "-keyfile-offset=" val " ";
else if ( par == "header" ) luksopts=luksopts "--header=" val " ";
else {
print "option: " par " not supported " >"/dev/stderr";
makeswap="";
use_luks="";
use_keyscript="";
next;
}
}
if ( makeswap == "y" && use_luks != "y" ) {
ccmd="cryptsetup " swapopts commonopts "-d " key " create " dest " " src;
ccmd_2="mkswap /dev/mapper/" dest;
makeswap="";
use_luks="";
use_keyscript="";
system(ccmd);
system(ccmd_2);
ccmd="";
ccmd_2="";
next;
}
if ( use_luks == "y" && makeswap != "y" ){
if ( use_keyscript == "y") {
ccmd=keyscript " | cryptsetup " luksopts commonopts "luksOpen -d - " src " " dest;
use_keyscript="";
}
else {
if ( key == "none" ){
ccmd="cryptsetup " luksopts commonopts "luksOpen " src " " dest;
}
else {
ccmd="cryptsetup " luksopts commonopts "luksOpen -d " key " " src " " dest;
}
}
}
else {
print "use swap OR luks as option" >"/dev/stderr";
ccmd="";
}
makeswap="";
use_luks="";
use_keyscript="";
if ( ccmd != ""){
system(ccmd);
ccmd=""
}
}
}

View File

@@ -1,55 +0,0 @@
# *-*-shell-*-*
msg() {
# bold
printf "\033[1m=> $@\033[m\n"
}
msg_ok() {
# bold/green
printf "\033[1m\033[32m OK\033[m\n"
}
msg_error() {
# bold/red
printf "\033[1m\033[31mERROR: $@\033[m\n"
}
msg_warn() {
# bold/yellow
printf "\033[1m\033[33mWARNING: $@\033[m"
}
emergency_shell() {
echo
echo "Cannot continue due to errors above, starting emergency shell."
echo "When ready type exit to continue booting."
/bin/sh -l
}
detect_virt() {
# Detect LXC containers
[ ! -e /proc/self/environ ] && return
if grep -q lxc /proc/self/environ >/dev/null; then
export VIRTUALIZATION=1
fi
}
deactivate_vgs() {
_group=${1:-All}
if [ -x /sbin/vgchange -o -x /bin/vgchange ]; then
vgs=$(vgs|wc -l)
if [ $vgs -gt 0 ]; then
msg "Deactivating $_group LVM Volume Groups..."
vgchange -an
fi
fi
}
deactivate_crypt() {
if [ -x /sbin/dmsetup -o -x /bin/dmsetup ]; then
msg "Deactivating Crypt Volumes"
dmsetup ls --target crypt --exec 'cryptsetup close'
deactivate_vgs "Crypt"
fi
}

67
halt.8
View File

@@ -1,67 +0,0 @@
.Dd July 29, 2014
.Dt HALT 8
.Os Linux
.Sh NAME
.Nm halt ,
.Nm reboot ,
.Nm poweroff
.Nd stop the system
.Sh SYNOPSIS
.Nm halt
.Op Fl n
.Op Fl f
.Nm reboot
.Op Fl n
.Op Fl f
.Nm poweroff
.Op Fl n
.Op Fl f
.Sh DESCRIPTION
.Nm halt
/
.Nm reboot
/
.Nm poweroff
tells
.Xr init 8
to bring down, reboot, or power off the system.
Without
.Fl f ,
it is a shortcut for
.Nm init 0
/
.Nm init 6 .
.Bl -tag -width indent
.It Fl n
Don't sync before reboot or halt.
Note that the kernel and storage drivers may still sync.
.It Fl f
Force halt or reboot, don't call
.Xr init 8 .
This is
.Sy dangerous !
.El
.Sh UNSUPPORTED OPTIONS
This version of
.Nm
is based on
.Xr runit 8 ,
the following features are
.Sy not
supported and silently ignored:
.Bl -tag -width indent
.It Fl w
to just write the wtmp record.
.It Fl d
to not write the wtmp record.
.It Fl h
to put hard drives in standby mode.
.It Fl i
to shut down network interfaces.
.El
.Sh SEE ALSO
.Xr init 8 ,
.Xr shutdown 8
.Sh AUTHOR
.An Leah Neukirchen ,
.Mt leah@vuxu.org .

77
halt.c
View File

@@ -1,77 +0,0 @@
#include <errno.h>
#include <unistd.h>
#include <err.h>
#include <string.h>
#include <sys/reboot.h>
extern char *__progname;
typedef enum {NOOP, HALT, REBOOT, POWEROFF} action_type;
int main(int argc, char *argv[]) {
int do_sync = 1;
int do_force = 0;
int opt;
action_type action = NOOP;
if (strcmp(__progname, "halt") == 0)
action = HALT;
else if (strcmp(__progname, "reboot") == 0)
action = REBOOT;
else if (strcmp(__progname, "poweroff") == 0)
action = POWEROFF;
else
warnx("no default behavior, needs to be called as halt/reboot/poweroff.");
while ((opt = getopt(argc, argv, "dfhinw")) != -1)
switch (opt) {
case 'n':
do_sync = 0;
break;
case 'w':
action = NOOP;
do_sync = 0;
break;
case 'd':
case 'h':
case 'i':
/* silently ignored. */
break;
case 'f':
do_force = 1;
break;
default:
errx(1, "Usage: %s [-n] [-f]", __progname);
}
if (do_sync)
sync();
switch (action) {
case HALT:
if (do_force)
reboot(RB_HALT_SYSTEM);
else
execl("/bin/runit-init", "init", "0", (char*)0);
err(1, "halt failed");
break;
case POWEROFF:
if (do_force)
reboot(RB_POWER_OFF);
else
execl("/bin/runit-init", "init", "0", (char*)0);
err(1, "poweroff failed");
break;
case REBOOT:
if (do_force)
reboot(RB_AUTOBOOT);
else
execl("/bin/runit-init", "init", "6", (char*)0);
err(1, "reboot failed");
break;
case NOOP:
break;
}
return 0;
}

View File

9
misc/tmpfile.conf Normal file
View File

@@ -0,0 +1,9 @@
#
# /usr/lib/tmpfiles.d/runit.conf
#
d /run/runit 0755 root root -
d /run/user 0755 root root -
d /run/lock 0755 root root -
d /run/log 0755 root root -
d /run/lvm 0755 root root -

View File

@@ -1,19 +0,0 @@
#!/bin/sh
# modules-load [-n] [-v] - modules-load.d(5) compatible kernel module loader
export PATH=/bin:/sbin
{
# Parameters passed as modules-load= or rd.modules-load= in kernel command line.
sed -nr 's/,/\n/;s/(.* |^)(rd\.)?modules-load=([^ ]*).*/\3/p' /proc/cmdline
# Find files /{etc,run,usr/lib}/modules-load.d/*.conf in that order.
find -L /etc/modules-load.d /run/modules-load.d /usr/lib/modules-load.d \
-maxdepth 1 -name '*.conf' -printf '%p %P\n' 2>/dev/null |
# Load each basename only once.
sort -k2 -s | uniq -f1 | cut -d' ' -f1 |
# Read the files, output all non-empty, non-comment lines.
tr '\012' '\0' | xargs -0 -r grep -h -v -e '^[#;]' -e '^$'
} |
# Call modprobe on the list of modules
tr '\012' '\0' | xargs -0 -r modprobe -ab "$@"

View File

@@ -1,52 +0,0 @@
.Dd June 1, 2016
.Dt MODULES-LOAD 8
.Os Linux
.Sh NAME
.Nm modules-load
.Nd Configure kernel modules to load at boot
.Sh SYNOPSIS
.Nm modules-load
.Op Fl nv
.Sh DESCRIPTION
.Nm
reads files which contain kernel modules to load during boot from the list of
locations below.
.Bl -tag -width indent
.It Fl n
dry-run mode.
This option does everything but actually insert or delete the modules.
.It Fl v
verbose mode.
Print messages about what the program is doing.
.El
.Sh FILES
Configuration files are read from the following locations:
.Bl -tag -width indent
.It /etc/modules-load.d/*.conf
.It /run/modules-load.d/*.conf
.It /usr/lib/modules-load.d/*.conf
.El
.Pp
The configuration files should simply contain a list of kernel module names
to load, separated by newlines.
Empty lines and lines whose first non-whitespace character is # or ; are
ignored.
.Sh EXAMPLES
.Pa /etc/modules-load.d/virtio-net.conf :
.Bd -literal -offset indent
# Load virtio-net.ko at boot
virtio-net
.Ed
.Sh SEE ALSO
.Xr modprobe 8
.Sh HISTORY
This program is a replacement for the
.Nm modules-load
utility provided by
.Nm systemd .
.Sh AUTHOR
.An Leah Neukirchen ,
.Mt leah@vuxu.org .
.Sh LICENSE
.Nm
is in the public domain.

29
rc.conf
View File

@@ -1,29 +0,0 @@
# /etc/runit/rc.conf - system configuration
# Set the host name.
#
# NOTE: it's preferred to declare the hostname in /etc/hostname instead:
# - echo myhost > /etc/hostname
#
#HOSTNAME="artix"
# Set RTC to UTC or localtime.
#HARDWARECLOCK="UTC"
# Set timezone, availables timezones at /usr/share/zoneinfo.
#TIMEZONE="Europe/Madrid"
# Keymap to load, see loadkeys(8).
#KEYMAP="us"
# Console font to load, see setfont(8).
#FONT="lat9w-16"
# Console map to load, see setfont(8).
#FONT_MAP=
# Font unimap to load, see setfont(8).
#FONT_UNIMAP=
# Amount of ttys which should be setup.
#TTYS=6

View File

@@ -1,4 +0,0 @@
# Default rc.local; add your custom commands here.
#
# This is run by runit in stage 2 before the services are executed
# (see /etc/runit/2).

View File

@@ -1,4 +0,0 @@
# Default rc.shutdown; add your custom commands here.
#
# This is run by runit in stage 3 after the services are stopped
# (see /etc/runit/3).

View File

@@ -1 +0,0 @@
default

View File

@@ -1 +0,0 @@
/etc/runit/sv/agetty-tty1

View File

@@ -1 +0,0 @@
/etc/runit/sv/agetty-tty2

View File

@@ -1 +0,0 @@
/etc/runit/sv/agetty-tty3

View File

@@ -1 +0,0 @@
/etc/runit/sv/agetty-tty4

View File

@@ -1 +0,0 @@
/etc/runit/sv/agetty-tty5

View File

@@ -1 +0,0 @@
/etc/runit/sv/agetty-tty6

View File

@@ -1 +0,0 @@
/etc/runit/sv/sulogin

12
script/1.in Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
PATH=/usr/bin:/usr/sbin
. @RCLIBDIR@/functions
run_sysinit
install -m000 /dev/null @RUNDIR@/stopit
install -m000 /dev/null @RUNDIR@/reboot
status "Initialization complete"

View File

@@ -1,21 +1,23 @@
#!/bin/sh #!/bin/bash
# vim: set ts=4 sw=4 et:
PATH=/usr/bin:/usr/sbin PATH=/usr/bin:/usr/sbin
runlevel=default runlevel=default
for arg in $(cat /proc/cmdline); do for arg in $(cat /proc/cmdline); do
if [ -d /etc/runit/runsvdir/"$arg" ]; then if [ -d @RUNITDIR@/runsvdir/"$arg" ]; then
echo "Runlevel detected: '$arg' (via kernel cmdline)" echo "Runlevel detected: '$arg' (via kernel cmdline)"
runlevel="$arg" runlevel="$arg"
fi fi
done done
[ -x /etc/runit/rc.local ] && /etc/runit/rc.local # Hacky hacky OpenRC compatibility
for script in @SYSCONFDIR@/local.d/*.start; do
[ -x "$script" ] && "$script"
done
runsvchdir "${runlevel}" runsvchdir "${runlevel}"
mkdir -p /run/runit/runsvdir
ln -s /etc/runit/runsvdir/current /run/runit/service ln -s @RUNSVDIR@/current @SERVICEDIR@
exec env - PATH=$PATH \ exec env - PATH=$PATH \
runsvdir -P /run/runit/service 'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................' runsvdir -P @SERVICEDIR@ 'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................'

25
script/3.in Executable file
View File

@@ -0,0 +1,25 @@
#!/bin/bash
PATH=/usr/bin:/usr/sbin
. @RCLIBDIR@/functions
stat_busy "Stop services ..."
sv force-stop @RUNDIR@/service/*
stat_done
stat_busy "Exit services ..."
sv exit @RUNDIR@/service/*
stat_done
# Hacky hacky OpenRC compatibility
for script in @SYSCONFDIR@/local.d/*.stop; do
[ -x "$script" ] && "$script"
done
run_shutdown
if [ -e @RUNDIR@/reboot ]; then
[[ -x $(type -P kexec) ]] && kexec -e &>/dev/null
fi
status "Stage 3 completed."

View File

@@ -3,8 +3,11 @@
PATH=/usr/bin:/usr/sbin PATH=/usr/bin:/usr/sbin
MSG="System is going down..." MSG="System is going down..."
# We check for this file after receiving a SIGCONT to move to stage3
chmod 100 @RUNDIR@/stopit
# We check for this file in stage3 to halt or reboot # We check for this file in stage3 to halt or reboot
touch /run/runit/reboot chmod 100 @RUNDIR@/reboot
# Proceed with shutdown process # Proceed with shutdown process
echo "$MSG" | wall echo "$MSG" | wall

15
script/rc.local.start.in Normal file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
if [ ! -x @SYSCONFDIR@/rc.local ]; then
cat > @SYSCONFDIR@/rc.local << EOF
# @SYSCONFDIR@/rc.local -- rc.local for Artix Linux
#
# Enter your custom commands here. It will be executed on stage 2
# before running services.
EOF
chmod +x @SYSCONFDIR@/rc.local
fi
# Execute rc.local only once.
# If artix-branding-base exists, that one will execute rc.local instead.
[ ! -x @SYSCONFDIR@/local.d/local.start ] && . @SYSCONFDIR@/rc.local

View File

@@ -0,0 +1,13 @@
#!/bin/sh
if [ ! -x @SYSCONFDIR@/rc.shutdown ]; then
cat > @SYSCONFDIR@/rc.shutdown << EOF
# @SYSCONFDIR@/rc.shutdown -- rc.shutdown for Artix Linux
#
# Enter your custom commands here. It will be executed on stage 3
# after stopping services.
EOF
chmod +x @SYSCONFDIR@/rc.shutdown
fi
. @SYSCONFDIR@/rc.shutdown

View File

View File

@@ -1 +0,0 @@
/run/runit/supervise.agetty-console

View File

@@ -1 +0,0 @@
/run/runit/supervise.agetty-tty1

View File

@@ -1 +0,0 @@
/run/runit/supervise.agetty-tty2

View File

@@ -1 +0,0 @@
/run/runit/supervise.agetty-tty3

View File

@@ -1 +0,0 @@
/run/runit/supervise.agetty-tty4

View File

@@ -1 +0,0 @@
/run/runit/supervise.agetty-tty5

View File

@@ -1 +0,0 @@
/run/runit/supervise.agetty-tty6

View File

@@ -1 +0,0 @@
/run/runit/supervise.agetty-ttyAMA0

View File

@@ -1 +0,0 @@
/run/runit/supervise.agetty-ttyS0

View File

@@ -1 +0,0 @@
/run/runit/supervise.agetty-ttyUSB0

View File

@@ -1 +0,0 @@
/run/runit/supervise.sulogin

View File

@@ -1,73 +0,0 @@
#!/bin/sh
# shutdown - shutdown(8) lookalike for runit
single() {
runsvchdir single
}
abort() {
printf '%s\n' "$1" >&2
exit 1
}
usage() {
abort "Usage: ${0##*/} [-fF] [-kchPr] time [warning message]"
}
action=single
while getopts akrhPHfFnct: opt; do
case "$opt" in
a|n|H) abort "'-$opt' is not implemented";;
t) ;;
f) touch /fastboot;;
F) touch /forcefsck;;
k) action=true;;
c) action=cancel;;
h|P) action=halt;;
r) action=reboot;;
[?]) usage;;
esac
done
shift $((OPTIND - 1))
[ $# -eq 0 ] && usage
time=$1; shift
message="${*:-system is going down}"
if [ "$action" = "cancel" ]; then
kill "$(cat /run/runit/shutdown.pid)"
if [ -e /etc/nologin ] && ! [ -s /etc/nologin ]; then
rm /etc/nologin
fi
echo "${*:-shutdown cancelled}" | wall
exit
fi
touch /run/runit/shutdown.pid 2>/dev/null || abort "Not enough permissions to execute ${0#*/}"
echo $$ >/run/runit/shutdown.pid
case "$time" in
now) time=0;;
+*) time=${time#+};;
*:*) abort "absolute time is not implemented";;
*) abort "invalid time";;
esac
for break in 5 0; do
[ "$time" -gt "$break" ] || continue
[ "$break" = 0 ] && touch /etc/nologin
printf '%s in %s minutes\n' "$message" "$time" | wall
printf 'shutdown: sleeping for %s minutes... ' "$(( time - break ))"
sleep $(( (time - break) * 60 ))
time="$break"
printf '\n'
[ "$break" = 0 ] && rm /etc/nologin
done
printf '%s NOW\n' "$message" | wall
$action

View File

@@ -1,90 +0,0 @@
.Dd July 29, 2014
.Dt SHUTDOWN 8
.Os Linux
.Sh NAME
.Nm shutdown
.Nd bring down the system
.Sh SYNOPSIS
.Nm shutdown
.Op Fl rhP
.Op Fl fF
.Op Cm now | Cm + Ns Ar mins
.Op Ar message ...
.Sh DESCRIPTION
.Nm
brings the system down in a secure way.
All logged-in users
are notified that the system is going down, and
.Xr login 1
is blocked.
.Pp
By default,
.Nm
puts the system into single user mode.
Rebooting and halting the system can be done using the following options:
.Bl -tag -width indent
.It Fl c
Cancel an ongoing shutdown.
.It Fl f
Enable fast booting; skip
.Xr fsck 8
on next boot.
.It Fl F
Force run of
.Xr fsck 8
on next boot.
.It Fl h
Halt the system.
.It Fl k
Don't really shutdown; only send the warning messages to everybody.
.It Fl P
Poweroff the system.
.It Fl r
Reboot the system.
.It Cm now
Shutdown without further waiting.
.It Cm + Ns Ar mins
Wait
.Ar mins
minutes before shutting down.
.It Ar message
Message displayed to all users, defaults to "system is going down".
.El
.Sh UNSUPPORTED OPTIONS
This version of
.Nm
is based on
.Xr runit 8 ,
the following features are
.Sy not
supported:
.Bl -tag -width indent
.It Fl t Ar secs
to wait
.Ar secs
seconds between SIGKILL and SIGTERM on shutdown is silently ignored.
.It Fl a
Use
.Pa /etc/shutdown.allow .
.It Fl H
Drop into boot monitor.
.It Fl n
Don't call
.Xr init 8 .
.It Ar hh Ns : Ns Ar mm
Absolute time specification is not implemented.
.El
.Sh EXAMPLES
Turn off the system:
.Dl # shutdown -h now
.Sh SEE ALSO
.Xr fsck 8 ,
.Xr halt 8 ,
.Xr init 8 ,
.Xr poweroff 8 ,
.Xr reboot 8 ,
.Xr runit 8 ,
.Xr runsvchdir 8
.Sh AUTHOR
.An Leah Neukirchen ,
.Mt leah@vuxu.org .

View File

@@ -1,4 +1,4 @@
if [ -x /sbin/agetty -o /bin/agetty ]; then if [ -x /sbin/agetty -o -x /bin/agetty ]; then
# util-linux specific settings # util-linux specific settings
if [ "${tty}" = "tty1" ]; then if [ "${tty}" = "tty1" ]; then
GETTY_ARGS="--noclear" GETTY_ARGS="--noclear"

3
sv/udevd/run Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
udevadm control --exit
exec udevd