From: root Date: Sat, 7 Jan 2017 13:17:02 +0000 (+0100) Subject: saving uncommitted changes in /etc prior to emerge run X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=7a00f507fef37d12e07ab3f95323bbe154243309;p=config%2Fhelga%2Fetc.git saving uncommitted changes in /etc prior to emerge run --- diff --git a/.etckeeper b/.etckeeper index 42414fb..883774d 100755 --- a/.etckeeper +++ b/.etckeeper @@ -468,6 +468,7 @@ maybe chmod 0644 'conf.d/spamd' maybe chmod 0644 'conf.d/sshd' maybe chmod 0644 'conf.d/staticroute' maybe chmod 0644 'conf.d/svnserve' +maybe chmod 0644 'conf.d/swap' maybe chmod 0644 'conf.d/teamspeak3-server' maybe chmod 0644 'conf.d/tmpfiles' maybe chmod 0644 'conf.d/twistd' @@ -1711,6 +1712,7 @@ maybe chmod 0755 'init.d/rarpd' maybe chmod 0755 'init.d/root' maybe chmod 0755 'init.d/rsyncd' maybe chmod 0755 'init.d/rsyslog' +maybe chmod 0755 'init.d/runsvdir' maybe chmod 0755 'init.d/s6-svscan' maybe chmod 0755 'init.d/samba' maybe chmod 0755 'init.d/saslauthd' diff --git a/conf.d/modules b/conf.d/modules index a062a62..c35b9ed 100644 --- a/conf.d/modules +++ b/conf.d/modules @@ -1,18 +1,22 @@ -# You can define a list modules for a specific kernel version, -# a released kernel version, a main kernel version or just a list. +# 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" -# You can give modules a different name when they load - the new name +# 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" -# Give the modules some arguments if needed, per version if necessary. +# 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" diff --git a/conf.d/net-online b/conf.d/net-online index bf0b09a..aa2c76b 100644 --- a/conf.d/net-online +++ b/conf.d/net-online @@ -1,6 +1,6 @@ # The interfaces setting controls which interfaces the net-online -# service considers in deciding whether the network is active. By -# default, it is all ethernet or wireless LAN interfaces. +# service considers in deciding whether the network is active. The +# default is all interfaces that support ethernet. #interfaces="" # This setting controls whether a ping to the default gateway is diff --git a/conf.d/swap b/conf.d/swap new file mode 100644 index 0000000..17bd034 --- /dev/null +++ b/conf.d/swap @@ -0,0 +1,13 @@ +# If you are only using local swap partitions, you should not change +# this file. Otherwise, you need to uncomment the below rc_before line +# followed by the appropriate rc_need line. +#rc_before="!localmount" +# +# If you are using swap files stored on local file systems, uncomment +# this line. +#rc_need="localmount" +# +# If you are using swap files stored on network file systems or swap +# partitions stored on network block devices such as iSCSI, uncomment +# this line. +#rc_need="netmount" diff --git a/init.d/hostname b/init.d/hostname index 614ac87..474d75a 100755 --- a/init.d/hostname +++ b/init.d/hostname @@ -17,10 +17,20 @@ depend() { start() { - # HOSTNAME variable used to be defined in caps in conf.d/hostname. - # It is also a magic variable in bash. - hostname=${hostname-${HOSTNAME-localhost}} # checkbashisms: false positive - ebegin "Setting hostname to $hostname" - hostname "$hostname" + local h source x + if [ -s /etc/hostname ] && [ -r /etc/hostname ]; then + read h x /dev/null 2>&1; then - ewarn "Failed to remove branch $aufs_branch from aufs \ - $aufs_mount_point" + ewarn "Failed to remove branch $aufs_branch from aufs" \ + "$aufs_mount_point" fi eoutdent sync diff --git a/init.d/loopback b/init.d/loopback index 8608c85..6a0c8a1 100755 --- a/init.d/loopback +++ b/init.d/loopback @@ -21,12 +21,10 @@ 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 + scope host - ip route add 127.0.0.0/8 dev lo scope host + 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 - route add -net 127.0.0.0 netmask 255.0.0.0 gw 127.0.0.1 fi else ebegin "Bringing up network interface lo0" @@ -35,8 +33,3 @@ start() fi eend $? } - -stop() -{ - return 0 -} diff --git a/init.d/modules b/init.d/modules index cea1934..c97bd55 100755 --- a/init.d/modules +++ b/init.d/modules @@ -18,7 +18,18 @@ depend() keyword -docker -lxc -openvz -prefix -systemd-nspawn -vserver } -start() +FreeBSD_modules() +{ + local cnt=0 x + for x in $modules; do + ebegin "Loading module $x" + kldload "$x" + eend $? "Failed to load $x" && : $(( cnt += 1 )) + done + einfo "Autoloaded $cnt module(s)" +} + +Linux_modules() { # Should not fail if kernel do not have module # support compiled in ... @@ -64,8 +75,17 @@ start() done [ -z "$args" ] && eval args=\$module_${aa}_args [ -z "$args" ] && eval args=\$module_${xx}_args - eval modprobe -q "$mpargs" "$x" "$args" + eval modprobe --use-blacklist -q "$mpargs" "$x" "$args" eend $? "Failed to load $x" && : $(( cnt += 1 )) done einfo "Autoloaded $cnt module(s)" } + +start() +{ + case "$RC_UNAME" in + FreeBSD|Linux) ${RC_UNAME}_modules ;; + *) ;; + esac + return 0 +} diff --git a/init.d/modules-load b/init.d/modules-load index 81c457c..b1a010b 100755 --- a/init.d/modules-load +++ b/init.d/modules-load @@ -54,7 +54,7 @@ load_modules() ebegin "Loading module $x" case "$RC_UNAME" in FreeBSD) kldload "$x"; rc=$? ;; - Linux) modprobe -q "$x"; rc=$? ;; + Linux) modprobe --use-blacklist -q "$x"; rc=$? ;; *) ;; esac eend $rc "Failed to load $x" diff --git a/init.d/mount-ro b/init.d/mount-ro index 6c7e70b..3badeac 100755 --- a/init.d/mount-ro +++ b/init.d/mount-ro @@ -34,6 +34,9 @@ start() 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 diff --git a/init.d/net-online b/init.d/net-online index c7031bb..0a1e997 100755 --- a/init.d/net-online +++ b/init.d/net-online @@ -42,8 +42,8 @@ get_default_gateway() start () { - local carriers configured dev gateway ifcount infinite interfaces - local rc state timeout x + local carriers configured dev gateway ifcount infinite + local rc state x ebegin "Checking to see if the network is online" rc=0 diff --git a/init.d/procfs b/init.d/procfs index 3189a37..91be45a 100755 --- a/init.d/procfs +++ b/init.d/procfs @@ -13,7 +13,8 @@ description="Mounts misc filesystems in /proc." depend() { - use modules devfs + use devfs + want modules need localmount keyword -docker -lxc -openvz -prefix -systemd-nspawn -vserver } @@ -21,8 +22,13 @@ depend() start() { # Setup Kernel Support for miscellaneous Binary Formats - if [ -d /proc/sys/fs/binfmt_misc -a ! -e /proc/sys/fs/binfmt_misc/register ]; then - modprobe -q binfmt-misc + if [ -d /proc/sys/fs/binfmt_misc ] && + [ ! -e /proc/sys/fs/binfmt_misc/register ]; then + if ! grep -qs binfmt_misc /proc/filesystems && + modprobe -q binfmt-misc; then + ewarn "The binfmt-misc module needs to be configured in" \ + "/etc/conf.d/modules or built in." + fi if grep -qs binfmt_misc /proc/filesystems; then ebegin "Mounting misc binary format filesystem" mount -t binfmt_misc -o nodev,noexec,nosuid \ diff --git a/init.d/runsvdir b/init.d/runsvdir new file mode 100755 index 0000000..fea196a --- /dev/null +++ b/init.d/runsvdir @@ -0,0 +1,20 @@ +#!/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. + +command=/usr/bin/runsvdir +command_background=yes +pidfile=/var/run/runsvdir.pid +command_args="-P $RC_SVCDIR/sv 'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................'" + +start_pre() +{ + checkpath -m 0755 -o root:root -d ${RC_SVCDIR}/sv +} diff --git a/init.d/savecache b/init.d/savecache index f1877b2..65bc05a 100755 --- a/init.d/savecache +++ b/init.d/savecache @@ -49,7 +49,7 @@ start() fi ebegin "Saving dependency cache" local rc=0 save= - for x in deptree depconfig shutdowntime softlevel rc.log; do + for x in 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 571ce2d..0b0de87 100755 --- a/init.d/swap +++ b/init.d/swap @@ -19,7 +19,6 @@ start() { ebegin "Activating swap devices" case "$RC_UNAME" in - Linux) swapon -a -e >/dev/null;; NetBSD|OpenBSD) swapctl -A -t noblk >/dev/null;; *) swapon -a >/dev/null;; esac @@ -29,12 +28,6 @@ start() stop() { ebegin "Deactivating swap devices" - - # Try to unmount all tmpfs filesystems not in use, else a deadlock may - # occur. As $RC_SVCDIR may also be tmpfs we cd to it to lock it - cd "$RC_SVCDIR" - umount -a -t tmpfs 2>/dev/null - case "$RC_UNAME" in NetBSD|OpenBSD) swapctl -U -t noblk >/dev/null;; *) swapoff -a >/dev/null;; diff --git a/init.d/sysctl b/init.d/sysctl index a49afb5..c27248d 100755 --- a/init.d/sysctl +++ b/init.d/sysctl @@ -15,12 +15,43 @@ depend() keyword -prefix -systemd-nspawn -vserver } -start() +BSD_sysctl() +{ + [ -e /etc/sysctl.conf ] || return 0 + local retval=0 var= comments= conf= + eindent + for conf in /etc/sysctl.conf /etc/sysctl.d/*.conf; do + if [ -r "$conf" ]; then + vebegin "applying $conf" + while read var comments; do + case "$var" in + ""|"#"*) continue;; + esac + sysctl -w "$var" >/dev/null || retval=1 + done < "$conf" + veend $retval + fi + done + eoutdent + return $retval +} + +Linux_sysctl() { local quiet yesno $rc_verbose || quiet=-q - ebegin "Configuring kernel parameters" sysctl ${quiet} --system - eend $? "Unable to configure some kernel parameters" +} + +start() +{ + local rc=0 + + ebegin "Configuring kernel parameters" + case "$RC_UNAME" in + *BSD|GNU) BSD_sysctl; rc=$? ;; + Linux) Linux_sysctl; rc=$? ;; + esac + eend $rc "Unable to configure some kernel parameters" } diff --git a/init.d/sysfs b/init.d/sysfs index ef7a388..81b5c08 100755 --- a/init.d/sysfs +++ b/init.d/sysfs @@ -15,6 +15,7 @@ sysfs_opts=nodev,noexec,nosuid depend() { + want modules keyword -docker -lxc -prefix -systemd-nspawn -vserver } @@ -97,17 +98,23 @@ mount_misc() 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 - if [ -d /sys/firmware/efi/efivars ] \ - && ! mountinfo -q /sys/firmware/efi/efivars; then - modprobe -q efivarfs - if grep -qs efivarfs /proc/filesystems; then - ebegin "Mounting efivarfs filesystem" - mount -n -t efivarfs -o ${sysfs_opts} \ - efivarfs /sys/firmware/efi/efivars - eend $? + # set up kernel support for efivarfs + # The presence of /sys/firmware/efi indicates that the system was + # booted in efi mode. + if [ -d /sys/firmware/efi ]; then + if [ ! -d /sys/firmware/efi/efivars ] && + modprobe -q efivarfs; then + ewarn "The efivarfs module needs to be configured in " \ + "/etc/conf.d/modules or built in" + fi + if [ -d /sys/firmware/efi/efivars ] && + ! mountinfo -q /sys/firmware/efi/efivars; then + if grep -qs efivarfs /proc/filesystems; then + ebegin "Mounting efivarfs filesystem" + mount -n -t efivarfs -o ${sysfs_opts} \ + efivarfs /sys/firmware/efi/efivars + eend $? + fi fi fi } diff --git a/local.d/README b/local.d/README index 352847b..068b7d9 100644 --- a/local.d/README +++ b/local.d/README @@ -8,7 +8,7 @@ service is stopped. All files are processed in lexical order. -Keep in mind that files in this directory are processed sequencially, +Keep in mind that files in this directory are processed sequentially, and the local service is not considered started or stopped until everything is processed, so if you have a process which takes a long time to run, it can delay your boot or shutdown processing.