]> Frank Brehm's Git Trees - config/bruni/etc.git/commitdiff
saving uncommitted changes in /etc prior to emerge run
authorFrank Brehm <frank@brehm-online.com>
Tue, 22 Nov 2016 00:24:34 +0000 (01:24 +0100)
committerFrank Brehm <root@bruni.home.brehm-online.com>
Tue, 22 Nov 2016 00:24:34 +0000 (01:24 +0100)
17 files changed:
conf.d/net-online
conf.d/swap [new file with mode: 0644]
init.d/hostname
init.d/hwclock
init.d/localmount
init.d/loopback
init.d/modules
init.d/modules-load
init.d/mount-ro
init.d/net-online
init.d/procfs
init.d/runsvdir [new file with mode: 0755]
init.d/savecache
init.d/swap
init.d/sysctl
init.d/sysfs
local.d/README

index bf0b09a265ad0caefd4103745c98d10f63d2b795..aa2c76ba6177c4b0796378ddba26d29c539abd89 100644 (file)
@@ -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 (file)
index 0000000..17bd034
--- /dev/null
@@ -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"
index 614ac87ed6c499c8708d126aee6babf033297c65..474d75affce34afa92fef5cecf6830f9f7615e1d 100755 (executable)
@@ -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 </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
+       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"
 }
index 7db8b7c49feb98b813c0dc0b9fc2ce388ce76204..897f02102525560082b772d7415c099ed3863d30 100755 (executable)
@@ -30,6 +30,7 @@ fi
 depend()
 {
        provide clock
+       want modules
        if yesno $clock_adjfile; then
                use root
        else
@@ -79,9 +80,18 @@ get_noadjfile()
        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=""
+       local retval=0 errstr="" modname
        setupopts
 
        if [ -z "$utc_cmd" ]; then
@@ -91,12 +101,13 @@ start()
 
        ebegin "Setting system clock using the hardware clock [$utc]"
        if [ -e /proc/modules ]; then
-               local rtc=
-               for rtc in /dev/rtc /dev/rtc[0-9]*; do
-                       [ -e "$rtc" ] && break
-               done
-               if [ ! -e "${rtc}" ]; then
-                       modprobe -q rtc-cmos || modprobe -q rtc || modprobe -q genrtc
+               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
 
index 0074e619450272c0d680b195fa4416318f4a11fd..92ddec339be53fef3867d3c24d871e8c77c9ac5d 100755 (executable)
@@ -99,8 +99,8 @@ stop()
                                aufs_branch=$(sed 's/=.*//g' $x)
                                eindent
                                if ! mount -o "remount,del:$aufs_branch" "$aufs_mount_point" > /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
index 8608c8579247e74d06d8d8177e4ab1ad087d8cbe..6a0c8a1437f421d9c4bd449be7e17c813c05bdde 100755 (executable)
@@ -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
-}
index cea1934233df54d9f7cf2995cfc28048d8f2af6f..c97bd55d6781144fd78d4c2c684d106c49d01634 100755 (executable)
@@ -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
+}
index 81c457c8f37e1c43ccc7514d04a198c0b0a49aa2..b1a010b1f558076ea75e874fcaf015373204fb49 100755 (executable)
@@ -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"
index 6c7e70b6854f35f22af3dc259738761dcb70b795..3badeace7c94fef7b99297b21ecd12e348464921 100755 (executable)
@@ -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
index c7031bbce1efafecffd26e207b6dd970f9f95bb7..0a1e9977889b23d749fec54b289a45ac28a49a80 100755 (executable)
@@ -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
index 3189a37f045c553ebaf1cca3fc84b16c7af164a6..91be45a5a9506a61782f3866310f01440508d8bf 100755 (executable)
@@ -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 (executable)
index 0000000..fea196a
--- /dev/null
@@ -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
+}
index f1877b2b0ae86867528961305d09f7428dc0fad1..65bc05a8b32783da1f960e9470f8911a9c4eee6d 100755 (executable)
@@ -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
index 571ce2d3ef920a22e9d2c71608e0a028c5a1404a..0b0de87069d4930ea534dfae865a3cde720c68eb 100755 (executable)
@@ -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;;
index a49afb5136bcf716840b04d4057e5b9e2fb7191f..c27248d565368d8bd4b075e04a56dd0618b23df6 100755 (executable)
@@ -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"
 }
index ef7a388c111f5ebfd3415d11cbe04557139bbaf5..81b5c08aa2e61f2704a93d02a6ebd1165a4f6b9d 100755 (executable)
@@ -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
 }
index 352847b4f01da80516d5d94672506a327be39438..068b7d98882c120273bc2f05c56cef907550b250 100644 (file)
@@ -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.