ports

recipes for building multiple softwares
git clone git://z3bra.org/ports
Log | Files | Refs

commit e75fcfd7f59310e855e5022e9c0f5ffd428f27c3
parent 37a1f19735de2be74593a3648bfa2356b0a63191
Author: z3bra <willyatmailoodotorg>
Date:   Sun Aug 16 16:47:48 2015

sinit: new port

Diffstat:
 sinit/config.h   |  5 +++++
 sinit/makeme     | 34 ++++++++++++++++++++++++++++++++++
 sinit/power.subr | 22 ++++++++++++++++++++++
 sinit/poweroff   |  2 ++
 sinit/rc         | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 sinit/reboot     |  2 ++
 6 files changed, 116 insertions(+), 0 deletions(-)

diff --git a/sinit/config.h b/sinit/config.h @@ -0,0 +1,5 @@ +/* See LICENSE file for copyright and license details. */ + +static char *const rcinitcmd[] = { "/sbin/rc", NULL }; +static char *const rcrebootcmd[] = { "/usr/libexec/power.subr", "reboot", NULL }; +static char *const rcpoweroffcmd[] = { "/usr/libexec/power.subr", "poweroff", NULL }; diff --git a/sinit/makeme b/sinit/makeme @@ -0,0 +1,34 @@ +name=sinit +version=0.0 +source=git://git.2f30.org/$name +commit=HEAD + +package() { + if cd $name-$version; then + git reset --hard + git pull + else + git clone $source $name-$version + cd $name-$version + fi + + test -f ../config.h && cp ../config.h config.h + + make CC="$CC" LDFLAGS="$LDFLAGS" \ + DESTDIR=$WORKDIR/$name \ + PREFIX= \ + MANPREFIX=/usr/share/man \ + + mkdir -p $WORKDIR/$name/sbin + mkdir -p $WORKDIR/$name/usr/libexec + cp sinit $WORKDIR/$name/sbin/init + cp ../rc $WORKDIR/$name/sbin/rc + cp ../power.subr $WORKDIR/$name/usr/libexec/power.subr + cp ../reboot $WORKDIR/$name/sbin/reboot + cp ../poweroff $WORKDIR/$name/sbin/poweroff + + chmod 750 $WORKDIR/$name/sbin/rc + chmod 750 $WORKDIR/$name/sbin/reboot + chmod 750 $WORKDIR/$name/sbin/poweroff + chmod 755 $WORKDIR/$name/usr/libexec/power.subr +} diff --git a/sinit/power.subr b/sinit/power.subr @@ -0,0 +1,22 @@ +#!/bin/sh + +echo system is going down + +echo remounting / read-only +/bin/mount -o remount,ro / + +echo unmounting filesystems +/bin/umount -a + +echo terminating all processes +/bin/killall5 -s TERM +/bin/sleep 2 +/bin/killall5 -s KILL + +/bin/sync +wait + +case $1 in + reboot) /bin/halt -r ;; + poweroff) /bin/halt -p ;; +esac+ \ No newline at end of file diff --git a/sinit/poweroff b/sinit/poweroff @@ -0,0 +1,2 @@ +#!/bin/sh +kill -s USR1 1 diff --git a/sinit/rc b/sinit/rc @@ -0,0 +1,51 @@ +#!/bin/sh + +umask 022 + +echo +echo +echo booting your setup +echo +echo + +/bin/ctrlaltdel -h + +echo mounting virtual filesystem +/bin/mount -n -t proc -o nosuid,noexec,nodev proc /proc +/bin/mount -n -t sysfs -o nosuid,noexec,nodev sys /sys +/bin/mount -n -t tmpfs -o nosuid,mode=0755 dev /dev + +/bin/mkdir -p /dev/pts /dev/shm +/bin/mount -n -t devpts -o gid=5,mode=0620 devpts /dev/pts +/bin/mount -n -t tpmfs -o mode=1777,nosuid,nodev shm /dev/shm + +echo remouting / read-only +/bin/mount -o remount,ro / + +echo running smdev +/bin/smdev -s + +echo setting smdev as the kernel hotplug +echo /bin/smdev > /proc/sys/kernel/hotplug + +/bin/ln -sf /proc/self/fd /dev/fd +/bin/ln -sf /proc/self/fd/0 /dev/stdin +/bin/ln -sf /proc/self/fd/1 /dev/stdout +/bin/ln -sf /proc/self/fd/2 /dev/stderr + +echo mounting filesystem from fstab +/bin/mount -a +ln -sf /proc/mounts /etc/mtab + +echo naming machine \$distro +/bin/hostname \$distro + +:> /var/run/utmp + +echo remounting / read-write +/bin/mount -o remount,rw / + +echo +/bin/respawn /bin/getty /dev/tty0 & +/bin/respawn /bin/getty /dev/tty1 & +/bin/respawn /bin/getty /dev/tty2 & diff --git a/sinit/reboot b/sinit/reboot @@ -0,0 +1,2 @@ +#!/bin/sh +kill -s INT 1