Compare commits
29 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ae2e097a6b | ||
![]() |
77057205d7 | ||
![]() |
4d67a11ce9 | ||
![]() |
a66aea9840 | ||
![]() |
6712d7bef0 | ||
![]() |
731f9414f1 | ||
![]() |
e02c2138db | ||
![]() |
1f6ec5f2f2 | ||
![]() |
2632e962ea | ||
![]() |
c09e70e9e2 | ||
![]() |
d628070a7a | ||
![]() |
ad09fc9981 | ||
![]() |
20d43abe7f | ||
![]() |
fea3b2675c | ||
![]() |
2dfb3ac0ad | ||
![]() |
fb924ced4f | ||
![]() |
7008745393 | ||
![]() |
5a93f2ca81 | ||
![]() |
3cd9f46117 | ||
![]() |
f88b0f4eac | ||
![]() |
1c6c1ff259 | ||
![]() |
f5217e18ef | ||
![]() |
051dacc843 | ||
![]() |
d3ec2f001e | ||
![]() |
0594295927 | ||
![]() |
95e074768e | ||
![]() |
dbc7e4d1af | ||
![]() |
4e1e004af7 | ||
![]() |
53bc1c3f84 |
2
LICENSE
2
LICENSE
@@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
4
Makefile
4
Makefile
@@ -1,6 +1,6 @@
|
|||||||
# Makefile for s6-boot
|
# Makefile for s6-boot
|
||||||
|
|
||||||
VERSION = $(git describe --tags| sed 's/-.*//g;s/^v//;')
|
VERSION = $$(git describe --tags| sed 's/-.*//g;s/^v//;')
|
||||||
PKGNAME = s6-boot
|
PKGNAME = s6-boot
|
||||||
|
|
||||||
BINDIR_EXECLINE = /usr/local/bin
|
BINDIR_EXECLINE = /usr/local/bin
|
||||||
@@ -56,7 +56,7 @@ install:
|
|||||||
|
|
||||||
install -m755 data/scripts/s6.local $(DESTDIR)/etc/s6/data/scripts/s6.local
|
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
|
ln -sf /etc/s6/data/scripts/s6.local $(DESTDIR)/etc/s6.local
|
||||||
install -m755 data/scripts/user.sh $(DESTDIR)/etc/s6/data/scripts/user.sh
|
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/modules.sh $(DESTDIR)/etc/s6/data/scripts/modules.sh
|
||||||
install -m755 data/scripts/tmpfiles.sh $(DESTDIR)/etc/s6/data/scripts/tmpfiles.sh
|
install -m755 data/scripts/tmpfiles.sh $(DESTDIR)/etc/s6/data/scripts/tmpfiles.sh
|
||||||
|
|
||||||
|
23
NEWS
23
NEWS
@@ -1,18 +1,31 @@
|
|||||||
Changelog for s6-boot
|
Changelog for s6-boot
|
||||||
|
|
||||||
In 0.1.8
|
In 0.2.0
|
||||||
|
--------
|
||||||
|
|
||||||
-- add data/scripts/modules.sh : the variable MODULES at s6.conf was
|
- 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
|
removed. Modules are now loaded by this file with the rofs-modules
|
||||||
oneshot service which run the scripts data/scripts/modules.sh. This
|
oneshot service which run the scripts data/scripts/modules.sh. This
|
||||||
scripts read, parse and load modules founded in files
|
scripts read, parse and load modules founded in files
|
||||||
/usr/lib/modules-load.d, /run/modules-load.d, and /etc/modules-load.d
|
/usr/lib/modules-load.d, /run/modules-load.d, and /etc/modules-load.d
|
||||||
the last supersedes the previous one.
|
the last supersedes the previous one.
|
||||||
-- fix bug at rwfs-ip6tables at the shutdown process
|
- fix bug at rwfs-ip6tables at the shutdown process
|
||||||
-- add rwfs-tmpfiles services : the file founded at /usr/lib/tmpfiles.d
|
- 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
|
is now parsed and applied at boot time. Those files create sub-directories
|
||||||
at /run directories.
|
at /run directories.
|
||||||
-- fix rwfs-end oneshot service
|
- fix rwfs-end oneshot service
|
||||||
|
|
||||||
In 0.1.7
|
In 0.1.7
|
||||||
--------
|
--------
|
||||||
|
2
_s6-svc
2
_s6-svc
@@ -1,5 +1,5 @@
|
|||||||
#compdef s6-svc
|
#compdef s6-svc
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -S0
|
#!@BINDIR_EXECLINE@/execlineb -S0
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,14 +0,0 @@
|
|||||||
#!@BINDIR@/bash
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
source /etc/obarun/s6opts.conf
|
|
||||||
if s6-svok ${LIVE_CLASSIC_PATH}/s6rc-fdholder; then
|
|
||||||
exec -c /usr/bin/agetty -J 38400 tty1
|
|
||||||
fi
|
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
@@ -8,4 +8,4 @@
|
|||||||
# This file may not be copied, modified, propagated, or distributed
|
# This file may not be copied, modified, propagated, or distributed
|
||||||
# except according to the terms contained in the LICENSE file.
|
# except according to the terms contained in the LICENSE file.
|
||||||
|
|
||||||
/usr/bin/agetty --delay 02 -J 38400 tty2
|
/usr/bin/agetty --delay 02 -J 38400 tty6
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/local/bin/execlineb -P
|
#!/usr/local/bin/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,14 +0,0 @@
|
|||||||
#!/usr/local/bin/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 -- udevd-udevadm started }
|
|
||||||
s6-devd
|
|
||||||
/usr/bin/udevadm settle
|
|
114
data/scripts/master.sh
Executable file
114
data/scripts/master.sh
Executable 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
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR@/bash
|
#!@BINDIR@/bash
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,254 +0,0 @@
|
|||||||
#!@BINDIR@/bash
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
exec 2>&1
|
|
||||||
exec 1>>/var/log/user.log
|
|
||||||
|
|
||||||
log(){
|
|
||||||
printf "%s %s %s\n" "$(date +"%Y-%m-%d %H:%M:%S")" "${FUNCNAME[1]} ::" "${@}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# ${1} user name
|
|
||||||
# ${2} action to do, add or del
|
|
||||||
|
|
||||||
if [[ -z "${1}" ]] || [[ -z "${2}" ]];then
|
|
||||||
log "handle-user :: Missing arguments, existing"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [[ "${1}" == "root" ]]; then
|
|
||||||
log "root user, nothing to do, exiting 0"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
ENV="/etc/s6/env"
|
|
||||||
DEST=$(head -n1 ${ENV}/DEST) #/run/boot
|
|
||||||
TEMPLATE=$(head -n1 ${ENV}/TEMPLATE) #/usr/share/obarun/s6opts/template
|
|
||||||
SOURCE=""
|
|
||||||
|
|
||||||
USER="${1}"
|
|
||||||
# special case here, adduser scipts call
|
|
||||||
# user.sh with boot as user, but this user
|
|
||||||
# doesn't exist, wrap the uid,gid to root
|
|
||||||
if [[ "${USER}" == "boot" ]]; then
|
|
||||||
_UID=$(id -u 0)
|
|
||||||
_GID=$(id -g 0)
|
|
||||||
else
|
|
||||||
_UID=$(id -u ${USER})
|
|
||||||
_GID=$(id -g ${USER})
|
|
||||||
fi
|
|
||||||
|
|
||||||
# overwrite conf if connected with user
|
|
||||||
if ! (( "${_UID}" == 0 )); then
|
|
||||||
if ! source $(getent passwd ${USER}|cut -d : -f 6)/service/service.conf 2>/dev/null; then
|
|
||||||
out_error "$(getent passwd ${USER}|cut -d : -f 6)/service/service.conf doesn't exist"
|
|
||||||
out_error "Use s6opts user command first"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
SOURCE="$(getent passwd ${USER}|cut -d : -f 6)/service/service.conf"
|
|
||||||
fi
|
|
||||||
elif ! source /etc/obarun/s6opts.conf; then
|
|
||||||
out_error "/etc/obarun/s6opts.conf not found, existing"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
SOURCE="/etc/obarun/s6opts.conf"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# at this point, the good .conf file is sourced
|
|
||||||
# we know all needed variables
|
|
||||||
|
|
||||||
# do not pass if DEST_USER already exist
|
|
||||||
if [[ -d "${DEST_USER}" ]] && [[ "${2}" == "add" ]]; then
|
|
||||||
log "${DEST_USER} already exist, nothing to do"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
LIST_SERV=$(ls ${CLASSIC_ENABLED})
|
|
||||||
# coming from boot time? so respect the choice of the .conf files
|
|
||||||
# and change the name of USER variable.
|
|
||||||
if [[ "${USER}" == "boot" ]]; then
|
|
||||||
USER="${DEST_USER##*/}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
copy_template() {
|
|
||||||
log "mkdir ${DEST}/service/${USER}/{log,env}"
|
|
||||||
mkdir -p -m 0755 ${DEST}/service/${USER}/{log,env}
|
|
||||||
log "s6-hiercopy from ${TEMPLATE}/base/ to ${DEST}/service/${USER}"
|
|
||||||
/usr/bin/s6-hiercopy ${TEMPLATE}/base/run ${DEST}/service/${USER}/run
|
|
||||||
/usr/bin/s6-hiercopy ${TEMPLATE}/base/log ${DEST}/service/${USER}/log
|
|
||||||
/usr/bin/s6-hiercopy ${TEMPLATE}/base/env ${DEST}/service/${USER}/env
|
|
||||||
}
|
|
||||||
|
|
||||||
parse_env() {
|
|
||||||
local named
|
|
||||||
log "replace base by ${USER} at LOG,run,log/run files"
|
|
||||||
for named in ${DEST}/service/${USER}/env/LOG ${DEST}/service/${USER}/{run,log/run}; do
|
|
||||||
sed -i "s:base:${USER}:g" $named
|
|
||||||
done
|
|
||||||
|
|
||||||
unset named
|
|
||||||
}
|
|
||||||
|
|
||||||
add_env() {
|
|
||||||
local -a list_env=$(printenv)
|
|
||||||
local var value line list
|
|
||||||
|
|
||||||
|
|
||||||
while read line;do
|
|
||||||
|
|
||||||
if [[ "${line:0:1}" == "#" ]] || [[ -z "${line}" ]];then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
var=$(awk -F"=" '{print $1}' <<< "${line}")
|
|
||||||
value=$(echo ${!var})
|
|
||||||
|
|
||||||
log "create new file ${var} with ${value} at ${DEST}/service/${USER}/env/"
|
|
||||||
touch ${DEST}/service/${USER}/env/"${var}"
|
|
||||||
echo "${value}" > ${DEST}/service/${USER}/env/"${var}"
|
|
||||||
|
|
||||||
done < "${SOURCE}"
|
|
||||||
|
|
||||||
#special env need to be create
|
|
||||||
log "create new file USER with ${USER} at ${DEST}/service/${USER}/env/"
|
|
||||||
touch ${DEST}/service/${USER}/env/USER
|
|
||||||
echo "${USER}" > ${DEST}/service/${USER}/env/USER
|
|
||||||
|
|
||||||
log "create new file UID with ${_UID} at ${DEST}/service/${USER}/env/"
|
|
||||||
touch ${DEST}/service/${USER}/env/UID
|
|
||||||
echo "${_UID}" > ${DEST}/service/${USER}/env/UID
|
|
||||||
|
|
||||||
log "create new file GID with ${_GID} at ${DEST}/service/${USER}/env/"
|
|
||||||
touch ${DEST}/service/${USER}/env/UID
|
|
||||||
echo "${_GID}" > ${DEST}/service/${USER}/env/GID
|
|
||||||
|
|
||||||
#su -l "${USER}" -c 'env'
|
|
||||||
|
|
||||||
# need improvement
|
|
||||||
for list in ${list_env[@]};do
|
|
||||||
|
|
||||||
while read line;do
|
|
||||||
|
|
||||||
var=$(awk -F"=" '{print $1}' <<< "${line}")
|
|
||||||
value=$(echo ${!var})
|
|
||||||
|
|
||||||
case "${var}" in
|
|
||||||
_|?|GID|UID|PWD|G_DEBUG|LOG) continue
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
log "create new file ${var} with ${value} at ${DEST}/service/${USER}/env/"
|
|
||||||
touch ${DEST}/service/${USER}/env/"${var}"
|
|
||||||
echo "${value}" > ${DEST}/service/${USER}/env/"${var}"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done <<< "${list}"
|
|
||||||
|
|
||||||
done
|
|
||||||
|
|
||||||
unset list_env var value line list
|
|
||||||
}
|
|
||||||
create_destuser() {
|
|
||||||
local tidy
|
|
||||||
|
|
||||||
log "create ${DEST_USER} directory"
|
|
||||||
mkdir -p ${DEST_USER}
|
|
||||||
log "create ${LIVE_CLASSIC_PATH} directory"
|
|
||||||
mkdir -p ${LIVE_CLASSIC_PATH}/.s6-svscan
|
|
||||||
log "create ${LIVE_RC_PATH} directory"
|
|
||||||
mkdir -p ${LIVE_RC_PATH}
|
|
||||||
|
|
||||||
|
|
||||||
log "copy ${TEMPLATE}/base/.s6-svscan to ${LIVE_CLASSIC_PATH}}/.s6-svscan"
|
|
||||||
/usr/bin/s6-hiercopy ${TEMPLATE}/base/.s6-svscan ${LIVE_CLASSIC_PATH}/.s6-svscan
|
|
||||||
|
|
||||||
# parse all SIG* file to point to the right place
|
|
||||||
for tidy in ${LIVE_CLASSIC_PATH}/.s6-svscan/{SIG{HUP,INT,QUIT,TERM,USR1,USR2},finish,crash}; do
|
|
||||||
log "change base by ${USER} at $tidy"
|
|
||||||
sed -i "s:base:${USER}:g" $tidy
|
|
||||||
done
|
|
||||||
|
|
||||||
log "change owner and permissions of ${DEST_USER} directory"
|
|
||||||
chown -R ${_UID}:root ${DEST_USER}
|
|
||||||
chmod 755 -R ${DEST_USER}
|
|
||||||
unset tidy
|
|
||||||
}
|
|
||||||
|
|
||||||
# copy daemon enabled by USER
|
|
||||||
enabled_daemon() {
|
|
||||||
log "enable daemon for $USER"
|
|
||||||
for serv in ${LIST_SERV[@]};do
|
|
||||||
ln -sfT ${CLASSIC_ENABLED}/${serv} ${LIVE_CLASSIC_PATH}/${serv}
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
start_database() {
|
|
||||||
log "init s6-rc database"
|
|
||||||
if [[ "${_UID}" == 0 ]]; then
|
|
||||||
s6-rc-init -l ${LIVE_RC_PATH}/${LIVE_RC_NAME} -c ${RC_DATABASE_COMPILED}/current ${LIVE_CLASSIC_PATH}
|
|
||||||
s6-rc -v 3 -l ${LIVE_RC_PATH}/${LIVE_RC_NAME} -u change All
|
|
||||||
else
|
|
||||||
su ${USER} -c "s6-rc-init -l ${LIVE_RC_PATH}/${LIVE_RC_NAME} -c ${RC_DATABASE_COMPILED}/current ${LIVE_CLASSIC_PATH}"
|
|
||||||
su ${USER} -c "s6-rc -v 3 -l ${LIVE_RC_PATH}/${LIVE_RC_NAME} -u change All"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# ${1} s6 program
|
|
||||||
# ${2} command to pass
|
|
||||||
# ${3} target
|
|
||||||
s6_cmd() {
|
|
||||||
local prog="${1}" cmd="${2}" target="${3}"
|
|
||||||
log "do a s6-${prog} -${cmd} ${target} command"
|
|
||||||
eval s6-"${prog}" -"${cmd}" "${target}"
|
|
||||||
|
|
||||||
unset prog cmd target
|
|
||||||
}
|
|
||||||
|
|
||||||
add() {
|
|
||||||
|
|
||||||
copy_template || exit 1
|
|
||||||
|
|
||||||
parse_env || exit 1
|
|
||||||
|
|
||||||
add_env || exit 1
|
|
||||||
|
|
||||||
create_destuser || exit 1
|
|
||||||
|
|
||||||
s6_cmd "svscanctl" "an" "${DEST}/service" || exit 1
|
|
||||||
|
|
||||||
enabled_daemon || exit 1
|
|
||||||
|
|
||||||
s6_cmd "svscanctl" "an" "${DESTUSER}/${USER}/${DESTCLASSIC}" 2>/dev/null || exit 1
|
|
||||||
|
|
||||||
start_database || exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
del() {
|
|
||||||
s6_cmd "svc" "wD -d -T2000" "${DEST}/service/${USER}"
|
|
||||||
|
|
||||||
if ! [[ -z $(s6-svstat ${DEST}/service/${USER}|grep down) ]];then
|
|
||||||
s6_cmd "svc" "kO" "${DEST}/service/${USER}"
|
|
||||||
fi
|
|
||||||
log "remove ${DEST}/service/${USER} directory"
|
|
||||||
rm -rf "${DEST}/service/${USER}/"
|
|
||||||
s6_cmd "svscanctl" "an" "${DEST}/service/"
|
|
||||||
log "remove ${DEST_USER} directory"
|
|
||||||
rm -rf "${DEST_USER}"
|
|
||||||
}
|
|
||||||
|
|
||||||
case "${2}" in
|
|
||||||
add)
|
|
||||||
add
|
|
||||||
;;
|
|
||||||
del)
|
|
||||||
del
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
1
env/MASTER
vendored
Normal file
1
env/MASTER
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
master-
|
2
init
2
init
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
2
poweroff
2
poweroff
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
00
|
00
|
||||||
all-Boot
|
all-Boot
|
||||||
adduser
|
adduser
|
||||||
|
tty
|
||||||
|
@@ -11,6 +11,6 @@
|
|||||||
fdmove -c 2 1
|
fdmove -c 2 1
|
||||||
importas -i HANDLE HANDLE
|
importas -i HANDLE HANDLE
|
||||||
if { s6-echo -- start adduser }
|
if { s6-echo -- start adduser }
|
||||||
if { ${HANDLE}/user.sh "boot" add }
|
if { ${HANDLE}/master.sh }
|
||||||
s6-echo -- adduser started successfully
|
s6-echo -- adduser started successfully
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
udevd-udev
|
udevd-udev
|
||||||
udevd-udevrules
|
|
||||||
udevd-udevadm
|
udevd-udevadm
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
@@ -9,14 +9,13 @@
|
|||||||
# except according to the terms contained in the LICENSE file.
|
# except according to the terms contained in the LICENSE file.
|
||||||
|
|
||||||
fdmove -c 2 1
|
fdmove -c 2 1
|
||||||
foreground {
|
if { s6-echo "unmounting cgroup" }
|
||||||
redirfd -r 0 /proc/cgroups
|
redirfd -r 0 /proc/cgroups
|
||||||
pipeline { s6-tail -n +2 }
|
pipeline { s6-tail -n +2 }
|
||||||
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
|
||||||
importas -ui i i
|
importas -ui 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}
|
||||||
}
|
|
||||||
umount /sys/fs/cgroup
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
@@ -9,19 +9,22 @@
|
|||||||
# except according to the terms contained in the LICENSE file.
|
# except according to the terms contained in the LICENSE file.
|
||||||
|
|
||||||
fdmove -c 2 1
|
fdmove -c 2 1
|
||||||
importas -i S6CONF S6CONF
|
|
||||||
if { s6-echo -- rofs-console started }
|
if { s6-echo -- rofs-console started }
|
||||||
|
importas -i S6CONF S6CONF
|
||||||
s6-envdir ${S6CONF}
|
s6-envdir ${S6CONF}
|
||||||
|
importas -D "" TTY TTY
|
||||||
importas -D "" KEYMAP KEYMAP
|
importas -D "" KEYMAP KEYMAP
|
||||||
importas -D "" FONT FONT
|
importas -D "" FONT FONT
|
||||||
importas -D "" FONT_MAP FONT_MAP
|
importas -D "" FONT_MAP FONT_MAP
|
||||||
importas -D "" FONT_UNIMAP FONT_UNIMAP
|
importas -D "" FONT_UNIMAP FONT_UNIMAP
|
||||||
|
foreground {
|
||||||
|
forbacktickx index { seq ${TTY} }
|
||||||
|
importas -u -D "" index index
|
||||||
|
bash -c "setfont ${FONT_MAP:+-m $FONT_MAP} ${FONT_UNIMAP:+-u $FONT_UNIMAP} $FONT -C /dev/tty${index}"
|
||||||
|
}
|
||||||
|
# special case for the earlier tty
|
||||||
|
foreground { bash -c "setfont ${FONT_MAP:+-m $FONT_MAP} ${FONT_UNIMAP:+-u $FONT_UNIMAP} $FONT -C /dev/tty6" }
|
||||||
foreground {
|
foreground {
|
||||||
loadkeys -q -u $KEYMAP
|
loadkeys -q -u $KEYMAP
|
||||||
}
|
}
|
||||||
foreground {
|
|
||||||
forx index { 0 1 2 3 4 5 6 7 8 9 10 }
|
|
||||||
importas -u -D "" index 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
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
@@ -16,6 +16,7 @@ importas -D "" IP6TABLES IP6TABLES
|
|||||||
ifelse -X { s6-test $IP6TABLES = yes }
|
ifelse -X { s6-test $IP6TABLES = yes }
|
||||||
{
|
{
|
||||||
if { s6-echo -- Flushing ip6tables }
|
if { s6-echo -- Flushing ip6tables }
|
||||||
/usr/lib/iptables/scripts/iptables-flush 6
|
foreground { /usr/lib/iptables/scripts/iptables-flush 6 }
|
||||||
|
s6-echo -- Ip6tables flushed
|
||||||
}
|
}
|
||||||
s6-echo -- Ip6tables flushed
|
s6-echo -- Ip6tables not actived
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
1
rc/tty/dependencies
Normal file
1
rc/tty/dependencies
Normal file
@@ -0,0 +1 @@
|
|||||||
|
adduser
|
30
rc/tty/up
Normal file
30
rc/tty/up
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#!@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
|
||||||
|
if { s6-echo -- tty started }
|
||||||
|
importas -i DEST DEST
|
||||||
|
importas -i S6CONF S6CONF
|
||||||
|
s6-envdir ${S6CONF}
|
||||||
|
importas -D "" TTY TTY
|
||||||
|
foreground {
|
||||||
|
forbacktickx index { seq ${TTY} }
|
||||||
|
importas -i index index
|
||||||
|
if { mkdir -p ${DEST}/service/tty${index} }
|
||||||
|
foreground {
|
||||||
|
redirfd -a 1 ${DEST}/service/tty${index}/run
|
||||||
|
s6-echo --
|
||||||
|
"#!/usr/bin/bash
|
||||||
|
/usr/bin/agetty -J 38400 tty${index}"
|
||||||
|
}
|
||||||
|
s6-chmod 0755 ${DEST}/service/tty${index}/run
|
||||||
|
}
|
||||||
|
if { s6-svscanctl -an ${DEST}/service }
|
||||||
|
s6-echo -- tty successfully started
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
udevd-udev
|
udevd-udev
|
||||||
udevd-udevrules
|
|
||||||
|
@@ -1,14 +0,0 @@
|
|||||||
#!@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 -- udevd-udevadm started }
|
|
||||||
s6-devd
|
|
||||||
/usr/bin/udevadm settle
|
|
@@ -1 +1 @@
|
|||||||
longrun
|
oneshot
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
@@ -10,8 +10,9 @@
|
|||||||
|
|
||||||
fdmove -c 2 1
|
fdmove -c 2 1
|
||||||
if { s6-echo -- udevd-udevrules started }
|
if { s6-echo -- udevd-udevrules started }
|
||||||
foreground {
|
if {
|
||||||
if { udevadm trigger --action=add --type=subsystems }
|
foreground { udevadm trigger --action=add --type=subsystems }
|
||||||
udevadm trigger --action=add --type=devices
|
foreground { udevadm trigger --action=add --type=devices }
|
||||||
|
udevadm settle
|
||||||
}
|
}
|
||||||
s6-echo -- udevd-udevrules successfully started
|
s6-echo -- udevd-udevrules successfully started
|
@@ -1,2 +0,0 @@
|
|||||||
udevd-udev
|
|
||||||
|
|
2
reboot
2
reboot
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -P
|
#!@BINDIR_EXECLINE@/execlineb -P
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
6
s6.conf
6
s6.conf
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
@@ -38,6 +38,10 @@ HARDWARECLOCK=UTC
|
|||||||
# Set timezone, availables timezones at /usr/share/zoneinfo.
|
# Set timezone, availables timezones at /usr/share/zoneinfo.
|
||||||
TZ=GMT
|
TZ=GMT
|
||||||
|
|
||||||
|
# Number of tty to start.
|
||||||
|
# The number MUST be included between 1-5.
|
||||||
|
TTY=2
|
||||||
|
|
||||||
# Keymap to load, see loadkeys(8), default us.
|
# Keymap to load, see loadkeys(8), default us.
|
||||||
KEYMAP=us
|
KEYMAP=us
|
||||||
|
|
||||||
|
2
shutdown
2
shutdown
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR@/bash
|
#!@BINDIR@/bash
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
11
stage2.tini
11
stage2.tini
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -S0
|
#!@BINDIR_EXECLINE@/execlineb -S0
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
@@ -9,14 +9,17 @@
|
|||||||
# except according to the terms contained in the LICENSE file.
|
# except according to the terms contained in the LICENSE file.
|
||||||
|
|
||||||
s6-envdir -if /etc/s6/env
|
s6-envdir -if /etc/s6/env
|
||||||
|
importas -i DEST DEST
|
||||||
importas -i DESTRC DESTRC
|
importas -i DESTRC DESTRC
|
||||||
importas -i S6CONF S6CONF
|
importas -i S6CONF S6CONF
|
||||||
|
importas -i MASTER MASTER
|
||||||
|
|
||||||
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 3 -l ${DESTRC} -da change }
|
foreground { s6-rc -v 3 -l ${DESTRC} -da change }
|
||||||
|
foreground { s6-rc -v 3 -l ${DEST}/${MASTER} -da change }
|
||||||
|
|
||||||
s6-envdir -if ${S6CONF}
|
s6-envdir -if ${S6CONF}
|
||||||
|
|
||||||
@@ -26,6 +29,12 @@ foreground {
|
|||||||
if { s6-echo -- Cleaning /tmp directory }
|
if { s6-echo -- Cleaning /tmp directory }
|
||||||
rm -rf /tmp/
|
rm -rf /tmp/
|
||||||
}
|
}
|
||||||
|
foreground {
|
||||||
|
if { s6-test -x /usr/bin/mountstats }
|
||||||
|
if -X { mountstats }
|
||||||
|
if { s6-echo Umount NFS filesystem }
|
||||||
|
umount -a -f -t nfs4
|
||||||
|
}
|
||||||
|
|
||||||
if { s6-echo -- "***************************************************************************" }
|
if { s6-echo -- "***************************************************************************" }
|
||||||
if { s6-echo -- "** Tini shutdown terminated **" }
|
if { s6-echo -- "** Tini shutdown terminated **" }
|
||||||
|
2
stage3
2
stage3
@@ -1,5 +1,5 @@
|
|||||||
#!@BINDIR_EXECLINE@/execlineb -S0
|
#!@BINDIR_EXECLINE@/execlineb -S0
|
||||||
# Copyright (c) 2015-2017 Eric Vidal <eric@obarun.org>
|
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of Obarun. It is subject to the license terms in
|
# This file is part of Obarun. It is subject to the license terms in
|
||||||
|
Reference in New Issue
Block a user