22 Commits
1.1 ... 1.8

Author SHA1 Message Date
48b9a2a9ec openrc (#26)
Reviewed-on: #26
2025-03-06 22:44:30 +00:00
e14878b49c artix-service: use dinitctl for disable and enable ops 2024-06-03 07:42:36 +07:00
31f3dda786 openrc: readd binfmt hook 2024-05-05 19:36:55 +02:00
09ef3fc619 Merge pull request 'unify binfmt into a single implementation' (#25) from binfmt into master
Reviewed-on: #25
2024-05-05 17:46:14 +02:00
9442565f14 unify binfmt into a single implementation
Since binfmt now lives in artix-groups, all the inits can use the same,
simplified hook.
2024-05-05 09:50:02 -05:00
c17eb2ad37 wrapper: fix quote to run 2024-01-07 22:06:00 +01:00
70445d2177 wrapper: remove script name from help 2024-01-05 00:35:32 +01:00
5d3cd01ffe wrapper: drop printf 2024-01-04 23:31:00 +01:00
fccd8fcdd9 bash (#24)
Reviewed-on: #24
2024-01-04 20:08:21 +01:00
0126b86bf7 wrapper: fix runit enable/disable 2024-01-04 03:50:49 +01:00
1487bf4089 makefile: install wrapper in /bin 2024-01-02 02:52:50 +01:00
cf66dd76c5 wrapper: add artix-service 2024-01-02 02:44:31 +01:00
d68ed909c4 actually fix runit test 2023-11-10 18:50:35 +07:00
Qontinuum
3ada9e391e Fix Runit commands 2023-11-07 20:06:01 +01:00
3d142ebda7 add artix-svc wrapper 2023-11-07 17:30:58 +01:00
7a5877342a Merge pull request 's6: change early getty to tty12' (#22) from s6-early-getty into master
Reviewed-on: #22
2023-11-07 17:14:15 +01:00
6a1c2c55d9 s6: change early getty to tty12
Some things do actually use tty7, so tty12 is better as a backup getty.
2023-11-06 20:00:53 -06:00
09bc2d021b run udevadm trigger with -c change 2023-09-27 15:40:33 +02:00
8396101929 adopt esysusers & tmpfiles 2023-08-29 02:25:43 +02:00
1344532759 adopt etmpfiles & esysusers binaries 2023-08-18 18:46:07 +02:00
4ace40eddd udev: use separate udevadm settle call 2023-05-03 10:20:29 +02:00
6a9ac65e53 udev: update hook script; not sure this change will work with future eudev release 2023-03-03 16:17:46 +01:00
13 changed files with 123 additions and 39 deletions

View File

@@ -2,6 +2,7 @@ PREFIX ?= /usr
ALPMDIR = $(PREFIX)/share/libalpm
SCRIPTSDIR = $(ALPMDIR)/scripts
HOOKSDIR = $(ALPMDIR)/hooks
BINDIR = $(PREFIX)/bin
OPENRCSCRIPTS = $(wildcard openrc/scripts/*)
OPENRCHOOKS = $(wildcard openrc/hooks/*)
@@ -33,9 +34,11 @@ UDEVHOOKS = $(wildcard udev/hooks/*)
BASESCRIPTS = $(wildcard base/scripts/*)
BASEHOOKS = $(wildcard base/hooks/*)
TMPFILESHOOKS = $(wildcard tmpfiles/hooks/*)
TMPFILESHOOKS = $(wildcard etmpfiles/hooks/*)
SYSUSERSHOOKS = $(wildcard sysusers/hooks/*)
SYSUSERSHOOKS = $(wildcard esysusers/hooks/*)
WRAPPER = $(wildcard wrapper/*)
DMODE = -dm0755
MODE = -m0644
@@ -105,4 +108,8 @@ install_dinit_at: install_hook_common
install_dinit_dbus: install_hook_common
install $(MODE) $(DINITDBUSHOOKS) $(DESTDIR)$(HOOKSDIR)
.PHONY: install install_base install_s6 install_openrc install_runit install_dinit
install_wrapper:
install $(DMODE) $(DESTDIR)$(BINDIR)
install $(EMODE) $(WRAPPER) $(DESTDIR)$(BINDIR)
.PHONY: install install_base install_s6 install_openrc install_runit install_dinit install_wrapper

View File

@@ -7,5 +7,5 @@ Target = usr/lib/binfmt.d/*.conf
[Action]
Description = Registering binary formats...
When = PostTransaction
Exec = /usr/share/libalpm/scripts/dinit-hook binfmt
Exec = /usr/lib/artix/binfmt.sh
NeedsTargets

View File

@@ -33,7 +33,7 @@ init_detect(){
s6_init_remake(){
# we need to ensure that s6-linux-init-maker is run on every machine
rm -rf /tmp/current
s6-linux-init-maker -1 -G "/usr/bin/agetty -L -8 tty7 115200" -c /etc/s6/current /tmp/current
s6-linux-init-maker -1 -G "/usr/bin/agetty -L -8 tty12 115200" -c /etc/s6/current /tmp/current
mv /tmp/current/bin/init /tmp/current/bin/s6-init
cp -a /tmp/current/bin /usr
rm -rf /tmp/current/{bin,scripts}

View File

@@ -46,7 +46,6 @@ op="$1"; shift
case $op in
sysctl) dinit_live; each_conf /usr/bin/sysctl -q -p ;;
binfmt) dinit_live; /usr/bin/dinitctl restart binfmt ;;
dbus_reload) dinit_live; reload_dbus ;;
# For use by other packages
reload) dinit_live; /usr/bin/dinitctl reload "$@"; /usr/bin/dinitctl restart "$@" ;;

View File

@@ -7,4 +7,4 @@ Target = usr/lib/sysusers.d/*.conf
[Action]
Description = Creating system user accounts...
When = PostTransaction
Exec = /usr/bin/sysusers
Exec = /usr/bin/esysusers

View File

@@ -7,4 +7,4 @@ Target = usr/lib/tmpfiles.d/*.conf
[Action]
Description = Creating temporary files...
When = PostTransaction
Exec = /usr/bin/tmpfiles --create
Exec = /usr/bin/etmpfiles --create

View File

@@ -10,17 +10,23 @@ openrc_live() {
svc_help(){
echo " ==> Start/stop/restart a service:"
echo " rc-service <service> <start/stop/restart>"
echo " ==> Further info on user services:"
echo "https://wiki.artixlinux.org/Main/OpenRC#User_Services"
}
svc_add_help(){
echo " ==> Add a service to runlevel:"
echo " rc-update add <service> <runlevel>"
echo " ==> Add a user service to runlevel:"
echo " rc-update add <service> <runlevel> -U"
svc_help
}
svc_del_help(){
echo " ==> Remove a service from runlevel:"
echo " rc-update del <service> <runlevel>"
echo " ==> Remove a user service from runlevel:"
echo " rc-update del <service> <runlevel> -U"
svc_help
}

View File

@@ -1,11 +0,0 @@
[Trigger]
Type = Path
Operation = Install
Operation = Upgrade
Target = usr/lib/binfmt.d/*.conf
[Action]
Description = Registering binary formats...
When = PostTransaction
Exec = /usr/share/libalpm/scripts/runit-hook binfmt
NeedsTargets

View File

@@ -34,7 +34,6 @@ op="$1"; shift
case $op in
sysctl) runit_live; each_conf /usr/bin/sysctl -q -p ;;
binfmt) runit_live; each_conf /usr/lib/rc/sv.d/binfmt once ;;
# For use by other packages
reload) runit_live; /usr/bin/sv "$@" reload ;;
add) svc_add_help ;;

View File

@@ -1,11 +0,0 @@
[Trigger]
Type = Path
Operation = Install
Operation = Upgrade
Target = usr/lib/binfmt.d/*.conf
[Action]
Description = Registering binary formats...
When = PostTransaction
Exec = /usr/share/libalpm/scripts/s6-rc-hook binfmt
NeedsTargets

View File

@@ -51,7 +51,6 @@ op="$1"; shift
case $op in
sysctl) s6_live; each_conf /usr/bin/sysctl -q -p ;;
binfmt) s6_live; sh /etc/s6/sv/binfmt/shell_up ;;
dbus_reload) s6_live; reload_dbus ;;
# For use by other packages
add) svc_add_help ;;

View File

@@ -1,18 +1,28 @@
#!/bin/sh -e
udevd_live() {
if [ ! -d /run/udev ]; then
echo >&2 " Skipped: Device manager is not running."
exit 0
fi
if [ ! -d /run/udev ]; then
echo >&2 " Skipped: Device manager is not running."
exit 0
fi
}
op="$1"; shift
case "$op" in
hwdb) /usr/bin/udevadm hwdb --update ;;
udev-reload) udevd_live; /usr/bin/udevadm control --reload ;;
*) echo >&2 " Invalid operation '$op'"; exit 1 ;;
hwdb)
/usr/bin/udev-hwdb --usr update
;;
udev-reload)
udevd_live
/usr/bin/udevadm control --reload
/usr/bin/udevadm trigger -c change
/usr/bin/udevadm settle
;;
*)
echo >&2 " Invalid operation '$op'"
exit 1
;;
esac
exit 0

86
wrapper/artix-service Normal file
View File

@@ -0,0 +1,86 @@
#!/bin/bash
cmds_openrc() {
COMMANDS[enable]="rc-update add ${SV} default"
COMMANDS[disable]="rc-update del ${SV} default"
COMMANDS[start]="rc-service ${SV} start"
COMMANDS[stop]="rc-service ${SV} stop"
}
cmds_s6() {
COMMANDS[start]="s6-rc -u change ${SV}"
COMMANDS[stop]="s6-rc -d change ${SV}"
COMMANDS[enable]="s6-service add default ${SV}"
COMMANDS[disable]="s6-service del default ${SV}"
}
cmds_dinit() {
COMMANDS[start]="dinitctl start ${SV}"
COMMANDS[stop]="dinitctl stop ${SV}"
COMMANDS[enable]="dinitctl -o enable ${SV}"
COMMANDS[disable]="dinitctl -o disable ${SV}"
}
cmds_runit() {
COMMANDS[start]="runsv /etc/runit/sv/${SV}"
COMMANDS[stop]="sv stop /etc/runit/sv/${SV}"
COMMANDS[enable]="ln -s /etc/runit/sv/${SV} /run/runit/service/"
COMMANDS[disable]="rm /run/runit/service/${SV}"
}
is_live() {
if [[ ! -d /run/openrc && "${INIT}" == "openrc" ]]; then
echo >&2 " Skipped: ${INIT} is not running."
exit 0
elif [[ ! -d /run/s6-rc && "${INIT}" == "s6" ]]; then
echo >&2 " Skipped: ${INIT} is not running."
exit 0
elif [[ ! -S /run/dinitctl && "${INIT}" == "dinit" ]]; then
echo >&2 " Skipped: ${INIT} is not running."
exit 0
elif [[ ! -d /run/runit && "${INIT}" == "runit" ]]; then
echo >&2 " Skipped: ${INIT} is not running."
exit 0
fi
}
detect() {
for i in "${SUPPORTED[@]}"; do
if [[ -f /usr/bin/"$i"-init ]]; then
INIT="$i"
cmds_"${INIT}"
fi
done
}
usage() {
cat <<EOF
usage: ${0##*/} [action] [service]
actions:
enable
disable
start
stop
EOF
}
readonly SUPPORTED=(openrc s6 dinit runit)
declare -A COMMANDS
INIT=
ACTION="$1"
SV="$2"
if [[ -z "${SV}" ]]; then
usage; exit 1
fi
detect
case "${ACTION}" in
start|stop) is_live; ${COMMANDS["${ACTION}"]} ;;
enable|disable) ${COMMANDS["${ACTION}"]} ;;
help) usage; exit 0 ;;
*) usage; exit 1 ;;
esac