Compare commits
38 Commits
mount-serv
...
0.18.x
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b9570d4c7 | ||
|
|
a94de51c4e | ||
|
|
ffbcabbbb4 | ||
|
|
bc6ab0f8f3 | ||
|
|
248a7dcda3 | ||
|
|
bb451fd7b4 | ||
|
|
fb23cbe204 | ||
|
|
a4346bb7f5 | ||
|
|
776346e2cd | ||
|
|
ce71ffbfbe | ||
|
|
d9ee8ca584 | ||
|
|
4e44e2cd73 | ||
|
|
88b807f9bc | ||
|
|
feba5d86b7 | ||
|
|
3b1e96a6a3 | ||
|
|
79998bdf9c | ||
|
|
050ddfae4a | ||
|
|
d5116cc697 | ||
|
|
b86d170037 | ||
|
|
6fa0d6318b | ||
|
|
80d3928b0d | ||
|
|
17ef205bc6 | ||
|
|
b20a1951ad | ||
|
|
bf0c0dd564 | ||
|
|
1558ad2b9e | ||
|
|
5f4f242036 | ||
|
|
b3f7ff901f | ||
|
|
a59365a582 | ||
|
|
dac5966ca4 | ||
|
|
3b6a6df4b5 | ||
|
|
b047ea47e9 | ||
|
|
b652752339 | ||
|
|
2a439c85bd | ||
|
|
7341cd882f | ||
|
|
279f1e5d10 | ||
|
|
c256a7aa80 | ||
|
|
6a42298257 | ||
|
|
f69833a1e1 |
@@ -1,3 +1,3 @@
|
||||
NAME= openrc
|
||||
VERSION= 0.18
|
||||
VERSION= 0.18.4
|
||||
PKG= ${NAME}-${VERSION}
|
||||
|
||||
34
NEWS.md
34
NEWS.md
@@ -3,6 +3,40 @@
|
||||
This file will contain a list of notable changes for each release. Note
|
||||
the information in this file is in reverse order.
|
||||
|
||||
## OpenRC-0.18.3
|
||||
|
||||
Modern Linux systems expect /etc/mtab to be a symbolic link to
|
||||
/proc/self/mounts. Reasons for this change include support for mount
|
||||
namespaces, which will not work if /etc/mtab is a file.
|
||||
By default, the mtab service enforces this on each reboot.
|
||||
|
||||
If you find that this breaks your system in some way, please do the
|
||||
following:
|
||||
|
||||
- Set mtab_is_file=yes in /etc/conf.d/mtab.
|
||||
|
||||
- Restart mtab. This will recreate the /etc/mtab file.
|
||||
|
||||
- Check for an issue on https://github.com/openrc/openrc/issues
|
||||
explaining why you need /etc/mtab to be a file. If there isn't one,
|
||||
please open one and explain in detail why you need this to be a file.
|
||||
If there is one, please add your comments to it. Please give concrete
|
||||
examples of why it is important that /etc/mtab be a file instead of a
|
||||
symbolic link. Those comments will be taken into consideration for how
|
||||
long to keep supporting mtab as a file or when the support can be
|
||||
removed.
|
||||
|
||||
## OpenRC-0.18
|
||||
|
||||
The behaviour of localmount and netmount in this version is changing. In
|
||||
the past, these services always started successfully. In this version,
|
||||
they will be able to fail if file systems they mount fail to mount. If
|
||||
you have file systems listed in fstab which should not be mounted at
|
||||
boot time, make sure to add noauto to the mount options. If you have
|
||||
file systems that you want to attempt to mount at boot time but failure
|
||||
should be allowed, add nofail to the mount options for these file
|
||||
systems in fstab.
|
||||
|
||||
## OpenRC-0.14
|
||||
|
||||
The binfmt service, which registers misc binary formats with the Linux
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
include ../mk/net.mk
|
||||
|
||||
DIR= ${CONFDIR}
|
||||
CONF= bootmisc fsck hostname localmount mount netmount urandom tmpfiles \
|
||||
CONF= bootmisc fsck hostname localmount netmount urandom tmpfiles \
|
||||
${CONF-${OS}}
|
||||
|
||||
ifeq (${MKNET},yes)
|
||||
@@ -15,7 +15,7 @@ include ${MK}/os.mk
|
||||
|
||||
CONF-FreeBSD= ipfw moused powerd rarpd savecore syscons
|
||||
|
||||
CONF-Linux= consolefont devfs dmesg hwclock keymaps killprocs modules
|
||||
CONF-Linux= consolefont devfs dmesg hwclock keymaps killprocs modules mtab
|
||||
|
||||
CONF-NetBSD= moused rarpd savecore
|
||||
|
||||
|
||||
23
conf.d/mount
23
conf.d/mount
@@ -1,23 +0,0 @@
|
||||
# The mount service is a multiplexed service. This means you must have
|
||||
# symbolic links to it in your init.d directory for each file system you
|
||||
# want to mount. I recommend naming those symbolic links the same as the
|
||||
# paths to the file systems they mount, removing the leading slash and
|
||||
# substituting _ for the remaining slashes, for example:
|
||||
#
|
||||
# cd /etc/init.d
|
||||
# ln -s mount mount.usr
|
||||
# ln -s mount mount.usr_local
|
||||
#
|
||||
# Set up a symbolic link like this for each file system you wish to
|
||||
# mount, then add the symbolic link to the appropriate runlevel. Once
|
||||
# that is done, add the appropriate definitions for the file system to
|
||||
# this file.
|
||||
#
|
||||
#You will need to define the mountpoint and any dependencies for each
|
||||
#filesystem as shown here.
|
||||
#
|
||||
#If the mountpoint does not match an entry in fstab, the mount will be
|
||||
#ignored.
|
||||
#
|
||||
#mount_usr_mountpoint="/usr"
|
||||
#
|
||||
5
conf.d/mtab
Normal file
5
conf.d/mtab
Normal file
@@ -0,0 +1,5 @@
|
||||
# This setting controls whether /etc/mtab is a file or symbolic link.
|
||||
# Most of the time, you shouldn't touch this. However, if the default
|
||||
# breaks your system in some way, please see the NEWS.md file that comes
|
||||
# with OpenRC for the actions to take.
|
||||
# mtab_is_file=no
|
||||
@@ -62,12 +62,21 @@ rc_tty_number=12
|
||||
# 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
|
||||
|
||||
@@ -10,6 +10,6 @@ name="Avahi DNS Configuration Daemon"
|
||||
depend()
|
||||
{
|
||||
use dns
|
||||
need mount.usr mount.var dbus
|
||||
need localmount dbus
|
||||
after bootmisc
|
||||
}
|
||||
|
||||
@@ -10,6 +10,6 @@ name="Avahi Service Advertisement Daemon"
|
||||
depend()
|
||||
{
|
||||
use dns
|
||||
need mount.usr mount.var dbus
|
||||
need localmount dbus
|
||||
after bootmisc
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ name="Message Bus Daemon"
|
||||
|
||||
depend()
|
||||
{
|
||||
need mount.usr mount.var net
|
||||
need localmount net
|
||||
after bootmisc
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ name="DHCP Client Daemon"
|
||||
depend()
|
||||
{
|
||||
provide net
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
use logger
|
||||
after bootmisc modules
|
||||
before dns
|
||||
|
||||
@@ -12,7 +12,7 @@ extra_started_commands="reload"
|
||||
depend()
|
||||
{
|
||||
provide dns
|
||||
need mount.usr mount.var net
|
||||
need localmount net
|
||||
after bootmisc
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ esac
|
||||
depend()
|
||||
{
|
||||
provide dns
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
after bootmisc
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ name="Network Time Protocol Daemon"
|
||||
depend()
|
||||
{
|
||||
use dns
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
after bootmisc ntp-client
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ fi
|
||||
|
||||
depend()
|
||||
{
|
||||
need mount.usr mount.var net
|
||||
need localmount net
|
||||
use dns
|
||||
after bootmisc
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ name="WPA Supplicant Daemon"
|
||||
|
||||
depend()
|
||||
{
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
use logger
|
||||
after bootmisc modules
|
||||
before dns dhcpcd net
|
||||
|
||||
1
init.d/.gitignore
vendored
1
init.d/.gitignore
vendored
@@ -4,7 +4,6 @@ hostname
|
||||
local
|
||||
localmount
|
||||
loopback
|
||||
mount
|
||||
moused
|
||||
netmount
|
||||
network
|
||||
|
||||
@@ -2,7 +2,7 @@ include ../mk/net.mk
|
||||
|
||||
DIR= ${INITDIR}
|
||||
SRCS= bootmisc.in fsck.in hostname.in local.in localmount.in loopback.in \
|
||||
mount.in netmount.in osclock.in root.in savecache.in swap.in swapfiles.in \
|
||||
netmount.in osclock.in root.in savecache.in swap.in swapfiles.in \
|
||||
tmpfiles.setup.in swclock.in sysctl.in urandom.in s6-svscan.in ${SRCS-${OS}}
|
||||
BIN= ${OBJS}
|
||||
|
||||
|
||||
@@ -16,5 +16,5 @@ start()
|
||||
ebegin "Loading custom binary format handlers"
|
||||
"$RC_LIBEXECDIR"/sh/binfmt.sh
|
||||
eend $?
|
||||
return 0
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
depend()
|
||||
{
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
before logger
|
||||
after clock root sysctl
|
||||
keyword -prefix -timeout
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ description="Sets a font for the consoles."
|
||||
|
||||
depend()
|
||||
{
|
||||
need mount.usr mount.var termencoding
|
||||
after hotplug bootmisc
|
||||
need localmount termencoding
|
||||
after hotplug bootmisc modules
|
||||
keyword -openvz -prefix -systemd-nspawn -uml -vserver -xenu -lxc
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ command_args=$devd_args
|
||||
name="Device State Change Daemon"
|
||||
|
||||
depend() {
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
after bootmisc
|
||||
before net.lo0
|
||||
keyword -jail -prefix
|
||||
|
||||
@@ -6,7 +6,7 @@ description="Creates the dev database"
|
||||
|
||||
depend()
|
||||
{
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -6,7 +6,7 @@ description="Applies a keymap for the consoles."
|
||||
|
||||
depend()
|
||||
{
|
||||
need mount.usr mount.var termencoding
|
||||
need localmount termencoding
|
||||
after bootmisc
|
||||
keyword -openvz -prefix -systemd-nspawn -uml -vserver -xenu -lxc
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -6,7 +6,7 @@ extra_commands="restore"
|
||||
|
||||
depend()
|
||||
{
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
|
||||
118
init.d/mount.in
118
init.d/mount.in
@@ -1,118 +0,0 @@
|
||||
#!@SBINDIR@/openrc-run
|
||||
# Copyright (c) 2015 William Hubbs <w.d.hubbs@gmail.com>
|
||||
# Released under the 2-clause BSD license.
|
||||
|
||||
description="Mount a file system defined in @SYSCONFDIR@/fstab"
|
||||
extra_commands="generate"
|
||||
|
||||
depend()
|
||||
{
|
||||
need fsck
|
||||
use modules mtab
|
||||
after modules
|
||||
keyword -jail -prefix -vserver -lxc
|
||||
}
|
||||
|
||||
. "$RC_LIBEXECDIR"/sh/rc-mount.sh
|
||||
|
||||
start_pre()
|
||||
{
|
||||
# Do not start this service as "mount"
|
||||
if [ "$rc_svcname" = mount ]; then
|
||||
eerror "The mount service should not be started directly"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
if [ "$rc_svcname" = mount-generate-symlinks ]; then
|
||||
generate
|
||||
return $?
|
||||
fi
|
||||
|
||||
local mountname=${rc_svcname#*.}
|
||||
local fspath=${mount_${mountname}_mountpoint}
|
||||
|
||||
# for now, make sure fspath is in fstab
|
||||
if [ ! fstabinfo -q $fspath ]; then
|
||||
einfo "$rc_svcname: $fspath is not in @SYSCONFDIR@/fstab"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Is the file system mounted?
|
||||
if mountinfo -q $fspath; then
|
||||
action=remount
|
||||
msg=Remounting
|
||||
else
|
||||
action=mount
|
||||
msg=Mounting
|
||||
fi
|
||||
|
||||
ebegin "$msg $fspath according to @SYSCONFDIR@/fstab"
|
||||
fstabinfo --$action $fspath
|
||||
eend $? "$fspath failed to $action"
|
||||
}
|
||||
|
||||
stop_pre()
|
||||
{
|
||||
# Do not stop this service as "mount"
|
||||
if [ "$rc_svcname" = mount ]; then
|
||||
eerror "The mount service should not be stopped directly"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
yesno $RC_GOINGDOWN || return 0
|
||||
local mountname=${rc_svcname#*.}
|
||||
local fspath=${mount_${mountname}_mountpoint}
|
||||
|
||||
# make sure fspath is in fstab
|
||||
if ! fstabinfo -q $fspath; then
|
||||
einfo "$rc_svcname: $fspath is not in @SYSCONFDIR@/fstab"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Is the file system mounted?
|
||||
mountinfo -q $fspath || return 0
|
||||
|
||||
# Flush all pending disk writes now
|
||||
sync
|
||||
|
||||
ebegin "Unmounting $fspath"
|
||||
do_unmount umount $fspath
|
||||
eend $? "Unable to umount $fspath"
|
||||
return 0
|
||||
}
|
||||
|
||||
generate()
|
||||
{
|
||||
local fslist="$(fstabinfo)"
|
||||
local fs fsopts rc=0
|
||||
local svcpath=${RC_SVCNAME%/*}
|
||||
ebegin "Generating mount symlinks"
|
||||
for fs in $fslist; do
|
||||
case $fs in
|
||||
/) ;;
|
||||
/*)
|
||||
fsopts="$(fstabinfo -o $fs)"
|
||||
case "$fsopts" in
|
||||
*noauto*) ;;
|
||||
*)
|
||||
local name="${fs#/}"
|
||||
name="$(echo $name | sed 's#/#.#g')"
|
||||
einfo ln -snf mount "${svcpath}/${name}"
|
||||
rc=$?
|
||||
[ $rc -ne 0 ] && break
|
||||
*) ;;
|
||||
esac
|
||||
*) ;;
|
||||
esac
|
||||
done
|
||||
eend $rc "Failed to generate symlinks for all mounts"
|
||||
return $rc
|
||||
}
|
||||
@@ -14,7 +14,7 @@ name="Console Mouse Daemon"
|
||||
|
||||
depend()
|
||||
{
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
after bootmisc
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
@@ -12,21 +12,19 @@ depend()
|
||||
|
||||
start()
|
||||
{
|
||||
[ -L /etc/mtab ] && return 0
|
||||
local rc=0
|
||||
ebegin "Updating /etc/mtab"
|
||||
if ! checkpath -W /etc; then
|
||||
rc=1
|
||||
elif [ ! -e /etc/mtab ]; then
|
||||
elif ! yesno ${mtab_is_file:-no}; then
|
||||
[ ! -L /etc/mtab ] && [ -f /etc/mtab ] &&
|
||||
ewarn "Removing /etc/mtab file"
|
||||
einfo "Creating mtab symbolic link"
|
||||
ln -snf /proc/self/mounts /etc/mtab
|
||||
else
|
||||
ewarn "The support for updating /etc/mtab as a file is"
|
||||
ewarn "deprecated and will be removed in the future."
|
||||
ewarn "Please run the following command as root on your system."
|
||||
ewarn
|
||||
ewarn "ln -snf /proc/self/mounts /etc/mtab"
|
||||
ewarn
|
||||
|
||||
[ -L /etc/mtab ] && ewarn "Removing /etc/mtab symbolic link"
|
||||
rm -f /etc/mtab
|
||||
einfo "Creating mtab file"
|
||||
# With / as tmpfs we cannot umount -at tmpfs in localmount as that
|
||||
# makes / readonly and dismounts all tmpfs even if in use which is
|
||||
# not good. Luckily, umount uses /etc/mtab instead of /proc/mounts
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -10,7 +10,7 @@ __nl="
|
||||
|
||||
depend()
|
||||
{
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
after bootmisc
|
||||
if [ -n "$(interfaces)" ]; then
|
||||
provide net
|
||||
|
||||
@@ -6,7 +6,7 @@ required_files="/etc/newsyslog.conf"
|
||||
|
||||
depend()
|
||||
{
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
keyword -prefix
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ name="Name Service Cache Daemon"
|
||||
extra_started_commands="flush"
|
||||
|
||||
depend() {
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
use net dns ldap ypbind
|
||||
after bootmisc
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
|
||||
|
||||
depend()
|
||||
{
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
keyword -openvz -prefix -systemd-nspawn -vserver -lxc
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ extra_commands="checkconfig showstatus"
|
||||
extra_started_commands="reload"
|
||||
|
||||
depend() {
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ name="Power Control Daemon"
|
||||
|
||||
depend()
|
||||
{
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
use logger
|
||||
after bootmisc
|
||||
keyword -jail -prefix
|
||||
|
||||
@@ -7,7 +7,7 @@ description="Mounts misc filesystems in /proc."
|
||||
depend()
|
||||
{
|
||||
use modules devfs
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
keyword -openvz -prefix -systemd-nspawn -vserver -lxc
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ command_background=YES
|
||||
|
||||
depend()
|
||||
{
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
after bootmisc
|
||||
need net
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
depend()
|
||||
{
|
||||
need mount.usr mount.var net
|
||||
need localmount net
|
||||
after *
|
||||
before local
|
||||
keyword -prefix
|
||||
|
||||
@@ -9,7 +9,7 @@ name="RPC program number mapper"
|
||||
depend()
|
||||
{
|
||||
provide rpc
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
use net logger dns
|
||||
before inetd xinetd ntpd ntp-client
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ pidfile=/var/run/s6-svscan.pid
|
||||
|
||||
depend()
|
||||
{
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
}
|
||||
|
||||
start_pre()
|
||||
|
||||
@@ -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_LIBEXECDIR/cache"
|
||||
return $rc
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
local save=
|
||||
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
|
||||
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"
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ description="Saves a kernel dump."
|
||||
|
||||
depend()
|
||||
{
|
||||
need dumpon mount.usr mount.var
|
||||
need dumpon localmount
|
||||
before encswap
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
depend()
|
||||
{
|
||||
before mount.usr mount.var
|
||||
before localmount
|
||||
keyword -jail -openvz -prefix -systemd-nspawn -vserver -lxc
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
depend()
|
||||
{
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
keyword -jail -openvz -prefix -systemd-nspawn -vserver -lxc
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Released under the 2-clause BSD license.
|
||||
|
||||
depend() {
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -14,7 +14,7 @@ depend()
|
||||
{
|
||||
provide logger
|
||||
use net newsyslog
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
after bootmisc
|
||||
keyword -prefix
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ description="Set up tmpfiles.d entries"
|
||||
|
||||
depend()
|
||||
{
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -7,7 +7,7 @@ description="Initializes the random number generator."
|
||||
|
||||
depend()
|
||||
{
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
keyword -jail -lxc -openvz -prefix -systemd-nspawn
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
depend()
|
||||
{
|
||||
need mount.usr mount.var
|
||||
need localmount
|
||||
keyword -prefix
|
||||
}
|
||||
|
||||
|
||||
@@ -487,8 +487,8 @@ _need_dbus()
|
||||
|
||||
depend()
|
||||
{
|
||||
# We write a pidfile and to /var/cache, so we need mount.var.
|
||||
need mount.var
|
||||
# We write a pidfile and to /var/cache, so we need localmount.
|
||||
need localmount
|
||||
# We can optionally use the network, but it's not essential.
|
||||
use net
|
||||
# We should be after bootmisc so that /var/run is cleaned before
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
# New Mount Service
|
||||
|
||||
This is definitely considered testing code, so if you use it on your
|
||||
system and it breaks, you have been warned.
|
||||
|
||||
This document will evolve as the testing proceeds and will be removed
|
||||
once the script goes mainline.
|
||||
|
||||
Since this is on a topic branch, this branch will be subject to
|
||||
rebasing, merging commits, etc. When it goes to master, everything here
|
||||
will be in one commit.
|
||||
|
||||
The goal of this is to replace the localmount and metmount services with
|
||||
a single mount service which will be multiplexed so that there is one
|
||||
service for each file system that will be mounted.
|
||||
|
||||
- rc-service mount generate
|
||||
|
||||
scans your fstab and attempts to generate symbolic links in /etc/init.d
|
||||
for each file system you want to mount.
|
||||
|
||||
Then you must edit /etc/conf.d/mount to list all of your file systems
|
||||
and the dependencies they have by using
|
||||
rc_mount_foo_before/after/need/use settings.
|
||||
|
||||
rc-service mount.foo start
|
||||
|
||||
tries to mount a file system and
|
||||
|
||||
rc-service mount.foo stop
|
||||
|
||||
tries to unmount it if your system is going down.
|
||||
|
||||
I'm considering automating the generation of symlinks into the boot
|
||||
process, but I'm not sure yet whether this is a good idea.
|
||||
|
||||
I haven't decided yet exactly how I want to handle the transition from
|
||||
localmount/netmount to this new mount service yet, so you will
|
||||
definitely not have a clean boot if you try to boot with this.
|
||||
|
||||
Another question is whether I want to try automating adding the mount
|
||||
services to runlevels; I think no, but let me know if you feel
|
||||
differently.
|
||||
|
||||
Any suggestions would be helpful.
|
||||
|
||||
@@ -221,20 +221,22 @@ done
|
||||
# Load our script
|
||||
sourcex "$RC_SERVICE"
|
||||
|
||||
for _d in $required_dirs; do
|
||||
if [ ! -d $_d ]; then
|
||||
eval "printf '%s\n' $required_dirs" | while read _d; do
|
||||
if [ -n "$_d" ] && [ ! -d "$_d" ]; then
|
||||
eerror "$RC_SVCNAME: \`$_d' is not a directory"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
[ $? -ne 0 ] && exit 1
|
||||
unset _d
|
||||
|
||||
for _f in $required_files; do
|
||||
if [ ! -r $_f ]; then
|
||||
eval "printf '%s\n' $required_files" | while read _f; do
|
||||
if [ -n "$_f" ] && [ ! -r "$_f" ]; then
|
||||
eerror "$RC_SVCNAME: \`$_f' is not readable"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
[ $? -ne 0 ] && exit 1
|
||||
unset _f
|
||||
|
||||
if [ -n "$opts" ]; then
|
||||
|
||||
@@ -54,7 +54,9 @@ cgroup_set_values()
|
||||
val=
|
||||
;;
|
||||
*)
|
||||
val="$val $1"
|
||||
[ -n "$val" ] &&
|
||||
val="$val $1" ||
|
||||
val="$1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
@@ -107,12 +109,21 @@ cgroup_set_limits()
|
||||
local devices="${rc_cgroup_devices:-$RC_CGROUP_DEVICES}"
|
||||
[ -n "$devices" ] && cgroup_set_values devices "$devices"
|
||||
|
||||
local hugetlb="${rc_cgroup_hugetlb:-$RC_CGROUP_HUGETLB}"
|
||||
[ -n "$hugetlb" ] && cgroup_set_values hugetlb "$hugetlb"
|
||||
|
||||
local memory="${rc_cgroup_memory:-$RC_CGROUP_MEMORY}"
|
||||
[ -n "$memory" ] && cgroup_set_values memory "$memory"
|
||||
|
||||
local net_cls="${rc_cgroup_net_cls:-$RC_CGROUP_NET_CLS}"
|
||||
[ -n "$net_cls" ] && cgroup_set_values net_cls "$net_cls"
|
||||
|
||||
local net_prio="${rc_cgroup_net_prio:-$RC_CGROUP_NET_PRIO}"
|
||||
[ -n "$net_prio" ] && cgroup_set_values net_prio "$net_prio"
|
||||
|
||||
local pids="${rc_cgroup_pids:-$RC_CGROUP_PIDS}"
|
||||
[ -n "$pids" ] && cgroup_set_values pids "$pids"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,13 @@
|
||||
|
||||
ssd_start()
|
||||
{
|
||||
[ -n "$command" ] || return 0
|
||||
if [ -z "$command" ]; then
|
||||
ewarn "The command variable is undefined."
|
||||
ewarn "There is nothing for ${name:-$RC_SVCNAME} to start."
|
||||
ewarn "If this is what you intend, please write a start function."
|
||||
ewarn "This will become a failure in a future release."
|
||||
return 0
|
||||
fi
|
||||
|
||||
local _background=
|
||||
ebegin "Starting ${name:-$RC_SVCNAME}"
|
||||
|
||||
@@ -53,10 +53,18 @@ relabel() {
|
||||
done
|
||||
}
|
||||
|
||||
splitpath() {
|
||||
local path=$1
|
||||
while [ -n "$path" ]; do
|
||||
echo $path
|
||||
path=${path%/*}
|
||||
done
|
||||
}
|
||||
|
||||
_restorecon() {
|
||||
local path=$1
|
||||
if [ -x /sbin/restorecon ]; then
|
||||
dryrun_or_real restorecon -F "$path"
|
||||
dryrun_or_real restorecon -F $(splitpath "$path")
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -122,6 +130,7 @@ _d() {
|
||||
|
||||
if [ ! -d "$path" ]; then
|
||||
dryrun_or_real mkdir -p "$path" 2>/dev/null
|
||||
_restorecon "$path"
|
||||
dryrun_or_real $CHECKPATH -dq -m "$mode" -o "$uid:$gid" "$path"
|
||||
fi
|
||||
}
|
||||
@@ -137,6 +146,7 @@ _D() {
|
||||
|
||||
if [ $CREATE -gt 0 ]; then
|
||||
dryrun_or_real mkdir -p "$path" 2>/dev/null
|
||||
_restorecon "$path"
|
||||
dryrun_or_real $CHECKPATH -Dq -m "$mode" -o "$uid:$gid" "$path"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ find_mounts(struct args *args)
|
||||
int netdev;
|
||||
RC_STRINGLIST *list;
|
||||
|
||||
if ((fp = fopen("/proc/mounts", "r")) == NULL)
|
||||
if ((fp = fopen("/proc/self/mounts", "r")) == NULL)
|
||||
eerrorx("getmntinfo: %s", strerror(errno));
|
||||
|
||||
list = rc_stringlist_new();
|
||||
@@ -315,6 +315,8 @@ find_mounts(struct args *args)
|
||||
if ((ent = getmntfile(to))) {
|
||||
if (strstr(ent->mnt_opts, "_netdev"))
|
||||
netdev = 0;
|
||||
else
|
||||
netdev = 1;
|
||||
}
|
||||
|
||||
process_mount(list, args, from, to, fst, opts, netdev);
|
||||
@@ -347,7 +349,7 @@ get_regex(const char *string)
|
||||
|
||||
#include "_usage.h"
|
||||
#define extraopts "[mount1] [mount2] ..."
|
||||
#define getoptstring "f:F:n:N:o:O:p:P:ist" getoptstring_COMMON
|
||||
#define getoptstring "f:F:n:N:o:O:p:P:iste:E:" getoptstring_COMMON
|
||||
static const struct option longopts[] = {
|
||||
{ "fstype-regex", 1, NULL, 'f'},
|
||||
{ "skip-fstype-regex", 1, NULL, 'F'},
|
||||
|
||||
@@ -85,8 +85,12 @@ static bool sighup, in_background, deps, dry_run;
|
||||
static pid_t service_pid;
|
||||
static int signal_pipe[2] = { -1, -1 };
|
||||
|
||||
static RC_STRINGLIST *types_b, *types_n, *types_nu, *types_nua, *types_m;
|
||||
static RC_STRINGLIST *types_mua = NULL;
|
||||
static RC_STRINGLIST *deptypes_b;
|
||||
static RC_STRINGLIST *deptypes_n;
|
||||
static RC_STRINGLIST *deptypes_nu;
|
||||
static RC_STRINGLIST *deptypes_nua;
|
||||
static RC_STRINGLIST *deptypes_m;
|
||||
static RC_STRINGLIST *deptypes_mua;
|
||||
|
||||
static void
|
||||
handle_signal(int sig)
|
||||
@@ -231,12 +235,12 @@ cleanup(void)
|
||||
rc_plugin_unload();
|
||||
|
||||
#ifdef DEBUG_MEMORY
|
||||
rc_stringlist_free(types_b);
|
||||
rc_stringlist_free(types_n);
|
||||
rc_stringlist_free(types_nu);
|
||||
rc_stringlist_free(types_nua);
|
||||
rc_stringlist_free(types_m);
|
||||
rc_stringlist_free(types_mua);
|
||||
rc_stringlist_free(deptypes_b);
|
||||
rc_stringlist_free(deptypes_n);
|
||||
rc_stringlist_free(deptypes_nu);
|
||||
rc_stringlist_free(deptypes_nua);
|
||||
rc_stringlist_free(deptypes_m);
|
||||
rc_stringlist_free(deptypes_mua);
|
||||
rc_deptree_free(deptree);
|
||||
rc_stringlist_free(restart_services);
|
||||
rc_stringlist_free(need_services);
|
||||
@@ -518,30 +522,30 @@ get_started_services(void)
|
||||
}
|
||||
|
||||
static void
|
||||
setup_types(void)
|
||||
setup_deptypes(void)
|
||||
{
|
||||
types_b = rc_stringlist_new();
|
||||
rc_stringlist_add(types_b, "broken");
|
||||
deptypes_b = rc_stringlist_new();
|
||||
rc_stringlist_add(deptypes_b, "broken");
|
||||
|
||||
types_n = rc_stringlist_new();
|
||||
rc_stringlist_add(types_n, "ineed");
|
||||
deptypes_n = rc_stringlist_new();
|
||||
rc_stringlist_add(deptypes_n, "ineed");
|
||||
|
||||
types_nu = rc_stringlist_new();
|
||||
rc_stringlist_add(types_nu, "ineed");
|
||||
rc_stringlist_add(types_nu, "iuse");
|
||||
deptypes_nu = rc_stringlist_new();
|
||||
rc_stringlist_add(deptypes_nu, "ineed");
|
||||
rc_stringlist_add(deptypes_nu, "iuse");
|
||||
|
||||
types_nua = rc_stringlist_new();
|
||||
rc_stringlist_add(types_nua, "ineed");
|
||||
rc_stringlist_add(types_nua, "iuse");
|
||||
rc_stringlist_add(types_nua, "iafter");
|
||||
deptypes_nua = rc_stringlist_new();
|
||||
rc_stringlist_add(deptypes_nua, "ineed");
|
||||
rc_stringlist_add(deptypes_nua, "iuse");
|
||||
rc_stringlist_add(deptypes_nua, "iafter");
|
||||
|
||||
types_m = rc_stringlist_new();
|
||||
rc_stringlist_add(types_m, "needsme");
|
||||
deptypes_m = rc_stringlist_new();
|
||||
rc_stringlist_add(deptypes_m, "needsme");
|
||||
|
||||
types_mua = rc_stringlist_new();
|
||||
rc_stringlist_add(types_mua, "needsme");
|
||||
rc_stringlist_add(types_mua, "usesme");
|
||||
rc_stringlist_add(types_mua, "beforeme");
|
||||
deptypes_mua = rc_stringlist_new();
|
||||
rc_stringlist_add(deptypes_mua, "needsme");
|
||||
rc_stringlist_add(deptypes_mua, "usesme");
|
||||
rc_stringlist_add(deptypes_mua, "beforeme");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -604,10 +608,10 @@ svc_start_deps(void)
|
||||
|
||||
if (!deptree && ((deptree = _rc_deptree_load(0, NULL)) == NULL))
|
||||
eerrorx("failed to load deptree");
|
||||
if (!types_b)
|
||||
setup_types();
|
||||
if (!deptypes_b)
|
||||
setup_deptypes();
|
||||
|
||||
services = rc_deptree_depends(deptree, types_b, applet_list,
|
||||
services = rc_deptree_depends(deptree, deptypes_b, applet_list,
|
||||
runlevel, 0);
|
||||
if (TAILQ_FIRST(services)) {
|
||||
eerrorn("ERROR: %s needs service(s) ", applet);
|
||||
@@ -625,9 +629,9 @@ svc_start_deps(void)
|
||||
rc_stringlist_free(services);
|
||||
services = NULL;
|
||||
|
||||
need_services = rc_deptree_depends(deptree, types_n,
|
||||
need_services = rc_deptree_depends(deptree, deptypes_n,
|
||||
applet_list, runlevel, depoptions);
|
||||
use_services = rc_deptree_depends(deptree, types_nu,
|
||||
use_services = rc_deptree_depends(deptree, deptypes_nu,
|
||||
applet_list, runlevel, depoptions);
|
||||
|
||||
if (!rc_runlevel_starting()) {
|
||||
@@ -655,7 +659,7 @@ svc_start_deps(void)
|
||||
return;
|
||||
|
||||
/* Now wait for them to start */
|
||||
services = rc_deptree_depends(deptree, types_nua, applet_list,
|
||||
services = rc_deptree_depends(deptree, deptypes_nua, applet_list,
|
||||
runlevel, depoptions);
|
||||
/* We use tmplist to hold our scheduled by list */
|
||||
tmplist = rc_stringlist_new();
|
||||
@@ -860,10 +864,10 @@ svc_stop_deps(RC_SERVICE state)
|
||||
if (!deptree && ((deptree = _rc_deptree_load(0, NULL)) == NULL))
|
||||
eerrorx("failed to load deptree");
|
||||
|
||||
if (!types_m)
|
||||
setup_types();
|
||||
if (!deptypes_m)
|
||||
setup_deptypes();
|
||||
|
||||
services = rc_deptree_depends(deptree, types_m, applet_list,
|
||||
services = rc_deptree_depends(deptree, deptypes_m, applet_list,
|
||||
runlevel, depoptions);
|
||||
tmplist = rc_stringlist_new();
|
||||
TAILQ_FOREACH_REVERSE(svc, services, rc_stringlist, entries) {
|
||||
@@ -923,7 +927,7 @@ svc_stop_deps(RC_SERVICE state)
|
||||
|
||||
/* We now wait for other services that may use us and are
|
||||
* stopping. This is important when a runlevel stops */
|
||||
services = rc_deptree_depends(deptree, types_mua, applet_list,
|
||||
services = rc_deptree_depends(deptree, deptypes_mua, applet_list,
|
||||
runlevel, depoptions);
|
||||
TAILQ_FOREACH(svc, services, entries) {
|
||||
if (rc_service_state(svc->value) & RC_SERVICE_STOPPED)
|
||||
@@ -939,9 +943,9 @@ svc_stop_real(void)
|
||||
{
|
||||
bool stopped;
|
||||
|
||||
/* If we're stopping mount.*, set LC_ALL=C so that
|
||||
/* If we're stopping localmount, set LC_ALL=C so that
|
||||
* bash doesn't load anything blocking the unmounting of /usr */
|
||||
if (strncmp(applet, "mount.", 6) == 0)
|
||||
if (strcmp(applet, "localmount") == 0)
|
||||
setenv("LC_ALL", "C", 1);
|
||||
|
||||
if (ibsave)
|
||||
|
||||
Reference in New Issue
Block a user