23 Commits

Author SHA1 Message Date
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
48 changed files with 142 additions and 94 deletions

View File

@@ -1,3 +1,4 @@
# s6-boot
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
# 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.
path_dir_boot=/run/boot/service

View File

@@ -7,14 +7,14 @@ s6-envdir /etc/s6/env/s6-conf
#if { s6-hostname $HOSTNAME }
foreground {
forx -p first { proc sys dev run }
import -ui first
importas -ui -D "" first first
foreground {
if -n { mountpoint -q /$first }
s6-envdir /etc/s6/env/mount/$first
import -ui fstype
import -ui device
import -ui mountpoint
import -ui options
importas -ui -D "" fstype fstype
importas -ui -D "" device device
importas -ui -D "" mountpoint mountpoint
importas -ui -D "" options options
s6-mount -o $options -t $fstype $device $mountpoint
}
@@ -23,7 +23,7 @@ foreground {
# create needed directory on run if doesn't exist
if {
forx -p second { lvm user lock }
import -ui second
importas -ui -D "" second second
foreground {
if -n { s6-test -d /run/$second }
s6-mkdir -p -m 0755 /run/$second
@@ -33,16 +33,16 @@ if {
# finaly mount /dev/shm /dev/pts
if {
forx -p third { shm pts }
import -ui third
importas -ui -D "" third third
if {
foreground {
if -n { mountpoint -q /dev/$third }
if { s6-mkdir -p -m 0755 /dev/$third }
s6-envdir /etc/s6/env/mount/$third
import -ui fstype
import -ui device
import -ui mountpoint
import -ui options
importas -ui -D "" fstype fstype
importas -ui -D "" device device
importas -ui -D "" mountpoint mountpoint
importas -ui -D "" options options
s6-mount -o $options -n -t $fstype $device $mountpoint
}
}

View File

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

View File

@@ -3,7 +3,7 @@
fdmove -c 2 1
if { s6-echo -- checkfs-brtfs started }
s6-envdir /etc/s6/env/s6-conf
import -D "" USEBTRFS
importas -D "" USEBTRFS USEBTRFS
foreground {
if { s6-test $USEBTRFS = yes }
if { s6-test -x /usr/bin/btrfs }

View File

@@ -3,7 +3,7 @@
fdmove -c 2 1
if { s6-echo -- checkfs-dmraid started }
s6-envdir /etc/s6/env/s6-conf
import -D "" USEDMRAID
importas -D "" USEDMRAID USEDMRAID
foreground {
if { s6-test $USEDMRAID = yes }
if { s6-test -x /usr/bin/dmraid }

View File

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

View File

@@ -2,20 +2,18 @@
fdmove -c 2 1
if { s6-echo -- checkfs-fsckeck started }
s6-envdir /etc/s6/env/s6-conf
import -D "" FORCECHCK
if -t {
importas -D "" FORCECHCK FORCECHCK
foreground {
if { s6-test $FORCECHCK = yes }
redirfd -w 1 /dev/console
if { s6-echo -- Check of filesystem was asked, please wait }
if { fsck -A -T -a -f noopts=_netdev }
if { s6-echo -- Filesystem checked }
redirfd -w 1 /run/s6/service/s6-svscan-log/fifo
s6-true
foreground { fsck -A -T -a -f noopts=_netdev }
s6-echo -- Filesystem checked
}
# 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
if -t {
fsck -A -T -a noopts=_netdev
foreground { fsck -A -T -a noopts=_netdev }
}
wait { }
s6-echo -- checkfs-fscheck successfully started

View File

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

View File

@@ -0,0 +1 @@
oneshot

View File

@@ -0,0 +1,19 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
s6-envdir /etc/s6/env/s6-conf
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-btrfs
checkfs-lvm
checkfs-fscheck

View File

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

View File

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

View File

@@ -4,16 +4,16 @@ fdmove -c 2 1
if { s6-echo -- rofs-console started }
s6-envdir /etc/s6/env/s6-conf
import -D "" KEYMAP
import -D "" FONT
import -D "" FONT_MAP
import -D "" FONT_UNIMAP
importas -D "" KEYMAP KEYMAP
importas -D "" FONT FONT
importas -D "" FONT_MAP FONT_MAP
importas -D "" FONT_UNIMAP FONT_UNIMAP
foreground {
loadkeys -q -u $KEYMAP
}
foreground {
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}
}
s6-echo -- rofs-console successfully started

View File

@@ -4,12 +4,12 @@ fdmove -c 2 1
if { s6-echo -- rofs-hardclock started }
foreground {
s6-envdir /etc/s6/env/s6-conf
import -D "" TZ
import -D "" HARDWARECLOCK
importas -D "" TZ TZ
importas -D "" HARDWARECLOCK HARDWARECLOCK
pipeline -d { echo $HARDWARECLOCK }
pipeline { tr A-Z a-z }
forstdin -- clock
import -iu clock
importas -iu -D "" clock clock
hwclock --systz --${clock} --noadjfile
}
s6-echo -- rofs-hardclock successfully started

View File

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

View File

@@ -3,7 +3,7 @@
fdmove -c 2 1
if { s6-echo -- rofs-kernruntime started }
s6-envdir /etc/s6/env/s6-conf
import -D "" KERNELRUNTIME
importas -D "" KERNELRUNTIME KERNELRUNTIME
foreground {
if { s6-test $KERNELRUNTIME = yes }
if { s6-test -x /usr/bin/sysctl }

View File

@@ -6,7 +6,7 @@ foreground {
if { s6-test -e /etc/s6/env/s6-conf/MODULES }
redirfd -r 0 /etc/s6/env/s6-conf/MODULES
forstdin -n -- mods
import -ui mods
importas -ui -D "" mods mods
foreground {
if { s6-test -n $mods }
modprobe -ab $mods

View File

@@ -3,7 +3,7 @@
fdmove -c 2 1
if { s6-echo -- rofs-swap started }
s6-envdir /etc/s6/env/s6-conf
import -D "" USESWAP
importas -D "" USESWAP USESWAP
foreground {
if { s6-test $USESWAP = yes }
swapon -a

View File

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

View File

@@ -2,12 +2,18 @@
fdmove -c 2 1
if { s6-echo -- rwfs-cleanboot started }
if -t { 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 -nt { s6-test -e /var/log/btmp }
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 {
foreground { install -m0664 -o root -g utmp /dev/null /run/utmp }
}
if -t {
if -nt { s6-test -e /var/log/wtmp }
foreground { install -m0664 -o root -g utmp /dev/null /var/log/wtmp }
}
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

View File

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

View File

@@ -14,4 +14,4 @@ foreground {
if { s6-echo -- Flushing ip6tables }
/usr/lib/iptables/scripts/iptables-flush 6
}
s6-true
s6-echo -- Iptables flushed

View File

@@ -3,20 +3,20 @@
fdmove -c 2 1
if { s6-echo -- rwfs-iptables started }
s6-envdir /etc/s6/env/s6-conf
import -D "" IPTABLES
import -D "" IP6TABLES
importas -D "" IPTABLES IPTABLES
importas -D "" IP6TABLES IP6TABLES
foreground {
if { s6-test $IPTABLES = yes }
if { s6-test -e /etc/iptables/iptables.rules }
if { s6-echo -- Activing iptables }
if { iptables-restore /etc/iptables/iptables.rules }
foreground { iptables-restore /etc/iptables/iptables.rules }
s6-echo -- Iptables actived
}
foreground {
if { s6-test $IP6TABLES = yes }
if { s6-test -e /etc/iptables/ip6tables.rules }
if { s6-echo -- Activing ip6tables }
ip6tables-restore /etc/iptables/ip6tables.rules
foreground { ip6tables-restore /etc/iptables/ip6tables.rules }
s6-echo -- Ip6tables actived
}
s6-echo -- rwfs-iptables successfully started

View File

@@ -3,6 +3,6 @@
fdmove -c 2 1
if { s6-echo -- rwfs-localtime started }
s6-envdir /etc/s6/env/s6-conf
import -D "" TZ
importas -D "" TZ TZ
if { s6-ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime }
s6-echo -- rwfs-localtime successfully started

View File

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

View File

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

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

@@ -3,5 +3,5 @@ fdmove -c 2 1
if { s6-echo -- start switch-presvscan }
if { s6-mkdir -p -m 0755 /run/user/service }
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

View File

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

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

View File

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

View File

15
init
View File

@@ -1,5 +1,5 @@
#!/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
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
@@ -23,7 +23,7 @@ foreground {
redirfd -r 0 /etc/s6/s6.conf
pipeline { s6-grep -vF -- "#" }
forstdin -nCd"\n" -- conf
importas -ui conf conf
importas -ui -D "" conf conf
multidefine -d"=" $conf { var value }
foreground {
if { mkdir -p /run/s6-conf/ }
@@ -34,7 +34,7 @@ foreground {
# load hostname for earlier tty
foreground {
s6-envdir /etc/s6/env/s6-conf
importas -i HOSTNAME HOSTNAME
importas -i -D "" HOSTNAME HOSTNAME
s6-hostname ${HOSTNAME}
}
# Clean environment
@@ -49,15 +49,14 @@ umask 022
if {
if { s6-echo -- "***************************************************************************" }
if { s6-echo -- "** Booting Obarun under S6 **" }
if { s6-echo -- "** Warning: Under development **" }
if { s6-echo -- "** http://obarun.org/ **" }
if { s6-echo -- "** https://obarun.org/ **" }
s6-echo -- "***************************************************************************"
}
# Copy service for pid1 in the right place
importas -i boot-serv boot-serv
# Copy service for pid1 at the right place
importas -i -D "" BOOTSERV BOOTSERV
foreground {
if { s6-hiercopy ${boot-serv} /run/boot }
if { s6-hiercopy ${BOOTSERV} /run/boot }
}
redirfd -r 0 /dev/null

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

4
stage2
View File

@@ -1,5 +1,5 @@
#!/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
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
@@ -25,4 +25,4 @@ if -nt {
s6-echo -- "***************************************************************************"
}
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 /run/boot/uncaught-logs/current to debug it"

View File

@@ -1,5 +1,5 @@
#!/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
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
@@ -32,7 +32,6 @@ foreground {
umask 077
dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=$bytes
}
foreground {
s6-envdir /etc/s6/env/s6-conf
importas -u -D "" HARDWARECLOCK HARDWARECLOCK
@@ -42,6 +41,14 @@ foreground {
importas -iu clock clock
hwclock --systohc --${clock}
}
foreground {
s6-envdir /etc/s6/env/s6-conf
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 -- "** Tini shutdown terminated **" }
if { s6-echo -- "** Enter on stage 3 **" }

15
stage3
View File

@@ -1,5 +1,5 @@
#!/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
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
@@ -21,26 +21,25 @@ fdmove -c 2 1
if { s6-echo -- "***************************************************************************" }
if { s6-echo -- "** Start stage3 **" }
if { s6-echo -- "***************************************************************************" }
foreground { s6-echo Syncing disks. }
foreground { s6-echo -- Syncing disks. }
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-sleep 1 }
foreground { s6-echo Sending all processes the KILL signal. }
foreground { s6-echo -- Sending all processes the KILL signal. }
foreground { s6-nuke -k }
wait { }
foreground { s6-echo Syncing disks. }
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 { rm -rf /tmp/* }
foreground { s6-echo Remount ro / }
foreground { s6-echo -- Remount ro / }
foreground { mount -o remount,ro / }
foreground { s6-echo Syncing disks. }
foreground { s6-echo -- Syncing disks. }
foreground { s6-sync }
# Reboot, halt or poweroff the machine, depending on the parameter