From 49599fc5738c946bafb3d0604e425a6c21e8f7a1 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 25 Oct 2016 22:25:39 +0200 Subject: [PATCH] saving uncommitted changes in /etc prior to emerge run --- .etckeeper | 2 ++ conf.d/bootmisc | 2 +- conf.d/fsck | 6 ++++ conf.d/localmount | 7 ++++ conf.d/netmount | 7 ++++ init.d/binfmt | 13 ++++++-- init.d/bootmisc | 11 +++++-- init.d/consolefont | 13 ++++++-- init.d/devfs | 13 ++++++-- init.d/dmesg | 13 ++++++-- init.d/fsck | 15 ++++++--- init.d/hostname | 13 ++++++-- init.d/hwclock | 40 ++++++++++++++--------- init.d/keymaps | 13 ++++++-- init.d/killprocs | 13 +++++--- init.d/local | 11 +++++-- init.d/localmount | 26 ++++++++++++--- init.d/loopback | 11 +++++-- init.d/modules | 14 ++++++-- init.d/modules-load | 72 ++++++++++++++++++++++++++++++++++++++++++ init.d/mount-ro | 13 ++++++-- init.d/mtab | 11 +++++-- init.d/net-online | 13 ++++++-- init.d/netmount | 40 ++++++++++++++++++----- init.d/numlock | 13 ++++++-- init.d/osclock | 11 +++++-- init.d/procfs | 13 ++++++-- init.d/root | 13 ++++++-- init.d/s6-svscan | 11 +++++-- init.d/savecache | 13 ++++++-- init.d/swap | 13 ++++++-- init.d/swapfiles | 13 ++++++-- init.d/swclock | 13 ++++++-- init.d/sysctl | 11 +++++-- init.d/sysfs | 22 +++++++++++-- init.d/termencoding | 13 ++++++-- init.d/urandom | 13 ++++++-- pam.d/supervise-daemon | 2 ++ 38 files changed, 458 insertions(+), 108 deletions(-) create mode 100755 init.d/modules-load create mode 100644 pam.d/supervise-daemon diff --git a/.etckeeper b/.etckeeper index 776283b..68a9f58 100755 --- a/.etckeeper +++ b/.etckeeper @@ -1677,6 +1677,7 @@ maybe chmod 0755 'init.d/mit-krb5kadmind' maybe chmod 0755 'init.d/mit-krb5kdc' maybe chmod 0755 'init.d/mit-krb5kpropd' maybe chmod 0755 'init.d/modules' +maybe chmod 0755 'init.d/modules-load' maybe chmod 0755 'init.d/mount-ro' maybe chmod 0755 'init.d/mtab' maybe chmod 0755 'init.d/mysql' @@ -2129,6 +2130,7 @@ maybe chmod 0644 'pam.d/sshd' maybe chmod 0644 'pam.d/start-stop-daemon' maybe chmod 0644 'pam.d/su' maybe chmod 0644 'pam.d/sudo' +maybe chmod 0644 'pam.d/supervise-daemon' maybe chmod 0644 'pam.d/system-auth' maybe chmod 0644 'pam.d/system-local-login' maybe chmod 0644 'pam.d/system-login' diff --git a/conf.d/bootmisc b/conf.d/bootmisc index 5371209..dd5b08e 100644 --- a/conf.d/bootmisc +++ b/conf.d/bootmisc @@ -9,7 +9,7 @@ wipe_tmp="YES" # This may be useful if you need the kernel boot log afterwards log_dmesg="YES" -# Save the previous dmesg log to dmesc.old +# Save the previous dmesg log to dmesg.old # This may be useful if you need to compare the current boot to the # previous one. #previous_dmesg=no diff --git a/conf.d/fsck b/conf.d/fsck index 16aa575..30131ea 100644 --- a/conf.d/fsck +++ b/conf.d/fsck @@ -32,3 +32,9 @@ fsck_on_battery="YES" # This is useful when periodic filesystem checks are causing undesirable # delays at startup, but such delays at shutdown are acceptable. fsck_shutdown="NO" + +# fsck_abort_on_errors can be set to no to cause fsck to not abort on +# errors. +# This is useful when periodic filesystem checks are causing undesirable +# aborts. +fsck_abort_on_errors="YES" diff --git a/conf.d/localmount b/conf.d/localmount index e3361da..e727719 100644 --- a/conf.d/localmount +++ b/conf.d/localmount @@ -1,3 +1,10 @@ # Stop the unmounting of certain points. # This could be useful for some NFS related work. #no_umounts="/dir1:/var/dir2" +# +# Mark certain mount points as critical. +# This contains aspace separated list of mount points which should be +# considered critical. If one of these mount points cannot be mounted, +# localmount will fail. +# By default, this is empty. +#critical_mounts="/home /var" diff --git a/conf.d/netmount b/conf.d/netmount index 53717fc..e759adf 100644 --- a/conf.d/netmount +++ b/conf.d/netmount @@ -38,3 +38,10 @@ # other words, please change it to be more suited to your system. # rc_need="net" +# +# Mark certain mount points as critical. +# This contains aspace separated list of mount points which should be +# considered critical. If one of these mount points cannot be mounted, +# netmount will fail. +# By default, this is empty. +#critical_mounts="/home /var" diff --git a/init.d/binfmt b/init.d/binfmt index f1d8791..e3b1a33 100755 --- a/init.d/binfmt +++ b/init.d/binfmt @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright 2015 William Hubbs -# Released under the 2-clause BSD license. +# Copyright (c) 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="Register misc binary format handlers" @@ -8,7 +15,7 @@ depend() { after procfs use modules devfs - keyword -openvz -prefix -systemd-nspawn -vserver -lxc + keyword -docker -lxc -openvz -prefix -systemd-nspawn -vserver } start() diff --git a/init.d/bootmisc b/init.d/bootmisc index 03f8924..f14793d 100755 --- a/init.d/bootmisc +++ b/init.d/bootmisc @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2009 Roy Marples -# Released under the 2-clause BSD license. +# 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() { diff --git a/init.d/consolefont b/init.d/consolefont index a7ad1dd..63d8601 100755 --- a/init.d/consolefont +++ b/init.d/consolefont @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2009 Roy Marples -# Released under the 2-clause BSD license. +# 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 a font for the consoles." @@ -8,7 +15,7 @@ depend() { need localmount termencoding after hotplug bootmisc modules - keyword -openvz -prefix -systemd-nspawn -uml -vserver -xenu -lxc + keyword -docker -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu } start() diff --git a/init.d/devfs b/init.d/devfs index 294f343..97b1804 100755 --- a/init.d/devfs +++ b/init.d/devfs @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2008 Roy Marples -# Released under the 2-clause BSD license. +# 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="Set up the /dev directory" @@ -8,7 +15,7 @@ depend() { provide dev-mount before dev - keyword -prefix -systemd-nspawn -vserver -lxc + keyword -docker -lxc -prefix -systemd-nspawn -vserver } mount_dev() diff --git a/init.d/dmesg b/init.d/dmesg index be6f774..bf9f4d5 100755 --- a/init.d/dmesg +++ b/init.d/dmesg @@ -1,13 +1,20 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2008 Roy Marples -# Released under the 2-clause BSD license. +# 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="Set the dmesg level for a cleaner boot" depend() { before dev modules - keyword -lxc -prefix -systemd-nspawn -vserver + keyword -docker -lxc -prefix -systemd-nspawn -vserver } start() diff --git a/init.d/fsck b/init.d/fsck index 8f43607..fc892c0 100755 --- a/init.d/fsck +++ b/init.d/fsck @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2009 Roy Marples -# Released under the 2-clause BSD license. +# 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="Check and repair filesystems according to /etc/fstab" _IFS=" @@ -9,11 +16,11 @@ _IFS=" depend() { use dev clock modules - keyword -jail -openvz -prefix -systemd-nspawn -timeout -vserver -lxc -uml + keyword -docker -jail -lxc -openvz -prefix -systemd-nspawn -timeout -vserver -uml } _abort() { - rc-abort + yesno ${fsck_abort_on_errors:-yes} && rc-abort return 1 } diff --git a/init.d/hostname b/init.d/hostname index b6f87b7..614ac87 100755 --- a/init.d/hostname +++ b/init.d/hostname @@ -1,11 +1,18 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2009 Roy Marples -# Released under the 2-clause BSD license. +# 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() { - keyword -prefix -systemd-nspawn -lxc + keyword -docker -lxc -prefix -systemd-nspawn } start() diff --git a/init.d/hwclock b/init.d/hwclock index 6da7f10..7db8b7c 100755 --- a/init.d/hwclock +++ b/init.d/hwclock @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2008 Roy Marples -# Released under the 2-clause BSD license. +# 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" @@ -28,7 +35,7 @@ depend() else before * fi - keyword -openvz -prefix -systemd-nspawn -uml -vserver -xenu -lxc + keyword -docker -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu } setupopts() @@ -62,6 +69,16 @@ _hwclock() 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 +} + start() { local retval=0 errstr="" @@ -84,16 +101,16 @@ start() fi # Always set the kernel's time zone. - _hwclock --systz $utc_cmd $clock_args + _hwclock --systz $utc_cmd $(get_noadjfile) $clock_args : $(( retval += $? )) if [ -e /etc/adjtime ] && yesno $clock_adjfile; then - _hwclock --adjust $utc_cmd + _hwclock --adjust $utc_cmd $(get_noadjfile) : $(( retval += $? )) fi if yesno ${clock_hctosys:-YES}; then - _hwclock --hctosys $utc_cmd $clock_args + _hwclock --hctosys $utc_cmd $(get_noadjfile) $clock_args : $(( retval += $? )) fi @@ -115,14 +132,7 @@ stop() ebegin "Setting hardware clock using the system clock" "[$utc]" - if ! yesno $clock_adjfile; then - # Some implementations don't handle adjustments - if LC_ALL=C hwclock --help 2>&1 | grep -q "\-\-noadjfile"; then - utc_cmd="$utc_cmd --noadjfile" - fi - fi - - _hwclock --systohc $utc_cmd $clock_args + _hwclock --systohc $utc_cmd $(get_noadjfile) $clock_args retval=$? eend $retval "Failed to sync clocks" @@ -137,5 +147,5 @@ save() show() { setupopts - hwclock --show "$utc_cmd" $clock_args + hwclock --show "$utc_cmd" $(get_noadjfile) $clock_args } diff --git a/init.d/keymaps b/init.d/keymaps index 3ab4556..49e41b0 100755 --- a/init.d/keymaps +++ b/init.d/keymaps @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2008 Roy Marples -# Released under the 2-clause BSD license. +# 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="Applies a keymap for the consoles." @@ -8,7 +15,7 @@ depend() { need localmount termencoding after bootmisc - keyword -openvz -prefix -systemd-nspawn -uml -vserver -xenu -lxc + keyword -docker -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu } start() diff --git a/init.d/killprocs b/init.d/killprocs index f07de69..d15cb44 100755 --- a/init.d/killprocs +++ b/init.d/killprocs @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2008 Roy Marples -# Released under the 2-clause BSD license. +# 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." @@ -13,10 +20,8 @@ start() { ebegin "Terminating remaining processes" killall5 -15 ${killall5_opts} - sleep 1 eend 0 ebegin "Killing remaining processes" killall5 -9 ${killall5_opts} - sleep 1 eend 0 } diff --git a/init.d/local b/init.d/local index 31e429e..5130daf 100755 --- a/init.d/local +++ b/init.d/local @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2008 Roy Marples -# Released under the 2-clause BSD license. +# 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="Executes user programs in /etc/local.d" diff --git a/init.d/localmount b/init.d/localmount index ed60049..0074e61 100755 --- a/init.d/localmount +++ b/init.d/localmount @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2009 Roy Marples -# Released under the 2-clause BSD license. +# 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="Mounts disks and swap according to /etc/fstab." @@ -9,13 +16,13 @@ depend() need fsck use lvm modules mtab after lvm modules - keyword -jail -prefix -systemd-nspawn -vserver -lxc + keyword -docker -jail -lxc -prefix -systemd-nspawn -vserver } start() { # Mount local filesystems in /etc/fstab. - local types="noproc" x= no_netdev= rc= + local critical= types="noproc" x= no_netdev= rc= for x in $net_fs_list $extra_net_fs_list; do types="${types},no${x}" done @@ -30,8 +37,17 @@ start() mount -at "$types" $no_netdev eend $? "Some local filesystem failed to mount" rc=$? - if [ "$RC_UNAME" != Linux ]; then + if [ -z "$critical_mounts" ]; then rc=0 + else + for x in ${critical_mounts}; do + fstabinfo -q $x || continue + if ! mountinfo -q $x; then + critical=x + eerror "Failed to mount $x" + fi + done + [ -z "$critical" ] && rc=0 fi return $rc } diff --git a/init.d/loopback b/init.d/loopback index 2b3b092..8608c85 100755 --- a/init.d/loopback +++ b/init.d/loopback @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright (c) 2013 William Hubbs -# Released under the 2-clause BSD license. +# 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." diff --git a/init.d/modules b/init.d/modules index e959236..cea1934 100755 --- a/init.d/modules +++ b/init.d/modules @@ -1,13 +1,21 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2009 Roy Marples -# Released under the 2-clause BSD license. +# 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 - keyword -openvz -prefix -systemd-nspawn -vserver -lxc + want modules-load + keyword -docker -lxc -openvz -prefix -systemd-nspawn -vserver } start() diff --git a/init.d/modules-load b/init.d/modules-load new file mode 100755 index 0000000..81c457c --- /dev/null +++ b/init.d/modules-load @@ -0,0 +1,72 @@ +#!/sbin/openrc-run +# Copyright (c) 2016 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 list of modules from systemd-compatible locations." + +depend() +{ + keyword -docker -lxc -openvz -prefix -systemd-nspawn -vserver +} + +find_modfiles() +{ + local dirs="/usr/lib/modules-load.d /run/modules-load.d /etc/modules-load.d" + local basenames files fn x y + for x in $dirs; do + [ ! -d $x ] && continue + for y in $x/*.conf; do + [ -f $y ] && basenames="${basenames}\n${y##*/}" + done + done + basenames=$(printf "$basenames" | sort -u) + for x in $basenames; do + for y in $dirs; do + [ -r $y/$x ] && + fn=$y/$x + done + files="$files $fn" + done + echo $files +} + +load_modules() +{ + local file m modules rc x + file=$1 + [ -z "$file" ] && return 0 + while read m x; do + case $m in + \;*) continue ;; + \#*) continue ;; + *) modules="$modules $m" + ;; + esac + done < $file + for x in $modules; do + ebegin "Loading module $x" + case "$RC_UNAME" in + FreeBSD) kldload "$x"; rc=$? ;; + Linux) modprobe -q "$x"; rc=$? ;; + *) ;; + esac + eend $rc "Failed to load $x" + done +} + +start() +{ + local x + files=$(find_modfiles) + for x in $files; do + load_modules $x + done + return 0 +} diff --git a/init.d/mount-ro b/init.d/mount-ro index b2f3a53..6c7e70b 100755 --- a/init.d/mount-ro +++ b/init.d/mount-ro @@ -1,13 +1,20 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2009 Roy Marples -# Released under the 2-clause BSD license. +# 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() { need killprocs savecache - keyword -openvz -prefix -systemd-nspawn -vserver -lxc + keyword -docker -lxc -openvz -prefix -systemd-nspawn -vserver } start() diff --git a/init.d/mtab b/init.d/mtab index 4eaea27..9b17525 100755 --- a/init.d/mtab +++ b/init.d/mtab @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2008 Roy Marples -# Released under the 2-clause BSD license. +# 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="Update /etc/mtab to match what the kernel knows about" diff --git a/init.d/net-online b/init.d/net-online index 3ef1481..c7031bb 100755 --- a/init.d/net-online +++ b/init.d/net-online @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright (C) 2015 William Hubbs -# Released under the 2-clause BSD license. +# Copyright (c) 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="Delays until the network is online or a specific timeout" @@ -8,7 +15,7 @@ depend() { after modules need sysfs - keyword -jail -lxc -openvz -prefix -systemd-nspawn -uml -vserver + keyword -docker -jail -lxc -openvz -prefix -systemd-nspawn -uml -vserver } get_interfaces() diff --git a/init.d/netmount b/init.d/netmount index d8383a1..112ac88 100755 --- a/init.d/netmount +++ b/init.d/netmount @@ -1,15 +1,30 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2009 Roy Marples -# Released under the 2-clause BSD license. +# 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="Mounts network shares according to /etc/fstab." depend() { - config /etc/fstab - use afc-client amd nfsclient autofs openvpn + local opts mywant="" + for opts in $(fstabinfo -o -t nfs,nfs4); do + case $opts in + noauto) ;; + *) mywant="$mywant nfsclient"; break ;; + esac + done + config /etc/fstab + want $mywant + use afc-client amd openvpn use dns - keyword -jail -prefix -systemd-nspawn -vserver -lxc + keyword -docker -jail -lxc -prefix -systemd-nspawn -vserver } start() @@ -22,13 +37,22 @@ start() ebegin "Mounting network filesystems" mount -at $fs rc=$? - if [ "$RC_UNAME" = Linux ]; then + if [ "$RC_UNAME" = Linux ] && [ $rc = 0 ]; then mount -a -O _netdev rc=$? fi ewend $rc "Could not mount all network filesystems" - if [ "$RC_UNAME" != Linux ]; then + if [ -z "$critical_mounts" ]; then rc=0 + else + for x in ${critical_mounts}; do + fstabinfo -q $x || continue + if ! mountinfo -q $x; then + critical=x + eerror "Failed to mount $x" + fi + done + [ -z "$critical" ] && rc=0 fi return $rc } @@ -57,7 +81,7 @@ stop() retval=$? eoutdent - if [ "$RC_UNAME" = Linux ]; then + if [ "$RC_UNAME" = Linux ] && [ $retval = 0 ]; then umount -a -O _netdev retval=$? fi diff --git a/init.d/numlock b/init.d/numlock index 2cd61aa..f4fc98b 100755 --- a/init.d/numlock +++ b/init.d/numlock @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2009 Roy Marples -# Released under the 2-clause BSD license. +# 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="Turns numlock on for the consoles." @@ -9,7 +16,7 @@ ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}} depend() { need localmount - keyword -openvz -prefix -systemd-nspawn -vserver -lxc + keyword -docker -lxc -openvz -prefix -systemd-nspawn -vserver } _setleds() diff --git a/init.d/osclock b/init.d/osclock index 486990e..8db43df 100755 --- a/init.d/osclock +++ b/init.d/osclock @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright (c) 2014 Ralph Sennhauser -# Released under the 2-clause BSD license. +# Copyright (c) 2014-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. # Can be used on OSs that take care of the clock. diff --git a/init.d/procfs b/init.d/procfs index 57c0017..3189a37 100755 --- a/init.d/procfs +++ b/init.d/procfs @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2009 Roy Marples -# Released under the 2-clause BSD license. +# 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="Mounts misc filesystems in /proc." @@ -8,7 +15,7 @@ depend() { use modules devfs need localmount - keyword -openvz -prefix -systemd-nspawn -vserver -lxc + keyword -docker -lxc -openvz -prefix -systemd-nspawn -vserver } start() diff --git a/init.d/root b/init.d/root index 550bcf9..36437a0 100755 --- a/init.d/root +++ b/init.d/root @@ -1,13 +1,20 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2009 Roy Marples -# Released under the 2-clause BSD license. +# 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="Mount the root fs read/write" depend() { need fsck - keyword -jail -openvz -prefix -systemd-nspawn -vserver -lxc + keyword -docker -jail -lxc -openvz -prefix -systemd-nspawn -vserver } start() diff --git a/init.d/s6-svscan b/init.d/s6-svscan index f73746c..0e03914 100755 --- a/init.d/s6-svscan +++ b/init.d/s6-svscan @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright (C) 2015 William Hubbs -# Released under the 2-clause BSD license. +# Copyright (c) 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. command=/bin/s6-svscan command_args="${RC_SVCDIR}"/s6-scan diff --git a/init.d/savecache b/init.d/savecache index 9e885e8..f1877b2 100755 --- a/init.d/savecache +++ b/init.d/savecache @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2009 Roy Marples -# Released under the 2-clause BSD license. +# 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="Saves the caches OpenRC uses to non volatile storage" @@ -42,7 +49,7 @@ start() fi ebegin "Saving dependency cache" local rc=0 save= - for x in deptree depconfig shutdowntime softlevel nettree rc.log; do + for x in deptree depconfig shutdowntime softlevel rc.log; do [ -e "$RC_SVCDIR/$x" ] && save="$save $RC_SVCDIR/$x" done if [ -n "$save" ]; then diff --git a/init.d/swap b/init.d/swap index bae812b..571ce2d 100755 --- a/init.d/swap +++ b/init.d/swap @@ -1,11 +1,18 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2009 Roy Marples -# Released under the 2-clause BSD license. +# 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() { before localmount - keyword -jail -openvz -prefix -systemd-nspawn -vserver -lxc + keyword -docker -jail -lxc -openvz -prefix -systemd-nspawn -vserver } start() diff --git a/init.d/swapfiles b/init.d/swapfiles index 5ab4b36..1d86123 100755 --- a/init.d/swapfiles +++ b/init.d/swapfiles @@ -1,11 +1,18 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2009 Roy Marples -# Released under the 2-clause BSD license. +# 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() { need localmount - keyword -jail -openvz -prefix -systemd-nspawn -vserver -lxc + keyword -docker -jail -lxc -openvz -prefix -systemd-nspawn -vserver } start() diff --git a/init.d/swclock b/init.d/swclock index d26621a..9bdef99 100755 --- a/init.d/swclock +++ b/init.d/swclock @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright (c) 2009 Roy Marples -# Released under the 2-clause BSD license. +# Copyright (c) 2009-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 local clock to the mtime of a given file." @@ -8,7 +15,7 @@ depend() { before * provide clock - keyword -openvz -prefix -systemd-nspawn -uml -vserver -xenu -lxc + keyword -docker -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu } # swclock is an OpenRC built in diff --git a/init.d/sysctl b/init.d/sysctl index 5618a1d..a49afb5 100755 --- a/init.d/sysctl +++ b/init.d/sysctl @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2008 Roy Marples -# Released under the 2-clause BSD license. +# 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() { diff --git a/init.d/sysfs b/init.d/sysfs index 24b781e..ef7a388 100755 --- a/init.d/sysfs +++ b/init.d/sysfs @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2009 Roy Marples -# Released under the 2-clause BSD license. +# 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="Mount the sys filesystem." @@ -8,7 +15,7 @@ sysfs_opts=nodev,noexec,nosuid depend() { - keyword -lxc -prefix -systemd-nspawn -vserver + keyword -docker -lxc -prefix -systemd-nspawn -vserver } mount_sys() @@ -81,6 +88,15 @@ mount_misc() fi fi + # Setup Kernel Support for persistent storage + if [ -d /sys/fs/pstore ] && ! mountinfo -q /sys/fs/pstore; then + if grep -qs 'pstore$' /proc/filesystems; then + ebegin "Mounting persistent storage (pstore) filesystem" + mount -t pstore pstore -o ${sysfs_opts} /sys/fs/pstore + eend $? + fi + fi + # setup up kernel support for efivarfs # slightly complicated, as if it's build as a module but NOT yet loaded, # it will NOT appear in /proc/filesystems yet diff --git a/init.d/termencoding b/init.d/termencoding index 85f9df3..b238d8d 100755 --- a/init.d/termencoding +++ b/init.d/termencoding @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright (c) 2008-2009 Roy Marples -# Released under the 2-clause BSD license. +# 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." @@ -9,7 +16,7 @@ ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}} depend() { - keyword -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu + keyword -docker -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu use root after bootmisc } diff --git a/init.d/urandom b/init.d/urandom index d6bb1dd..499feea 100755 --- a/init.d/urandom +++ b/init.d/urandom @@ -1,6 +1,13 @@ #!/sbin/openrc-run -# Copyright (c) 2007-2009 Roy Marples -# Released under the 2-clause BSD license. +# 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." @@ -8,7 +15,7 @@ description="Initializes the random number generator." depend() { need localmount - keyword -jail -lxc -openvz -prefix -systemd-nspawn + keyword -docker -jail -lxc -openvz -prefix -systemd-nspawn } save_seed() diff --git a/pam.d/supervise-daemon b/pam.d/supervise-daemon new file mode 100644 index 0000000..2127f6a --- /dev/null +++ b/pam.d/supervise-daemon @@ -0,0 +1,2 @@ +account required pam_permit.so +session include system-services -- 2.39.5