Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
fea3b2675c | ||
![]() |
2dfb3ac0ad | ||
![]() |
fb924ced4f | ||
![]() |
7008745393 | ||
![]() |
5a93f2ca81 | ||
![]() |
3cd9f46117 | ||
![]() |
f88b0f4eac | ||
![]() |
1c6c1ff259 | ||
![]() |
f5217e18ef | ||
![]() |
051dacc843 | ||
![]() |
d3ec2f001e | ||
![]() |
0594295927 | ||
![]() |
95e074768e | ||
![]() |
dbc7e4d1af | ||
![]() |
4e1e004af7 | ||
![]() |
53bc1c3f84 | ||
![]() |
ea871d703a | ||
![]() |
2b6b36c265 | ||
![]() |
9acfccfad5 | ||
![]() |
32eaffc776 | ||
![]() |
de179883e4 | ||
![]() |
59f5925d6b | ||
![]() |
b5f41908b3 | ||
![]() |
a72258985a | ||
![]() |
9f81864f69 |
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
|
||||||
@@ -57,6 +57,8 @@ 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/user.sh $(DESTDIR)/etc/s6/data/scripts/user.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
|
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/current
|
||||||
|
27
NEWS
27
NEWS
@@ -1,5 +1,32 @@
|
|||||||
Changelog for s6-boot
|
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
|
In 0.1.7
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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
|
|
71
data/scripts/modules.sh
Executable file
71
data/scripts/modules.sh
Executable file
@@ -0,0 +1,71 @@
|
|||||||
|
#!@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.
|
||||||
|
|
||||||
|
|
||||||
|
# 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
|
411
data/scripts/tmpfiles.sh
Executable file
411
data/scripts/tmpfiles.sh
Executable 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:
|
@@ -188,7 +188,7 @@ enabled_daemon() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
start_database() {
|
start_database() {
|
||||||
log "init s6-rc database"
|
log "init s6-rc database with -l ${LIVE_RC_PATH}/${LIVE_RC_NAME} -c ${RC_DATABASE_COMPILED}/current ${LIVE_CLASSIC_PATH}"
|
||||||
if [[ "${_UID}" == 0 ]]; then
|
if [[ "${_UID}" == 0 ]]; then
|
||||||
s6-rc-init -l ${LIVE_RC_PATH}/${LIVE_RC_NAME} -c ${RC_DATABASE_COMPILED}/current ${LIVE_CLASSIC_PATH}
|
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
|
s6-rc -v 3 -l ${LIVE_RC_PATH}/${LIVE_RC_NAME} -u change All
|
||||||
@@ -223,7 +223,7 @@ add() {
|
|||||||
|
|
||||||
enabled_daemon || exit 1
|
enabled_daemon || exit 1
|
||||||
|
|
||||||
s6_cmd "svscanctl" "an" "${DESTUSER}/${USER}/${DESTCLASSIC}" 2>/dev/null || exit 1
|
s6_cmd "svscanctl" "an" "${LIVE_CLASSIC_PATH}" 2>/dev/null || exit 1
|
||||||
|
|
||||||
start_database || exit 1
|
start_database || exit 1
|
||||||
}
|
}
|
||||||
|
6
init
6
init
@@ -10,10 +10,10 @@
|
|||||||
|
|
||||||
# Export good path
|
# Export good path
|
||||||
/usr/bin/s6-envdir -if /etc/s6/env
|
/usr/bin/s6-envdir -if /etc/s6/env
|
||||||
/usr/local/bin/importas -i PATH PATH
|
@BINDIR_EXECLINE@/importas -i PATH PATH
|
||||||
/usr/local/bin/export PATH ${PATH}
|
@BINDIR_EXECLINE@/export PATH ${PATH}
|
||||||
|
|
||||||
/usr/local/bin/cd /
|
@BINDIR_EXECLINE@/cd /
|
||||||
|
|
||||||
# Be clean and safe
|
# Be clean and safe
|
||||||
emptyenv -p
|
emptyenv -p
|
||||||
|
@@ -10,3 +10,4 @@ rwfs-cleanboot
|
|||||||
rwfs-end
|
rwfs-end
|
||||||
rwfs-dmesglog
|
rwfs-dmesglog
|
||||||
rwfs-s6local
|
rwfs-s6local
|
||||||
|
rwfs-tmpfiles
|
@@ -1,3 +1,3 @@
|
|||||||
udevd-udev
|
udevd-udev
|
||||||
udevd-udevrules
|
|
||||||
udevd-udevadm
|
udevd-udevadm
|
||||||
|
|
||||||
|
@@ -19,4 +19,4 @@ foreground {
|
|||||||
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
|
umount -R /sys/fs/cgroup
|
||||||
|
@@ -9,17 +9,7 @@
|
|||||||
# 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
|
importas -i HANDLE HANDLE
|
||||||
ifelse -X { s6-test -e ${S6CONF}/MODULES }
|
|
||||||
{
|
|
||||||
if { s6-echo -- rofs-modules started }
|
if { s6-echo -- rofs-modules started }
|
||||||
redirfd -r 0 ${S6CONF}/MODULES
|
foreground { ${HANDLE}/modules.sh }
|
||||||
forstdin -n -- mods
|
|
||||||
importas -ui mods mods
|
|
||||||
foreground {
|
|
||||||
if { s6-test -n $mods }
|
|
||||||
modprobe -ab $mods
|
|
||||||
}
|
|
||||||
s6-echo -- rofs-modules successfully started
|
s6-echo -- rofs-modules successfully started
|
||||||
}
|
|
||||||
s6-echo -- rofs-modules desactived
|
|
||||||
|
@@ -7,3 +7,4 @@
|
|||||||
# distribution and at https://github.com/Obarun/s6-boot/LICENSE
|
# distribution and at https://github.com/Obarun/s6-boot/LICENSE
|
||||||
# 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.
|
||||||
|
s6-true
|
||||||
|
@@ -13,9 +13,10 @@ importas -i S6CONF S6CONF
|
|||||||
s6-envdir ${S6CONF}
|
s6-envdir ${S6CONF}
|
||||||
importas -D "" IP6TABLES IP6TABLES
|
importas -D "" IP6TABLES IP6TABLES
|
||||||
|
|
||||||
if { s6-test $IP6TABLES = yes }
|
ifelse -X { s6-test $IP6TABLES = yes }
|
||||||
foreground {
|
{
|
||||||
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
rc/rwfs-tmpfiles/dependencies
Normal file
1
rc/rwfs-tmpfiles/dependencies
Normal file
@@ -0,0 +1 @@
|
|||||||
|
rwfs-s6local
|
@@ -9,6 +9,7 @@
|
|||||||
# 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
|
||||||
if { s6-echo -- udevd-udevadm started }
|
importas -i HANDLE HANDLE
|
||||||
s6-devd
|
if { s6-echo rwfs-tmpfiles started }
|
||||||
/usr/bin/udevadm settle
|
foreground { exec -c ${HANDLE}/tmpfiles.sh --create --verbose }
|
||||||
|
s6-echo -- rwfs-tmpfiles successfully started
|
@@ -1,2 +1,2 @@
|
|||||||
udevd-udev
|
udevd-udev
|
||||||
udevd-udevrules
|
|
||||||
|
@@ -1 +1 @@
|
|||||||
longrun
|
oneshot
|
||||||
|
@@ -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
|
|
||||||
|
|
3
s6.conf
3
s6.conf
@@ -50,9 +50,6 @@ FONT=lat9w-16
|
|||||||
# Font unimap to load, see setfont(8).
|
# Font unimap to load, see setfont(8).
|
||||||
#FONT_UNIMAP=
|
#FONT_UNIMAP=
|
||||||
|
|
||||||
#Modules, the list must be separate by space e.g. MODULES=vboxdrv i915 loop#
|
|
||||||
#MODULES=
|
|
||||||
|
|
||||||
# Use Iptables [yes|no]
|
# Use Iptables [yes|no]
|
||||||
# The configuration file in /etc/iptables/iptables.rules MUST exist
|
# The configuration file in /etc/iptables/iptables.rules MUST exist
|
||||||
IPTABLES=no
|
IPTABLES=no
|
||||||
|
@@ -26,6 +26,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 **" }
|
||||||
|
Reference in New Issue
Block a user