diff options
| author | Shokara Kou <kou@13f0.net> | 2022-05-13 11:50:43 -0400 |
|---|---|---|
| committer | Shokara Kou <kou@13f0.net> | 2022-12-10 16:12:53 -0500 |
| commit | f9b84b4967282cd6da931b7ea2569557937d4e24 (patch) | |
| tree | 07f690d9180ce73379adc9182af49e72f259dbcd | |
| parent | 81255a3b68be5969bf107bcb46e75a11187c2f53 (diff) | |
add sinit and perp
replaces sysvinit. perp can be used alongside crux's rc scripts, but i
didn't try that.
| -rw-r--r-- | perp/.footprint | 59 | ||||
| -rw-r--r-- | perp/.md5sum | 1 | ||||
| -rw-r--r-- | perp/Pkgfile | 19 | ||||
| -rw-r--r-- | perp/post-install | 4 | ||||
| -rw-r--r-- | sinit/.footprint | 13 | ||||
| -rw-r--r-- | sinit/.md5sum | 5 | ||||
| -rw-r--r-- | sinit/Pkgfile | 33 | ||||
| -rw-r--r-- | sinit/poweroff | 2 | ||||
| -rw-r--r-- | sinit/rc.conf | 3 | ||||
| -rw-r--r-- | sinit/rc.init | 72 | ||||
| -rw-r--r-- | sinit/rc.shutdown | 47 | ||||
| -rw-r--r-- | sinit/reboot | 2 |
12 files changed, 260 insertions, 0 deletions
diff --git a/perp/.footprint b/perp/.footprint new file mode 100644 index 0000000..d2a965e --- /dev/null +++ b/perp/.footprint | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | drwxr-xr-x root/root sbin/ | ||
| 2 | -rwxr-xr-x root/root sbin/perp-setup | ||
| 3 | -rwxr-xr-x root/root sbin/perpboot | ||
| 4 | -rwxr-xr-x root/root sbin/perpctl | ||
| 5 | -rwxr-xr-x root/root sbin/perpd | ||
| 6 | -rwxr-xr-x root/root sbin/perphup | ||
| 7 | -rwxr-xr-x root/root sbin/perpls | ||
| 8 | -rwxr-xr-x root/root sbin/perpok | ||
| 9 | -rwxr-xr-x root/root sbin/perpstat | ||
| 10 | -rwxr-xr-x root/root sbin/runargs | ||
| 11 | -rwxr-xr-x root/root sbin/runargv0 | ||
| 12 | -rwxr-xr-x root/root sbin/runchoom | ||
| 13 | -rwxr-xr-x root/root sbin/rundetach | ||
| 14 | -rwxr-xr-x root/root sbin/rundeux | ||
| 15 | -rwxr-xr-x root/root sbin/runenv | ||
| 16 | -rwxr-xr-x root/root sbin/runfile | ||
| 17 | -rwxr-xr-x root/root sbin/runlimit | ||
| 18 | -rwxr-xr-x root/root sbin/runlock | ||
| 19 | -rwxr-xr-x root/root sbin/runpause | ||
| 20 | -rwxr-xr-x root/root sbin/runsession | ||
| 21 | -rwxr-xr-x root/root sbin/runtool | ||
| 22 | -rwxr-xr-x root/root sbin/runtrap | ||
| 23 | -rwxr-xr-x root/root sbin/runuid | ||
| 24 | -rwxr-xr-x root/root sbin/sissylog | ||
| 25 | -rwxr-xr-x root/root sbin/tinylog | ||
| 26 | -rwxr-xr-x root/root sbin/tinylog_run | ||
| 27 | drwxr-xr-x root/root usr/ | ||
| 28 | drwxr-xr-x root/root usr/share/ | ||
| 29 | drwxr-xr-x root/root usr/share/man/ | ||
| 30 | drwxr-xr-x root/root usr/share/man/man5/ | ||
| 31 | -rw-r--r-- root/root usr/share/man/man5/perpetrate.5.gz | ||
| 32 | drwxr-xr-x root/root usr/share/man/man8/ | ||
| 33 | -rw-r--r-- root/root usr/share/man/man8/perp-setup.8.gz | ||
| 34 | -rw-r--r-- root/root usr/share/man/man8/perp_intro.8.gz | ||
| 35 | -rw-r--r-- root/root usr/share/man/man8/perpboot.8.gz | ||
| 36 | -rw-r--r-- root/root usr/share/man/man8/perpctl.8.gz | ||
| 37 | -rw-r--r-- root/root usr/share/man/man8/perpd.8.gz | ||
| 38 | -rw-r--r-- root/root usr/share/man/man8/perpetrate.8.gz | ||
| 39 | -rw-r--r-- root/root usr/share/man/man8/perphup.8.gz | ||
| 40 | -rw-r--r-- root/root usr/share/man/man8/perpls.8.gz | ||
| 41 | -rw-r--r-- root/root usr/share/man/man8/perpok.8.gz | ||
| 42 | -rw-r--r-- root/root usr/share/man/man8/perpstat.8.gz | ||
| 43 | -rw-r--r-- root/root usr/share/man/man8/runargs.8.gz | ||
| 44 | -rw-r--r-- root/root usr/share/man/man8/runargv0.8.gz | ||
| 45 | -rw-r--r-- root/root usr/share/man/man8/runchoom.8.gz | ||
| 46 | -rw-r--r-- root/root usr/share/man/man8/rundetach.8.gz | ||
| 47 | -rw-r--r-- root/root usr/share/man/man8/rundeux.8.gz | ||
| 48 | -rw-r--r-- root/root usr/share/man/man8/runenv.8.gz | ||
| 49 | -rw-r--r-- root/root usr/share/man/man8/runfile.8.gz | ||
| 50 | -rw-r--r-- root/root usr/share/man/man8/runlimit.8.gz | ||
| 51 | -rw-r--r-- root/root usr/share/man/man8/runlock.8.gz | ||
| 52 | -rw-r--r-- root/root usr/share/man/man8/runpause.8.gz | ||
| 53 | -rw-r--r-- root/root usr/share/man/man8/runsession.8.gz | ||
| 54 | -rw-r--r-- root/root usr/share/man/man8/runtool.8.gz | ||
| 55 | -rw-r--r-- root/root usr/share/man/man8/runtools_intro.8.gz | ||
| 56 | -rw-r--r-- root/root usr/share/man/man8/runtrap.8.gz | ||
| 57 | -rw-r--r-- root/root usr/share/man/man8/runuid.8.gz | ||
| 58 | -rw-r--r-- root/root usr/share/man/man8/sissylog.8.gz | ||
| 59 | -rw-r--r-- root/root usr/share/man/man8/tinylog.8.gz | ||
diff --git a/perp/.md5sum b/perp/.md5sum new file mode 100644 index 0000000..d3ab623 --- /dev/null +++ b/perp/.md5sum | |||
| @@ -0,0 +1 @@ | |||
| a2acc7425d556d9635a25addcee9edb5 perp-2.07.tar.gz | |||
diff --git a/perp/Pkgfile b/perp/Pkgfile new file mode 100644 index 0000000..af63eca --- /dev/null +++ b/perp/Pkgfile | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | # Description: persistent process supervisor/service managment framework | ||
| 2 | # URL: http://b0llix.net/perp/ | ||
| 3 | # Maintainer: Shokara Kou, kou at 13f0 dot net | ||
| 4 | # Depends on: | ||
| 5 | |||
| 6 | name=perp | ||
| 7 | version=2.07 | ||
| 8 | release=1 | ||
| 9 | source=(http://b0llix.net/$name/distfiles/$name-$version.tar.gz) | ||
| 10 | |||
| 11 | build() { | ||
| 12 | cd $name-$version | ||
| 13 | |||
| 14 | sed '/BINDIR/ s/\/usr//' conf.mk > conf.mk.tmp | ||
| 15 | mv conf.mk.tmp conf.mk | ||
| 16 | |||
| 17 | make | ||
| 18 | make DESTDIR=$PKG install | ||
| 19 | } | ||
diff --git a/perp/post-install b/perp/post-install new file mode 100644 index 0000000..9a47bdc --- /dev/null +++ b/perp/post-install | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | groupadd log | ||
| 3 | useradd -r log | ||
| 4 | perp-setup /etc/perp | ||
diff --git a/sinit/.footprint b/sinit/.footprint new file mode 100644 index 0000000..92edcc3 --- /dev/null +++ b/sinit/.footprint | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | drwxr-xr-x root/root bin/ | ||
| 2 | -rwxr-xr-x root/root bin/poweroff | ||
| 3 | -rwxr-xr-x root/root bin/reboot | ||
| 4 | -rwxr-xr-x root/root bin/sinit | ||
| 5 | drwxr-xr-x root/root etc/ | ||
| 6 | -rw-r--r-- root/root etc/rc.conf | ||
| 7 | -rwxr-xr-x root/root etc/rc.init | ||
| 8 | -rwxr-xr-x root/root etc/rc.shutdown | ||
| 9 | drwxr-xr-x root/root sbin/ | ||
| 10 | lrwxrwxrwx root/root sbin/init -> /bin/sinit | ||
| 11 | drwxr-xr-x root/root usr/ | ||
| 12 | drwxr-xr-x root/root usr/man8/ | ||
| 13 | -rw-r--r-- root/root usr/man8/sinit.8 | ||
diff --git a/sinit/.md5sum b/sinit/.md5sum new file mode 100644 index 0000000..f1cf8fc --- /dev/null +++ b/sinit/.md5sum | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | dfd17c0b4f0ce941f4b7492e497fae0b poweroff | ||
| 2 | 9ce036092ec6320a2f5d27abc41a25b7 rc.conf | ||
| 3 | a55a9362936986a1aad4b9a4186722a4 rc.init | ||
| 4 | 37d30c23a48271712ae53175be980423 rc.shutdown | ||
| 5 | 415e4e2648e9bb30e9281c3e5e48f48e reboot | ||
diff --git a/sinit/Pkgfile b/sinit/Pkgfile new file mode 100644 index 0000000..738a01a --- /dev/null +++ b/sinit/Pkgfile | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | # Description: suckless init, based on felker's minimal init | ||
| 2 | # URL: https://git.suckless.org/sinit/file/README.html | ||
| 3 | # Maintainer: Shokara Kou, kou at 13f0 dot net | ||
| 4 | # Depends on: | ||
| 5 | |||
| 6 | name=sinit | ||
| 7 | commit=28c44b6 | ||
| 8 | version=git-$commit | ||
| 9 | release=1 | ||
| 10 | source=(poweroff reboot rc.conf rc.init rc.shutdown) | ||
| 11 | |||
| 12 | gitsource=git://git.suckless.org/$name/ | ||
| 13 | |||
| 14 | build() { | ||
| 15 | git clone $gitsource | ||
| 16 | cd $name | ||
| 17 | git checkout $commit | ||
| 18 | |||
| 19 | sed 's/bin/etc/' config.def.h >config.h | ||
| 20 | |||
| 21 | make | ||
| 22 | make PREFIX=/ MANPREFIX=/usr DESTDIR=$PKG install | ||
| 23 | |||
| 24 | mkdir $PKG/sbin | ||
| 25 | ln -s /bin/sinit $PKG/sbin/init | ||
| 26 | |||
| 27 | install -Dt $PKG/bin -m755 $SRC/poweroff | ||
| 28 | install -Dt $PKG/bin -m755 $SRC/reboot | ||
| 29 | |||
| 30 | install -Dt $PKG/etc -m644 $SRC/rc.conf | ||
| 31 | install -Dt $PKG/etc -m755 $SRC/rc.init | ||
| 32 | install -Dt $PKG/etc -m755 $SRC/rc.shutdown | ||
| 33 | } | ||
diff --git a/sinit/poweroff b/sinit/poweroff new file mode 100644 index 0000000..b33bc03 --- /dev/null +++ b/sinit/poweroff | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | kill -USR1 1 | ||
diff --git a/sinit/rc.conf b/sinit/rc.conf new file mode 100644 index 0000000..5cf7280 --- /dev/null +++ b/sinit/rc.conf | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | HOSTNAME=crux | ||
| 2 | INTERFACE=eth0 | ||
| 3 | TIMEZONE="UTC" | ||
diff --git a/sinit/rc.init b/sinit/rc.init new file mode 100644 index 0000000..aab0073 --- /dev/null +++ b/sinit/rc.init | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | umask 022 | ||
| 3 | |||
| 4 | . /etc/rc.conf | ||
| 5 | |||
| 6 | echo "CRUX booting" | ||
| 7 | |||
| 8 | /bin/mount -n -t proc -o nosuid,noexec,nodev proc /proc | ||
| 9 | /bin/mount -n -t sysfs -o nosuid,noexec,nodev sysfs /sys | ||
| 10 | |||
| 11 | /bin/mount -n -t tmpfs -o nosuid,mode=0755 dev /dev | ||
| 12 | /bin/mkdir -p /dev/pts | ||
| 13 | /bin/mount -n -t devpts -o gid=5,mode=0620 devpts /dev/pts | ||
| 14 | |||
| 15 | /bin/mount -o remount,ro / | ||
| 16 | |||
| 17 | echo Running smdev | ||
| 18 | /bin/smdev -s | ||
| 19 | |||
| 20 | echo Setting smdev as the kernel hotplug | ||
| 21 | echo /bin/smdev >/proc/sys/kernel/hotplug | ||
| 22 | |||
| 23 | cd /dev | ||
| 24 | /bin/ln -sf /proc/self/fd/0 stdin | ||
| 25 | /bin/ln -sf /proc/self/fd/1 stdout | ||
| 26 | /bin/ln -sf /proc/self/fd/2 stderr | ||
| 27 | /bin/ln -sf /proc/self/fd fd | ||
| 28 | cd - >/dev/null | ||
| 29 | |||
| 30 | echo Checking filesystems | ||
| 31 | /bin/fsck -ATa | ||
| 32 | if [ $? -eq 1 ]; then | ||
| 33 | echo Filesystems error exist, fix manually. | ||
| 34 | /bin/sh | ||
| 35 | /bin/halt -r | ||
| 36 | fi | ||
| 37 | |||
| 38 | echo Remounting root as read-write | ||
| 39 | /bin/mount -o remount,rw / | ||
| 40 | |||
| 41 | echo Mounting filesystems | ||
| 42 | /bin/mount -a | ||
| 43 | |||
| 44 | /bin/hostname $HOSTNAME | ||
| 45 | |||
| 46 | echo Bringing up loopback | ||
| 47 | /bin/ip addr add 127.0.0.1/8 dev lo broadcast + scope host | ||
| 48 | /bin/ip link set lo up | ||
| 49 | |||
| 50 | echo Setting hwclock | ||
| 51 | [ -n "$TIMEZONE" ] && export TZ="$TIMEZONE" | ||
| 52 | /bin/hwclock -s -u /dev/rtc0 | ||
| 53 | unset TZ | ||
| 54 | |||
| 55 | [ -f /etc/random-seed ] && /bin/cat /etc/random-seed >/dev/urandom | ||
| 56 | /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2>/dev/null | ||
| 57 | |||
| 58 | echo Enabling core dumps | ||
| 59 | ulimit -c unlimited | ||
| 60 | |||
| 61 | if [ -x /etc/rc.local ]; then | ||
| 62 | echo Running rc.local | ||
| 63 | /etc/rc.local | ||
| 64 | fi | ||
| 65 | |||
| 66 | : >/var/run/utmp | ||
| 67 | |||
| 68 | echo | ||
| 69 | /bin/sh -c '/bin/respawn /bin/getty /dev/tty1 linux' &>/dev/null & | ||
| 70 | /bin/sh -c '/bin/respawn /bin/getty /dev/tty2 linux' &>/dev/null & | ||
| 71 | /bin/sh -c '/bin/respawn /bin/getty /dev/tty3 linux' &>/dev/null & | ||
| 72 | /bin/sh -c '/bin/respawn /bin/getty /dev/tty4 linux' &>/dev/null & | ||
diff --git a/sinit/rc.shutdown b/sinit/rc.shutdown new file mode 100644 index 0000000..24cc606 --- /dev/null +++ b/sinit/rc.shutdown | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | umask 022 | ||
| 3 | |||
| 4 | . /etc/rc.conf | ||
| 5 | |||
| 6 | case "$1" in | ||
| 7 | reboot|poweroff) ;; | ||
| 8 | *) | ||
| 9 | echo "Invalid action '$1' for rc.shutdown" >&2 | ||
| 10 | exit 1 | ||
| 11 | ;; | ||
| 12 | esac | ||
| 13 | |||
| 14 | # avoid staircase effect by setting linefeed mode | ||
| 15 | echo; /bin/stty onlcr | ||
| 16 | |||
| 17 | echo Shutting down | ||
| 18 | |||
| 19 | echo Saving system clock | ||
| 20 | [ -n "$TIMEZONE" ] && export TZ="$TIMEZONE" | ||
| 21 | /bin/hwclock -w -u /dev/rtc0 | ||
| 22 | unset TZ | ||
| 23 | |||
| 24 | /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2>/dev/null | ||
| 25 | |||
| 26 | echo Sending TERM to all processes | ||
| 27 | /bin/killall5 -s TERM | ||
| 28 | /bin/sleep 3 | ||
| 29 | echo Sending KILL to all processes | ||
| 30 | /bin/killall5 -s KILL | ||
| 31 | |||
| 32 | echo Remounting root as read-only | ||
| 33 | /bin/mount -o remount,ro / | ||
| 34 | |||
| 35 | echo Unmounting filesystems | ||
| 36 | /bin/umount -a | ||
| 37 | |||
| 38 | /bin/sync | ||
| 39 | /bin/sleep 3 | ||
| 40 | wait | ||
| 41 | |||
| 42 | echo Good bye. | ||
| 43 | |||
| 44 | case "$1" in | ||
| 45 | reboot) /bin/halt -r ;; | ||
| 46 | poweroff) /bin/halt -p ;; | ||
| 47 | esac | ||
diff --git a/sinit/reboot b/sinit/reboot new file mode 100644 index 0000000..3d05840 --- /dev/null +++ b/sinit/reboot | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | kill -INT 1 | ||
