5 Commits

Author SHA1 Message Date
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
5 changed files with 45 additions and 32 deletions

3
1.in
View File

@@ -14,9 +14,6 @@ for sysinit in @RCDIR@/sysinit.d/*; do
. $sysinit
done
# Remove leftover files
# remove_leftover
cleanup_sysinit
run_hook sysinit_end

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.

View File

@@ -3,14 +3,10 @@
This repository contains the runit init scripts for the Artix Linux
distribution.
This work is based on Void Linux's
[void-runit](https://github.com/voidlinux/void-runit). Patches to Void
Linux's repo will also be applied here.
## Dependencies
- GNU coreutils
- A POSIX shell
- GNU bash
- A POSIX awk
- procps-ng (needs pkill -s0,1)
- runit
@@ -43,9 +39,7 @@ Feel free to send patches and contribute with improvements!
## Copyright
runit-artix 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
all copyright and related or neighboring rights to this work.
http://creativecommons.org/publicdomain/zero/1.0/
The rest of runit-artix is licensed under the terms as described in the
COPYING file.

View File

@@ -124,15 +124,9 @@ in_array() {
}
kill_all() {
stat_busy "Sending TERM signal to processes"
pkill --inverse -s0,1 -TERM
if (( $? == 0 )); then
stat_done
else
stat_fail
status "Sending TERM signal to processes" pkill --inverse -s0,1 -TERM
sleep 1
status "Sending KILL signal to processes" pkill --inverse -s0,1 -KILL
fi
}
print_welcome() {
@@ -379,20 +373,15 @@ mount_all() {
mount -a -t "no${NETFS//,/,no}" -O no_netdev
}
remove_leftover() {
status 'Removing leftover files' tmpfiles --create --remove --clean
}
bootlogd_stop() {
[[ -f /run/bootlogd.pid ]] || return 0
touch /var/log/boot
touch /var/log/boot.log
kill $(< /run/bootlogd.pid)
rm -f /run/bootlogd.pid
}
bootlogd_start(){
# [[ ! -f /var/log/boot ]] && touch /var/log/boot
bootlogd -p /run/bootlogd.pid
bootlogd -p /run/bootlogd.pid -l /var/log/boot.log
}
console_setup(){
@@ -436,6 +425,10 @@ mk_tmpfiles_setup(){
fi
}
remove_leftover() {
status 'Removing leftover files' tmpfiles --create --remove --clean
}
mk_sysusers(){
if [ -x /usr/bin/sysusers ]; then
sysusers
@@ -450,8 +443,13 @@ cleanup_sysinit(){
if [ ! -e /var/log/btmp ]; then
install -m0600 -o root -g utmp /dev/null /var/log/btmp
fi
rm -rf /tmp
install -dm1777 /tmp /tmp/.X11-unix /tmp/.ICE-unix
# Remove leftover files
remove_leftover
# this is not good, why remove tmp? consider /tmp is mounted tmpfs.
# rm -rf /tmp
# install -dm1777 /tmp /tmp/.X11-unix /tmp/.ICE-unix
rm -f /etc/nologin #/forcefsck /forcequotacheck /fastboot
}

View File

@@ -8,7 +8,7 @@ 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 /sys/kernel/security || mount -n -t securityfs securityfs /sys/kernel/security
mountpoint -q /sys/firmware/efi/efivars || mount -n -t efivarfs -o ro efivarfs /sys/firmware/efi/efivars
[ -d /sys/firmware/efi ] && (mountpoint -q /sys/firmware/efi/efivars || mount -n -t efivarfs -o ro efivarfs /sys/firmware/efi/efivars)
mountpoint -q /sys/fs/cgroup || mount -o mode=0755 -t tmpfs cgroup /sys/fs/cgroup
mountpoint -q /sys/fs/cgroup/openrc || mkdir -p /sys/fs/cgroup/openrc && mount -t cgroup -o none,name=openrc cgroup /sys/fs/cgroup/openrc
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