Replace OpenRC with custom init system

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
This commit is contained in:
David Oberhollenzer 2018-03-04 16:35:28 +01:00
parent 94cc2d2c46
commit f5a62aef6a
31 changed files with 53 additions and 1059 deletions

46
pkg/init/build Executable file
View File

@ -0,0 +1,46 @@
VERSION="0.1"
SRCDIR="init-${VERSION}"
TARBALL="${SRCDIR}.tar.gz"
URL="http://infraroot.at/pygos"
SHA256SUM="56fb57c7cc1b869642028497f81ea20f42d17821cd60af3d3b6a58170123f750"
DEPENDS="toolchain"
prepare() {
return
}
build() {
local SOURCE="$1"
local DEPLOY="$2"
$SOURCE/configure --prefix="" --host="$TARGET" --sbindir=/bin
make -j $NUMJOBS
}
deploy() {
local SOURCE="$1"
local DEPLOY="$2"
local svc
make DESTDIR="$DEPLOY" install-strip
mkdir -p "$DEPLOY/etc/init.d"
if [ -e "$SCRIPTDIR/board/$BOARD/INIT" ]; then
source "$SCRIPTDIR/board/$BOARD/INIT"
fi
if [ -e "$SCRIPTDIR/product/$PRODUCT/INIT" ]; then
source "$SCRIPTDIR/product/$PRODUCT/INIT"
fi
for svc in hostname loopback sysctl hwclock sysinit; do
ln -s "/share/init/$svc" "$DEPLOY/etc/init.d/$svc"
done
for svc in $GETTY_TTY; do
ln -s "/share/init/agetty" "$DEPLOY/etc/init.d/agetty@$svc"
done
unset -v i GETTY_TTY
}

View File

@ -160,8 +160,10 @@ umount -l /dev
umount /sys
umount /proc
if [ "$singleuser" == "1" ]; then
unset -v singleuser overlay_dev root root_sfs
exec /bin/busybox switch_root /newroot /bin/bash
fi
unset -v singleuser overlay_dev root root_sfs
/bin/busybox chroot /newroot /bin/openrc
exec /bin/busybox switch_root /newroot /bin/openrc-init
exec /bin/busybox switch_root /newroot /bin/init

View File

@ -1,48 +0,0 @@
--- a/src/rc/openrc-init.c
+++ b/src/rc/openrc-init.c
@@ -53,7 +53,7 @@ static pid_t do_openrc(const char *runlevel)
sigemptyset(&signals);
sigprocmask(SIG_SETMASK, &signals, NULL);
printf("Starting %s runlevel\n", runlevel);
- execl("/sbin/openrc", "/sbin/openrc", runlevel, NULL);
+ execl("/bin/openrc", "/bin/openrc", runlevel, NULL);
perror("exec");
break;
default:
--- a/src/rc/rc-selinux.c
+++ b/src/rc/rc-selinux.c
@@ -400,8 +400,8 @@ void selinux_setup(char **argv)
* which will open the pty with initrc_devpts_t, if it doesnt exist,
* fall back to plain exec
*/
- if (!access("/usr/sbin/open_init_pty", X_OK)) {
- if (execvp("/usr/sbin/open_init_pty", argv)) {
+ if (!access("/bin/open_init_pty", X_OK)) {
+ if (execvp("/bin/open_init_pty", argv)) {
perror("execvp");
exit(-1);
}
--- a/src/rc/rc.c
+++ b/src/rc/rc.c
@@ -78,8 +78,8 @@ const char *usagestring = "" \
#define INITSH RC_LIBEXECDIR "/sh/init.sh"
#define INITEARLYSH RC_LIBEXECDIR "/sh/init-early.sh"
-#define SHUTDOWN "/sbin/shutdown"
-#define SULOGIN "/sbin/sulogin"
+#define SHUTDOWN "/bin/shutdown"
+#define SULOGIN "/bin/sulogin"
#define INTERACTIVE RC_SVCDIR "/interactive"
@@ -288,8 +288,8 @@ open_shell(void)
/* VSERVER systems cannot really drop to shells */
if (sys && strcmp(sys, RC_SYS_VSERVER) == 0)
{
- execl("/sbin/halt", "/sbin/halt", "-f", (char *) NULL);
- eerrorx("%s: unable to exec `/sbin/halt': %s",
+ execl("/bin/halt", "/bin/halt", "-f", (char *) NULL);
+ eerrorx("%s: unable to exec `/bin/halt': %s",
applet, strerror(errno));
}
#endif

View File

@ -1,74 +0,0 @@
VERSION="0.34.11"
SRCDIR="openrc-${VERSION}"
TARBALL="${VERSION}.tar.gz"
URL="https://github.com/OpenRC/openrc/archive"
SHA256SUM="4e7b7510c363e99622400feba4b009ec0e0b57dbb99fd4cc678a7b5d2036e00a"
DEPENDS="ncurses"
prepare() {
return
}
build() {
local SOURCE="$1"
local DEPLOY="$2"
local distroname="${OS_NAME}-${OS_RELEASE}"
cp -R ${SOURCE}/* ${PKGBUILDDIR}
apply_patches
make CC=${TARGET}-gcc AR=${TARGET}-ar RANLIB=${TARGET}-ranlib \
LD=${TARGET}-ld LIBTERMCAP="-lncursesw" \
SBINDIR="/bin" INCDIR="/include" LIBNAME="lib" \
DESTDIR="$DEPLOY" OS=Linux BRANDING="$distroname" \
MKNET=no MKSELINUX=no MKSTATICLIBS=no MKSYSVINIT=yes \
MKTERMCAP=ncurses UPREFIX="" \
-j $NUMJOBS
}
deploy() {
local SOURCE="$1"
local DEPLOY="$2"
local DEVDEPLOY="$3"
local distroname="${OS_NAME}-${OS_RELEASE}"
make SBINDIR="/bin" INCDIR="/include" LIBNAME="lib" \
DESTDIR="$DEPLOY" OS=Linux BRANDING="$distroname" UPREFIX="" \
install
split_dev_deploy "$DEPLOY" "$DEVDEPLOY"
rm -r ${DEPLOY}/share
rm -r ${DEPLOY}/etc
chmod 755 ${DEPLOY}/lib/*.so*
strip_files ${DEPLOY}/{bin,lib}/* ${DEPLOY}/libexec/rc/{bin,sbin}/*
mkdir -p ${DEPLOY}/etc/{conf.d,init.d,runlevels,sysctl.d}
mkdir -p ${DEPLOY}/etc/runlevels/{boot,sysinit,shutdown,default}
cp -R "$SCRIPTDIR/pkg/$PKGNAME/etc" "$DEPLOY"
if [ -e "$SCRIPTDIR/board/$BOARD/INIT" ]; then
source "$SCRIPTDIR/board/$BOARD/INIT"
fi
if [ -e "$SCRIPTDIR/product/$PRODUCT/INIT" ]; then
source "$SCRIPTDIR/product/$PRODUCT/INIT"
fi
for i in $GETTY_TTY; do
cat > "$DEPLOY/etc/conf.d/agetty.$i" << _EOF
#quiet="yes"
#baud="38400"
term_type="linux"
#agetty_options=""
_EOF
ln -s "/etc/init.d/agetty" "$DEPLOY/etc/init.d/agetty.$i"
ln -s "/etc/init.d/agetty.$i" "$DEPLOY/etc/runlevels/default/agetty.$i"
done
unset -v i GETTY_TTY
}

View File

@ -1,2 +0,0 @@
# Set to the hostname of this machine
hostname="localhost"

View File

@ -1,20 +0,0 @@
# Set CLOCK to "UTC" if your Hardware Clock is set to UTC (also known as
# Greenwich Mean Time). If that clock is set to the local time, then
# set CLOCK to "local". Note that if you dual boot with Windows, then
# you should set it to "local".
clock="UTC"
# If you want the hwclock script to set the system time (software clock)
# to match the current hardware clock during bootup, leave this
# commented out.
# However, you can set this to "NO" if you are running a modern kernel
# and using NTP to synchronize your system clock.
#clock_hctosys="YES"
# If you do not want to set the hardware clock to the current system
# time (software clock) during shutdown, set this to no.
#clock_systohc="YES"
# If you wish to pass any other arguments to hwclock during bootup,
# you may do so here. Alpha users may wish to use --arc or --srm here.
clock_args=""

View File

@ -1,6 +0,0 @@
# If you wish to pass any options to kill_all during shutdown,
# you should do so here.
#
# The setting is called killall5_opts because the options here are meant
# to be identical to those you could pass to killall5.
killall5_opts=""

View File

@ -1,27 +0,0 @@
# Linux users can define a list of modules for a specific kernel version,
# a released kernel version, a main kernel version or all kernel versions.
# The most specific versioned variable will take precedence.
# FreeBSD users can only use the modules="foo bar" setting.
#modules_2_6_23_gentoo_r5="ieee1394 ohci1394"
#modules_2_6_23="tun ieee1394"
#modules_2_6="tun"
#modules_2="ipv6"
#modules="ohci1394"
# Linux users can give modules a different name when they load - the new name
# will also be used to pick arguments below.
# This is not supported on FreeBSD.
#modules="dummy:dummy1"
# Linux users can give the modules some arguments if needed, per version
# if necessary.
# Again, the most specific versioned variable will take precedence.
# This is not supported on FreeBSD.
#module_ieee1394_args="debug"
#module_ieee1394_args_2_6_23_gentoo_r5="debug2"
#module_ieee1394_args_2_6_23="debug3"
#module_ieee1394_args_2_6="debug4"
#module_ieee1394_args_2="debug5"
# You should consult your kernel documentation and configuration
# for a list of modules and their options.

View File

@ -1,5 +0,0 @@
# Sometimes you want to have urandom start before "localmount"
# (say for crypt swap), so you will need to customize this
# behavior. If you have /var on a separate partition, then
# make sure this path lives on your root device somewhere.
urandom_seed="/var/lib/misc/random-seed"

View File

@ -1,33 +0,0 @@
#!/bin/openrc-run
# Copyright (c) 2017 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
#
# This file is part of OpenRC. 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/OpenRC/openrc/blob/master/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
description="start agetty on a terminal line"
supervisor=supervise-daemon
port="${RC_SVCNAME#*.}"
term_type="${term_type:-linux}"
command=/bin/agetty
command_args_foreground="${agetty_options} ${port} ${baud} ${term_type}"
pidfile="/run/${RC_SVCNAME}.pid"
export EINFO_QUIET="${quiet:-yes}"
depend() {
after local
keyword -prefix
}
start_pre() {
if [ -z "$port" ]; then
eerror "${RC_SVCNAME} cannot be started directly. You must create"
eerror "symbolic links to it for the ports you want to start"
eerror "agetty on and add those to the appropriate runlevels."
return 1
fi
}

View File

@ -1 +0,0 @@
/libexec/rc/sh/functions.sh

View File

@ -1,38 +0,0 @@
#!/bin/openrc-run
# Copyright (c) 2007-2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
#
# This file is part of OpenRC. 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/OpenRC/openrc/blob/master/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
description="Sets the hostname of the machine."
depend()
{
after clock
keyword -docker -lxc -prefix -systemd-nspawn
}
start()
{
local h source x
if [ -s /etc/hostname ] && [ -r /etc/hostname ]; then
read h x </etc/hostname
source="from /etc/hostname"
else
# HOSTNAME variable used to be defined in caps in conf.d/hostname.
# It is also a magic variable in bash.
h=${hostname:-${HOSTNAME}} # checkbashisms: false positive (HOSTNAME var)
fi
if [ -z "$h" ]; then
einfo "Using default system hostname"
return 0
fi
ebegin "Setting hostname to $h $source"
hostname "$h"
eend $? "Failed to set the hostname"
}

View File

@ -1,160 +0,0 @@
#!/bin/openrc-run
# Copyright (c) 2007-2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
#
# This file is part of OpenRC. 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/OpenRC/openrc/blob/master/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
extra_commands="save show"
description="Sets the local clock to UTC or Local Time."
description_save="Saves the current time in the BIOS."
description_show="Displays the current time in the BIOS."
: ${clock_adjfile:=${CLOCK_ADJFILE}}
: ${clock_args:=${CLOCK_OPTS}}
: ${clock_systohc:=${CLOCK_SYSTOHC}}
: ${clock:=${CLOCK:-UTC}}
if [ "$clock" = "UTC" ]; then
utc="UTC"
utc_cmd="--utc"
else
utc="Local Time"
utc_cmd="--localtime"
fi
depend()
{
provide clock
want modules
if yesno $clock_adjfile; then
use root
fi
keyword -docker -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu
}
setupopts()
{
case "$(uname -m)" in
s390*)
utc="s390"
;;
*)
if [ -e /proc/devices ] && \
grep -q " cobd$" /proc/devices
then
utc="coLinux"
fi
;;
esac
case "$utc" in
UTC|Local" "Time);;
*) unset utc_cmd;;
esac
}
# hwclock doesn't always return non zero on error
_hwclock()
{
local err="$(hwclock "$@" 2>&1 >/dev/null)"
[ -z "$err" ] && return 0
echo "${err}" >&2
return 1
}
get_noadjfile()
{
if ! yesno $clock_adjfile; then
# Some implementations don't handle adjustments
if LC_ALL=C hwclock --help 2>&1 | grep -q "\-\-noadjfile"; then
echo --noadjfile
fi
fi
}
rtc_exists()
{
local rtc=
for rtc in /dev/rtc /dev/rtc[0-9]*; do
[ -e "$rtc" ] && break
done
[ -e "$rtc" ]
}
start()
{
local retval=0 errstr="" modname
setupopts
if [ -z "$utc_cmd" ]; then
ewarn "Not setting clock for $utc system"
return 0
fi
ebegin "Setting system clock using the hardware clock [$utc]"
if [ -e /proc/modules ]; then
if ! rtc_exists; then
for x in rtc-cmos rtc genrtc; do
modprobe -q $x && rtc_exists && modname="$x" && break
done
[ -n "$modname" ] &&
ewarn "The $modname module needs to be configured in" \
"/etc/conf.d/modules or built in."
fi
fi
# Always set the kernel's time zone.
_hwclock --systz $utc_cmd $(get_noadjfile) $clock_args
: $(( retval += $? ))
if [ -e /etc/adjtime ] && yesno $clock_adjfile; then
_hwclock --adjust $utc_cmd $(get_noadjfile)
: $(( retval += $? ))
fi
if yesno ${clock_hctosys:-YES}; then
_hwclock --hctosys $utc_cmd $(get_noadjfile) $clock_args
: $(( retval += $? ))
fi
eend $retval "Failed to set the system clock"
return 0
}
stop()
{
# Don't tweak the hardware clock on LiveCD halt.
[ -n "$CDBOOT" ] && return 0
yesno ${clock_systohc:-YES} || return 0
local retval=0 errstr=""
setupopts
[ -z "$utc_cmd" ] && return 0
ebegin "Setting hardware clock using the system clock" "[$utc]"
_hwclock --systohc $utc_cmd $(get_noadjfile) $clock_args
retval=$?
eend $retval "Failed to sync clocks"
}
save()
{
clock_systohc=yes
stop
}
show()
{
setupopts
hwclock --show "$utc_cmd" $(get_noadjfile) $clock_args
}

View File

@ -1,27 +0,0 @@
#!/bin/openrc-run
# Copyright (c) 2007-2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
#
# This file is part of OpenRC. 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/OpenRC/openrc/blob/master/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
description="Kill all processes so we can unmount disks cleanly."
depend()
{
keyword -prefix
}
start()
{
ebegin "Terminating remaining processes"
kill_all 15 ${killall5_opts}
eend 0
ebegin "Killing remaining processes"
kill_all 9 ${killall5_opts}
eend 0
}

View File

@ -1,35 +0,0 @@
#!/bin/openrc-run
# Copyright (c) 2013-2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
#
# This file is part of OpenRC. 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/OpenRC/openrc/blob/master/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
description="Configures the loopback interface."
depend()
{
after clock
keyword -jail -prefix -systemd-nspawn -vserver
}
start()
{
if [ "$RC_UNAME" = Linux ]; then
ebegin "Bringing up network interface lo"
if command -v ip > /dev/null 2>&1; then
ip addr add 127.0.0.1/8 dev lo brd +
ip link set lo up
else
ifconfig lo 127.0.0.1 netmask 255.0.0.0
fi
else
ebegin "Bringing up network interface lo0"
ifconfig lo0 127.0.0.1 netmask 255.0.0.0
fi
eend $?
}

View File

@ -1,70 +0,0 @@
#!/bin/openrc-run
# Copyright (c) 2007-2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
#
# This file is part of OpenRC. 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/OpenRC/openrc/blob/master/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
description="Loads a user defined list of kernel modules."
depend()
{
use isapnp
want modules-load
keyword -docker -lxc -openvz -prefix -systemd-nspawn -vserver
}
start()
{
# Should not fail if kernel does not have module
# support compiled in ...
[ ! -f /proc/modules ] && return 0
local KV x y kv_variant_list
KV=$(uname -r)
# full $KV
kv_variant_list="${KV}"
# remove any KV_EXTRA options to just get the full version
x=${KV%%-*}
# now slowly strip them
while [ -n "$x" ] && [ "$x" != "$y" ]; do
kv_variant_list="${kv_variant_list} $x"
y=$x
x=${x%.*}
done
local list= x= xx= y= args= mpargs= a=
for x in $kv_variant_list ; do
eval list=\$modules_$(shell_var "$x")
[ -n "$list" ] && break
done
[ -z "$list" ] && list=$modules
[ -n "$list" ] && ebegin "Loading kernel modules"
for x in $list; do
a=${x#*:}
if [ "$a" = "$x" ]; then
unset mpargs
else
x=${x%%:*}
mpargs="-o $a"
fi
aa=$(shell_var "$a")
xx=$(shell_var "$x")
for y in $kv_variant_list ; do
eval args=\$module_${aa}_args_$(shell_var "$y")
[ -n "${args}" ] && break
eval args=\$module_${xx}_args_$(shell_var "$y")
[ -n "${args}" ] && break
done
[ -z "$args" ] && eval args=\$module_${aa}_args
[ -z "$args" ] && eval args=\$module_${xx}_args
eval modprobe --use-blacklist --verbose "$mpargs" "$x" "$args"
done
[ -n "$list" ] && eend
return 0
}

View File

@ -1,59 +0,0 @@
#!/bin/openrc-run
# Copyright (c) 2007-2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
#
# This file is part of OpenRC. 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/OpenRC/openrc/blob/master/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
description="Re-mount filesytems read-only for a clean reboot."
depend()
{
after killprocs
keyword -docker -lxc -openvz -prefix -systemd-nspawn -vserver
}
start()
{
local ret=0
# Flush all pending disk writes now
sync
ebegin "Remounting remaining filesystems read-only"
# We need the do_unmount function
. "$RC_LIBEXECDIR"/sh/rc-mount.sh
eindent
# Bug 381783
local rc_svcdir=$(echo $RC_SVCDIR | sed 's:/lib\(32\|64\)\?/:/lib(32|64)?/:g')
local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|/run|${rc_svcdir}" x= fs=
m="$m|/bin|/sbin|/lib(32|64)?|/libexec"
if [ -e "$rc_svcdir"/usr_premounted ]; then
m="$m|/usr"
fi
# RC_NO_UMOUNTS is an env var that can be set by plugins
local IFS="$IFS:"
for x in $no_umounts $RC_NO_UMOUNTS; do
m="$m|$x"
done
m="^($m)$"
fs=
for x in $net_fs_list $extra_net_fs_list; do
fs="$fs${fs:+|}$x"
done
[ -n "$fs" ] && fs="^($fs)$"
do_unmount "umount -r" \
--skip-point-regex "$m" \
"${fs:+--skip-fstype-regex}" $fs --nonetdev
ret=$?
eoutdent
eend $ret
}

View File

@ -1,24 +0,0 @@
#!/bin/openrc-run
# Copyright (c) 2007-2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
#
# This file is part of OpenRC. 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/OpenRC/openrc/blob/master/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
depend()
{
after clock
before bootmisc logger
keyword -prefix -systemd-nspawn -vserver
}
start()
{
ebegin "Configuring kernel parameters"
sysctl --system
eend $? "Unable to configure some kernel parameters"
}

View File

@ -1,55 +0,0 @@
#!/bin/openrc-run
# Copyright (c) 2008-2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
#
# This file is part of OpenRC. 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/OpenRC/openrc/blob/master/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
description="Configures terminal encoding."
ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
: ${unicode:=${UNICODE}}
depend()
{
keyword -docker -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu
use root
after bootmisc clock
}
start()
{
local ttydev=/dev/tty n=
[ -d /dev/vc ] && ttydev=/dev/vc/
# Set terminal encoding to either ASCII or UNICODE.
# See utf-8(7) for more information.
local termencoding="%@" termmsg="ASCII"
if yesno ${unicode}; then
termencoding="%G"
termmsg="UTF-8"
fi
ebegin "Setting terminal encoding [$termmsg]"
n=1
while [ ${n} -le "$ttyn" ]; do
printf "\033%s" "$termencoding" >$ttydev$n
: $(( n += 1 ))
done
# Save the encoding for use immediately at boot
if checkpath -W "$RC_LIBEXECDIR"; then
mkdir -p "$RC_LIBEXECDIR"/console
if yesno ${unicode:-${UNICODE}}; then
echo "" > "$RC_LIBEXECDIR"/console/unicode
else
rm -f "$RC_LIBEXECDIR"/console/unicode
fi
fi
eend 0
}

View File

@ -1,52 +0,0 @@
#!/bin/openrc-run
# Copyright (c) 2007-2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
#
# This file is part of OpenRC. 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/OpenRC/openrc/blob/master/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
: ${urandom_seed:=${URANDOM_SEED:-/var/lib/misc/random-seed}}
description="Initializes the random number generator."
depend()
{
after clock
keyword -docker -jail -lxc -openvz -prefix -systemd-nspawn
}
save_seed()
{
local psz=1
if [ -e /proc/sys/kernel/random/poolsize ]; then
: $(( psz = $(cat /proc/sys/kernel/random/poolsize) / 4096 ))
fi
( # sub shell to prevent umask pollution
umask 077
dd if=/dev/urandom of="$urandom_seed" count=${psz} 2>/dev/null
)
}
start()
{
[ -c /dev/urandom ] || return
if [ -f "$urandom_seed" ]; then
ebegin "Initializing random number generator"
cat "$urandom_seed" > /dev/urandom
eend $? "Error initializing random number generator"
fi
rm -f "$urandom_seed" && save_seed
return 0
}
stop()
{
ebegin "Saving random seed"
save_seed
eend $? "Failed to save random seed"
}

View File

@ -1,309 +0,0 @@
# Global OpenRC configuration settings
# Set to "YES" if you want the rc system to try and start services
# in parallel for a slight speed improvement. When running in parallel we
# prefix the service output with its name as the output will get
# jumbled up.
# WARNING: whilst we have improved parallel, it can still potentially lock
# the boot process. Don't file bugs about this unless you can supply
# patches that fix it without breaking other things!
#rc_parallel="NO"
# Set rc_interactive to "YES" and you'll be able to press the I key during
# boot so you can choose to start specific services. Set to "NO" to disable
# this feature. This feature is automatically disabled if rc_parallel is
# set to YES.
#rc_interactive="YES"
# If we need to drop to a shell, you can specify it here.
# If not specified we use $SHELL, otherwise the one specified in /etc/passwd,
# otherwise /bin/sh
# Linux users could specify /sbin/sulogin
#rc_shell=/bin/sh
# Do we allow any started service in the runlevel to satisfy the dependency
# or do we want all of them regardless of state? For example, if net.eth0
# and net.eth1 are in the default runlevel then with rc_depend_strict="NO"
# both will be started, but services that depend on 'net' will work if either
# one comes up. With rc_depend_strict="YES" we would require them both to
# come up.
#rc_depend_strict="YES"
# rc_hotplug controls which services we allow to be hotplugged.
# A hotplugged service is one started by a dynamic dev manager when a matching
# hardware device is found.
# Hotplugged services appear in the "hotplugged" runlevel.
# If rc_hotplug is set to any value, we compare the name of this service
# to every pattern in the value, from left to right, and we allow the
# service to be hotplugged if it matches a pattern, or if it matches no
# patterns. Patterns can include shell wildcards.
# To disable services from being hotplugged, prefix patterns with "!".
#If rc_hotplug is not set or is empty, all hotplugging is disabled.
# Example - rc_hotplug="net.wlan !net.*"
# This allows net.wlan and any service not matching net.* to be hotplugged.
# Example - rc_hotplug="!net.*"
# This allows services that do not match "net.*" to be hotplugged.
# rc_logger launches a logging daemon to log the entire rc process to
# /var/log/rc.log
# NOTE: Linux systems require the devfs service to be started before
# logging can take place and as such cannot log the sysinit runlevel.
#rc_logger="NO"
# Through rc_log_path you can specify a custom log file.
# The default value is: /var/log/rc.log
#rc_log_path="/var/log/rc.log"
# If you want verbose output for OpenRC, set this to yes. If you want
# verbose output for service foo only, set it to yes in /etc/conf.d/foo.
#rc_verbose=no
# By default we filter the environment for our running scripts. To allow other
# variables through, add them here. Use a * to allow all variables through.
#rc_env_allow="VAR1 VAR2"
# By default we assume that all daemons will start correctly.
# However, some do not - a classic example is that they fork and return 0 AND
# then child barfs on a configuration error. Or the daemon has a bug and the
# child crashes. You can set the number of milliseconds start-stop-daemon
# waits to check that the daemon is still running after starting here.
# The default is 0 - no checking.
#rc_start_wait=100
# rc_nostop is a list of services which will not stop when changing runlevels.
# This still allows the service itself to be stopped when called directly.
#rc_nostop=""
# rc will attempt to start crashed services by default.
# However, it will not stop them by default as that could bring down other
# critical services.
#rc_crashed_stop=NO
#rc_crashed_start=YES
# Set rc_nocolor to yes if you do not want colors displayed in OpenRC
# output.
#rc_nocolor=NO
##############################################################################
# MISC CONFIGURATION VARIABLES
# There variables are shared between many init scripts
# Set unicode to YES to turn on unicode support for keyboards and screens.
#unicode="NO"
# This is how long fuser should wait for a remote server to respond. The
# default is 60 seconds, but it can be adjusted here.
#rc_fuser_timeout=60
# Below is the default list of network fstypes.
#
# afs ceph cifs coda davfs fuse fuse.sshfs gfs glusterfs lustre ncpfs
# nfs nfs4 ocfs2 shfs smbfs
#
# If you would like to add to this list, you can do so by adding your
# own fstypes to the following variable.
#extra_net_fs_list=""
##############################################################################
# SERVICE CONFIGURATION VARIABLES
# These variables are documented here, but should be configured in
# /etc/conf.d/foo for service foo and NOT enabled here unless you
# really want them to work on a global basis.
# If your service has characters in its name which are not legal in
# shell variable names and you configure the variables for it in this
# file, those characters should be replaced with underscores in the
# variable names as shown below.
# Some daemons are started and stopped via start-stop-daemon.
# We can set some things on a per service basis, like the nicelevel.
#SSD_NICELEVEL="-19"
# Or the ionice level. The format is class[:data] , just like the
# --ionice start-stop-daemon parameter.
#SSD_IONICELEVEL="2:2"
# Pass ulimit parameters
# If you are using bash in POSIX mode for your shell, note that the
# ulimit command uses a block size of 512 bytes for the -c and -f
# options
#rc_ulimit="-u 30"
# It's possible to define extra dependencies for services like so
#rc_config="/etc/foo"
#rc_need="openvpn"
#rc_use="net.eth0"
#rc_after="clock"
#rc_before="local"
#rc_provide="!net"
# You can also enable the above commands here for each service. Below is an
# example for service foo.
#rc_foo_config="/etc/foo"
#rc_foo_need="openvpn"
#rc_foo_after="clock"
# Below is an example for service foo-bar. Note that the '-' is illegal
# in a shell variable name, so we convert it to an underscore.
# example for service foo-bar.
#rc_foo_bar_config="/etc/foo-bar"
#rc_foo_bar_need="openvpn"
#rc_foo_bar_after="clock"
# You can also remove dependencies.
# This is mainly used for saying which services do NOT provide net.
#rc_net_tap0_provide="!net"
# This is the subsystem type.
# It is used to match against keywords set by the keyword call in the
# depend function of service scripts.
#
# It should be set to the value representing the environment this file is
# PRESENTLY in, not the virtualization the environment is capable of.
# If it is commented out, automatic detection will be used.
#
# The list below shows all possible settings as well as the host
# operating systems where they can be used and autodetected.
#
# "" - nothing special
# "docker" - Docker container manager (Linux)
# "jail" - Jail (DragonflyBSD or FreeBSD)
# "lxc" - Linux Containers
# "openvz" - Linux OpenVZ
# "prefix" - Prefix
# "rkt" - CoreOS container management system (Linux)
# "subhurd" - Hurd subhurds (to be checked)
# "systemd-nspawn" - Container created by systemd-nspawn (Linux)
# "uml" - Usermode Linux
# "vserver" - Linux vserver
# "xen0" - Xen0 Domain (Linux and NetBSD)
# "xenU" - XenU Domain (Linux and NetBSD)
#rc_sys=""
# if you use openrc-init, which is currently only available on Linux,
# this is the default runlevel to activate after "sysinit" and "boot"
# when booting.
#rc_default_runlevel="default"
# on Linux and Hurd, this is the number of ttys allocated for logins
# It is used in the consolefont, keymaps, numlock and termencoding
# service scripts.
rc_tty_number=12
##############################################################################
# LINUX CGROUPS RESOURCE MANAGEMENT
# This sets the mode used to mount cgroups.
# "hybrid" mounts cgroups version 2 on /sys/fs/cgroup/unified and
# cgroups version 1 on /sys/fs/cgroup.
# "legacy" mounts cgroups version 1 on /sys/fs/cgroup
# "unified" mounts cgroups version 2 on /sys/fs/cgroup
#rc_cgroup_mode="hybrid"
# This is a list of controllers which should be enabled for cgroups version 2.
# If hybrid mode is being used, controllers listed here will not be
# available for cgroups version 1.
# This is a global setting.
#rc_cgroup_controllers=""
# This variable contains the cgroups version 2 settings for your services.
# If this is set in this file, the settings will apply to all services.
# If you want different settings for each service, place the settings in
# /etc/conf.d/foo for service foo.
# The format is to specify the setting and value followed by a newline.
# Multiple settings and values can be specified.
# For example, you would use this to set the maximum memory and maximum
# number of pids for a service.
#rc_cgroup_settings="
#memory.max 10485760
#pids.max max
#"
#
# For more information about the adjustments that can be made with
# cgroups version 2, see Documentation/cgroups-v2.txt in the linux kernel
# source tree.
#rc_cgroup_settings=""
# This switch controls whether or not cgroups version 1 controllers are
# individually mounted under
# /sys/fs/cgroup in hybrid or legacy mode.
#rc_controller_cgroups="YES"
# The following settings allow you to set up values for the cgroups version 1
# controllers for your services.
# They can be set in this file;, however, if you do this, the settings
# will apply to all of your services.
# If you want different settings for each service, place the settings in
# /etc/conf.d/foo for service foo.
# The format is to specify the names of the settings followed by their
# values. Each variable can hold multiple settings.
# For example, you would use this to set the cpu.shares setting in the
# cpu controller to 512 for your service.
# rc_cgroup_cpu="
# cpu.shares 512
# "
#
# For more information about the adjustments that can be made with
# cgroups version 1, see Documentation/cgroups-v1/* in the linux kernel
# source tree.
# Set the blkio controller settings for this service.
#rc_cgroup_blkio=""
# Set the cpu controller settings for this service.
#rc_cgroup_cpu=""
# Add this service to the cpuacct controller (any value means yes).
#rc_cgroup_cpuacct=""
# Set the cpuset controller settings for this service.
#rc_cgroup_cpuset=""
# Set the devices controller settings for this service.
#rc_cgroup_devices=""
# Set the hugetlb controller settings for this service.
#rc_cgroup_hugetlb=""
# Set the memory controller settings for this service.
#rc_cgroup_memory=""
# Set the net_cls controller settings for this service.
#rc_cgroup_net_cls=""
# Set the net_prio controller settings for this service.
#rc_cgroup_net_prio=""
# Set the pids controller settings for this service.
#rc_cgroup_pids=""
# Set this to YES if you want all of the processes in a service's cgroup
# killed when the service is stopped or restarted.
# Be aware that setting this to yes means all of a service's
# child processes will be killed. Keep this in mind if you set this to
# yes here instead of for the individual services in
# /etc/conf.d/<service>.
# To perform this cleanup manually for a stopped service, you can
# execute cgroup_cleanup with /etc/init.d/<service> cgroup_cleanup or
# rc-service <service> cgroup_cleanup.
# The process followed in this cleanup is the following:
# 1. send stopsig (sigterm if it isn't set) to all processes left in the
# cgroup immediately followed by sigcont.
# 2. Send sighup to all processes in the cgroup if rc_send_sighup is
# yes.
# 3. delay for rc_timeout_stopsec seconds.
# 4. send sigkill to all processes in the cgroup unless disabled by
# setting rc_send_sigkill to no.
# rc_cgroup_cleanup="NO"
# If this is yes, we will send sighup to the processes in the cgroup
# immediately after stopsig and sigcont.
#rc_send_sighup="NO"
# This is the amount of time in seconds that we delay after sending sigcont
# and optionally sighup, before we optionally send sigkill to all
# processes in the # cgroup.
# The default is 90 seconds.
#rc_timeout_stopsec="90"
# If this is set to no, we do not send sigkill to all processes in the
# cgroup.
#rc_send_sigkill="YES"

View File

@ -1 +0,0 @@
/etc/init.d/hostname

View File

@ -1 +0,0 @@
/etc/init.d/hwclock

View File

@ -1 +0,0 @@
/etc/init.d/loopback

View File

@ -1 +0,0 @@
/etc/init.d/modules

View File

@ -1 +0,0 @@
/etc/init.d/sysctl

View File

@ -1 +0,0 @@
/etc/init.d/termencoding

View File

@ -1 +0,0 @@
/etc/init.d/urandom

View File

@ -1 +0,0 @@
/etc/init.d/killprocs

View File

@ -1 +0,0 @@
/etc/init.d/mount-ro

View File

@ -14,7 +14,7 @@ findutils
sed
gawk
shadow
openrc
procps-ng
psmisc
file
init