From 8c696abda1f7539f45fd949f180fdb8d18840dc4 Mon Sep 17 00:00:00 2001 From: root Samara Date: Mon, 7 Dec 2015 22:13:31 +0100 Subject: [PATCH] saving uncommitted changes in /etc prior to emerge run --- ._cfg0000_rc.conf | 236 +++++++++++++++++++++++++++++++++++++++++++++ init.d/binfmt | 2 +- init.d/bootmisc | 9 +- init.d/consolefont | 2 +- init.d/localmount | 24 +++-- init.d/netmount | 5 +- init.d/savecache | 48 +++++---- init.d/sysfs | 2 +- 8 files changed, 290 insertions(+), 38 deletions(-) create mode 100644 ._cfg0000_rc.conf diff --git a/._cfg0000_rc.conf b/._cfg0000_rc.conf new file mode 100644 index 0000000..8eb5286 --- /dev/null +++ b/._cfg0000_rc.conf @@ -0,0 +1,236 @@ +# Global OpenRC configuration settings + +# Set to "YES" if you want the rc system to try and start services +# in parallel for a slight speed improvement. When running in parallel we +# prefix the service output with its name as the output will get +# jumbled up. +# WARNING: whilst we have improved parallel, it can still potentially lock +# the boot process. Don't file bugs about this unless you can supply +# patches that fix it without breaking other things! +#rc_parallel="NO" + +# Set rc_interactive to "YES" and you'll be able to press the I key during +# boot so you can choose to start specific services. Set to "NO" to disable +# this feature. This feature is automatically disabled if rc_parallel is +# set to YES. +#rc_interactive="YES" + +# If we need to drop to a shell, you can specify it here. +# If not specified we use $SHELL, otherwise the one specified in /etc/passwd, +# otherwise /bin/sh +# Linux users could specify /sbin/sulogin +rc_shell=/sbin/sulogin + +# Do we allow any started service in the runlevel to satisfy the dependency +# or do we want all of them regardless of state? For example, if net.eth0 +# and net.eth1 are in the default runlevel then with rc_depend_strict="NO" +# both will be started, but services that depend on 'net' will work if either +# one comes up. With rc_depend_strict="YES" we would require them both to +# come up. +#rc_depend_strict="YES" + +# rc_hotplug is a list of services that we allow to be hotplugged. +# By default we do not allow hotplugging. +# A hotplugged service is one started by a dynamic dev manager when a matching +# hardware device is found. +# This service is intrinsically included in the boot runlevel. +# To disable services, prefix with a ! +# Example - rc_hotplug="net.wlan !net.*" +# This allows net.wlan and any service not matching net.* to be plugged. +# Example - rc_hotplug="*" +# This allows all services to be hotplugged +#rc_hotplug="*" + +# rc_logger launches a logging daemon to log the entire rc process to +# /var/log/rc.log +# NOTE: Linux systems require the devfs service to be started before +# logging can take place and as such cannot log the sysinit runlevel. +#rc_logger="YES" + +# Through rc_log_path you can specify a custom log file. +# The default value is: /var/log/rc.log +#rc_log_path="/var/log/rc.log" + +# If you want verbose output for OpenRC, set this to yes. If you want +# verbose output for service foo only, set it to yes in /etc/conf.d/foo. +#rc_verbose=no + +# By default we filter the environment for our running scripts. To allow other +# variables through, add them here. Use a * to allow all variables through. +#rc_env_allow="VAR1 VAR2" + +# By default we assume that all daemons will start correctly. +# However, some do not - a classic example is that they fork and return 0 AND +# then child barfs on a configuration error. Or the daemon has a bug and the +# child crashes. You can set the number of milliseconds start-stop-daemon +# waits to check that the daemon is still running after starting here. +# The default is 0 - no checking. +#rc_start_wait=100 + +# rc_nostop is a list of services which will not stop when changing runlevels. +# This still allows the service itself to be stopped when called directly. +#rc_nostop="" + +# rc will attempt to start crashed services by default. +# However, it will not stop them by default as that could bring down other +# critical services. +#rc_crashed_stop=NO +#rc_crashed_start=YES + +# Set rc_nocolor to yes if you do not want colors displayed in OpenRC +# output. +#rc_nocolor=NO + +############################################################################## +# MISC CONFIGURATION VARIABLES +# There variables are shared between many init scripts + +# Set unicode to YES to turn on unicode support for keyboards and screens. +unicode="YES" + +# This is how long fuser should wait for a remote server to respond. The +# default is 60 seconds, but it can be adjusted here. +#rc_fuser_timeout=60 + +# Below is the default list of network fstypes. +# +# afs ceph cifs coda davfs fuse fuse.sshfs gfs glusterfs lustre ncpfs +# nfs nfs4 ocfs2 shfs smbfs +# +# If you would like to add to this list, you can do so by adding your +# own fstypes to the following variable. +#extra_net_fs_list="" + +############################################################################## +# SERVICE CONFIGURATION VARIABLES +# These variables are documented here, but should be configured in +# /etc/conf.d/foo for service foo and NOT enabled here unless you +# really want them to work on a global basis. +# If your service has characters in its name which are not legal in +# shell variable names and you configure the variables for it in this +# file, those characters should be replaced with underscores in the +# variable names as shown below. + +# Some daemons are started and stopped via start-stop-daemon. +# We can set some things on a per service basis, like the nicelevel. +#SSD_NICELEVEL="-19" + +# Pass ulimit parameters +# If you are using bash in POSIX mode for your shell, note that the +# ulimit command uses a block size of 512 bytes for the -c and -f +# options +#rc_ulimit="-u 30" + +# It's possible to define extra dependencies for services like so +#rc_config="/etc/foo" +#rc_need="openvpn" +#rc_use="net.eth0" +#rc_after="clock" +#rc_before="local" +#rc_provide="!net" + +# You can also enable the above commands here for each service. Below is an +# example for service foo. +#rc_foo_config="/etc/foo" +#rc_foo_need="openvpn" +#rc_foo_after="clock" + +# Below is an example for service foo-bar. Note that the '-' is illegal +# in a shell variable name, so we convert it to an underscore. +# example for service foo-bar. +#rc_foo_bar_config="/etc/foo-bar" +#rc_foo_bar_need="openvpn" +#rc_foo_bar_after="clock" + +# You can also remove dependencies. +# This is mainly used for saying which servies do NOT provide net. +#rc_net_tap0_provide="!net" + +############################################################################## +# LINUX SPECIFIC OPTIONS + +# This is the subsystem type. Valid options on Linux: +# "" - nothing special +# "lxc" - Linux Containers +# "openvz" - Linux OpenVZ +# "prefix" - Prefix +# "uml" - Usermode Linux +# "vserver" - Linux vserver +# "systemd-nspawn" - Container created by the systemd-nspawn utility +# "xen0" - Xen0 Domain +# "xenU" - XenU Domain +# If this is commented out, automatic detection will be used. +# +# This should be set to the value representing the environment this file is +# PRESENTLY in, not the virtualization the environment is capable of. +#rc_sys="" + +# This is the number of tty's used in most of the rc-scripts (like +# consolefont, numlock, etc ...) +rc_tty_number=12 + +############################################################################## +# CGROUPS RESOURCE MANAGEMENT + +# If you have cgroups turned on in your kernel, this switch controls +# whether or not a group for each controller is mounted under +# /sys/fs/cgroup. +# None of the other options in this section work if this is set to "NO". +#rc_controller_cgroups="YES" + +# The following settings allow you to set up values for the cgroup +# controllers for your services. +# They can be set in this file;, however, if you do this, the settings +# will apply to all of your services. +# If you want different settings for each service, place the settings in +# /etc/conf.d/foo for service foo. +# The format is to specify the names of the settings followed by their +# values. Each variable can hold multiple settings. +# For example, you would use this to set the cpu.shares setting in the +# cpu controller to 512 for your service. +# rc_cgroup_cpu=" +# cpu.shares 512 +# " +# +#For more information about the adjustments that can be made with +#cgroups, see Documentation/cgroups/* in the linux kernel source tree. + +# Set the blkio controller settings for this service. +#rc_cgroup_blkio="" + +# Set the cpu controller settings for this service. +#rc_cgroup_cpu="" + +# Add this service to the cpuacct controller (any value means yes). +#rc_cgroup_cpuacct="" + +# Set the cpuset controller settings for this service. +#rc_cgroup_cpuset="" + +# Set the devices controller settings for this service. +#rc_cgroup_devices="" + +# Set the hugetlb controller settings for this service. +#rc_cgroup_hugetlb="" + +# Set the memory controller settings for this service. +#rc_cgroup_memory="" + +# Set the net_cls controller settings for this service. +#rc_cgroup_net_cls="" + +# Set the net_prio controller settings for this service. +#rc_cgroup_net_prio="" + +# Set the pids controller settings for this service. +#rc_cgroup_pids="" + +# Set this to YES if yu want all of the processes in a service's cgroup +# killed when the service is stopped or restarted. +# This should not be set globally because it kills all of the service's +# child processes, and most of the time this is undesirable. Please set +# it in /etc/conf.d/. +# To perform this cleanup manually for a stopped service, you can +# execute cgroup_cleanup with /etc/init.d/ cgroup_cleanup or +# rc-service cgroup_cleanup. +# rc_cgroup_cleanup="NO" diff --git a/init.d/binfmt b/init.d/binfmt index 057c76f..f1d8791 100755 --- a/init.d/binfmt +++ b/init.d/binfmt @@ -16,5 +16,5 @@ start() ebegin "Loading custom binary format handlers" "$RC_LIBEXECDIR"/sh/binfmt.sh eend $? -return 0 + return 0 } diff --git a/init.d/bootmisc b/init.d/bootmisc index cd9f457..c8c0cf5 100755 --- a/init.d/bootmisc +++ b/init.d/bootmisc @@ -121,11 +121,11 @@ clean_run() local dir # If / is still read-only due to a problem, this will fail! if ! checkpath -W /; then - eerror "/ is not writable; unable to clean up underlying /run" + ewarn "/ is not writable; unable to clean up underlying /run" return 1 fi if ! checkpath -W /tmp; then - eerror "/tmp is not writable; unable to clean up underlying /run" + ewarn "/tmp is not writable; unable to clean up underlying /run" return 1 fi # Now we know that we can modify /tmp and / @@ -136,13 +136,12 @@ clean_run() dir=$(mktemp -d) if [ -n "$dir" -a -d $dir -a -w $dir ]; then mount --bind / $dir && rm -rf $dir/run/* || rc=1 - umount $dir - rm -rf $dir + umount $dir && rmdir $dir else rc=1 fi if [ $rc -ne 0 ]; then - eerror "Could not clean up underlying /run on /" + ewarn "Could not clean up underlying /run on /" return 1 fi } diff --git a/init.d/consolefont b/init.d/consolefont index 5b175a6..a7ad1dd 100755 --- a/init.d/consolefont +++ b/init.d/consolefont @@ -7,7 +7,7 @@ description="Sets a font for the consoles." depend() { need localmount termencoding - after hotplug bootmisc + after hotplug bootmisc modules keyword -openvz -prefix -systemd-nspawn -uml -vserver -xenu -lxc } diff --git a/init.d/localmount b/init.d/localmount index ae9d3cf..ed60049 100755 --- a/init.d/localmount +++ b/init.d/localmount @@ -15,7 +15,7 @@ depend() start() { # Mount local filesystems in /etc/fstab. - local types="noproc" x= no_netdev= + local types="noproc" x= no_netdev= rc= for x in $net_fs_list $extra_net_fs_list; do types="${types},no${x}" done @@ -29,9 +29,11 @@ start() ebegin "Mounting local filesystems" mount -at "$types" $no_netdev eend $? "Some local filesystem failed to mount" - - # Always return 0 - some local mounts may not be critical for boot - return 0 + rc=$? + if [ "$RC_UNAME" != Linux ]; then + rc=0 + fi + return $rc } stop() @@ -70,17 +72,19 @@ stop() sync fi - local aufs_branch aufs_mount_dir aufs_mount_point aufs_si_dir aufs_si_id - for aufs_si_dir in /sys/fs/aufs/*; do - aufs_mount_dir=${aufs_si_dir#/sys/fs/aufs/} - aufs_si_id="$(printf "%s" $aufs_mount_dir | sed 's/_/=/g')" + local aufs_branch aufs_mount_point aufs_si_id aufs_br_id branches + for aufs_si_dir in /sys/fs/aufs/si*; do + [ -d "${aufs_si_dir}" ] || continue + aufs_si_id="si=${aufs_si_dir#/sys/fs/aufs/si_}" aufs_mount_point="$(mountinfo -o ${aufs_si_id})" - for x in $aufs_si_dir/br[0-9][0-9][0-9]; do + branches="$aufs_si_dir/br[0-9] $aufs_si_dir/br[0-9][0-9] $aufs_si_dir/br[0-9][0-9][0-9]" + for x in $branches; do + [ -e "${x}" ] || continue 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" + $aufs_mount_point" fi eoutdent sync diff --git a/init.d/netmount b/init.d/netmount index 7949d68..d8383a1 100755 --- a/init.d/netmount +++ b/init.d/netmount @@ -27,7 +27,10 @@ start() rc=$? fi ewend $rc "Could not mount all network filesystems" - return 0 + if [ "$RC_UNAME" != Linux ]; then + rc=0 + fi + return $rc } stop() diff --git a/init.d/savecache b/init.d/savecache index f3caa0a..9e885e8 100755 --- a/init.d/savecache +++ b/init.d/savecache @@ -7,43 +7,53 @@ description="Saves the caches OpenRC uses to non volatile storage" start() { if [ -e "$RC_SVCDIR"/clock-skewed ]; then - ewarn "WARNING: clock skew detected!" + ewarn "Clock skew detected!" if ! yesno "${RC_GOINGDOWN}"; then eerror "Not saving deptree cache" return 1 fi fi - if ! checkpath -W "$RC_LIBEXECDIR"; then - ewarn "WARNING: ${RC_LIBEXECDIR} is not writable!" - if ! yesno "${RC_GOINGDOWN}"; then - ewarn "Unable to save deptree cache" + if [ ! -d "$RC_LIBEXECDIR"/cache ]; then + if ! checkpath -W "$RC_LIBEXECDIR"; then + eerror "${RC_LIBEXECDIR} is not writable!" + eerror "Unable to save dependency cache" + if yesno "${RC_GOINGDOWN}"; then + return 0 + fi return 1 fi - return 0 - fi - ebegin "Saving dependency cache" - local rc= - if [ ! -d "$RC_LIBEXECDIR"/cache ]; then rm -rf "$RC_LIBEXECDIR"/cache if ! mkdir -p "$RC_LIBEXECDIR"/cache; then - rc=$? + eerror "Unable to create $RC_LIBEXECDIR/cache" + eerror "Unable to save dependency cache" if yesno "${RC_GOINGDOWN}"; then - rc=0 + return 0 fi - eend $rc "Unable to create $RC_SVCDIR/cache" - return $rc + return 1 + fi + fi + if ! checkpath -W "$RC_LIBEXECDIR"/cache; then + eerror "${RC_LIBEXECDIR}/cache is not writable!" + eerror "Unable to save dependency cache" + if yesno "${RC_GOINGDOWN}"; then + return 0 fi + return 1 fi - local save= + ebegin "Saving dependency cache" + local rc=0 save= for x in deptree depconfig shutdowntime softlevel nettree rc.log; do [ -e "$RC_SVCDIR/$x" ] && save="$save $RC_SVCDIR/$x" done if [ -n "$save" ]; then - cp -p $save "$RC_LIBEXECDIR"/cache 2>/dev/null + cp -p $save "$RC_LIBEXECDIR"/cache + rc=$? fi - rc=$? if yesno "${RC_GOINGDOWN}"; then - rc=0 + if [ $rc -ne 0 ]; then + eerror "Unable to save dependency cache" + fi + eend 0 fi - eend $rc + eend $rc "Unable to save dependency cache" } diff --git a/init.d/sysfs b/init.d/sysfs index 5dc62cd..70eaaa9 100755 --- a/init.d/sysfs +++ b/init.d/sysfs @@ -116,7 +116,7 @@ mount_cgroups() mount -n -t cgroup \ -o none,${sysfs_opts},name=openrc,release_agent="$agent" \ openrc /sys/fs/cgroup/openrc - echo 1 > /sys/fs/cgroup/openrc/notify_on_release + printf 1 > /sys/fs/cgroup/openrc/notify_on_release fi yesno ${rc_controller_cgroups:-YES} && [ -e /proc/cgroups ] || return 0 -- 2.39.5