Compare commits
19 Commits
openrc-0.9
...
openrc-0.9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7644e027fd | ||
|
|
3ad849c5d6 | ||
|
|
f6c27abeb5 | ||
|
|
9175534752 | ||
|
|
c5fb64d61f | ||
|
|
4b63929878 | ||
|
|
29693ecb7a | ||
|
|
930f4021b1 | ||
|
|
bf49e59e3e | ||
|
|
fb485366e6 | ||
|
|
f52dca6984 | ||
|
|
47d305d2af | ||
|
|
95adeb85ba | ||
|
|
0e4d169a40 | ||
|
|
72e31e753d | ||
|
|
645bbf2e0f | ||
|
|
539c4e5872 | ||
|
|
e14e78db16 | ||
|
|
2d180551ef |
@@ -1,3 +1,3 @@
|
||||
NAME= openrc
|
||||
VERSION= 0.9.3
|
||||
VERSION= 0.9.4
|
||||
PKG= ${NAME}-${VERSION}
|
||||
|
||||
@@ -4,3 +4,7 @@ clean_tmp_dirs="/tmp"
|
||||
# Should we wipe the tmp paths completely or just selectively remove known
|
||||
# locks / files / etc... ?
|
||||
wipe_tmp="YES"
|
||||
|
||||
# Write the initial dmesg log into /var/log/dmesg after boot
|
||||
# This may be useful if you need the kernel boot log afterwards
|
||||
log_dmesg="YES"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# This blank configuration will automatically use DHCP for any net.*
|
||||
# scripts in /etc/init.d. To create a more complete configuration,
|
||||
# please review /usr/share/doc/openrc/net.example and save your configuration
|
||||
# please review /usr/share/doc/openrc*/net.example* and save your configuration
|
||||
# in /etc/conf.d/net (this file :]!).
|
||||
|
||||
@@ -16,6 +16,7 @@ dir_writeable()
|
||||
}
|
||||
|
||||
: ${wipe_tmp:=${WIPE_TMP:-yes}}
|
||||
: ${log_dmesg:=${LOG_DMESG:-yes}}
|
||||
|
||||
cleanup_tmp_dir()
|
||||
{
|
||||
@@ -142,11 +143,13 @@ start()
|
||||
fi
|
||||
fi
|
||||
|
||||
if $logw || dir_writeable /var/log; then
|
||||
# Create an 'after-boot' dmesg log
|
||||
if [ "$RC_SYS" != VSERVER -a "$RC_SYS" != OPENVZ ]; then
|
||||
dmesg > /var/log/dmesg
|
||||
chmod 640 /var/log/dmesg
|
||||
if yesno $log_dmesg; then
|
||||
if $logw || dir_writeable /var/log; then
|
||||
# Create an 'after-boot' dmesg log
|
||||
if [ "$RC_SYS" != VSERVER -a "$RC_SYS" != OPENVZ ]; then
|
||||
dmesg > /var/log/dmesg
|
||||
chmod 640 /var/log/dmesg
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -34,8 +34,12 @@ start()
|
||||
stop()
|
||||
{
|
||||
# We never unmount / or /dev or $RC_SVCDIR
|
||||
local x= no_umounts_r="/|/dev|/dev/.*|${RC_SVCDIR}"
|
||||
no_umounts_r="${no_umounts_r}|/bin|/sbin|/lib|/libexec"
|
||||
|
||||
# Bug 381783
|
||||
local rc_svcdir=$(echo $RC_SVCDIR | sed 's:/lib\(32\|64\)\?/:/lib(32|64)?/:g')
|
||||
|
||||
local x= no_umounts_r="/|/dev|/dev/.*|${rc_svcdir}"
|
||||
no_umounts_r="${no_umounts_r}|/bin|/sbin|/lib(32|64)?|/libexec"
|
||||
# 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
|
||||
@@ -69,7 +73,7 @@ stop()
|
||||
done
|
||||
[ -n "$fs" ] && fs="^($fs)$"
|
||||
do_unmount umount --skip-point-regex "$no_umounts_r" \
|
||||
${fs:+--skip-fstype-regex} $fs --nonetdev
|
||||
"${fs:+--skip-fstype-regex}" $fs --nonetdev
|
||||
eoutdent
|
||||
|
||||
return 0
|
||||
|
||||
@@ -19,8 +19,12 @@ start()
|
||||
# We need the do_unmount function
|
||||
. "$RC_LIBEXECDIR"/sh/rc-mount.sh
|
||||
eindent
|
||||
local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|${RC_SVCDIR}" x= fs=
|
||||
m="$m|/bin|/sbin|/lib|/libexec"
|
||||
|
||||
# Bug 381783
|
||||
local rc_svcdir=$(echo $RC_SVCDIR | sed 's:/lib\(32\|64\)\?/:/lib(32|64)?/:g')
|
||||
|
||||
local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|${rc_svcdir}" x= fs=
|
||||
m="$m|/bin|/sbin|/lib(32|64)?|/libexec"
|
||||
# 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
|
||||
@@ -34,7 +38,7 @@ start()
|
||||
[ -n "$fs" ] && fs="^($fs)$"
|
||||
do_unmount "umount -r" \
|
||||
--skip-point-regex "$m" \
|
||||
${fs:+--skip-fstype-regex} $fs --nonetdev
|
||||
"${fs:+--skip-fstype-regex}" $fs --nonetdev
|
||||
eoutdent
|
||||
eend $?
|
||||
}
|
||||
|
||||
@@ -42,6 +42,16 @@ depend()
|
||||
}
|
||||
|
||||
# Support bash arrays - sigh
|
||||
_array_helper()
|
||||
{
|
||||
local _a=
|
||||
|
||||
eval _a=\$$1
|
||||
_a=$(echo "${_a}" | sed -e 's:^[[:space:]]*::' -e 's:[[:space:]]*$::' -e '/^$/d' -e 's:[[:space:]]\{1,\}: :g')
|
||||
|
||||
[ -n "${_a}" ] && printf "%s\n" "${_a}"
|
||||
}
|
||||
|
||||
_get_array()
|
||||
{
|
||||
local _a=
|
||||
@@ -60,10 +70,7 @@ _get_array()
|
||||
esac
|
||||
fi
|
||||
|
||||
eval _a=\$$1
|
||||
printf "%s" "${_a}"
|
||||
printf "\n"
|
||||
[ -n "${_a}" ]
|
||||
_array_helper $1
|
||||
}
|
||||
|
||||
# Flatten bash arrays to simple strings
|
||||
@@ -84,10 +91,7 @@ _flatten_array()
|
||||
esac
|
||||
fi
|
||||
|
||||
eval _a=\$$1
|
||||
printf "%s" "${_a}"
|
||||
printf "\n"
|
||||
[ -n "${_a}" ]
|
||||
_array_helper $1
|
||||
}
|
||||
|
||||
_wait_for_carrier()
|
||||
|
||||
@@ -37,24 +37,24 @@ start()
|
||||
fi
|
||||
fi
|
||||
|
||||
# Setup Kernel Support for the NFS daemon status
|
||||
if [ -d /proc/fs/nfsd ] && ! mountinfo -q /proc/fs/nfsd; then
|
||||
if grep -qs nfsd /proc/filesystems; then
|
||||
ebegin "Mounting NFS filesystem"
|
||||
mount -t nfsd -o nodev,noexec,nosuid \
|
||||
nfsd /proc/fs/nfsd
|
||||
eend $?
|
||||
fi
|
||||
fi
|
||||
|
||||
# Setup Kernel Support for miscellaneous Binary Formats
|
||||
if [ -d /proc/sys/fs/binfmt_misc ] \
|
||||
&& ! mountinfo -q /proc/sys/fs/binfmt_misc; then
|
||||
if [ -d /proc/sys/fs/binfmt_misc -a ! -e /proc/sys/fs/binfmt_misc/register ]; then
|
||||
if grep -qs binfmt_misc /proc/filesystems; then
|
||||
ebegin "Mounting misc binary format filesystem"
|
||||
mount -t binfmt_misc -o nodev,noexec,nosuid \
|
||||
binfmt_misc /proc/sys/fs/binfmt_misc
|
||||
eend $?
|
||||
if eend $? ; then
|
||||
local fmts
|
||||
ebegin "Loading custom binary format handlers"
|
||||
fmts=$(grep -hsv -e '^[#;]' -e '^[[:space:]]*$' \
|
||||
/run/binfmt.d/*.conf \
|
||||
"/etc"/binfmt.d/*.conf \
|
||||
""/usr/lib/binfmt.d/*.conf)
|
||||
if [ -n "${fmts}" ]; then
|
||||
echo "${fmts}" > /proc/sys/fs/binfmt_misc/register
|
||||
fi
|
||||
eend $?
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ arping_address()
|
||||
[ -z "$(_get_inet_address)" ] && opts="${opts} -D"
|
||||
|
||||
foundmac="$(arping -w "${w}" ${opts} -f -I "${IFACE}" "${ip}" 2>/dev/null | \
|
||||
sed -n -e 'y/abcdef/ABCDEF/' -e 's/.*\[\([^]]*\)\].*/\1/p')"
|
||||
sed -n -e 'y/abcdef/ABCDEF/' -e 's/[^[]*\[\([^]]*\)\].*/\1/p')"
|
||||
fi
|
||||
[ -z "${foundmac}" ] && return 1
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ ethtool_pre_start() {
|
||||
[ -z "${args}" ] && continue
|
||||
|
||||
# Split on \n
|
||||
OIFS="${IFS}"
|
||||
local IFS="$__IFS"
|
||||
|
||||
for p in ${args} ; do
|
||||
@@ -38,6 +39,7 @@ ethtool_pre_start() {
|
||||
local args_pretty="$(_trim "${p}")"
|
||||
# Do nothing if empty
|
||||
[ -z "${args_pretty}" ] && continue
|
||||
[ "${opt}" = "ring" ] && opt="set-ring"
|
||||
args_pretty="--${opt} $IFACE ${args_pretty}"
|
||||
args="--${opt} $IFACE ${args}"
|
||||
ebegin "ethtool ${args_pretty}"
|
||||
|
||||
@@ -308,7 +308,11 @@ iproute2_post_stop()
|
||||
einfo "Removing RPDB rules"
|
||||
_ip_rule_runner del "${rules}"
|
||||
fi
|
||||
ip route flush table cache dev "${IFACE}"
|
||||
|
||||
# Only do something if the interface actually exist
|
||||
if _exists; then
|
||||
ip route flush table cache dev "${IFACE}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Don't delete sit0 as it's a special tunnel
|
||||
|
||||
@@ -54,15 +54,18 @@ tuntap_pre_start()
|
||||
do_tunctl=true
|
||||
elif type openvpn >/dev/null 2>&1; then
|
||||
do_openvpn=true
|
||||
else
|
||||
elif type tunctl >/dev/null 2>&1; then
|
||||
do_tunctl=true
|
||||
fi
|
||||
|
||||
if ${do_openvpn}; then
|
||||
openvpn --mktun --dev-type "${tuntap}" --dev "${IFACE}" \
|
||||
${o_opts} >/dev/null
|
||||
else
|
||||
elif ${do_tunctl}; then
|
||||
tunctl ${t_opts} -t "${IFACE}" >/dev/null
|
||||
else
|
||||
eerror "Neither openvpn nor tunctl has been found, please install"
|
||||
eerror "either \"openvpn\" or \"usermode-utilities\"."
|
||||
fi
|
||||
eend $? && _up && service_set_value tuntap "${tuntap}"
|
||||
}
|
||||
|
||||
16
net/vlan.sh
16
net/vlan.sh
@@ -77,7 +77,17 @@ vlan_post_start()
|
||||
eval vegress=\$vlan${vlan}_egress
|
||||
[ -z "${vegress}" ] || vegress="egress-qos-map ${vegress}"
|
||||
|
||||
e="$(ip link add link "${IFACE}" name "${vname}" type vlan id "${vlan}" ${vflags} ${vingress} ${vegress} 2>&1 1>/dev/null)"
|
||||
local txqueuelen=
|
||||
eval txqueuelen=\$txqueuelen_vlan${vlan}
|
||||
local mac=
|
||||
eval mac=\$mac_vlan${vlan}
|
||||
local broadcast=
|
||||
eval broadcast=\$broadcast_vlan${vlan}
|
||||
local mtu=
|
||||
eval mtu=\$mtu_vlan${vlan}
|
||||
local opts="${txqueuelen:+txqueuelen} ${txqueuelen} ${mac:+address} ${mac} ${broadcast:+broadcast} ${broadcast} ${mtu+:mtu} ${mtu}"
|
||||
|
||||
e="$(ip link add link "${IFACE}" name "${vname}" ${opts} type vlan id "${vlan}" ${vflags} ${vingress} ${vegress} 2>&1 1>/dev/null)"
|
||||
if [ -n "${e}" ]; then
|
||||
eend 1 "${e}"
|
||||
continue
|
||||
@@ -101,10 +111,12 @@ vlan_post_start()
|
||||
return 0
|
||||
}
|
||||
|
||||
vlan_post_stop()
|
||||
vlan_pre_stop()
|
||||
{
|
||||
local vlan=
|
||||
|
||||
_exists || return 1
|
||||
|
||||
for vlan in $(_get_vlans); do
|
||||
einfo "Removing VLAN ${vlan##*.} from ${IFACE}"
|
||||
(
|
||||
|
||||
@@ -5,24 +5,6 @@
|
||||
: ${CONSOLE:=/dev/console}
|
||||
: ${RC_LIBEXECDIR:=@LIBEXECDIR@}
|
||||
|
||||
# Mount tmpfs on /run when directory exists.
|
||||
# /run is a new directory for storing volatile runtime data.
|
||||
# Read more about /run at https://lwn.net/Articles/436012
|
||||
if [ -d /run ]; then
|
||||
if mountinfo -q /run; then
|
||||
einfo "/run is already mounted, skipping"
|
||||
else
|
||||
ebegin "Mounting /run"
|
||||
if ! fstabinfo --mount /run; then
|
||||
mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /run
|
||||
fi
|
||||
eend $?
|
||||
fi
|
||||
checkpath -d -m 0775 -o root:uucp /run/lock
|
||||
elif [ -e /run ]; then
|
||||
einfo "Unable to mount /run since it is not a directory"
|
||||
fi
|
||||
|
||||
if [ -e "$RC_LIBEXECDIR"/console/unicode ]; then
|
||||
termencoding="%G"
|
||||
kmode="-u"
|
||||
|
||||
@@ -91,6 +91,24 @@ if $mountproc; then
|
||||
eend $?
|
||||
fi
|
||||
|
||||
# Mount tmpfs on /run when directory exists.
|
||||
# /run is a new directory for storing volatile runtime data.
|
||||
# Read more about /run at https://lwn.net/Articles/436012
|
||||
if [ -d /run ]; then
|
||||
if mountinfo -q /run; then
|
||||
einfo "/run is already mounted, skipping"
|
||||
else
|
||||
ebegin "Mounting /run"
|
||||
if ! fstabinfo --mount /run; then
|
||||
mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /run
|
||||
fi
|
||||
eend $?
|
||||
fi
|
||||
checkpath -d -m 0775 -o root:uucp /run/lock
|
||||
elif [ -e /run ]; then
|
||||
einfo "Unable to mount /run since it is not a directory"
|
||||
fi
|
||||
|
||||
# Try to mount xenfs as early as possible, otherwise rc_sys() will always
|
||||
# return RC_SYS_XENU and will think that we are in a domU while it's not.
|
||||
if grep -Eq "[[:space:]]+xenfs$" /proc/filesystems; then
|
||||
|
||||
@@ -49,8 +49,7 @@ sourcex "@SYSCONFDIR@/init.d/functions.sh"
|
||||
sourcex "@LIBEXECDIR@/sh/rc-functions.sh"
|
||||
|
||||
# Support LiveCD foo
|
||||
if [ -r /sbin/livecd-functions.sh ]; then
|
||||
sourcex "/sbin/livecd-functions.sh"
|
||||
if sourcex -e "/sbin/livecd-functions.sh"; then
|
||||
livecd_read_commandline
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user