34 Commits

Author SHA1 Message Date
obarun
c7d9be62f8 rebuild default compiled database 2017-06-21 13:06:20 +11:00
obarun
608df4bd47 replace deprecated import by importas command on rwfs-iptables/down file 2017-06-21 13:04:23 +11:00
obarun
c32cc76462 fix setfont command line 2017-06-21 13:02:54 +11:00
obarun
065c79b9ff replace absolute path by variable 2017-06-21 12:25:35 +11:00
obarun
97f13d2f1a add s6-conf file parsing as oneshot service 2017-06-21 12:25:13 +11:00
obarun
983d28ae45 replace absolute path by variable 2017-06-21 12:23:02 +11:00
obarun
1470fda317 add delay on tty to let the time to have the hostname set 2017-06-21 12:21:23 +11:00
obarun
9e41be013b reorganize environment variable 2017-06-21 12:17:55 +11:00
obarun
b53a85ef5c stage2 stage2.tini, replace absolute path by variable 2017-06-21 12:14:36 +11:00
obarun
3790871455 translate poweroff and reboot file on execlineb script 2017-06-21 12:12:34 +11:00
obarun
4aece292a1 init : replace absolute path by variable, remove s6.conf file parsing 2017-06-21 12:04:46 +11:00
obarun
ce00a75a25 rebuild default database 2017-03-28 10:05:31 +04:00
obarun
473a622f41 replace import command by importas 2017-03-28 09:58:26 +04:00
obarun
6dab7d1ff9 add lvm features 2017-03-22 19:01:59 +04:00
obarun
aa34195b53 remove rm -rf /tmp 2016-12-12 12:28:14 +04:00
obarun
15cb695a3e rebuild database 2016-12-11 11:13:56 +04:00
obarun
9aa8671c09 fix bug: rwfs-random 2016-12-11 11:13:07 +04:00
obarun
76e68327a6 start iptables before ip link 2016-12-11 11:12:44 +04:00
obarun
6f095a01e7 rebuild database 2016-12-10 21:32:52 +04:00
obarun
b5162cd430 fix bug at rwfs-cleanboot 2016-12-10 21:31:33 +04:00
obarun
95674ac04f fix bug 2016-12-10 21:30:53 +04:00
obarun
20c709697d add rwfs-tmpdir as dependencies 2016-12-10 19:56:36 +04:00
obarun
62e44763a1 typo fix 2016-12-10 19:40:12 +04:00
obarun
8b2f67c2bd change boot-serv file to BOOTSERV 2016-12-10 19:39:45 +04:00
obarun
4db28f92ad change boot-serv variable to BOOTSERV 2016-12-10 19:38:42 +04:00
obarun
e994d4f8e0 typo fix 2016-12-10 19:38:00 +04:00
obarun
6679703194 add TMPDIR features onto s6.conf 2016-12-10 09:50:14 +04:00
obarun
5a5798e699 typo fix 2016-12-10 09:49:45 +04:00
obarun
4c4aa196a3 rebuild db according to the change of boot-rc-serv 2016-12-09 21:17:38 +04:00
obarun
59103805ae clean the /tmp directory 2016-12-09 21:01:05 +04:00
obarun
629e2a2693 typo fix 2016-12-09 21:00:40 +04:00
obarun
730c47503d typo fix 2016-12-09 21:00:15 +04:00
obarun
4a2ce7486b add rwfs-tmpdir oneshot service : this is create the /tmp directory 2016-12-09 20:59:52 +04:00
obarun
4b516a60a3 change import by importas to avoid conflict with imagemagick's import binary 2016-12-09 20:59:00 +04:00
99 changed files with 285 additions and 184 deletions

View File

@@ -1,3 +1,4 @@
# s6-boot # s6-boot
Boot files for s6 Boot files for s6
UNDER DEVELOPMENT, DO NOT USE FOR PRODUCTION For instructions about S6 supervision suite : http://skarnet.org/software/
Please see here http://obarun.org/forum/viewtopic.php?id=123 for futher informations about obarun use it.

View File

@@ -1,7 +1,7 @@
#compdef s6-svc #compdef s6-svc
# completion for s6-svc # completion for s6-svc
# Eric Vidal <eric@obarun.org> # Copyright (C) 2015-2017 Eric Vidal <eric@obarun.org>
# services in /run/s6/service. Change the path variable to suit your needs. # services in /run/s6/service. Change the path variable to suit your needs.
path_dir_boot=/run/boot/service path_dir_boot=/run/boot/service

1
base-env/DESTBOOTSERV Normal file
View File

@@ -0,0 +1 @@
/run/boot

1
base-env/DESTRCSERV Normal file
View File

@@ -0,0 +1 @@
/run/boot-rc

1
base-env/S6CONF Normal file
View File

@@ -0,0 +1 @@
/run/s6-conf

1
base-env/SRCRCCOMPILED Normal file
View File

@@ -0,0 +1 @@
/etc/s6/compiled

1
base-env/SRCRCSERV Normal file
View File

@@ -0,0 +1 @@
/etc/s6/boot-rc-serv

View File

@@ -1,20 +1,17 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
fdmove -c 2 1 fdmove -c 2 1
if { s6-echo -- 00 started } if { s6-echo -- 00 started }
s6-envdir /etc/s6/env/s6-conf
# mount proc sys dev run if doesn't exist # mount proc sys dev run if doesn't exist
#import -i HOSTNAME
#if { s6-hostname $HOSTNAME }
foreground { foreground {
forx -p first { proc sys dev run } forx -p first { proc sys dev run }
import -ui first importas -ui -D "" first first
foreground { foreground {
if -n { mountpoint -q /$first } if -n { mountpoint -q /$first }
s6-envdir /etc/s6/env/mount/$first s6-envdir /etc/s6/filesystem-env/$first
import -ui fstype importas -ui -D "" fstype fstype
import -ui device importas -ui -D "" device device
import -ui mountpoint importas -ui -D "" mountpoint mountpoint
import -ui options importas -ui -D "" options options
s6-mount -o $options -t $fstype $device $mountpoint s6-mount -o $options -t $fstype $device $mountpoint
} }
@@ -23,7 +20,7 @@ foreground {
# create needed directory on run if doesn't exist # create needed directory on run if doesn't exist
if { if {
forx -p second { lvm user lock } forx -p second { lvm user lock }
import -ui second importas -ui -D "" second second
foreground { foreground {
if -n { s6-test -d /run/$second } if -n { s6-test -d /run/$second }
s6-mkdir -p -m 0755 /run/$second s6-mkdir -p -m 0755 /run/$second
@@ -33,16 +30,16 @@ if {
# finaly mount /dev/shm /dev/pts # finaly mount /dev/shm /dev/pts
if { if {
forx -p third { shm pts } forx -p third { shm pts }
import -ui third importas -ui -D "" third third
if { if {
foreground { foreground {
if -n { mountpoint -q /dev/$third } if -n { mountpoint -q /dev/$third }
if { s6-mkdir -p -m 0755 /dev/$third } if { s6-mkdir -p -m 0755 /dev/$third }
s6-envdir /etc/s6/env/mount/$third s6-envdir /etc/s6/filesystem-env/$third
import -ui fstype importas -ui -D "" fstype fstype
import -ui device importas -ui -D "" device device
import -ui mountpoint importas -ui -D "" mountpoint mountpoint
import -ui options importas -ui -D "" options options
s6-mount -o $options -n -t $fstype $device $mountpoint s6-mount -o $options -n -t $fstype $device $mountpoint
} }
} }

View File

@@ -1,3 +1,4 @@
00
s6-conf
all-Boot all-Boot
#all-User
all-Switch all-Switch

View File

@@ -1,4 +1,3 @@
00
rofs-cgroups rofs-cgroups
rofs-kernmod rofs-kernmod
rofs-console rofs-console

View File

@@ -1,4 +1,5 @@
rwfs-fsrw rwfs-fsrw
rwfs-tmpdir
rwfs-loopback rwfs-loopback
rwfs-iptables rwfs-iptables
rwfs-nonetwork rwfs-nonetwork

View File

@@ -1,9 +1,10 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
fdmove -c 2 1 fdmove -c 2 1
s6-envdir -if /etc/s6/base-env
importas -i -D "" S6CONF S6CONF
if { s6-echo -- checkfs-brtfs started } if { s6-echo -- checkfs-brtfs started }
s6-envdir /etc/s6/env/s6-conf s6-envdir ${S6CONF}
import -D "" USEBTRFS importas -D "" USEBTRFS USEBTRFS
foreground { foreground {
if { s6-test $USEBTRFS = yes } if { s6-test $USEBTRFS = yes }
if { s6-test -x /usr/bin/btrfs } if { s6-test -x /usr/bin/btrfs }

View File

@@ -1,9 +1,10 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
fdmove -c 2 1 fdmove -c 2 1
s6-envdir -if /etc/s6/base-env
importas -i -D "" S6CONF S6CONF
if { s6-echo -- checkfs-dmraid started } if { s6-echo -- checkfs-dmraid started }
s6-envdir /etc/s6/env/s6-conf s6-envdir ${S6CONF}
import -D "" USEDMRAID importas -D "" USEDMRAID USEDMRAID
foreground { foreground {
if { s6-test $USEDMRAID = yes } if { s6-test $USEDMRAID = yes }
if { s6-test -x /usr/bin/dmraid } if { s6-test -x /usr/bin/dmraid }

View File

@@ -1,3 +1,4 @@
rofs-Udevd rofs-Udevd
checkfs-dmraid checkfs-dmraid
checkfs-btrfs checkfs-btrfs
checkfs-lvm

View File

@@ -1,21 +1,21 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
fdmove -c 2 1 fdmove -c 2 1
s6-envdir -if /etc/s6/base-env
importas -i -D "" S6CONF S6CONF
if { s6-echo -- checkfs-fsckeck started } if { s6-echo -- checkfs-fsckeck started }
s6-envdir /etc/s6/env/s6-conf s6-envdir ${S6CONF}
import -D "" FORCECHCK importas -D "" FORCECHCK FORCECHCK
if -t { foreground {
if { s6-test $FORCECHCK = yes } if { s6-test $FORCECHCK = yes }
redirfd -w 1 /dev/console redirfd -w 1 /dev/console
if { s6-echo -- Check of filesystem was asked, please wait } if { s6-echo -- Check of filesystem was asked, please wait }
if { fsck -A -T -a -f noopts=_netdev } foreground { fsck -A -T -a -f noopts=_netdev }
if { s6-echo -- Filesystem checked } s6-echo -- Filesystem checked
redirfd -w 1 /run/s6/service/s6-svscan-log/fifo
s6-true
} }
# if partition is checked, fsck return a fail exit # if partition is checked, fsck return a fail exit
# and a crash occurs, so whatever happens with fsck, the output need to be a success # and a crash occurs, so whatever happens with fsck, the output need to be a success
if -t { if -t {
fsck -A -T -a noopts=_netdev foreground { fsck -A -T -a noopts=_netdev }
} }
wait { }
s6-echo -- checkfs-fscheck successfully started s6-echo -- checkfs-fscheck successfully started

View File

@@ -0,0 +1 @@
rofs-Udevd

View File

@@ -0,0 +1 @@
oneshot

View File

@@ -0,0 +1,21 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
s6-envdir -if /etc/s6/base-env
importas -i -D "" S6CONF S6CONF
s6-envdir ${S6CONF}
importas -D "" USELVM USELVM
foreground {
if { s6-test $USELVM = yes }
if { s6-echo -- checkfs-lvm started }
foreground {
if -nt { s6-test -d /run/lvm }
s6-mkdir /run/lvm
}
if { /usr/bin/lvmetad -p /run/lvm/lvmetad.pid }
foreground {
if { /usr/bin/vgscan }
/usr/bin/vgchange -ay
}
pkill lvmetad
}
s6-echo -- lvm-prepare successfully started

View File

@@ -1,3 +1,4 @@
checkfs-dmraid checkfs-dmraid
checkfs-btrfs checkfs-btrfs
checkfs-lvm
checkfs-fscheck checkfs-fscheck

View File

@@ -7,7 +7,7 @@ foreground {
pipeline { s6-cut -d"\t" -f1 } pipeline { s6-cut -d"\t" -f1 }
pipeline { s6-grep -vF -- devices } pipeline { s6-grep -vF -- devices }
forstdin -d"\n" -- i forstdin -d"\n" -- i
import -u i importas -u -D "" i i
if { mountpoint -q /sys/fs/cgroup/${i} } if { mountpoint -q /sys/fs/cgroup/${i} }
umount -R /sys/fs/cgroup/${i} umount -R /sys/fs/cgroup/${i}
} }

View File

@@ -1,9 +1,10 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
fdmove -c 2 1 fdmove -c 2 1
s6-envdir -if /etc/s6/base-env
importas -i -D "" S6CONF S6CONF
if { s6-echo -- rofs-cgroups started } if { s6-echo -- rofs-cgroups started }
s6-envdir /etc/s6/env/s6-conf s6-envdir ${S6CONF}
import -D "" CGROUPS importas -D "" CGROUPS CGROUPS
foreground { foreground {
if { s6-test $CGROUPS = yes } if { s6-test $CGROUPS = yes }
if { mkdir -p -m 0755 /sys/fs/cgroup } if { mkdir -p -m 0755 /sys/fs/cgroup }
@@ -13,7 +14,7 @@ foreground {
pipeline { s6-cut -d"\t" -f1 } pipeline { s6-cut -d"\t" -f1 }
pipeline { s6-grep -vF -- devices } pipeline { s6-grep -vF -- devices }
forstdin -d"\n" -- i forstdin -d"\n" -- i
import -u i importas -u -D "" i i
if { s6-mkdir /sys/fs/cgroup/${i} } if { s6-mkdir /sys/fs/cgroup/${i} }
s6-mount -t cgroup -o ${i} -- cgroup /sys/fs/cgroup/${i} s6-mount -t cgroup -o ${i} -- cgroup /sys/fs/cgroup/${i}
} }

View File

@@ -1,19 +1,19 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
fdmove -c 2 1 fdmove -c 2 1
s6-envdir -if /etc/s6/base-env
importas -i -D "" S6CONF S6CONF
if { s6-echo -- rofs-console started } if { s6-echo -- rofs-console started }
s6-envdir ${S6CONF}
s6-envdir /etc/s6/env/s6-conf importas -D "" KEYMAP KEYMAP
import -D "" KEYMAP importas -D "" FONT FONT
import -D "" FONT importas -D "" FONT_MAP FONT_MAP
import -D "" FONT_MAP importas -D "" FONT_UNIMAP FONT_UNIMAP
import -D "" FONT_UNIMAP
foreground { foreground {
loadkeys -q -u $KEYMAP loadkeys -q -u $KEYMAP
} }
foreground { foreground {
forx index { 0 1 2 3 4 5 6 7 8 9 10 } forx index { 0 1 2 3 4 5 6 7 8 9 10 }
import -u index importas -u -D "" index index
setfont -m $FONT_MAP -u $FONT_UNIMAP $FONT -C /dev/tty${index} exec bash -c "setfont ${FONT_MAP:+-m $FONT_MAP} ${FONT_UNIMAP:+-u $FONT_UNIMAP} $FONT -C /dev/tty${index}"
} }
s6-echo -- rofs-console successfully started s6-echo -- rofs-console successfully started

View File

@@ -1,15 +1,16 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
fdmove -c 2 1 fdmove -c 2 1
s6-envdir -if /etc/s6/base-env
importas -i -D "" S6CONF S6CONF
if { s6-echo -- rofs-hardclock started } if { s6-echo -- rofs-hardclock started }
foreground { foreground {
s6-envdir /etc/s6/env/s6-conf s6-envdir ${S6CONF}
import -D "" TZ importas -D "" TZ TZ
import -D "" HARDWARECLOCK importas -D "" HARDWARECLOCK HARDWARECLOCK
pipeline -d { echo $HARDWARECLOCK } pipeline -d { echo $HARDWARECLOCK }
pipeline { tr A-Z a-z } pipeline { tr A-Z a-z }
forstdin -- clock forstdin -- clock
import -iu clock importas -iu -D "" clock clock
hwclock --systz --${clock} --noadjfile hwclock --systz --${clock} --noadjfile
} }
s6-echo -- rofs-hardclock successfully started s6-echo -- rofs-hardclock successfully started

View File

@@ -8,7 +8,7 @@ foreground {
pipeline { s6-cut -d":" -f2 } pipeline { s6-cut -d":" -f2 }
pipeline { s6-cut -d" " -f2 } pipeline { s6-cut -d" " -f2 }
forstdin -d"\n" -- mod forstdin -d"\n" -- mod
import -iu mod importas -iu -D "" mod mod
modprobe $mod modprobe $mod
} }
s6-echo -- rofs-kermod successfully started s6-echo -- rofs-kermod successfully started

View File

@@ -1,9 +1,10 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
fdmove -c 2 1 fdmove -c 2 1
s6-envdir -if /etc/s6/base-env
importas -i -D "" S6CONF S6CONF
if { s6-echo -- rofs-kernruntime started } if { s6-echo -- rofs-kernruntime started }
s6-envdir /etc/s6/env/s6-conf s6-envdir ${S6CONF}
import -D "" KERNELRUNTIME importas -D "" KERNELRUNTIME KERNELRUNTIME
foreground { foreground {
if { s6-test $KERNELRUNTIME = yes } if { s6-test $KERNELRUNTIME = yes }
if { s6-test -x /usr/bin/sysctl } if { s6-test -x /usr/bin/sysctl }

View File

@@ -1,12 +1,13 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
fdmove -c 2 1 fdmove -c 2 1
s6-envdir -if /etc/s6/base-env
importas -i -D "" S6CONF S6CONF
if { s6-echo -- rofs-modules started } if { s6-echo -- rofs-modules started }
foreground { foreground {
if { s6-test -e /etc/s6/env/s6-conf/MODULES } if { s6-test -e ${S6CONF}/MODULES }
redirfd -r 0 /etc/s6/env/s6-conf/MODULES redirfd -r 0 ${S6CONF}/MODULES
forstdin -n -- mods forstdin -n -- mods
import -ui mods importas -ui -D "" mods mods
foreground { foreground {
if { s6-test -n $mods } if { s6-test -n $mods }
modprobe -ab $mods modprobe -ab $mods

View File

@@ -1,9 +1,10 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
fdmove -c 2 1 fdmove -c 2 1
s6-envdir -if /etc/s6/base-env
importas -i -D "" S6CONF S6CONF
if { s6-echo -- rofs-swap started } if { s6-echo -- rofs-swap started }
s6-envdir /etc/s6/env/s6-conf s6-envdir ${S6CONF}
import -D "" USESWAP importas -D "" USESWAP USESWAP
foreground { foreground {
if { s6-test $USESWAP = yes } if { s6-test $USESWAP = yes }
swapon -a swapon -a

View File

@@ -1 +1,2 @@
rwfs-fsrw rwfs-fsrw
rwfs-tmpdir

View File

@@ -2,12 +2,18 @@
fdmove -c 2 1 fdmove -c 2 1
if { s6-echo -- rwfs-cleanboot started } if { s6-echo -- rwfs-cleanboot started }
if -t { install -m0664 -o root -g utmp /dev/null /run/utmp } if -t {
foreground { install -m0664 -o root -g utmp /dev/null /run/utmp }
if -nt { s6-test -e /var/log/wtmp } }
if -t { install -m0664 -o root -g utmp /dev/null /var/log/wtmp } if -t {
if -nt { s6-test -e /var/log/wtmp }
if -nt { s6-test -e /var/log/btmp } foreground { install -m0664 -o root -g utmp /dev/null /var/log/wtmp }
if -t { install -m0600 -o root -g utmp /dev/null /var/log/btmp } }
if -t { install -dm1777 /tmp/.X11-unix /tmp/.ICE-unix } if -t {
if -nt { s6-test -e /var/log/btmp }
foreground { install -m0600 -o root -g utmp /dev/null /var/log/btmp }
}
if -t {
foreground { install -dm1777 /tmp/.X11-unix /tmp/.ICE-unix }
}
s6-echo -- rwfs-cleanboot successfully started s6-echo -- rwfs-cleanboot successfully started

View File

@@ -1,2 +1,2 @@
rwfs-fsrw rwfs-fsrw
rwfs-loopback

View File

@@ -1,8 +1,10 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
fdmove -c 2 1 fdmove -c 2 1
s6-envdir /etc/s6/env/s6-conf s6-envdir -if /etc/s6/base-env
import -D "" IPTABLES importas -i -D "" S6CONF S6CONF
import -D "" IP6TABLES s6-envdir ${S6CONF}
importas -i -D "" IPTABLES IPTABLES
importas -i -D "" IP6TABLES IP6TABLES
foreground { foreground {
if { s6-test $IPTABLES = yes } if { s6-test $IPTABLES = yes }
if { s6-echo -- Flushing iptables } if { s6-echo -- Flushing iptables }
@@ -14,4 +16,4 @@ foreground {
if { s6-echo -- Flushing ip6tables } if { s6-echo -- Flushing ip6tables }
/usr/lib/iptables/scripts/iptables-flush 6 /usr/lib/iptables/scripts/iptables-flush 6
} }
s6-true s6-echo -- Iptables flushed

View File

@@ -1,22 +1,23 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
fdmove -c 2 1 fdmove -c 2 1
s6-envdir -if /etc/s6/base-env
importas -i -D "" S6CONF S6CONF
if { s6-echo -- rwfs-iptables started } if { s6-echo -- rwfs-iptables started }
s6-envdir /etc/s6/env/s6-conf s6-envdir ${S6CONF}
import -D "" IPTABLES importas -D "" IPTABLES IPTABLES
import -D "" IP6TABLES importas -D "" IP6TABLES IP6TABLES
foreground { foreground {
if { s6-test $IPTABLES = yes } if { s6-test $IPTABLES = yes }
if { s6-test -e /etc/iptables/iptables.rules } if { s6-test -e /etc/iptables/iptables.rules }
if { s6-echo -- Activing iptables } if { s6-echo -- Activing iptables }
if { iptables-restore /etc/iptables/iptables.rules } foreground { iptables-restore /etc/iptables/iptables.rules }
s6-echo -- Iptables actived s6-echo -- Iptables actived
} }
foreground { foreground {
if { s6-test $IP6TABLES = yes } if { s6-test $IP6TABLES = yes }
if { s6-test -e /etc/iptables/ip6tables.rules } if { s6-test -e /etc/iptables/ip6tables.rules }
if { s6-echo -- Activing ip6tables } if { s6-echo -- Activing ip6tables }
ip6tables-restore /etc/iptables/ip6tables.rules foreground { ip6tables-restore /etc/iptables/ip6tables.rules }
s6-echo -- Ip6tables actived s6-echo -- Ip6tables actived
} }
s6-echo -- rwfs-iptables successfully started s6-echo -- rwfs-iptables successfully started

View File

@@ -1,8 +1,9 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
fdmove -c 2 1 fdmove -c 2 1
s6-envdir -if /etc/s6/base-env
importas -i -D "" S6CONF S6CONF
if { s6-echo -- rwfs-localtime started } if { s6-echo -- rwfs-localtime started }
s6-envdir /etc/s6/env/s6-conf s6-envdir ${S6CONF}
import -D "" TZ importas -D "" TZ TZ
if { s6-ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime } if { s6-ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime }
s6-echo -- rwfs-localtime successfully started s6-echo -- rwfs-localtime successfully started

View File

@@ -1,2 +1,2 @@
rwfs-fsrw rwfs-fsrw
rwfs-iptables

View File

@@ -7,18 +7,16 @@ foreground {
} }
backtick -n bytes { cat /proc/sys/kernel/random/poolsize } backtick -n bytes { cat /proc/sys/kernel/random/poolsize }
import -u bytes importas -u -D "" bytes bytes
if -t { if -t {
foreground { foreground {
if { s6-test -z $bytes } if { s6-test -z $bytes }
define defbytes 512 define defbytes 512
umask 077 umask 077
dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=$defbytes dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=$defbytes
} }
true s6-true
} }
umask 077
umask 077 foreground { dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=$bytes }
redirfd -w 1 /dev/null
if { dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=$bytes }
s6-echo -- rwfs-random successfully started s6-echo -- rwfs-random successfully started

View File

@@ -1,6 +1,8 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
fdmove -c 2 1 fdmove -c 2 1
s6-envdir /etc/s6/env/s6-conf s6-envdir -if /etc/s6/base-env
importas -i -D "" S6CONF S6CONF
s6-envdir ${S6CONF}
importas -D "" S6LOCAL S6LOCAL importas -D "" S6LOCAL S6LOCAL
ifelse -X { s6-test $S6LOCAL = yes } ifelse -X { s6-test $S6LOCAL = yes }
{ exec -c /etc/s6/data/scripts/s6.local } { exec -c /etc/s6/data/scripts/s6.local }

View File

@@ -0,0 +1 @@
rwfs-fsrw

View File

@@ -0,0 +1 @@
oneshot

View File

@@ -0,0 +1,10 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
if { s6-echo -- rwfs-tmpdir started }
foreground {
if { s6-echo -- Create /tmp directory }
mkdir -p -m1777 /tmp
}
s6-echo -- rwfs-tmpdir successfully started

View File

@@ -0,0 +1 @@
oneshot

25
boot-rc-serv/s6-conf/up Normal file
View File

@@ -0,0 +1,25 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
s6-envdir -if /etc/s6/base-env
importas -i -D "" S6CONF S6CONF
if { s6-echo -- s6-conf started }
# parse s6.conf before loading environment
foreground {
redirfd -r 0 /etc/s6/s6.conf
pipeline { s6-grep -vF -- "#" }
forstdin -nCd"\n" -- conf
importas -ui -D "" conf conf
multidefine -d"=" $conf { var value }
foreground {
if { mkdir -p ${S6CONF}/ }
redirfd -w 1 ${S6CONF}/$var
s6-echo -- $value
}
}
# load hostname for earlier tty
foreground {
s6-envdir ${S6CONF}
importas -i -D "" HOSTNAME HOSTNAME
s6-hostname ${HOSTNAME}
}
s6-echo -- s6-conf successfully started

View File

@@ -3,5 +3,5 @@ fdmove -c 2 1
if { s6-echo -- start switch-presvscan } if { s6-echo -- start switch-presvscan }
if { s6-mkdir -p -m 0755 /run/user/service } if { s6-mkdir -p -m 0755 /run/user/service }
forbacktickx -p -0 serv { s6-ls -0 /etc/s6-serv/enabled/classic } forbacktickx -p -0 serv { s6-ls -0 /etc/s6-serv/enabled/classic }
importas -u serv serv importas -u -D "" serv serv
s6-ln -s -- /etc/s6-serv/enabled/classic/${serv} /run/user/service s6-ln -s -- /etc/s6-serv/enabled/classic/${serv} /run/user/service

View File

@@ -1,5 +1,13 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
fdmove -c 2 1 fdmove -c 2 1
if {
foreground {
if -n { s6-test -d /run/user/uncaught-logs }
s6-mkdir -p -m 0755 /run/user/uncaught-logs
}
}
redirfd -an 1 /run/user/uncaught-logs/fifo
fdmove -c 2 1
if { s6-echo -- switch-user started } if { s6-echo -- switch-user started }
if { s6-rc-init -c /etc/s6-serv/enabled/rc/compiled/current -l /run/user-rc /run/user/service } if { s6-rc-init -c /etc/s6-serv/enabled/rc/compiled/current -l /run/user-rc /run/user/service }
if { s6-rc -l /run/user-rc -u change All } if { s6-rc -l /run/user-rc -u change All }

View File

@@ -1,6 +1,6 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
fdmove -c 2 1 fdmove -c 2 1
if { s6-echo -- udevd-udev started } if { s6-echo -- udevd-udev longrun started }
exec -c exec -c
udevd udevd

View File

@@ -1,4 +1,5 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
s6-envdir -if /etc/s6/base-env
importas -i -D "" DESTBOOTSERV DESTBOOTSERV
foreground { /etc/s6/stage2.tini } foreground { /etc/s6/stage2.tini }
s6-svscanctl -h -- /run/boot/service s6-svscanctl -h -- ${DESTBOOTSERV}/service

View File

@@ -1,4 +1,5 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
s6-envdir -if /etc/s6/base-env
importas -i -D "" DESTBOOTSERV DESTBOOTSERV
foreground { /etc/s6/stage2.tini } foreground { /etc/s6/stage2.tini }
s6-svscanctl -6 -- /run/boot/service s6-svscanctl -6 -- ${DESTBOOTSERV}/service

View File

@@ -1,4 +1,5 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
s6-envdir -if /etc/s6/base-env
importas -i -D "" DESTBOOTSERV DESTBOOTSERV
foreground { /etc/s6/stage2.tini } foreground { /etc/s6/stage2.tini }
s6-svscanctl -q -- /run/boot/service s6-svscanctl -q -- ${DESTBOOTSERV}/service

View File

@@ -1,4 +1,5 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
s6-envdir -if /etc/s6/base-env
importas -i -D "" DESTBOOTSERV DESTBOOTSERV
foreground { /etc/s6/stage2.tini } foreground { /etc/s6/stage2.tini }
s6-svscanctl -t -- /run/boot/service s6-svscanctl -t -- ${DESTBOOTSERV}/service

View File

@@ -1,3 +1,4 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
s6-envdir -if /etc/s6/base-env
s6-svscanctl -an -- /run/boot/service importas -i -D "" DESTBOOTSERV DESTBOOTSERV
s6-svscanctl -an -- ${DESTBOOTSERV}/service

View File

@@ -1,4 +1,5 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
s6-envdir -if /etc/s6/base-env
importas -i -D "" DESTBOOTSERV DESTBOOTSERV
foreground { /etc/s6/stage2.tini } foreground { /etc/s6/stage2.tini }
s6-svscanctl -7 -- /run/boot/service s6-svscanctl -7 -- ${DESTBOOTSERV}/service

View File

@@ -1,9 +1,10 @@
#!/usr/local/bin/execlineb -S0 #!/usr/local/bin/execlineb -S0
s6-envdir -if /etc/s6/base-env
importas -i -D "" DESTBOOTSERV DESTBOOTSERV
cd / cd /
redirfd -w 2 /dev/console redirfd -w 2 /dev/console
fdmove -c 1 2 fdmove -c 1 2
foreground { s6-svc -X -- /run/boot/service/s6-svscan-log } foreground { s6-svc -X -- ${DESTBOOTSERV}/service/s6-svscan-log }
unexport ? unexport ?
wait -r -- { } wait -r -- { }
/etc/s6/stage3 ${@} /etc/s6/stage3 ${@}

View File

@@ -1,8 +1,9 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
s6-envdir -if /etc/s6/base-env
importas -i -D "" DESTBOOTSERV DESTBOOTSERV
redirfd -w 2 /dev/console redirfd -w 2 /dev/console
fdmove -c 1 2 fdmove -c 1 2
#redirfd -w 1 /dev/null #redirfd -w 1 /dev/null
redirfd -rnb 0 fifo redirfd -rnb 0 fifo
s6-applyuidgid -u 19 -g 19 -- s6-applyuidgid -u 19 -g 19 --
s6-log -bp -- t /run/boot/uncaught-logs s6-log -bp -- t ${DESTBOOTSERV}/uncaught-logs

View File

@@ -1,3 +1,3 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
/usr/bin/agetty -J 38400 tty1 /usr/bin/agetty --delay 02 -J 38400 tty1

View File

@@ -1,3 +1,3 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
/usr/bin/agetty -J 38400 tty2 /usr/bin/agetty --delay 02 -J 38400 tty2

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -8,8 +8,9 @@ pipeline -dw --
} }
if -nt -- if -nt --
{ {
redirfd -r 0 ./data/autofilled
s6-ipcclient -l0 -- s s6-ipcclient -l0 -- s
/usr/libexec/s6-rc-fdholder-filler -1 -- /usr/libexec/s6-rc-fdholder-filler -1 --
} }
s6-svc -t . s6-svc -t .
} }

View File

@@ -4,5 +4,5 @@ fdmove 1 3
s6-ipcserver-socketbinder -- s s6-ipcserver-socketbinder -- s
s6-ipcserverd -1 -- s6-ipcserverd -1 --
s6-ipcserver-access -v0 -E -l0 -i data/rules -- s6-ipcserver-access -v0 -E -l0 -i data/rules --
s6-sudod -t 2000 -- s6-sudod -t 30000 --
/usr/libexec/s6-rc-oneshot-run -l ../.. -- /usr/libexec/s6-rc-oneshot-run -l ../.. --

View File

@@ -1,6 +1,6 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
fdmove -c 2 1 fdmove -c 2 1
if { s6-echo -- udevd-udev started } if { s6-echo -- udevd-udev longrun started }
exec -c exec -c
udevd udevd

1
env/s6-conf vendored
View File

@@ -1 +0,0 @@
/run/s6-conf

50
init
View File

@@ -1,5 +1,5 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
# Copyright (C) 2015-2016 Eric Vidal <eric@obarun.org> # Copyright (C) 2015-2017 Eric Vidal <eric@obarun.org>
# #
# This file is distributed in the hope that it will be useful, but WITHOUT ANY # This file is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
@@ -14,63 +14,43 @@
# Export good path # Export good path
/usr/local/bin/export PATH "/usr/local/bin:/usr/bin" /usr/bin/s6-envdir -if /etc/s6/base-env
/usr/local/bin/importas -i -D "" PATH PATH
cd / /usr/local/bin/export PATH ${PATH}
# parse s6.conf before loading environment
foreground {
redirfd -r 0 /etc/s6/s6.conf
pipeline { s6-grep -vF -- "#" }
forstdin -nCd"\n" -- conf
importas -ui conf conf
multidefine -d"=" $conf { var value }
foreground {
if { mkdir -p /run/s6-conf/ }
redirfd -w 1 /run/s6-conf/$var
s6-echo -- $value
}
}
# load hostname for earlier tty
foreground {
s6-envdir /etc/s6/env/s6-conf
importas -i HOSTNAME HOSTNAME
s6-hostname ${HOSTNAME}
}
# Clean environment
emptyenv -p
s6-envdir -if /etc/s6/env
/usr/local/bin/cd /
# Be clean and safe # Be clean and safe
emptyenv -p
s6-setsid -qb -- s6-setsid -qb --
umask 022 umask 022
if { if {
if { s6-echo -- "***************************************************************************" } if { s6-echo -- "***************************************************************************" }
if { s6-echo -- "** Booting Obarun under S6 **" } if { s6-echo -- "** Booting Obarun under S6 **" }
if { s6-echo -- "** Warning: Under development **" } if { s6-echo -- "** https://obarun.org/ **" }
if { s6-echo -- "** http://obarun.org/ **" }
s6-echo -- "***************************************************************************" s6-echo -- "***************************************************************************"
} }
# Copy service for pid1 in the right place # Copy service for pid1 at the right place
importas -i boot-serv boot-serv s6-envdir -if /etc/s6/base-env
importas -i -D "" SRCBOOTSERV SRCBOOTSERV
importas -i -D "" DESTBOOTSERV DESTBOOTSERV
foreground { foreground {
if { s6-hiercopy ${boot-serv} /run/boot } if { s6-hiercopy ${SRCBOOTSERV} ${DESTBOOTSERV} }
} }
redirfd -r 0 /dev/null redirfd -r 0 /dev/null
redirfd -wnb 1 /run/boot/service/s6-svscan-log/fifo redirfd -wnb 1 ${DESTBOOTSERV}/service/s6-svscan-log/fifo
# Now we are good for stage2, start it # Now we are good for stage2, start it
background { background {
s6-setsid -- s6-setsid --
redirfd -w 1 /run/boot/service/s6-svscan-log/fifo redirfd -w 1 ${DESTBOOTSERV}/service/s6-svscan-log/fifo
fdmove -c 2 1 fdmove -c 2 1
/etc/s6/stage2 /etc/s6/stage2
} }
unexport ! unexport !
fdmove -c 2 1 fdmove -c 2 1
s6-svscan -st0 /run/boot/service s6-svscan -st0 ${DESTBOOTSERV}/service

View File

@@ -1,3 +1,5 @@
#!/bin/bash #!/usr/local/bin/execlineb -P
exec /run/boot/service/.s6-svscan/SIGUSR2 s6-envdir -if /etc/s6/base-env
importas -i -D "" DESTBOOTSERV DESTBOOTSERV
exec ${DESTBOOTSERV}/service/.s6-svscan/SIGUSR2

6
reboot
View File

@@ -1,3 +1,5 @@
#!/bin/bash #!/usr/local/bin/execlineb -P
exec /run/boot/service/.s6-svscan/SIGINT s6-envdir -if /etc/s6/base-env
importas -i -D "" DESTBOOTSERV DESTBOOTSERV
exec ${DESTBOOTSERV}/service/.s6-svscan/SIGINT

View File

@@ -1 +1 @@
erase me delete this file

View File

@@ -1 +1 @@
erase me delete this file

View File

@@ -1 +1 @@
erase me delete this file

12
s6.conf
View File

@@ -4,15 +4,15 @@
# Apply kernel runtime [yes|no] # Apply kernel runtime [yes|no]
KERNELRUNTIME=yes KERNELRUNTIME=yes
#boot with dmraid support [yes|no] # Boot with dmraid support [yes|no]
USEDMRAID=no USEDMRAID=no
#boot with btrfs support [yes|no] # Boot with btrfs support [yes|no]
USEBTRFS=no USEBTRFS=no
#boot with lvm support [yes|no] # Boot with lvm support [yes|no]
# This option is not available for the moment # Do not forget to remake your initramfs with lvm2 hook on it
#USELVM=no USELVM=no
#swap support [yes|no] #swap support [yes|no]
USESWAP=no USESWAP=no
@@ -58,3 +58,5 @@ FORCECHCK=no
# Use /etc/s6.local [yes|no] # Use /etc/s6.local [yes|no]
S6LOCAL=no S6LOCAL=no
# Remove entirely the /tmp directory
TMPDIR=no

12
stage2
View File

@@ -1,5 +1,5 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
# Copyright (C) 2015-2016 Eric Vidal <eric@obarun.org> # Copyright (C) 2015-2017 Eric Vidal <eric@obarun.org>
# #
# This file is distributed in the hope that it will be useful, but WITHOUT ANY # This file is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
@@ -12,17 +12,21 @@
# can do whatever you want with this stuff. If we meet some day, and you think # can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return. Eric Vidal http://obarun.org # this stuff is worth it, you can buy me a beer in return. Eric Vidal http://obarun.org
s6-envdir -if /etc/s6/base-env
importas -i -D "" DESTRCSERV DESTRCSERV
importas -i -D "" DESTBOOTSERV DESTBOOTSERV
importas -i -D "" SRCRCCOMPILED SRCRCCOMPILED
if -nt { if -nt {
if { s6-echo -- "***************************************************************************" } if { s6-echo -- "***************************************************************************" }
if { s6-echo -- "** Start Stage 2 **" } if { s6-echo -- "** Start Stage 2 **" }
if { s6-echo -- "***************************************************************************" } if { s6-echo -- "***************************************************************************" }
# start service # start service
if { s6-rc-init -l /run/boot-rc -c /etc/s6/compiled/current /run/boot/service } if { s6-rc-init -l ${DESTRCSERV} -c ${SRCRCCOMPILED}/current ${DESTBOOTSERV}/service }
if { s6-rc -l /run/boot-rc -u change All } if { s6-rc -l ${DESTRCSERV} -u change All }
if { s6-echo -- "***************************************************************************" } if { s6-echo -- "***************************************************************************" }
if { s6-echo -- "** Stage 2 completed **" } if { s6-echo -- "** Stage 2 completed **" }
s6-echo -- "***************************************************************************" s6-echo -- "***************************************************************************"
} }
redirfd -w 1 /dev/console redirfd -w 1 /dev/console
s6-echo "Something wrong on stage2, log to debug it" s6-echo "Something wrong on stage2, please see the log at ${DESTBOOTSERV}/uncaught-logs/current to debug it"

View File

@@ -1,5 +1,5 @@
#!/usr/local/bin/execlineb -S0 #!/usr/local/bin/execlineb -S0
# Copyright (C) 2015-2016 Eric Vidal <eric@obarun.org> # Copyright (C) 2015-2017 Eric Vidal <eric@obarun.org>
# #
# This file is distributed in the hope that it will be useful, but WITHOUT ANY # This file is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
@@ -12,11 +12,15 @@
# can do whatever you want with this stuff. If we meet some day, and you think # can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return. Eric Vidal http://obarun.org # this stuff is worth it, you can buy me a beer in return. Eric Vidal http://obarun.org
s6-envdir -if /etc/s6/base-env
importas -i -D "" DESTRCSERV DESTRCSERV
importas -i -D "" S6CONF S6CONF
if { s6-echo -- "***************************************************************************" } if { s6-echo -- "***************************************************************************" }
if { s6-echo -- "** Start Tini shutdown **" } if { s6-echo -- "** Start Tini shutdown **" }
if { s6-echo -- "***************************************************************************" } if { s6-echo -- "***************************************************************************" }
cd / cd /
foreground { s6-rc -v 2 -l /run/boot-rc -da change } foreground { s6-rc -v 2 -l ${DESTRCSERV} -da change }
foreground { foreground {
backtick -n bytes { cat /proc/sys/kernel/random/poolsize } backtick -n bytes { cat /proc/sys/kernel/random/poolsize }
importas -u bytes bytes importas -u bytes bytes
@@ -32,9 +36,8 @@ foreground {
umask 077 umask 077
dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=$bytes dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=$bytes
} }
foreground { foreground {
s6-envdir /etc/s6/env/s6-conf s6-envdir ${S6CONF}
importas -u -D "" HARDWARECLOCK HARDWARECLOCK importas -u -D "" HARDWARECLOCK HARDWARECLOCK
pipeline -d { echo $HARDWARECLOCK } pipeline -d { echo $HARDWARECLOCK }
pipeline { tr A-Z a-z } pipeline { tr A-Z a-z }
@@ -42,6 +45,14 @@ foreground {
importas -iu clock clock importas -iu clock clock
hwclock --systohc --${clock} hwclock --systohc --${clock}
} }
foreground {
s6-envdir ${S6CONF}
importas -u -D "" TMPDIR TMPDIR
if { s6-test $TMPDIR = yes }
if { s6-echo -- Cleaning /tmp directory }
rm -rf /tmp/
}
if { s6-echo -- "***************************************************************************" } if { s6-echo -- "***************************************************************************" }
if { s6-echo -- "** Tini shutdown terminated **" } if { s6-echo -- "** Tini shutdown terminated **" }
if { s6-echo -- "** Enter on stage 3 **" } if { s6-echo -- "** Enter on stage 3 **" }

15
stage3
View File

@@ -1,5 +1,5 @@
#!/usr/local/bin/execlineb -S0 #!/usr/local/bin/execlineb -S0
# Copyright (C) 2015-2016 Eric Vidal <eric@obarun.org> # Copyright (C) 2015-2017 Eric Vidal <eric@obarun.org>
# #
# This file is distributed in the hope that it will be useful, but WITHOUT ANY # This file is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
@@ -21,26 +21,25 @@ fdmove -c 2 1
if { s6-echo -- "***************************************************************************" } if { s6-echo -- "***************************************************************************" }
if { s6-echo -- "** Start stage3 **" } if { s6-echo -- "** Start stage3 **" }
if { s6-echo -- "***************************************************************************" } if { s6-echo -- "***************************************************************************" }
foreground { s6-echo Syncing disks. } foreground { s6-echo -- Syncing disks. }
foreground { s6-sync } foreground { s6-sync }
foreground { s6-echo Sending all processes the TERM signal. } foreground { s6-echo -- Sending all processes the TERM signal. }
foreground { s6-nuke -th } foreground { s6-nuke -th }
foreground { s6-sleep 1 } foreground { s6-sleep 1 }
foreground { s6-echo Sending all processes the KILL signal. } foreground { s6-echo -- Sending all processes the KILL signal. }
foreground { s6-nuke -k } foreground { s6-nuke -k }
wait { } wait { }
foreground { s6-echo Syncing disks. } foreground { s6-echo Syncing disks. }
foreground { s6-sync } foreground { s6-sync }
foreground { s6-echo Umount extra filesystem } foreground { s6-echo -- Umount extra filesystem }
foreground { umount -r -a -t nosysfs,noproc,nodevtmpfs,notmpfs } foreground { umount -r -a -t nosysfs,noproc,nodevtmpfs,notmpfs }
foreground { rm -rf /tmp/* } foreground { s6-echo -- Remount ro / }
foreground { s6-echo Remount ro / }
foreground { mount -o remount,ro / } foreground { mount -o remount,ro / }
foreground { s6-echo Syncing disks. } foreground { s6-echo -- Syncing disks. }
foreground { s6-sync } foreground { s6-sync }
# Reboot, halt or poweroff the machine, depending on the parameter # Reboot, halt or poweroff the machine, depending on the parameter