From: Frank Brehm Date: Tue, 20 Sep 2016 14:24:15 +0000 (+0200) Subject: saving uncommitted changes in /etc prior to emerge run X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=eaab99d8f35944db9a9bf5b0024f1fd74ed05650;p=config%2Fbruni%2Fetc.git saving uncommitted changes in /etc prior to emerge run --- diff --git a/conf.d/bootmisc b/conf.d/bootmisc index 53712097..dd5b08e0 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 16aa5752..30131ea1 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 e3361da3..e7277194 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 53717fcd..e759adf1 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 f1d8791e..e3b1a33b 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 03f89243..f14793db 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 a7ad1dde..63d8601c 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 294f343d..97b1804d 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 be6f7740..bf9f4d55 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 8f43607e..fc892c03 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 b6f87b7e..614ac87e 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 6da7f104..7db8b7c4 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 3ab45562..49e41b0e 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 f07de69c..d15cb443 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 31e429e0..5130dafd 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 ed60049c..0074e619 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 2b3b0922..8608c857 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 e9592365..cea19342 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 00000000..81c457c8 --- /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 b2f3a535..6c7e70b6 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/net-online b/init.d/net-online index 3ef14813..c7031bbc 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 d8383a14..112ac88c 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 2cd61aa5..f4fc98bb 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 486990ed..8db43dfb 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 57c00175..3189a37f 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 550bcf90..36437a04 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 f73746c1..0e03914c 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 9e885e8e..f1877b2b 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 bae812b4..571ce2d3 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 5ab4b36b..1d861238 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 d26621ab..9bdef99d 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 5618a1d3..a49afb51 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 24b781e0..ef7a388c 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 85f9df38..b238d8d8 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 d6bb1dd9..499feea5 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 00000000..2127f6a7 --- /dev/null +++ b/pam.d/supervise-daemon @@ -0,0 +1,2 @@ +account required pam_permit.so +session include system-services