160 Commits
v0.0.4 ... dev

Author SHA1 Message Date
obarun
ae2e097a6b earlier tty start now at tty6 2018-01-18 14:17:20 +11:00
obarun
77057205d7 allow to start multiple tty at boot time 2018-01-18 14:16:56 +11:00
obarun
4d67a11ce9 disable parsing environment 2018-01-12 17:00:50 +11:00
obarun
a66aea9840 append MASTER name with a suffix 2018-01-12 15:15:31 +11:00
obarun
6712d7bef0 update user.sh to master.sh 2018-01-12 14:22:22 +11:00
obarun
731f9414f1 rebuild database 2018-01-12 13:57:44 +11:00
obarun
e02c2138db shutdown the rc database coming grom root 2018-01-12 13:56:26 +11:00
obarun
1f6ec5f2f2 allow to change the name for root user 2018-01-12 13:56:06 +11:00
obarun
2632e962ea call master.sh instead of user.sh 2018-01-12 13:55:46 +11:00
obarun
c09e70e9e2 split file for creation of supervision tree,root in now independant, user.sh pass now to s6opts 2018-01-12 13:55:15 +11:00
obarun
d628070a7a Merge branch 'master' into dev 2018-01-11 09:17:50 +11:00
obarun
ad09fc9981 update copyright 2018-01-11 08:24:52 +11:00
obarun
20d43abe7f rofs-cgroups : fix umounting cgroups at shutdown 2018-01-10 23:27:18 +11:00
obarun
fea3b2675c Bump 0.2.0 2018-01-04 15:50:31 +11:00
obarun
2dfb3ac0ad rebuild database 2018-01-04 15:36:08 +11:00
obarun
fb924ced4f merge branch dev 2018-01-04 15:34:28 +11:00
obarun
7008745393 rebuild database 2018-01-04 15:26:26 +11:00
obarun
5a93f2ca81 fix output message of iptables6 at shutdown 2018-01-04 15:23:08 +11:00
obarun
3cd9f46117 umount nfs if exist 2018-01-04 15:19:10 +11:00
obarun
f88b0f4eac rebuild database 2018-01-04 15:03:28 +11:00
obarun
1c6c1ff259 improve udevd and udevadm service 2018-01-04 15:01:57 +11:00
obarun
f5217e18ef oops wrong variable 2017-12-13 15:34:02 +11:00
obarun
051dacc843 bump 0.1.9 2017-12-13 15:12:05 +11:00
obarun
d3ec2f001e rebuild database 2017-12-13 15:11:32 +11:00
obarun
0594295927 fix svscanctl command 2017-12-13 15:01:34 +11:00
obarun
95e074768e stage2.tini : umount Nfs filesystem if exist 2017-10-11 09:39:33 +11:00
obarun
dbc7e4d1af NEWS : oops forget to push before tagging 2017-10-11 09:16:51 +11:00
obarun
4e1e004af7 Makefile : fix version 2017-10-11 09:16:26 +11:00
obarun
53bc1c3f84 rofs-cgroups: add -R at umount command 2017-10-11 09:15:59 +11:00
obarun
ea871d703a Makefile : install tmpfiles.sh and modules.sh script 2017-10-03 10:16:26 +11:00
obarun
2b6b36c265 rebuild database 2017-10-03 10:11:46 +11:00
obarun
9acfccfad5 NEWS : new version 2017-10-03 10:09:28 +11:00
obarun
32eaffc776 rwfs-end : fix it 2017-10-03 10:09:13 +11:00
obarun
de179883e4 fix BINDIR_EXECLINE 2017-10-03 10:08:51 +11:00
obarun
59f5925d6b add data/scripts/tmpfiles.sh : this scripts parse and apply files founded at /usr/lib/tmpfiles.d 2017-10-03 10:08:24 +11:00
obarun
b5f41908b3 wrap systemd modules-load.d/ directory to load modules 2017-09-30 09:05:25 +11:00
obarun
a72258985a rwfs-ip6tables : fix down file 2017-09-30 09:04:39 +11:00
obarun
9f81864f69 add modules.sh script to load modules from /etc,/run,/usr/lib/modules-load.d 2017-09-29 18:50:49 +11:00
obarun
571079581d tty1/run : fix shebang 2017-09-26 10:09:55 +11:00
obarun
5153867c5c tty1 : wait for LIVE_CLASSIC_PATH/s6rc-fdholder be ready 2017-09-25 13:08:18 +11:00
obarun
3edf09f112 rebuild again database 2017-09-25 09:13:18 +11:00
obarun
7cceba59ba rebuild database 2017-09-25 09:10:00 +11:00
obarun
f443c45b58 user.sh : respect the choice of user in .conf file 2017-09-25 09:09:44 +11:00
obarun
a02517cd6c add NEWS file 2017-09-23 16:51:50 +11:00
obarun
780ccf8ccf source .conf file to define path 2017-09-23 15:56:54 +11:00
obarun
69b9f7ec7f pass through .conf file 2017-09-23 09:56:56 +11:00
obarun
a0f3aa87f3 be sure that daemon is existed before removing directories 2017-09-22 08:58:01 +11:00
obarun
2859cd5fa4 create DESTUSER/USER with mode 755 2017-09-20 20:05:01 +11:00
obarun
a29d97570b WTF... 2017-09-20 19:45:50 +11:00
obarun
4e0a612d6c do not clean environment in shutdown file 2017-09-20 19:10:16 +11:00
obarun
426afc67cb reverse to importas command, fail without it 2017-09-20 19:09:22 +11:00
obarun
16f76d0e89 change s6opts-user.log file name to user.log 2017-09-20 10:50:21 +11:00
obarun
3e198ee09d rebuild database 2017-09-20 10:39:21 +11:00
obarun
157561ff1a modify readme 2017-09-20 07:21:49 +11:00
obarun
ee63627f34 modify readme 2017-09-20 07:20:17 +11:00
obarun
8aa20b50f3 fix output to fd 1 2017-09-20 07:08:49 +11:00
obarun
aaf133355a add Makefile , append file with license 2017-09-20 06:59:48 +11:00
obarun
69b64ba057 append file with license, simplify it for the command to pass at s6-svscan 2017-09-20 06:57:41 +11:00
obarun
376d28df6f add file HANDLE in env directory to find template directory place 2017-09-20 06:56:15 +11:00
obarun
ca57ac6852 pass start-user.ck to s6opts package, this file concern running time, not booting time 2017-09-20 06:55:14 +11:00
obarun
c7b42d7b02 template/ and s6-serv/ directories concern running time, not booting time, pass those directories to s6opts 2017-09-20 06:53:41 +11:00
obarun
9e6b8bf1b5 fix place for user.sh script at data/script directory 2017-09-20 06:52:05 +11:00
obarun
a8a8109903 change place of template directory to /usr/share/obarun/s6opts/template 2017-09-20 06:51:07 +11:00
obarun
3289c6c736 replace TEMPLATE variable by HANDLE, replace handle-user script name by user.sh 2017-09-20 06:49:55 +11:00
obarun
1d17321c9a change COPYING to LICENSE 2017-09-20 06:48:12 +11:00
obarun
f2ed6b08ac pass to ISC license 2017-09-18 15:59:44 +11:00
obarun
8a2cd0bd2a follow change of directories place and creation 2017-09-14 10:29:05 +11:00
obarun
638a03632d create function for all operation, output on log file, prevent root creation, add environment to the supervision tree 2017-09-14 10:28:22 +11:00
obarun
c1f8e69e31 control creation of supervision tree by consolekit 2017-09-14 10:25:03 +11:00
obarun
1188fd5a02 change again place of svscandir and rc database, hoping that the final version 2017-09-08 17:58:17 +11:00
obarun
66ff1cd25a final version for the moment 2017-09-08 16:41:08 +11:00
obarun
5dd10c21ab wait for the service /run/boot/service/0 instead of the s6-rc database at /run/user/rc-0 2017-09-08 16:40:46 +11:00
obarun
f02e3e77f6 fix s6-rc, s6-rc-init command for root user 2017-09-07 14:41:39 +11:00
obarun
c39d4eaa9f follow change of directory to look at 2017-09-07 14:35:46 +11:00
obarun
5118d345f5 copy SIG* file to the right place 2017-09-07 14:35:12 +11:00
obarun
0fdfb07785 improve template, launch {svscandir,s6-rc-init,s6-rc} with correct uid gid, parse file to retrieve daemon in function of the user, pass command onto function, classified a little more run/user 2017-09-07 14:33:24 +11:00
obarun
71c69a3712 create directory by handle-user script instead of run script and create it on tmpfs with uid coming from user specification, exit on every command failed 2017-09-05 19:41:55 +11:00
obarun
6e9aa207a9 rebuild database 2017-09-05 08:45:58 +11:00
obarun
776956629c pass through down file instead of stage2.tini for hardclock and random configuration 2017-09-05 08:14:43 +11:00
obarun
9c398628df reverse to preview version, consolekit do not do the difference between halt and poweroff 2017-09-05 08:12:29 +11:00
obarun
1e3db3d992 change variable name 2017-09-05 07:26:15 +11:00
obarun
d734920302 change variable name, add message about behaviour interactive shell and tty2 2017-09-05 07:21:15 +11:00
obarun
45228a409b add halt signal option 2017-09-05 07:18:47 +11:00
obarun
b05eb70a1a change variable name 2017-09-05 07:17:14 +11:00
obarun
f0e4ef7e71 remove uneeded file 2017-09-05 07:16:14 +11:00
obarun
76bd850f2e change variable name 2017-09-05 07:14:49 +11:00
obarun
6a3223a718 add template directory, allow creation of user on the fly 2017-09-05 07:13:04 +11:00
obarun
9c034c223c rename boot-serv directory to classic, block tty1 till the boot process is completly finished 2017-09-05 07:12:17 +11:00
obarun
08d073fe82 rename directories base-env to env, change name of variable to be more clear, add TEMPLATE variable, change place of rc live database creation from /run/rc-boot to /run/boot/rc 2017-09-05 07:01:34 +11:00
obarun
aa834f05e4 renamed boot-rc-serv to rc, remove bundle-switch and replace it by adduser oneshot service. 2017-09-05 06:45:20 +11:00
obarun
e4a337d82d Add variable on base-env to prepare dev branch, block tty1 until boot procedure is not fully operational 2017-08-30 17:11:58 +11:00
obarun
ef93123fc6 fix README 2017-07-14 11:40:55 +11:00
obarun
96c517fbb6 rebuild database 2017-07-12 16:32:53 +11:00
obarun
928bcb559f separate ip6tables from iptables service 2017-07-12 16:32:21 +11:00
obarun
e2d67d7c8c rebuild the database 2017-07-12 14:01:42 +11:00
obarun
a483e72826 change output to reflect the choice on s6.conf 2017-07-12 14:00:42 +11:00
obarun
5aa4632678 remove s6-conf service and implement it on 00 service 2017-07-12 14:00:07 +11:00
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
Eric Vidal
3ede7a7e1a ooops 2016-06-16 09:19:16 +04:00
Eric Vidal
ecf880bbba separate classic and rc service, change location of compiled database for user 2016-06-16 09:16:38 +04:00
Eric Vidal
e078f81833 rename variable boot-serv 2016-06-16 09:11:31 +04:00
Eric Vidal
2da29b1f89 add s6.local script 2016-06-16 09:10:03 +04:00
Eric Vidal
2229c16ccb rebuild database according to the change of boot-rc-serv 2016-06-16 09:08:47 +04:00
Eric Vidal
a973077e7c rename rc service for boot, separate boot service and user service, add new features, rename directory for better clarity 2016-06-16 09:07:44 +04:00
Eric Vidal
c1462043c4 rename service directory for boot to better clarity 2016-06-16 09:06:13 +04:00
Eric Vidal
8f488f90c2 add s6.local features 2016-06-16 08:59:12 +04:00
Eric Vidal
5b60188bd1 change poweroff, shutdown, reboot script according to the new location of .s6-svscan 2016-06-16 08:58:45 +04:00
Eric Vidal
6467aa9404 change database location with -l option 2016-06-16 08:57:22 +04:00
Eric Vidal
ac5d797b7f change database initiation with -l option 2016-06-16 08:56:40 +04:00
Eric Vidal
1360a70b56 remove symlinks,use directly the copy of boot-serv variable 2016-06-16 08:55:50 +04:00
Eric Vidal
46e69c496d change completion according to the new directory for service 2016-06-16 08:54:24 +04:00
Eric Vidal
22f0fca0fd build default database 2016-06-10 09:10:33 +04:00
Eric Vidal
069c32c3c1 allow forcecheck if asked 2016-06-10 09:10:03 +04:00
Eric Vidal
36cf18ab0f add iptables features and fscheck options 2016-06-10 09:09:16 +04:00
Eric Vidal
be97f38a80 add iptables oneshot at boot time 2016-06-10 09:08:44 +04:00
Eric Vidal
1b297934a6 dmesg must be the last oneshot started before switching to bundle all-User 2016-06-10 09:08:04 +04:00
Eric Vidal
230d30ff1a clean /tmp directory at shutdown 2016-06-10 09:06:29 +04:00
Eric Vidal
8a2027df08 classify the compilation database source directory 2016-06-07 17:50:44 +04:00
Eric Vidal
d2a83294e0 fix obscur bug about ip link 2016-06-06 17:19:58 +04:00
Eric Vidal
a221f2dd22 grrr 2016-06-04 21:20:02 +04:00
Eric Vidal
905d8f07b2 add shutdown script 2016-06-04 16:15:43 +04:00
Eric Vidal
244c0a4203 change path for stage2, stage3 2016-06-04 09:36:00 +04:00
Eric Vidal
fa04d943a6 rebuild database 2016-06-03 22:10:36 +04:00
Eric Vidal
1758a4fe48 fix dependencies for rofs-hardclock 2016-06-03 22:10:02 +04:00
Eric Vidal
22bfa5e1a5 build again default database to follow the change 2016-06-02 18:21:07 +04:00
Eric Vidal
49d7bc3436 bring up after udevd 2016-06-02 18:20:36 +04:00
Eric Vidal
615bfc18a4 always exit with success to avoids crash if a check is made 2016-06-02 18:19:44 +04:00
222 changed files with 2018 additions and 495 deletions

2
AUTHORS Normal file
View File

@@ -0,0 +1,2 @@
Main author:
Eric Vidal <eric@obarun.org>

18
LICENSE
View File

@@ -1,4 +1,14 @@
# "THE BEERWARE LICENSE" (Revision 42): Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
# <eric@obarun.org> wrote this file. As long as you retain this notice you All rights reserved.
# 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 Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

85
Makefile Normal file
View File

@@ -0,0 +1,85 @@
# Makefile for s6-boot
VERSION = $$(git describe --tags| sed 's/-.*//g;s/^v//;')
PKGNAME = s6-boot
BINDIR_EXECLINE = /usr/local/bin
BINDIR = /usr/bin
CLASSIC = `find classic/ -type f`
DATA = `find data/scripts -type f`
RC = `find rc/ -type f`
FILESYSTEM = `find filesystem-env/ -type f`
ENV = `find env/ -type f`
DIRS= \
/usr/bin \
/etc/s6 \
/etc/s6/compiled \
/etc/s6/data/scripts \
/etc/s6/env \
/etc/s6/filesystem-env \
/etc/s6/rc \
/etc/s6/classic/service \
/etc/s6/classic/uncaught-logs \
/usr/share/zsh/site-functions \
/usr/share/licenses
install:
install -dm755 $(addprefix $(DESTDIR),$(DIRS))
for i in $(CLASSIC) $(RC) init stage2 stage2.tini stage3 poweroff reboot ; do \
sed -i 's,@BINDIR_EXECLINE@,$(BINDIR_EXECLINE),' $$i; \
done
for i in $(DATA) shutdown $(CLASSIC); do \
sed -i 's,@BINDIR@,$(BINDIR),' $$i; \
done
for i in $(CLASSIC); do \
install -Dm755 $$i $(DESTDIR)/etc/s6/$$i; \
done
for i in $(RC); do \
install -Dm644 $$i $(DESTDIR)/etc/s6/$$i; \
done
for i in $(FILESYSTEM); do \
install -Dm644 $$i $(DESTDIR)/etc/s6/$$i;\
done
for i in $(ENV); do \
install -m644 $$i $(DESTDIR)/etc/s6/$$i; \
done
rm $(DESTDIR)/etc/s6/classic/uncaught-logs/README
install -m755 data/scripts/s6.local $(DESTDIR)/etc/s6/data/scripts/s6.local
ln -sf /etc/s6/data/scripts/s6.local $(DESTDIR)/etc/s6.local
install -m755 data/scripts/master.sh $(DESTDIR)/etc/s6/data/scripts/master.sh
install -m755 data/scripts/modules.sh $(DESTDIR)/etc/s6/data/scripts/modules.sh
install -m755 data/scripts/tmpfiles.sh $(DESTDIR)/etc/s6/data/scripts/tmpfiles.sh
cp -P -a compiled/default $(DESTDIR)/etc/s6/compiled/default
ln -sf /etc/s6/compiled/default $(DESTDIR)/etc/s6/compiled/current
ln -sf /etc/s6/compiled/default $(DESTDIR)/etc/s6/compiled/previous
install -m755 init $(DESTDIR)/$(BINDIR)
for i in stage2 stage2.tini stage3 reboot shutdown poweroff; do \
install -m755 $$i $(DESTDIR)/etc/s6/$$i;\
done
ln -sf /etc/s6/poweroff $(DESTDIR)/$(BINDIR)
ln -sf /etc/s6/reboot $(DESTDIR)/$(BINDIR)
ln -sf /etc/s6/shutdown $(DESTDIR)/$(BINDIR)
install -m644 s6.conf $(DESTDIR)/etc/s6
ln -sf /etc/s6/s6.conf $(DESTDIR)/etc/s6.conf
install -m644 _s6-svc $(DESTDIR)/usr/share/zsh/site-functions
install -Dm644 LICENSE $(DESTDIR)/usr/share/licenses/$(PKGNAME)/LICENSE
version:
@echo $(VERSION)
.PHONY: install version

55
NEWS Normal file
View File

@@ -0,0 +1,55 @@
Changelog for s6-boot
In 0.2.0
--------
- Bugs fix
- Improve udevd and udevadm service
- Umount NFS4 system if exist on stage2.tini
In 0.1.9
--------
- Bugs fix
In 0.1.8
--------
- add data/scripts/modules.sh : the variable MODULES at s6.conf was
removed. Modules are now loaded by this file with the rofs-modules
oneshot service which run the scripts data/scripts/modules.sh. This
scripts read, parse and load modules founded in files
/usr/lib/modules-load.d, /run/modules-load.d, and /etc/modules-load.d
the last supersedes the previous one.
- fix bug at rwfs-ip6tables at the shutdown process
- add rwfs-tmpfiles services : the file founded at /usr/lib/tmpfiles.d
is now parsed and applied at boot time. Those files create sub-directories
at /run directories.
- fix rwfs-end oneshot service
In 0.1.7
--------
- Pass to ISC license
- S6opts is now a dependences of s6-boot
- Rename boot-serv directory to classic
- Rename boot-rc-serv directory to rc
- Rename base-env directory to env :
- rename DESTBOOTSERV to DEST
- rename DESTRCSERV to DESTRC : this variable point now to /run/boot/rc
- rename SRCBOOTSERV to SRC : this variable point now to /etc/s6/classic
- rename SRCRCCOMPILED to SRCRC
- remove SRCRCSERV
- add HANDLE : point to /etc/s6/data/scripts to find user.sh scripts
- add TEMPLATE : point to /usr/share/obarun/s6opts/template to find supervison tree creation scheme
- Modify files in classic/.s6-svscan to reflect the change into env/ directory
- Modify files init, stage2, stage2.tini, poweroff, shutdown, reboot to reflect the change into env/ directory
- Simplify stage2.tini : random-seed and hwclock command is now made by down file of respectively services
- Use *.conf files at _s6-svc to define path for completion
- Remove all-Switch bundle, switch-{user,svscan,ready} rc service and replace it by adduser service:
- the supervision tree for root user is now created by adduser service calling data/scripts/user.sh to do it
- Remove s6-serv directory (added to s6opts)
- Add data/scripts/user.sh scripts : This scripts allow to create a supervison tree whatever the user calling it.
The scripts source {s6opts,service}.conf to define path, name of the different elements of the supervision tree.
- Add Makefile
- Block tty1 service until boot procedure is not fully operational.

View File

@@ -1,3 +1,9 @@
# s6-boot # s6-boot
Boot files for s6
UNDER DEVELOPMENT, DO NOT USE FOR PRODUCTION Obarun boot files for s6
For instructions about [S6 supervision suite.](https://skarnet.org/software/)
[Bug reports](https://forum.obarun.org)

29
_s6-svc
View File

@@ -1,17 +1,36 @@
#compdef s6-svc #compdef s6-svc
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
# All rights reserved.
#
# This file is part of Obarun. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/Obarun/s6-boot/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
# completion for s6-svc # completion for s6-svc
# Eric Vidal <eric@obarun.org> # Change the path variable to suit your needs.
# services in /run/s6/service. Change the path variable to suit your needs.
path_dir=/run/s6/service first_word=${${(z)BUFFER}[1]}
#overwrite config with user specification
if [[ $first_word == "sudo" ]] || [[ $first_word == "su" ]] || [[ $EUID == 0 ]]; then
source /etc/obarun/s6opts.conf
else
source $(getent passwd $(whoami)|cut -d : -f 6)/service/service.conf
fi
path_dir_boot=/run/boot/service
path_dir_user=${LIVE_CLASSIC_PATH}
typeset -A opt_args typeset -A opt_args
_path() { _path() {
local list_dir local list_dir
list_dir=( $path_dir/* ) list_dir_boot=( $path_dir_boot/* )
compadd "$@" -a list_dir list_dir_user=( $path_dir_user/* )
compadd "$@" -a list_dir_boot list_dir_root list_dir_user
} }
_list_common=( _list_common=(

View File

@@ -0,0 +1,15 @@
#!@BINDIR_EXECLINE@/execlineb -P
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
# All rights reserved.
#
# This file is part of Obarun. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/Obarun/s6-boot/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
fdmove -c 2 1
s6-envdir -if /etc/s6/env
importas -i DEST DEST
foreground { /etc/s6/stage2.tini }
s6-svscanctl -h -- ${DEST}/service

View File

@@ -0,0 +1,15 @@
#!@BINDIR_EXECLINE@/execlineb -P
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
# All rights reserved.
#
# This file is part of Obarun. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/Obarun/s6-boot/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
fdmove -c 2 1
s6-envdir -if /etc/s6/env
importas -i DEST DEST
foreground { /etc/s6/stage2.tini }
s6-svscanctl -6 -- ${DEST}/service

View File

@@ -0,0 +1,15 @@
#!@BINDIR_EXECLINE@/execlineb -P
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
# All rights reserved.
#
# This file is part of Obarun. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/Obarun/s6-boot/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
fdmove -c 2 1
s6-envdir -if /etc/s6/env
importas -i DEST DEST
foreground { /etc/s6/stage2.tini }
s6-svscanctl -7 -- ${DEST}/service

View File

@@ -0,0 +1,15 @@
#!@BINDIR_EXECLINE@/execlineb -P
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
# All rights reserved.
#
# This file is part of Obarun. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/Obarun/s6-boot/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
fdmove -c 2 1
s6-envdir -if /etc/s6/env
importas -i DEST DEST
foreground { /etc/s6/stage2.tini }
s6-svscanctl -t -- ${DEST}/service

View File

@@ -0,0 +1,14 @@
#!@BINDIR_EXECLINE@/execlineb -P
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
# All rights reserved.
#
# This file is part of Obarun. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/Obarun/s6-boot/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
fdmove -c 2 1
s6-envdir -if /etc/s6/env
importas -i DEST DEST
s6-svscanctl -an -- ${DEST}/service

View File

@@ -0,0 +1,16 @@
#!@BINDIR_EXECLINE@/execlineb -P
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
# All rights reserved.
#
# This file is part of Obarun. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/Obarun/s6-boot/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
fdmove -c 2 1
s6-envdir -if /etc/s6/env
importas -i DEST DEST
foreground { /etc/s6/stage2.tini }
s6-svscanctl -0 -- ${DEST}/service

View File

@@ -0,0 +1,17 @@
#!@BINDIR_EXECLINE@/execlineb -P
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
# All rights reserved.
#
# This file is part of Obarun. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/Obarun/s6-boot/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
s6-envdir -if /etc/s6/env
importas -i DEST DEST
redirfd -r 0 /dev/console
redirfd -w 1 /dev/console
fdmove -c 2 1
foreground { s6-echo -- "s6-svscan at ${DEST}/service crashed. Dropping to an interactive shell." }
/bin/sh -i

View File

@@ -0,0 +1,19 @@
#!@BINDIR_EXECLINE@/execlineb -S0
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
# All rights reserved.
#
# This file is part of Obarun. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/Obarun/s6-boot/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
s6-envdir -if /etc/s6/env
importas -i DEST DEST
cd /
redirfd -w 2 /dev/console
fdmove -c 1 2
foreground { s6-svc -X -- ${DEST}/service/s6-svscan-log }
unexport ?
wait -r -- { }
/etc/s6/stage3 ${@}

View File

@@ -0,0 +1,16 @@
#!@BINDIR_EXECLINE@/execlineb -P
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
# All rights reserved.
#
# This file is part of Obarun. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/Obarun/s6-boot/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
importas -i DEST DEST
redirfd -w 2 /dev/console
fdmove -c 1 2
redirfd -rnb 0 fifo
s6-setuidgid s6log
s6-log -bp -- t ${DEST}/uncaught-logs

11
classic/service/tty2/run Executable file
View File

@@ -0,0 +1,11 @@
#!@BINDIR_EXECLINE@/execlineb -P
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
# All rights reserved.
#
# This file is part of Obarun. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/Obarun/s6-boot/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
/usr/bin/agetty --delay 02 -J 38400 tty6

View File

@@ -0,0 +1 @@
erase me

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,5 +1,15 @@
#!/usr/local/bin/execlineb -P #!/usr/local/bin/execlineb -P
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
# All rights reserved.
#
# This file is part of Obarun. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/Obarun/s6-boot/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
fdmove -c 2 1 fdmove -c 2 1
if { s6-echo -- udevd-udev longrun started }
exec -c exec -c
udevd udevd

View File

@@ -1,4 +0,0 @@
#!/usr/local/bin/execlineb -P
#fdmove -c 2 1
s6-devd
/usr/bin/udevadm settle

1
compiled/previous Symbolic link
View File

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

View File

@@ -1 +0,0 @@
put your special script here

114
data/scripts/master.sh Executable file
View File

@@ -0,0 +1,114 @@
#!@BINDIR@/bash
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
# All rights reserved.
#
# This file is part of Obarun. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/Obarun/s6-boot/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
exec 2>&1
exec 1>/var/log/master.log
log(){
printf "%s %s %s\n" "$(date +"%Y-%m-%d %H:%M:%S")" "${FUNCNAME[1]} ::" "${@}"
}
ENV="/etc/s6/env"
DEST=$(<${ENV}/DEST) #/run/boot
if ! source /etc/obarun/s6opts.conf; then
out_error "/etc/obarun/s6opts.conf not found, existing"
exit 1
else
SOURCE="/etc/obarun/s6opts.conf"
fi
GEN_NAME=$(<${ENV}/MASTER)
DEST_USER=$(<${ENV}/DEST)
LIVE_CLASSIC_PATH=${DEST_USER}/service
LIVE_RC_PATH=${DEST_USER}
LIST_SERV=$(ls ${CLASSIC_ENABLED})
add_env() {
local -a list_env=$(printenv)
local var value line list
log "mkdir ${DEST}/env"
mkdir -p -m 0755 ${DEST}/env
while read line;do
if [[ "${line:0:1}" == "#" ]] || [[ -z "${line}" ]];then
continue
fi
var=$(awk -F"=" '{print $1}' <<< "${line}")
value=${!var}
log "create new file ${var} with ${value} at ${DEST}/env/"
touch ${DEST}/env/"${var}"
echo "${value}" > ${DEST}/env/"${var}"
done < "${SOURCE}"
# need improvement
for list in ${list_env[@]};do
while read line;do
var=$(awk -F"=" '{print $1}' <<< "${line}")
value=${!var}
case "${var}" in
_|?|PWD|G_DEBUG) continue
;;
*)
log "create new file ${var} with ${value} at ${DEST}/env/"
touch ${DEST}/env/"${var}"
echo "${value}" > ${DEST}/env/"${var}"
;;
esac
done <<< "${list}"
done
for tidy_loop in GEN_NAME DEST_USER LIVE_CLASSIC_PATH LIVE_RC_PATH;do
var=${!tidy_loop}
log "create new file ${tidy_loop} with ${var} at ${DEST}/env"
touch ${DEST}/env/"${tidy_loop}"
echo "${var}" > ${DEST}/env/"${tidy_loop}"
done
unset list_env var value line list
}
# copy daemon enabled by USER
enabled_daemon() {
for serv in ${LIST_SERV[@]};do
log "enable daemon for ${serv}"
ln -sfT ${CLASSIC_ENABLED}/${serv} ${LIVE_CLASSIC_PATH}/${serv}
done
}
start_database() {
log "init s6-rc database with -l ${LIVE_RC_PATH}/${GEN_NAME} -c ${RC_DATABASE_COMPILED}/current ${LIVE_CLASSIC_PATH}"
s6-rc-init -l ${LIVE_RC_PATH}/${GEN_NAME} -c ${RC_DATABASE_COMPILED}/current -p ${GEN_NAME} ${LIVE_CLASSIC_PATH}
s6-rc -v 3 -l ${LIVE_RC_PATH}/${GEN_NAME} -u change All
}
start() {
#add_env || exit 1
enabled_daemon || exit 1
svscanctl -an "${LIVE_CLASSIC_PATH}" 2>/dev/null
start_database || exit 1
}
start

71
data/scripts/modules.sh Executable file
View File

@@ -0,0 +1,71 @@
#!@BINDIR@/bash
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
# All rights reserved.
#
# This file is part of Obarun. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/Obarun/s6-boot/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
# Configuration files are read from directories in
# /usr/lib/modules-load.d, /run/modules-load.d, and /etc/modules-load.d,
# in order of precedence
MODULES_PATH=( "/etc/modules-load.d" "/run/modules-load.d" "/usr/lib/modules-load.d" )
MODULES_NAME=""
MODULES_RESULT=""
check_elements(){
for e in "${@:2}"; do [[ $e == $1 ]] && return 0; done; return 1;
}
check_file(){
local tidy_loop conf
for tidy_loop in ${MODULES_PATH[@]}; do
if [[ -d "${tidy_loop}" ]]; then
for conf in "${tidy_loop}"/*.conf ; do
check_elements ${conf##*/} ${MODULES_NAME[@]}
if (( $? )); then
MODULES_NAME+=("${conf##*/}")
fi
done
fi
done
unset tidy_loop conf
}
check_path(){
local path tidy_loop
for path in ${MODULES_PATH[@]}; do
for tidy_loop in ${MODULES_NAME[@]}; do
if [[ -f "${path}/${tidy_loop}" ]]; then
check_elements "${tidy_loop}" ${MODULES_RESULT[@]##*/}
if (( $? ));then
MODULES_RESULT+=("${path}/${tidy_loop}")
fi
fi
done
done
}
check_file
if [[ -n ${MODULES_NAME[@]} ]]; then
check_path
else
echo "rofs-modules :: Nothing to do"
exit 0
fi
for mod in ${MODULES_RESULT[@]}; do
while read line; do
if [[ "${line:0:1}" == "#" ]] || [[ -z "${line}" ]];then
continue
fi
for check in ${line};do
modprobe -b "${check}" -v | sed 's:insmod [^ ]*/:Load modules :g; s:\.ko\(\.gz\)\? ::g'
done
done < "${mod}"
done
exit 0

14
data/scripts/s6.local Executable file
View File

@@ -0,0 +1,14 @@
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
# All rights reserved.
#
# This file is part of Obarun. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/Obarun/s6-boot/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
#
# Default s6.local for obarun; add your custom commands here.
#
# This is run by s6 before the user services are executed.
# This file is declared as oneshot service on s6, do not try to launch any daemon with this file.
# Do not forget to define your environment by a shebang.

411
data/scripts/tmpfiles.sh Executable file
View File

@@ -0,0 +1,411 @@
#!@BINDIR@/sh
# This is a reimplementation of the systemd tmpfiles.d code
# Control creation, deletion, and cleaning of volatile and temporary files
#
# Copyright (c) 2012 Gentoo Foundation
# Released under the 2-clause BSD license.
#
# This instance is a pure-POSIX sh version, written by Robin H Johnson
# <robbat2@gentoo.org>, based on the Arch Linux version as of 2012/01/01:
# http://projects.archlinux.org/initscripts.git/tree/arch-tmpfiles
#
# See the tmpfiles.d manpage as well:
# http://0pointer.de/public/systemd-man/tmpfiles.d.html
# This script should match the manpage as of 2012/03/12
#
# This file was modified by Eric Vidal <eric@obarun.org> for Obarun
DRYRUN=0
checkprefix() {
n=$1
shift
for x in $@; do
case $n in
${x}*) return 0 ;;
esac
done
return 1
}
warninvalid() {
printf "tmpfiles: ignoring invalid entry on line %d of \`%s'\n" "$LINENUM" "$FILE"
error=$(( error+1 ))
} >&2
dryrun_or_real() {
local dryrun=
[ $DRYRUN -eq 1 ] && dryrun=echo
$dryrun "$@"
}
relabel() {
local path
local paths=$1 mode=$2 uid=$3 gid=$4
for path in ${paths}; do
if [ -e "$path" ]; then
[ -x /sbin/restorecon ] && dryrun_or_real restorecon $CHOPTS "$path"
[ $uid != '-' ] && dryrun_or_real chown $CHOPTS "$uid" "$path"
[ $gid != '-' ] && dryrun_or_real chgrp $CHOPTS "$gid" "$path"
[ $mode != '-' ] && dryrun_or_real chmod $CHOPTS "$mode" "$path"
fi
done
}
splitpath() {
local path=$1
while [ -n "$path" ]; do
echo $path
path=${path%/*}
done
}
_restorecon() {
local path=$1
if [ -x /sbin/restorecon ]; then
dryrun_or_real restorecon -F $(splitpath "$path")
fi
}
_b() {
# Create a block device node if it doesn't exist yet
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
if [ ! -e "$path" ]; then
dryrun_or_real mknod -m $mode $path b ${arg%:*} ${arg#*:}
_restorecon "$path"
dryrun_or_real chown $uid:$gid $path
fi
}
_c() {
# Create a character device node if it doesn't exist yet
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
if [ ! -e "$path" ]; then
dryrun_or_real mknod -m $mode $path c ${arg%:*} ${arg#*:}
_restorecon "$path"
dryrun_or_real chown $uid:$gid $path
fi
}
_C() {
# recursively copy a file or directory
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
if [ ! -e "$path" ]; then
dryrun_or_real cp -r "$arg" "$path"
_restorecon "$path"
[ $uid != '-' ] && dryrun_or_real chown "$uid" "$path"
[ $gid != '-' ] && dryrun_or_real chgrp "$gid" "$path"
[ $mode != '-' ] && dryrun_or_real chmod "$mode" "$path"
fi
}
_f() {
# Create a file if it doesn't exist yet
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
[ $CREATE -gt 0 ] || return 0
if [ ! -e "$path" ]; then
#dryrun_or_real $CHECKPATH -fq -m "$mode" -o "$uid:$gid" "$path"
dryrun_or_real touch "$path"
dryrun_or_real chmod "$mode" "$path"
dryrun_or_real chown "$uid:$gid" "$path"
[ -z "$arg" ] || _w "$@"
fi
}
_F() {
# Create or truncate a file
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
[ $CREATE -gt 0 ] || return 0
if [ -e "$path" ]; then
[ -z "$arg" ] || _w "$@"
else
#dryrun_or_real $CHECKPATH -Fq -m "$mode" -o "$uid:$gid" "$path"
dryrun_or_real touch "$path"
dryrun_or_real chmod "$mode" "$path"
dryrun_or_real chown "$uid:$gid" "$path"
[ -z "$arg" ] || _w "$@"
fi
}
_d() {
# Create a directory if it doesn't exist yet
local path=$1 mode=$2 uid=$3 gid=$4
[ $CREATE -gt 0 ] || return 0
if [ ! -d "$path" ]; then
dryrun_or_real mkdir -p "$path" 2>/dev/null
_restorecon "$path"
#dryrun_or_real $CHECKPATH -dq -m "$mode" -o "$uid:$gid" "$path"
dryrun_or_real chmod "$mode" "$path"
dryrun_or_real chown "$uid:$gid" "$path"
fi
}
_D() {
# Create or empty a directory
local path=$1 mode=$2 uid=$3 gid=$4
if [ -d "$path" ] && [ $REMOVE -gt 0 ]; then
dryrun_or_real find "$path" -mindepth 1 -maxdepth 1 -xdev -exec rm -rf {} +
_restorecon "$path"
fi
if [ $CREATE -gt 0 ]; then
dryrun_or_real mkdir -p "$path" 2>/dev/null
_restorecon "$path"
#dryrun_or_real $CHECKPATH -Dq -m "$mode" -o "$uid:$gid" "$path"
dryrun_or_real chmod "$mode" "$path"
dryrun_or_real chown "$uid:$gid" "$path"
fi
}
_v() {
# Create a subvolume if the path does not exist yet and the file system
# supports this (btrfs). Otherwise create a normal directory.
# TODO: Implement btrfs subvol creation.
_d "$@"
}
_L() {
# Create a symlink if it doesn't exist yet
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
[ ! -e "$path" ] && dryrun_or_real ln -s "$arg" "$path"
_restorecon "$path"
}
_p() {
# Create a named pipe (FIFO) if it doesn't exist yet
local path=$1 mode=$2 uid=$3 gid=$4
[ $CREATE -gt 0 ] || return 0
if [ ! -p "$path" ]; then
#dryrun_or_real $CHECKPATH -pq -m $mode -o "$uid:$gid" "$path"
dryrun_or_real mkfifo -m "$mode" "$path"
dryrun_or_real chown "$uid:$gid" "$path"
fi
}
_x() {
# Ignore a path during cleaning. Use this type to exclude paths from clean-up as
# controlled with the Age parameter. Note that lines of this type do not
# influence the effect of r or R lines. Lines of this type accept shell-style
# globs in place of of normal path names.
:
# XXX: we don't implement this
}
_X() {
# Ignore a path during cleanup. Use this type to prevent path
# removal as controled with the age parameter. Note that if path is
# a directory, the content of the directory is not excluded from
# clean-up, only the directory itself.
# Lines of this type accept shell-style globs in place of normal path names.
:
# XXX: we don't implement this
}
_r() {
# Remove a file or directory if it exists. This may not be used to remove
# non-empty directories, use R for that. Lines of this type accept shell-style
# globs in place of normal path names.
local path
local paths=$1
[ $REMOVE -gt 0 ] || return 0
for path in ${paths}; do
if [ -f "$path" ]; then
dryrun_or_real rm -f "$path"
elif [ -d "$path" ]; then
dryrun_or_real rmdir "$path"
fi
done
}
_R() {
# Recursively remove a path and all its subdirectories (if it is a directory).
# Lines of this type accept shell-style globs in place of normal path names.
local path
local paths=$1
[ $REMOVE -gt 0 ] || return 0
for path in ${paths}; do
[ -d "$path" ] && dryrun_or_real rm -rf --one-file-system "$path"
done
}
_w() {
# Write the argument parameter to a file, if it exists.
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
if [ -f "$path" ]; then
if [ $DRYRUN -eq 1 ]; then
echo "echo \"$arg\" >>\"$path\""
else
echo "$arg" >>"$path"
fi
fi
}
_z() {
# Set ownership, access mode and relabel security context of a file or
# directory if it exists. Lines of this type accept shell-style globs in
# place of normal path names.
[ $CREATE -gt 0 ] || return 0
relabel "$@"
}
_Z() {
# Recursively set ownership, access mode and relabel security context of a
# path and all its subdirectories (if it is a directory). Lines of this type
# accept shell-style globs in place of normal path names.
[ $CREATE -gt 0 ] || return 0
CHOPTS=-R relabel "$@"
}
BOOT=0 CREATE=0 REMOVE=0 CLEAN=0 VERBOSE=0 DRYRUN=0 error=0 LINENO=0
EXCLUDE=
PREFIX=
FILE=
fragments=
# XXX: The harcoding of /usr/lib/ is an explicit choice by upstream
tmpfiles_dirs='/usr/lib/tmpfiles.d/ /run/tmpfiles.d/ /etc/tmpfiles.d/'
tmpfiles_basenames=''
tmpfiles_d=''
# Build a list of sorted unique basenames
# directories declared later in the tmpfiles_d array will override earlier
# directories, on a per file basename basis.
# `/etc/tmpfiles.d/foo.conf' supersedes `/usr/lib/tmpfiles.d/foo.conf'.
# `/run/tmpfiles/foo.conf' will always be read after `/etc/tmpfiles.d/bar.conf'
for d in ${tmpfiles_dirs} ; do
[ -d $d ] && for f in ${d}/*.conf ; do
case "${f##*/}" in
systemd.conf|systemd-*.conf) continue;;
esac
[ -f $f ] && tmpfiles_basenames="${tmpfiles_basenames}\n${f##*/}"
done # for f in ${d}
done # for d in ${tmpfiles_dirs}
tmpfiles_basenames="$(printf "${tmpfiles_basenames}\n" | sort -u )"
for b in $tmpfiles_basenames ; do
real_f=''
for d in $tmpfiles_dirs ; do
f=${d}/${b}
[ -f "${f}" ] && real_f=$f
done
[ -f "${real_f}" ] && tmpfiles_d="${tmpfiles_d} ${real_f}"
done
while [ $# -gt 0 ]; do
case $1 in
--boot) BOOT=1 ;;
--create) CREATE=1 ;;
--remove) REMOVE=1 ;;
--clean) CLEAN=1 ;; # TODO: Not implemented
--verbose) VERBOSE=1 ;;
--dryrun|--dry-run) DRYRUN=1 ;;
--exclude-prefix=*) EXCLUDE="${EXCLUDE}${1##--exclude-prefix=} " ;;
--prefix=*) PREFIX="${PREFIX}${1##--prefix=} " ;;
esac
shift
done
if [ $(( CLEAN )) -eq 1 ] ; then
printf '%s clean mode is not implemented\n' "${0##*/}"
exit 1
fi
if [ "$CREATE$REMOVE" = '00' ]; then
printf 'usage: %s [--exclude-prefix=path] [--prefix=path] [--boot] [--create] [--remove] [--clean] [--verbose] [--dry-run]\n' "${0##*/}"
exit 1
fi
error=0
# loop through the gathered fragments, sorted globally by filename.
# `/run/tmpfiles/foo.conf' will always be read after `/etc/tmpfiles.d/bar.conf'
for FILE in $tmpfiles_d ; do
LINENUM=0
### FILE FORMAT ###
# XXX: We ignore the 'Age' parameter
# 1 2 3 4 5 6 7
# Cmd Path Mode UID GID Age Argument
# d /run/user 0755 root root 10d -
# Mode, UID, GID, Age, Argument may be omitted!
# If Cmd ends with !, the line is only processed if --boot is passed
# XXX: Upstream says whitespace is NOT permitted in the Path argument.
# But IS allowed when globs are expanded for the x/r/R/z/Z types.
while read cmd path mode uid gid age arg; do
LINENUM=$(( LINENUM+1 ))
FORCE=0
# Unless we have both command and path, skip this line.
if [ -z "$cmd" -o -z "$path" ]; then
continue
fi
case $cmd in
\#*) continue ;;
esac
while [ ${#cmd} -gt 1 ]; do
case $cmd in
*!) cmd=${cmd%!}; [ "$BOOT" -eq "1" ] || continue 2 ;;
*+) cmd=${cmd%+}; FORCE=1; ;;
*) warninvalid ; continue 2 ;;
esac
done
# whine about invalid entries
case $cmd in
f|F|w|d|D|v|p|L|c|C|b|x|X|r|R|z|Z) ;;
*) warninvalid ; continue ;;
esac
# fall back on defaults when parameters are passed as '-'
if [ "$mode" = '-' -o "$mode" = '' ]; then
case "$cmd" in
p|f|F) mode=0644 ;;
d|D|v) mode=0755 ;;
C|z|Z|x|r|R|L) ;;
esac
fi
[ "$uid" = '-' -o "$uid" = '' ] && uid=0
[ "$gid" = '-' -o "$gid" = '' ] && gid=0
[ "$age" = '-' -o "$age" = '' ] && age=0
[ "$arg" = '-' -o "$arg" = '' ] && arg=''
set -- "$path" "$mode" "$uid" "$gid" "$age" "$arg"
[ -n "$EXCLUDE" ] && checkprefix $path $EXCLUDE && continue
[ -n "$PREFIX" ] && ! checkprefix $path $PREFIX && continue
if [ $FORCE -gt 0 ]; then
case $cmd in
p|L|c|b) [ -f "$path" ] && dryrun_or_real rm -f "$path"
esac
fi
[ "$VERBOSE" -eq "1" ] && echo _$cmd "$@"
_$cmd "$@"
rc=$?
if [ "${DRYRUN}" -eq "0" ]; then
[ $rc -ne 0 ] && error=$((error + 1))
fi
done <$FILE
done
exit $error
# vim: set ts=2 sw=2 sts=2 noet ft=sh:

1
env/DEST vendored Normal file
View File

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

1
env/DESTRC vendored Normal file
View File

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

1
env/HANDLE vendored Normal file
View File

@@ -0,0 +1 @@
/etc/s6/data/scripts

1
env/MASTER vendored Normal file
View File

@@ -0,0 +1 @@
master-

1
env/S6CONF vendored Normal file
View File

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

1
env/SRC vendored Normal file
View File

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

1
env/SRCRC vendored Normal file
View File

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

1
env/TEMPLATE vendored Normal file
View File

@@ -0,0 +1 @@
/usr/share/obarun/s6opts/template

1
env/s6-conf vendored
View File

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

1
env/svc-serv vendored
View File

@@ -1 +0,0 @@
/etc/s6/svc-serv

94
init
View File

@@ -1,88 +1,50 @@
#!/usr/local/bin/execlineb -P #!@BINDIR_EXECLINE@/execlineb -P
# Copyright (C) 2015-2016 Eric Vidal <eric@obarun.org> # Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
# # All rights reserved.
# 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 # This file is part of Obarun. It is subject to the license terms in
# FOR A PARTICULAR PURPOSE. # the LICENSE file found in the top-level directory of this
# # distribution and at https://github.com/Obarun/s6-boot/LICENSE
# This scripts is under License Beerware. # This file may not be copied, modified, propagated, or distributed
# # except according to the terms contained in the LICENSE file.
# "THE BEERWARE LICENSE" (Revision 42):
# <eric@obarun.org> wrote this file. As long as you retain this notice you
# 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
# Export good path # Export good path
/usr/local/bin/export PATH "/usr/local/bin:/usr/bin" /usr/bin/s6-envdir -if /etc/s6/env
@BINDIR_EXECLINE@/importas -i PATH PATH
cd / @BINDIR_EXECLINE@/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
import -ui 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
import -i HOSTNAME
s6-hostname ${HOSTNAME}
}
# Clean environment
emptyenv -p
s6-envdir -if /etc/s6/env
@BINDIR_EXECLINE@/cd /
# Be clean and safe # Be clean and safe
emptyenv -p
s6-setsid -qb -- s6-setsid -qb --
umask 022 umask 022
if { foreground {
if { s6-echo -- "***************************************************************************" } if { s6-echo -- "***************************************************************************" }
if { s6-echo -- "** Booting Obarun under S6 **" } if { s6-echo -- "** Booting Obarun with S6 **" }
if { s6-echo -- "** Warning: Under development **" } if { s6-echo -- "** https://obarun.org/ **" }
if { s6-echo -- "** http://obarun.org/forum/ **" }
s6-echo -- "***************************************************************************" s6-echo -- "***************************************************************************"
} }
# Copy service for pid1 in the right place # Copy service for pid1 at the right place
import -i svc-serv s6-envdir -if /etc/s6/env
importas -i SRC SRC
importas -i DEST DEST
foreground { foreground {
if { cp -a ${svc-serv} /run/s6 } s6-hiercopy ${SRC} ${DEST}
}
# Create symlink to /run/s6-run
if {
forbacktickx -p -0 i { s6-ls -0 /run/s6 }
import -u i
foreground
{
if { s6-mkdir -p -m 0755 /run/s6-run/ }
s6-ln -s -- /run/s6/${i} /run/s6-run/
}
} }
redirfd -r 0 /dev/null redirfd -r 0 /dev/null
redirfd -wnb 1 /run/s6-run/service/s6-svscan-log/fifo redirfd -wnb 1 ${DEST}/service/s6-svscan-log/fifo
fdmove -c 2 1
# 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/s6-run/service/s6-svscan-log/fifo redirfd -w 1 ${DEST}/service/s6-svscan-log/fifo
fdmove -c 2 1 /etc/s6/stage2
/etc/stage2
} }
unexport ! unexport !
fdmove -c 2 1 s6-svscan -st0 ${DEST}/service
s6-envdir -I /run/s6-run/service/.s6-svscan/
s6-svscan -st0 /run/s6-run/service

View File

@@ -1,3 +1,13 @@
#!/bin/bash #!@BINDIR_EXECLINE@/execlineb -P
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
# All rights reserved.
#
# This file is part of Obarun. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/Obarun/s6-boot/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
exec /run/s6-run/service/.s6-svscan/SIGUSR2 s6-envdir -if /etc/s6/env
importas -i DEST DEST
exec -c ${DEST}/service/.s6-svscan/SIGQUIT

View File

@@ -1,46 +0,0 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
s6-envdir /etc/s6/env/s6-conf
# mount proc sys dev run if doesn't exist
#import -i HOSTNAME
#if { s6-hostname $HOSTNAME }
foreground {
forx -p first { proc sys dev run }
import -ui 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
s6-mount -o $options -t $fstype $device $mountpoint
}
}
# create needed directory on run if doesn't exist
if {
forx -p second { lvm user lock }
import -ui second
foreground {
if -n { s6-test -d /run/$second }
s6-mkdir -p -m 0755 /run/$second
}
}
# finaly mount /dev/shm /dev/pts
forx -p third { shm pts }
import -ui 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
s6-mount -o $options -n -t $fstype $device $mountpoint
}
}

View File

@@ -1,2 +0,0 @@
all-Boot
all-User

View File

@@ -1,11 +0,0 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
s6-envdir /etc/s6/env/s6-conf
import -D "" USEBTRFS
foreground {
if { s6-test $USEBTRFS = yes }
if { s6-test -x /usr/bin/btrfs }
btrfs device scan
}
true

View File

@@ -1,11 +0,0 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
s6-envdir /etc/s6/env/s6-conf
import -D "" USEDMRAID
foreground {
if { s6-test $USEDMRAID = yes }
if { s6-test -x /usr/bin/dmraid }
dmraid -i -ay
}
true

View File

@@ -1,3 +0,0 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
fsck -A -T -a

View File

@@ -1,14 +0,0 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
foreground {
redirfd -r 0 /proc/cgroups
pipeline { s6-tail -n +2 }
pipeline { s6-cut -d"\t" -f1 }
pipeline { s6-grep -vF -- devices }
forstdin -d"\n" -- i
import -u i
if { mountpoint -q /sys/fs/cgroup/${i} }
umount -R /sys/fs/cgroup/${i}
}
umount /sys/fs/cgroup

View File

@@ -1,19 +0,0 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
s6-envdir /etc/s6/env/s6-conf
import -D "" CGROUPS
foreground {
if { s6-test $CGROUPS = yes }
if { mkdir -p -m 0755 /sys/fs/cgroup }
if { s6-mount -wt tmpfs cgroup /sys/fs/cgroup }
redirfd -r 0 /proc/cgroups
pipeline { s6-tail -n +2 }
pipeline { s6-cut -d"\t" -f1 }
pipeline { s6-grep -vF -- devices }
forstdin -d"\n" -- i
import -u i
if { s6-mkdir /sys/fs/cgroup/${i} }
s6-mount -t cgroup -o ${i} -- cgroup /sys/fs/cgroup/${i}
}
true

View File

@@ -1,14 +0,0 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
s6-envdir /etc/s6/env/s6-conf
import -D "" KEYMAP
import -D "" FONT
import -D "" FONT_MAP
import -D "" FONT_UNIMAP
foreground {
loadkeys -q -u $KEYMAP
}
forx index { 0 1 2 3 4 5 6 7 8 9 10 }
import -u index
setfont -m $FONT_MAP -u $FONT_UNIMAP $FONT -C /dev/tty${index}

View File

@@ -1 +0,0 @@

View File

@@ -1,11 +0,0 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
s6-envdir /etc/s6/env/s6-conf
import -D "" TZ
import -D "" HARDWARECLOCK
pipeline -d { echo $HARDWARECLOCK }
pipeline { tr A-Z a-z }
forstdin -- clock
import -iu clock
hwclock --systz --${clock} --noadjfile

View File

@@ -1,10 +0,0 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
pipeline -d { kmod static-nodes }
pipeline { s6-grep -F -- Module: }
pipeline { s6-cut -d":" -f2 }
pipeline { s6-cut -d" " -f2 }
forstdin -d"\n" -- mod
import -iu mod
modprobe $mod

View File

@@ -1,12 +0,0 @@
#!/usr/bin/execlineb -P
fdmove -c 2 1
s6-envdir /etc/s6/env/s6-conf
import -D "" KERNELRUNTIME
foreground {
if { s6-test $KERNELRUNTIME = yes }
if { s6-test -x /usr/bin/sysctl }
if { s6-test -e /etc/sysctl.conf }
sysctl -p /etc/sysctl.conf
}
true

View File

@@ -1,4 +0,0 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
ip link set up dev lo

View File

@@ -1,14 +0,0 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
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
foreground {
if { s6-test -n $mods }
modprobe -ab $mods
}
}
true

View File

@@ -1,4 +0,0 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
swapoff -a

View File

@@ -1,10 +0,0 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
s6-envdir /etc/s6/env/s6-conf
import -D "" USESWAP
foreground {
if { s6-test $USESWAP = yes }
swapon -a
}
true

View File

@@ -1,11 +0,0 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
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 }
install -dm1777 /tmp/.X11-unix /tmp/.ICE-unix

View File

@@ -1,5 +0,0 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
redirfd -w 1 /var/log/dmesg.log
dmesg

View File

@@ -1,3 +0,0 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
s6-mount -o remount,rw / /

View File

@@ -1,6 +0,0 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
s6-envdir /etc/s6/env/s6-conf
import -D "" TZ
s6-ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime

View File

@@ -1,4 +0,0 @@
#!/usr/bin/execlineb -P
fdmove -c 2 1
mount -a -t "nosysfs,nonfs,nonfs4,nosmbfs,nocifs" -O no_netdev

View File

@@ -1,23 +0,0 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
foreground {
cp /var/lib/random-seed /dev/urandom
}
backtick -n bytes { cat /proc/sys/kernel/random/poolsize }
import -u 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
}
umask 077
redirfd -w 1 /dev/null
dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=$bytes

View File

@@ -1,5 +0,0 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
exec -c
udevd

View File

@@ -1,2 +0,0 @@
udevd-udev
udevd-udevrules

View File

@@ -1,4 +0,0 @@
#!/usr/local/bin/execlineb -P
#fdmove -c 2 1
s6-devd
/usr/bin/udevadm settle

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1,6 +0,0 @@
#!/usr/local/bin/execlineb -P
fdmove -c 2 1
foreground {
if { udevadm trigger --action=add --type=subsystems }
udevadm trigger --action=add --type=devices
}

94
rc/00/up Normal file
View File

@@ -0,0 +1,94 @@
#!@BINDIR_EXECLINE@/execlineb -P
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
# All rights reserved.
#
# This file is part of Obarun. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/Obarun/s6-boot/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
fdmove -c 2 1
if { s6-echo -- 00 started }
foreground {
if { s6-echo -- Mounting filesystem }
# mount proc sys dev run if doesn't exist
foreground {
forx -p first { proc sys dev run }
importas -ui -D "" first first
foreground {
if -n { mountpoint -q /$first }
s6-envdir /etc/s6/filesystem-env/$first
importas -ui fstype fstype
importas -ui device device
importas -ui mountpoint mountpoint
importas -ui options options
s6-mount -o $options -t $fstype $device $mountpoint
}
}
# create needed directory on run if doesn't exist
if {
forx -p second { lvm user lock }
importas -ui second second
foreground {
if -n { s6-test -d /run/$second }
s6-mkdir -p -m 0755 /run/$second
}
}
# finaly mount /dev/shm /dev/pts
if {
forx -p third { shm pts }
importas -ui third third
if {
foreground {
if -n { mountpoint -q /dev/$third }
if { s6-mkdir -p -m 0755 /dev/$third }
s6-envdir /etc/s6/filesystem-env/$third
importas -ui fstype fstype
importas -ui device device
importas -ui mountpoint mountpoint
importas -ui options options
s6-mount -o $options -n -t $fstype $device $mountpoint
}
}
}
s6-echo -- filesystem was mounted successfully
}
# parse s6.conf before loading environment
foreground {
if { s6-echo -- Parsing s6-conf }
importas -i S6CONF S6CONF
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 ${S6CONF}/ }
redirfd -w 1 ${S6CONF}/$var
s6-echo -- $value
}
}
s6-echo -- s6-conf was parsed successfully
}
# load hostname for earlier tty
foreground {
if { s6-echo -- Define hostname }
importas -i S6CONF S6CONF
s6-envdir ${S6CONF}
importas -i HOSTNAME HOSTNAME
s6-hostname ${HOSTNAME}
}
s6-echo -- 00 successfully started

4
rc/All/contents Normal file
View File

@@ -0,0 +1,4 @@
00
all-Boot
adduser
tty

Some files were not shown because too many files have changed in this diff Show More