14 Commits

Author SHA1 Message Date
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
8 changed files with 47 additions and 13 deletions

View File

@@ -26,7 +26,7 @@ STAGES = \
script/3 \
script/ctrlaltdel
RCLOCAL = script/rc.local
RCLOCAL = script/rc.local.start script/rc.shutdown.stop
AGETTY_CONSOLE = $(wildcard sv/agetty-console/*)
AGETTY_CONSOLE_S = supervise.agetty-console
@@ -91,6 +91,7 @@ EDIT = sed \
-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
@@ -117,8 +118,8 @@ install-runit:
$(LN) $(RUNDIR)/reboot $(DESTDIR)$(RUNITDIR)/
$(LN) $(RUNDIR)/stopit $(DESTDIR)$(RUNITDIR)/
install -d $(DESTDIR)$(RCDIR)
install -m755 $(RCLOCAL) $(DESTDIR)$(RCDIR)
install -d $(DESTDIR)$(SYSCONFDIR)/local.d
install -m755 $(RCLOCAL) $(DESTDIR)$(SYSCONFDIR)/local.d
install -d $(DESTDIR)$(BINDIR)
install -m755 $(BIN) $(DESTDIR)$(BINDIR)

View File

@@ -6,6 +6,7 @@ PATH=/usr/bin:/usr/sbin
run_sysinit
install -m100 /dev/null @RUNDIR@/stopit
install -m000 /dev/null @RUNDIR@/stopit
install -m000 /dev/null @RUNDIR@/reboot
status "Initialization complete"

View File

@@ -10,7 +10,11 @@ for arg in $(cat /proc/cmdline); do
fi
done
[ -x @RCDIR@/rc.local ] && @RCDIR@/rc.local
# Hacky hacky OpenRC compatibility
for script in @SYSCONFDIR@/local.d/*.start; do
[ -x "$script" ] && "$script"
done
runsvchdir "${runlevel}"
ln -s @RUNSVDIR@/current @SERVICEDIR@

View File

@@ -11,9 +11,10 @@ stat_busy "Exit services ..."
sv exit @RUNDIR@/service/*
stat_done
if [ -e @RUNDIR@/reboot ]; then
chmod 100 @RUNDIR@/reboot
fi
# Hacky hacky OpenRC compatibility
for script in @SYSCONFDIR@/local.d/*.stop; do
[ -x "$script" ] && "$script"
done
run_shutdown

View File

@@ -3,8 +3,11 @@
PATH=/usr/bin:/usr/sbin
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
touch @RUNDIR@/reboot
chmod 100 @RUNDIR@/reboot
# Proceed with shutdown process
echo "$MSG" | wall

View File

@@ -1,4 +0,0 @@
# @RCDIR@/rc.local -- rc.local for Artix Linux
#
# Enter your custom commands here. It will be executed on stage 2
# before running services.

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