saving uncommitted changes in /etc prior to emerge run
This commit is contained in:
@@ -1,88 +0,0 @@
|
||||
#!/sbin/runscript
|
||||
# $Id$
|
||||
# Copyright 1999-2014 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
alsastatedir=/var/lib/alsa
|
||||
alsascrdir=/etc/alsa.d
|
||||
alsahomedir=/var/run/alsasound
|
||||
|
||||
extra_commands="save restore"
|
||||
|
||||
depend() {
|
||||
need localmount
|
||||
after bootmisc modules isapnp coldplug hotplug
|
||||
}
|
||||
|
||||
restore() {
|
||||
ebegin "Restoring Mixer Levels"
|
||||
|
||||
checkpath -q -d -m 0700 -o root:root ${alsahomedir} || return 1
|
||||
|
||||
if [ ! -r "${alsastatedir}/asound.state" ] ; then
|
||||
ewarn "No mixer config in ${alsastatedir}/asound.state, you have to unmute your card!"
|
||||
eend 0
|
||||
return 0
|
||||
fi
|
||||
|
||||
local cards="$(sed -n -e 's/ *\([[:digit:]]*\) .*/\1/p' /proc/asound/cards)"
|
||||
local CARDNUM
|
||||
for cardnum in ${cards}; do
|
||||
[ -e /dev/snd/controlC${cardnum} ] || sleep 2
|
||||
[ -e /dev/snd/controlC${cardnum} ] || sleep 2
|
||||
[ -e /dev/snd/controlC${cardnum} ] || sleep 2
|
||||
[ -e /dev/snd/controlC${cardnum} ] || sleep 2
|
||||
alsactl -E HOME="${alsahomedir}" -I -f "${alsastatedir}/asound.state" restore ${cardnum} \
|
||||
|| ewarn "Errors while restoring defaults, ignoring"
|
||||
done
|
||||
|
||||
for ossfile in "${alsastatedir}"/oss/card*_pcm* ; do
|
||||
[ -e "${ossfile}" ] || continue
|
||||
# We use cat because I'm not sure if cp works properly on /proc
|
||||
local procfile=${ossfile##${alsastatedir}/oss}
|
||||
procfile="$(echo "${procfile}" | sed -e 's,_,/,g')"
|
||||
if [ -e /proc/asound/"${procfile}"/oss ] ; then
|
||||
cat "${ossfile}" > /proc/asound/"${procfile}"/oss
|
||||
fi
|
||||
done
|
||||
|
||||
eend 0
|
||||
}
|
||||
|
||||
save() {
|
||||
ebegin "Storing ALSA Mixer Levels"
|
||||
|
||||
checkpath -q -d -m 0700 -o root:root ${alsahomedir} || return 1
|
||||
|
||||
mkdir -p "${alsastatedir}"
|
||||
if ! alsactl -E HOME="${alsahomedir}" -f "${alsastatedir}/asound.state" store; then
|
||||
eerror "Error saving levels."
|
||||
eend 1
|
||||
return 1
|
||||
fi
|
||||
|
||||
for ossfile in /proc/asound/card*/pcm*/oss; do
|
||||
[ -e "${ossfile}" ] || continue
|
||||
local device=${ossfile##/proc/asound/} ; device=${device%%/oss}
|
||||
device="$(echo "${device}" | sed -e 's,/,_,g')"
|
||||
mkdir -p "${alsastatedir}/oss/"
|
||||
cp "${ossfile}" "${alsastatedir}/oss/${device}"
|
||||
done
|
||||
|
||||
eend 0
|
||||
}
|
||||
|
||||
start() {
|
||||
if [ "${RESTORE_ON_START}" = "yes" ]; then
|
||||
restore
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
stop() {
|
||||
if [ "${SAVE_ON_STOP}" = "yes" ]; then
|
||||
save
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Id$
|
||||
|
||||
command="/bin/busybox ntpd"
|
||||
command_args="${NTPD_OPTS}"
|
||||
pidfile="/var/run/ntpd.pid"
|
||||
|
||||
depend() {
|
||||
use net dns logger
|
||||
after ntp-client
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2013 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Id$
|
||||
|
||||
command="/bin/busybox watchdog"
|
||||
command_args="${WATCHDOG_OPTS}"
|
||||
pidfile="/var/run/watchdog.pid"
|
||||
@@ -1,335 +0,0 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2015 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Id$
|
||||
|
||||
depend() {
|
||||
before checkfs fsck
|
||||
|
||||
if grep -qs ^swap= "${conf_file}" ; then
|
||||
before swap
|
||||
fi
|
||||
}
|
||||
|
||||
# We support multiple dmcrypt instances based on $SVCNAME
|
||||
conf_file="/etc/conf.d/${SVCNAME}"
|
||||
|
||||
# Get splash helpers if available.
|
||||
if [ -e /sbin/splash-functions.sh ] ; then
|
||||
. /sbin/splash-functions.sh
|
||||
fi
|
||||
|
||||
# Setup mappings for an individual target/swap
|
||||
# Note: This relies on variables localized in the main body below.
|
||||
dm_crypt_execute() {
|
||||
local dev ret mode foo
|
||||
|
||||
if [ -z "${target}" -a -z "${swap}" ] ; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Handle automatic look up of the source path.
|
||||
if [ -z "${source}" -a -n "${loop_file}" ] ; then
|
||||
source=$(losetup --show -f "${loop_file}")
|
||||
fi
|
||||
case ${source} in
|
||||
*=*)
|
||||
source=$(blkid -l -t "${source}" -o device)
|
||||
;;
|
||||
esac
|
||||
if [ -z "${source}" ] || [ ! -e "${source}" ] ; then
|
||||
ewarn "source \"${source}\" for ${target} missing, skipping..."
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -n "${target}" ] ; then
|
||||
# let user set options, otherwise leave empty
|
||||
: ${options:=' '}
|
||||
elif [ -n "${swap}" ] ; then
|
||||
if cryptsetup isLuks ${source} 2>/dev/null ; then
|
||||
ewarn "The swap you have defined is a LUKS partition. Aborting crypt-swap setup."
|
||||
return
|
||||
fi
|
||||
target=${swap}
|
||||
# swap contents do not need to be preserved between boots, luks not required.
|
||||
# suspend2 users should have initramfs's init handling their swap partition either way.
|
||||
: ${options:='-c aes -h sha1 -d /dev/urandom'}
|
||||
: ${pre_mount:='mkswap ${dev}'}
|
||||
fi
|
||||
|
||||
if [ -n "${loop_file}" ] ; then
|
||||
dev="/dev/mapper/${target}"
|
||||
ebegin " Setting up loop device ${source}"
|
||||
losetup ${source} ${loop_file}
|
||||
fi
|
||||
|
||||
# cryptsetup:
|
||||
# open <device> <name> # <device> is $source
|
||||
# create <name> <device> # <name> is $target
|
||||
local arg1="create" arg2="${target}" arg3="${source}"
|
||||
if cryptsetup isLuks ${source} 2>/dev/null ; then
|
||||
arg1="open"
|
||||
arg2="${source}"
|
||||
arg3="${target}"
|
||||
fi
|
||||
|
||||
# Older versions reported:
|
||||
# ${target} is active:
|
||||
# Newer versions report:
|
||||
# ${target} is active[ and is in use.]
|
||||
if cryptsetup status ${target} | egrep -q ' is active' ; then
|
||||
einfo "dm-crypt mapping ${target} is already configured"
|
||||
return
|
||||
fi
|
||||
splash svc_input_begin ${SVCNAME} >/dev/null 2>&1
|
||||
|
||||
# Handle keys
|
||||
if [ -n "${key}" ] ; then
|
||||
read_abort() {
|
||||
# some colors
|
||||
local ans savetty resettty
|
||||
[ -z "${NORMAL}" ] && eval $(eval_ecolors)
|
||||
einfon " $1? (${WARN}yes${NORMAL}/${GOOD}No${NORMAL}) "
|
||||
shift
|
||||
# This is ugly as s**t. But POSIX doesn't provide `read -t`, so
|
||||
# we end up having to implement our own crap with stty/etc...
|
||||
savetty=$(stty -g)
|
||||
resettty='stty ${savetty}; trap - EXIT HUP INT TERM'
|
||||
trap 'eval "${resettty}"' EXIT HUP INT TERM
|
||||
stty -icanon
|
||||
[ "${1}" = -t ] && stty min 0 time "$(( $2 * 10 ))"
|
||||
ans=$(dd count=1 bs=1 2>/dev/null) || ans=''
|
||||
eval "${resettty}"
|
||||
if [ -z "${ans}" ] ; then
|
||||
printf '\r'
|
||||
else
|
||||
echo
|
||||
fi
|
||||
case ${ans} in
|
||||
[yY]) return 0;;
|
||||
*) return 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Notes: sed not used to avoid case where /usr partition is encrypted.
|
||||
mode=${key##*:} && ( [ "${mode}" = "${key}" ] || [ -z "${mode}" ] ) && mode=reg
|
||||
key=${key%:*}
|
||||
case "${mode}" in
|
||||
gpg|reg)
|
||||
# handle key on removable device
|
||||
if [ -n "${remdev}" ] ; then
|
||||
# temp directory to mount removable device
|
||||
local mntrem="${RC_SVCDIR}/dm-crypt-remdev.$$"
|
||||
if [ ! -d "${mntrem}" ] ; then
|
||||
if ! mkdir -p "${mntrem}" ; then
|
||||
ewarn "${source} will not be decrypted ..."
|
||||
einfo "Reason: Unable to create temporary mount point '${mntrem}'"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
i=0
|
||||
einfo "Please insert removable device for ${target}"
|
||||
while [ ${i} -lt ${dmcrypt_max_timeout:-120} ] ; do
|
||||
foo=""
|
||||
if mount -n -o ro "${remdev}" "${mntrem}" 2>/dev/null >/dev/null ; then
|
||||
# keyfile exists?
|
||||
if [ ! -e "${mntrem}${key}" ] ; then
|
||||
umount -n "${mntrem}"
|
||||
rmdir "${mntrem}"
|
||||
einfo "Cannot find ${key} on removable media."
|
||||
read_abort "Abort" ${read_timeout:--t 1} && return
|
||||
else
|
||||
key="${mntrem}${key}"
|
||||
break
|
||||
fi
|
||||
else
|
||||
[ -e "${remdev}" ] \
|
||||
&& foo="mount failed" \
|
||||
|| foo="mount source not found"
|
||||
fi
|
||||
: $((i += 1))
|
||||
read_abort "Stop waiting after $i attempts (${foo})" -t 1 && return
|
||||
done
|
||||
else # keyfile ! on removable device
|
||||
if [ ! -e "${key}" ] ; then
|
||||
ewarn "${source} will not be decrypted ..."
|
||||
einfo "Reason: keyfile ${key} does not exist."
|
||||
return
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
ewarn "${source} will not be decrypted ..."
|
||||
einfo "Reason: mode ${mode} is invalid."
|
||||
return
|
||||
;;
|
||||
esac
|
||||
else
|
||||
mode=none
|
||||
fi
|
||||
ebegin " ${target} using: ${options} ${arg1} ${arg2} ${arg3}"
|
||||
if [ "${mode}" = "gpg" ] ; then
|
||||
: ${gpg_options:='-q -d'}
|
||||
# gpg available ?
|
||||
if command -v gpg >/dev/null ; then
|
||||
for i in 0 1 2 ; do
|
||||
# paranoid, don't store key in a variable, pipe it so it stays very little in ram unprotected.
|
||||
# save stdin stdout stderr "values"
|
||||
gpg ${gpg_options} ${key} 2>/dev/null | cryptsetup --key-file - ${options} ${arg1} ${arg2} ${arg3}
|
||||
ret=$?
|
||||
[ ${ret} -eq 0 ] && break
|
||||
done
|
||||
eend ${ret} "failure running cryptsetup"
|
||||
else
|
||||
ewarn "${source} will not be decrypted ..."
|
||||
einfo "Reason: cannot find gpg application."
|
||||
einfo "You have to install app-crypt/gnupg first."
|
||||
einfo "If you have /usr on its own partition, try copying gpg to /bin ."
|
||||
fi
|
||||
else
|
||||
if [ "${mode}" = "reg" ] ; then
|
||||
cryptsetup ${options} -d ${key} ${arg1} ${arg2} ${arg3}
|
||||
ret=$?
|
||||
eend ${ret} "failure running cryptsetup"
|
||||
else
|
||||
cryptsetup ${options} ${arg1} ${arg2} ${arg3}
|
||||
ret=$?
|
||||
eend ${ret} "failure running cryptsetup"
|
||||
fi
|
||||
fi
|
||||
if [ -d "${mntrem}" ] ; then
|
||||
umount -n ${mntrem} 2>/dev/null >/dev/null
|
||||
rmdir ${mntrem} 2>/dev/null >/dev/null
|
||||
fi
|
||||
splash svc_input_end ${SVCNAME} >/dev/null 2>&1
|
||||
|
||||
if [ ${ret} -ne 0 ] ; then
|
||||
cryptfs_status=1
|
||||
else
|
||||
if [ -n "${pre_mount}" ] ; then
|
||||
dev="/dev/mapper/${target}"
|
||||
eval ebegin \"" pre_mount: ${pre_mount}"\"
|
||||
eval "${pre_mount}" > /dev/null
|
||||
ewend $? || cryptfs_status=1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Lookup optional bootparams
|
||||
get_bootparam_val() {
|
||||
# We're given something like:
|
||||
# foo=bar=cow
|
||||
# Return the "bar=cow" part.
|
||||
case $1 in
|
||||
*\=*)
|
||||
local key=$(echo "$1" | cut -f1 -d=)
|
||||
echo "$1" | cut -c $(( ${#key} + 2 ))
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
start() {
|
||||
local header=true cryptfs_status=0
|
||||
local gpg_options key loop_file target targetline options pre_mount post_mount source swap remdev
|
||||
|
||||
local x
|
||||
for x in $(cat /proc/cmdline) ; do
|
||||
case "${x}" in
|
||||
key_timeout\=*)
|
||||
local KEY_TIMEOUT=$(get_bootparam_val "${x}")
|
||||
if [ ${KEY_TIMEOUT} -gt 0 ] ; then
|
||||
read_timeout="-t ${KEY_TIMEOUT}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
while read targetline <&3 ; do
|
||||
case ${targetline} in
|
||||
# skip comments and blank lines
|
||||
""|"#"*) continue ;;
|
||||
# skip service-specific openrc configs #377927
|
||||
rc_*) continue ;;
|
||||
esac
|
||||
|
||||
${header} && ebegin "Setting up dm-crypt mappings"
|
||||
header=false
|
||||
|
||||
# check for the start of a new target/swap
|
||||
case ${targetline} in
|
||||
target=*|swap=*)
|
||||
# If we have a target queued up, then execute it
|
||||
dm_crypt_execute
|
||||
|
||||
# Prepare for the next target/swap by resetting variables
|
||||
unset gpg_options key loop_file target options pre_mount post_mount source swap remdev
|
||||
;;
|
||||
|
||||
gpg_options=*|remdev=*|key=*|loop_file=*|options=*|pre_mount=*|post_mount=*|source=*)
|
||||
if [ -z "${target}${swap}" ] ; then
|
||||
ewarn "Ignoring setting outside target/swap section: ${targetline}"
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
|
||||
dmcrypt_max_timeout=*)
|
||||
# ignore global options
|
||||
continue
|
||||
;;
|
||||
|
||||
*)
|
||||
ewarn "Skipping invalid line in ${conf_file}: ${targetline}"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Queue this setting for the next call to dm_crypt_execute
|
||||
eval "${targetline}"
|
||||
done 3< ${conf_file}
|
||||
|
||||
# If we have a target queued up, then execute it
|
||||
dm_crypt_execute
|
||||
|
||||
ewend ${cryptfs_status} "Failed to setup dm-crypt devices"
|
||||
}
|
||||
|
||||
stop() {
|
||||
local line header
|
||||
|
||||
# Break down all mappings
|
||||
header=true
|
||||
egrep "^(target|swap)=" ${conf_file} | \
|
||||
while read line ; do
|
||||
${header} && einfo "Removing dm-crypt mappings"
|
||||
header=false
|
||||
|
||||
target= swap=
|
||||
eval ${line}
|
||||
|
||||
[ -n "${swap}" ] && target=${swap}
|
||||
if [ -z "${target}" ] ; then
|
||||
ewarn "invalid line in ${conf_file}: ${line}"
|
||||
continue
|
||||
fi
|
||||
|
||||
ebegin " ${target}"
|
||||
cryptsetup remove ${target}
|
||||
eend $?
|
||||
done
|
||||
|
||||
# Break down loop devices
|
||||
header=true
|
||||
grep '^source=./dev/loop' ${conf_file} | \
|
||||
while read line ; do
|
||||
${header} && einfo "Detaching dm-crypt loop devices"
|
||||
header=false
|
||||
|
||||
source=
|
||||
eval ${line}
|
||||
|
||||
ebegin " ${source}"
|
||||
losetup -d "${source}"
|
||||
eend $?
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2013 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
DOCKER_LOGFILE=${DOCKER_LOGFILE:-/var/log/${SVCNAME}.log}
|
||||
DOCKER_PIDFILE=${DOCKER_PIDFILE:-/run/${SVCNAME}.pid}
|
||||
DOCKER_BINARY=${DOCKER_BINARY:-/usr/bin/docker}
|
||||
DOCKER_OPTS=${DOCKER_OPTS:-}
|
||||
|
||||
start() {
|
||||
checkpath -f -m 0644 -o root:docker "$DOCKER_LOGFILE"
|
||||
|
||||
ulimit -n 1048576
|
||||
ulimit -u 1048576
|
||||
|
||||
ebegin "Starting docker daemon"
|
||||
start-stop-daemon --start --background \
|
||||
--exec "$DOCKER_BINARY" \
|
||||
--pidfile "$DOCKER_PIDFILE" \
|
||||
--stdout "$DOCKER_LOGFILE" \
|
||||
--stderr "$DOCKER_LOGFILE" \
|
||||
-- daemon -p "$DOCKER_PIDFILE" \
|
||||
$DOCKER_OPTS
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping docker daemon"
|
||||
start-stop-daemon --stop \
|
||||
--exec "$DOCKER_BINARY" \
|
||||
--pidfile "$DOCKER_PIDFILE"
|
||||
eend $?
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Id$
|
||||
|
||||
#NB: Config is in /etc/conf.d/gpm
|
||||
|
||||
command=/usr/sbin/gpm
|
||||
command_args="
|
||||
-m ${MOUSEDEV}
|
||||
-t ${MOUSE}
|
||||
${RESPONSIVENESS:+ -r ${RESPONSIVENESS}}
|
||||
${REPEAT_TYPE:+ -R${REPEAT_TYPE}}
|
||||
${APPEND}
|
||||
"
|
||||
|
||||
pidfile=/var/run/gpm.pid
|
||||
|
||||
depend() {
|
||||
need localmount
|
||||
use hotplug logger
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
if [ -z "${MOUSEDEV}" ] || [ -z "${MOUSE}" ] ; then
|
||||
eerror "You need to setup MOUSEDEV and MOUSE in /etc/conf.d/gpm first"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2013 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Id$
|
||||
|
||||
extra_commands="configtest"
|
||||
extra_started_commands="upgrade reload"
|
||||
|
||||
description="Robust, small and high performance http and reverse proxy server"
|
||||
description_configtest="Run nginx' internal config check."
|
||||
description_upgrade="Upgrade the nginx binary without losing connections."
|
||||
description_reload="Reload the nginx configuration without losing connections."
|
||||
|
||||
nginx_config=${nginx_config:-/etc/nginx/nginx.conf}
|
||||
|
||||
command="/usr/sbin/nginx"
|
||||
command_args="-c ${nginx_config}"
|
||||
pidfile=${pidfile:-/run/nginx.pid}
|
||||
user=${user:-nginx}
|
||||
group=${group:-nginx}
|
||||
|
||||
depend() {
|
||||
need net
|
||||
use dns logger netmount
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
if [ "${RC_CMD}" != "restart" ]; then
|
||||
configtest || return 1
|
||||
fi
|
||||
}
|
||||
|
||||
stop_pre() {
|
||||
if [ "${RC_CMD}" = "restart" ]; then
|
||||
configtest || return 1
|
||||
fi
|
||||
}
|
||||
|
||||
stop_post() {
|
||||
rm -f ${pidfile}
|
||||
}
|
||||
|
||||
reload() {
|
||||
configtest || return 1
|
||||
ebegin "Refreshing nginx' configuration"
|
||||
kill -HUP `cat ${pidfile}` &>/dev/null
|
||||
eend $? "Failed to reload nginx"
|
||||
}
|
||||
|
||||
upgrade() {
|
||||
configtest || return 1
|
||||
ebegin "Upgrading nginx"
|
||||
|
||||
einfo "Sending USR2 to old binary"
|
||||
kill -USR2 `cat ${pidfile}` &>/dev/null
|
||||
|
||||
einfo "Sleeping 3 seconds before pid-files checking"
|
||||
sleep 3
|
||||
|
||||
if [ ! -f ${pidfile}.oldbin ]; then
|
||||
eerror "File with old pid not found"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ ! -f ${pidfile} ]; then
|
||||
eerror "New binary failed to start"
|
||||
return 1
|
||||
fi
|
||||
|
||||
einfo "Sleeping 3 seconds before WINCH"
|
||||
sleep 3 ; kill -WINCH `cat ${pidfile}.oldbin`
|
||||
|
||||
einfo "Sending QUIT to old binary"
|
||||
kill -QUIT `cat ${pidfile}.oldbin`
|
||||
|
||||
einfo "Upgrade completed"
|
||||
eend $? "Upgrade failed"
|
||||
}
|
||||
|
||||
configtest() {
|
||||
ebegin "Checking nginx' configuration"
|
||||
${command} -c ${nginx_config} -t -q
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
${command} -c ${nginx_config} -t
|
||||
fi
|
||||
|
||||
eend $? "failed, please correct errors above"
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Id$
|
||||
|
||||
extra_started_commands="reload abort flush"
|
||||
|
||||
description_reload="Re-read configuration files. Running processes terminate at their earliest convenience."
|
||||
description_abort="Stop the Postfix mail system abruptly. Running processes are signaled to stop immediately."
|
||||
description_flush="Force delivery: attempt to deliver every message in the deferred mail queue."
|
||||
|
||||
# Please read http://www.postfix.org/MULTI_INSTANCE_README.html for multi instance support
|
||||
CONF_DIR="/etc/postfix"
|
||||
CONF_OPT="${SVCNAME##*.}"
|
||||
if [ -n ${CONF_OPT} -a ${SVCNAME} != "postfix" ]; then
|
||||
CONF_DIR="${CONF_DIR}.${CONF_OPT}"
|
||||
fi
|
||||
if [ "${CONF_DIR}" = "/etc/postfix" ]; then
|
||||
CONF_PARAM=""
|
||||
CONF_MESSAGE=""
|
||||
else
|
||||
CONF_PARAM="-c ${CONF_DIR}"
|
||||
CONF_MESSAGE="(${CONF_DIR})"
|
||||
fi
|
||||
|
||||
depend() {
|
||||
use logger dns ypbind amavisd antivirus postfix_greylist net saslauthd
|
||||
if [ "${SVCNAME}" = "postfix" ]; then
|
||||
provide mta
|
||||
fi
|
||||
}
|
||||
|
||||
start() {
|
||||
if [ ! -z "${CONF_PARAM}" ]; then
|
||||
einfo "Please consider updating your config for postmulti support."
|
||||
fi
|
||||
ebegin "Starting postfix ${CONF_MESSAGE}"
|
||||
if [ ! -d ${CONF_DIR} ]; then
|
||||
eend 1 "${CONF_DIR} does not exist"
|
||||
return 1
|
||||
fi
|
||||
/usr/sbin/postfix ${CONF_PARAM} start >/dev/null 2>&1
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping postfix ${CONF_MESSAGE}"
|
||||
/usr/sbin/postfix ${CONF_PARAM} stop >/dev/null 2>&1
|
||||
eend
|
||||
}
|
||||
|
||||
status() {
|
||||
local _retval
|
||||
einfon ""
|
||||
/usr/sbin/postfix ${CONF_PARAM} status
|
||||
_retval=$?
|
||||
if [ x${_retval} = 'x0' ]; then
|
||||
mark_service_started "${SVCNAME}"
|
||||
eend 0
|
||||
else
|
||||
mark_service_stopped "${SVCNAME}"
|
||||
eend 3
|
||||
fi
|
||||
}
|
||||
|
||||
reload() {
|
||||
ebegin "Reloading postfix ${CONF_MESSAGE}"
|
||||
/usr/sbin/postfix ${CONF_PARAM} reload >/dev/null 2>&1
|
||||
eend $?
|
||||
}
|
||||
|
||||
abort() {
|
||||
ebegin "Aborting postfix ${CONF_MESSAGE}"
|
||||
|
||||
if service_started "${SVCNAME}"; then
|
||||
mark_service_stopped "${SVCNAME}"
|
||||
fi
|
||||
/usr/sbin/postfix ${CONF_PARAM} abort >/dev/null 2>&1
|
||||
eend $?
|
||||
}
|
||||
|
||||
flush() {
|
||||
ebegin "Flushing postfix ${CONF_MESSAGE}"
|
||||
/usr/sbin/postfix ${CONF_PARAM} flush >/dev/null 2>&1
|
||||
eend $?
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Id$
|
||||
|
||||
command="/usr/bin/rsync"
|
||||
command_args="--daemon ${RSYNC_OPTS}"
|
||||
pidfile="/var/run/${SVCNAME}.pid"
|
||||
|
||||
depend() {
|
||||
use net
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2013 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Id$
|
||||
|
||||
extra_started_commands="reload"
|
||||
description="Transmission is a fast, easy and free bittorrent client"
|
||||
description_start="Start transmission-daemon server and web interface"
|
||||
description_stop="Stop transmission-daemon server and web interface"
|
||||
description_reload="Reload transmission-daemon settings"
|
||||
|
||||
rundir=${rundir:-/var/run/transmission}
|
||||
pidfile=${pidfile:-${rundir}/transmission.pid}
|
||||
config_dir=${config_dir:-/var/lib/transmission/config}
|
||||
download_dir=${download_dir:-/var/lib/transmission/downloads}
|
||||
logfile=${logfile:-/var/log/transmission/transmission.log}
|
||||
runas_user=${runas_user:-transmission:transmission}
|
||||
|
||||
SSD_OPTIONS=""
|
||||
|
||||
depend() {
|
||||
need net
|
||||
}
|
||||
|
||||
check_config() {
|
||||
if [ ! -d "${rundir}" ]; then
|
||||
mkdir "${rundir}"
|
||||
if [ -n "${runas_user}" ]; then
|
||||
chown -R ${runas_user} "${rundir}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# In case no config directory option passed use default
|
||||
if ! $(echo ${TRANSMISSION_OPTIONS} | grep -q -e '\B-g' -e '\B--config-dir'); then
|
||||
TRANSMISSION_OPTIONS="${TRANSMISSION_OPTIONS} --config-dir ${config_dir}"
|
||||
# put download dir location on first run (and take it from config later)
|
||||
if [ ! -f ${config_dir}/settings.json ]; then
|
||||
TRANSMISSION_OPTIONS="${TRANSMISSION_OPTIONS} --download-dir ${download_dir}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${runas_user}" ]; then
|
||||
if [ -f /etc/init.d/sysfs ]; then
|
||||
SSD_OPTIONS="${SSD_OPTIONS} --user ${runas_user}"
|
||||
else
|
||||
SSD_OPTIONS="${SSD_OPTIONS} --chuid ${runas_user}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
start() {
|
||||
check_config
|
||||
|
||||
ebegin "Starting transmission daemon"
|
||||
start-stop-daemon --start --quiet --pidfile ${pidfile} ${SSD_OPTIONS} \
|
||||
--exec /usr/bin/transmission-daemon -- --pid-file ${pidfile} \
|
||||
$(test ${logfile} != "syslog" && echo --logfile ${logfile}) \
|
||||
${TRANSMISSION_OPTIONS}
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping transmission daemon"
|
||||
start-stop-daemon --stop --quiet --retry TERM/45/QUIT/15 --pidfile ${pidfile}
|
||||
eend $?
|
||||
}
|
||||
|
||||
reload() {
|
||||
ebegin "Reloading transmission configuration"
|
||||
start-stop-daemon --signal HUP --pidfile ${pidfile}
|
||||
eend $?
|
||||
}
|
||||
|
||||
@@ -1,231 +0,0 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2014 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License, v2
|
||||
# $Id$
|
||||
|
||||
# This is here to serve as a note to myself, and future developers.
|
||||
#
|
||||
# Any Display manager (gdm,kdm,xdm) has the following problem: if
|
||||
# it is started before any getty, and no vt is specified, it will
|
||||
# usually run on vt2. When the getty on vt2 then starts, and the
|
||||
# DM is already started, the getty will take control of the keyboard,
|
||||
# leaving us with a "dead" keyboard.
|
||||
#
|
||||
# Resolution: add the following line to /etc/inittab
|
||||
#
|
||||
# x:a:once:/etc/X11/startDM.sh
|
||||
#
|
||||
# and have /etc/X11/startDM.sh start the DM in daemon mode if
|
||||
# a lock is present (with the info of what DM should be started),
|
||||
# else just fall through.
|
||||
#
|
||||
# How this basically works, is the "a" runlevel is a additional
|
||||
# runlevel that you can use to fork processes with init, but the
|
||||
# runlevel never gets changed to this runlevel. Along with the "a"
|
||||
# runlevel, the "once" key word means that startDM.sh will only be
|
||||
# run when we specify it to run, thus eliminating respawning
|
||||
# startDM.sh when "xdm" is not added to the default runlevel, as was
|
||||
# done previously.
|
||||
#
|
||||
# This script then just calls "telinit a", and init will run
|
||||
# /etc/X11/startDM.sh after the current runlevel completes (this
|
||||
# script should only be added to the actual runlevel the user is
|
||||
# using).
|
||||
#
|
||||
# Martin Schlemmer
|
||||
# aka Azarah
|
||||
# 04 March 2002
|
||||
|
||||
depend() {
|
||||
need localmount xdm-setup
|
||||
|
||||
# this should start as early as possible
|
||||
# we can't do 'before *' as that breaks it
|
||||
# (#139824) Start after ypbind and autofs for network authentication
|
||||
# (#145219 #180163) Could use lirc mouse as input device
|
||||
# (#70689 comment #92) Start after consolefont to avoid display corruption
|
||||
# (#291269) Start after quota, since some dm need readable home
|
||||
# (#390609) gdm-3 will fail when dbus is not running
|
||||
# (#366753) starting keymaps after X causes problems
|
||||
after bootmisc consolefont modules netmount
|
||||
after readahead-list ypbind autofs openvpn gpm lircmd
|
||||
after quota keymaps
|
||||
before alsasound
|
||||
|
||||
# Start before X
|
||||
use consolekit dbus xfs
|
||||
}
|
||||
|
||||
setup_dm() {
|
||||
local MY_XDM
|
||||
|
||||
MY_XDM=$(echo "${DISPLAYMANAGER}" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
# Load our root path from profile.env
|
||||
# Needed for kdm
|
||||
PATH=${PATH}:$(. /etc/profile.env; echo "${ROOTPATH}")
|
||||
|
||||
NAME=
|
||||
case "${MY_XDM}" in
|
||||
kdm|kde)
|
||||
EXE=/usr/bin/kdm
|
||||
PIDFILE=/run/kdm.pid
|
||||
;;
|
||||
entrance*)
|
||||
EXE=/usr/sbin/entrance
|
||||
PIDFILE=/run/entrance.pid
|
||||
;;
|
||||
gdm|gnome)
|
||||
# gdm-3 and above has different paths
|
||||
if [ -f /usr/sbin/gdm ]; then
|
||||
EXE=/usr/sbin/gdm
|
||||
PIDFILE=/run/gdm/gdm.pid
|
||||
START_STOP_ARGS="--background"
|
||||
AUTOCLEAN_CGROUP="yes"
|
||||
else
|
||||
EXE=/usr/bin/gdm
|
||||
PIDFILE=/run/gdm.pid
|
||||
fi
|
||||
[ "${RC_UNAME}" != "Linux" ] && NAME=gdm-binary
|
||||
;;
|
||||
wdm)
|
||||
EXE=/usr/bin/wdm
|
||||
PIDFILE=
|
||||
;;
|
||||
gpe)
|
||||
EXE=/usr/bin/gpe-dm
|
||||
PIDFILE=/run/gpe-dm.pid
|
||||
;;
|
||||
lxdm)
|
||||
EXE=/usr/sbin/lxdm-binary
|
||||
PIDFILE=/run/lxdm.pid
|
||||
START_STOP_ARGS="--background"
|
||||
;;
|
||||
lightdm)
|
||||
EXE=/usr/sbin/lightdm
|
||||
PIDFILE=/run/lightdm.pid
|
||||
START_STOP_ARGS="--background"
|
||||
;;
|
||||
sddm)
|
||||
EXE="/usr/bin/sddm"
|
||||
START_STOP_ARGS="-m --background"
|
||||
PIDFILE=/run/sddm.pid
|
||||
;;
|
||||
*)
|
||||
# first find out if there is such executable
|
||||
EXE="$(command -v ${MY_XDM} 2>/dev/null)"
|
||||
PIDFILE="/run/${MY_XDM}.pid"
|
||||
|
||||
# warn user that he is doing sick things if the exe was not found
|
||||
if [ -z "${EXE}" ]; then
|
||||
echo "ERROR: Your XDM value is invalid."
|
||||
echo " No ${MY_XDM} executable could be found on your system."
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if ! [ -x "${EXE}" ]; then
|
||||
EXE=/usr/bin/xdm
|
||||
PIDFILE=/run/xdm.pid
|
||||
if ! [ -x "/usr/bin/xdm" ]; then
|
||||
echo "ERROR: Please set your DISPLAYMANAGER variable in /etc/conf.d/xdm,"
|
||||
echo " or install x11-apps/xdm package"
|
||||
eend 255
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Check to see if something is defined on our VT
|
||||
vtstatic() {
|
||||
if [ -e /etc/inittab ] ; then
|
||||
grep -Eq "^[^#]+.*\<tty$1\>" /etc/inittab
|
||||
elif [ -e /etc/ttys ] ; then
|
||||
grep -q "^ttyv$(($1 - 1))" /etc/ttys
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
start() {
|
||||
local EXE NAME PIDFILE AUTOCLEAN_CGROUP
|
||||
setup_dm
|
||||
|
||||
if [ -f /etc/.noxdm ]; then
|
||||
einfo "Skipping ${EXE##*/}, /etc/.noxdm found or \"nox\" bootparam passed."
|
||||
rm /etc/.noxdm
|
||||
return 0
|
||||
fi
|
||||
|
||||
ebegin "Setting up ${EXE##*/}"
|
||||
|
||||
# save the prefered DM
|
||||
save_options "service" "${EXE}"
|
||||
save_options "name" "${NAME}"
|
||||
save_options "pidfile" "${PIDFILE}"
|
||||
save_options "start_stop_args" "${START_STOP_ARGS}"
|
||||
save_options "autoclean_cgroup" "${AUTOCLEAN_CGROUP:-no}"
|
||||
|
||||
if [ -n "${CHECKVT-y}" ] ; then
|
||||
if vtstatic "${CHECKVT:-7}" ; then
|
||||
if [ -x /sbin/telinit ] && [ "${SOFTLEVEL}" != "BOOT" ] && [ "${RC_SOFTLEVEL}" != "BOOT" ]; then
|
||||
ewarn "Something is already defined on VT ${CHECKVT:-7}, will start X later"
|
||||
telinit a >/dev/null 2>&1
|
||||
return 0
|
||||
else
|
||||
eerror "Something is already defined on VT ${CHECKVT:-7}, not starting"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
/etc/X11/startDM.sh
|
||||
eend 0
|
||||
}
|
||||
|
||||
stop() {
|
||||
local curvt retval
|
||||
|
||||
retval=0
|
||||
if [ -t 0 ]; then
|
||||
if type fgconsole >/dev/null 2>&1; then
|
||||
curvt=$(fgconsole 2>/dev/null)
|
||||
else
|
||||
curvt=$(tty)
|
||||
case "${curvt}" in
|
||||
/dev/ttyv[0-9]*) curvt=${curvt#/dev/ttyv} ;;
|
||||
*) curvt= ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
local myexe myname mypidfile myservice
|
||||
myexe=$(get_options "service")
|
||||
myname=$(get_options "name")
|
||||
mypidfile=$(get_options "pidfile")
|
||||
myservice=${myexe##*/}
|
||||
yesno "${rc_cgroup_cleanup:-no}" || rc_cgroup_cleanup=$(get_options "autoclean_cgroup")
|
||||
|
||||
[ -z "${myexe}" ] && return 0
|
||||
|
||||
ebegin "Stopping ${myservice}"
|
||||
|
||||
if start-stop-daemon --quiet --test --stop --exec "${myexe}"; then
|
||||
start-stop-daemon --stop --exec "${myexe}" --retry TERM/5/TERM/5 \
|
||||
${mypidfile:+--pidfile} ${mypidfile} \
|
||||
${myname:+--name} ${myname}
|
||||
retval=${?}
|
||||
fi
|
||||
|
||||
# switch back to original vt
|
||||
if [ -n "${curvt}" ]; then
|
||||
if type chvt >/dev/null 2>&1; then
|
||||
chvt "${curvt}"
|
||||
else
|
||||
vidcontrol -s "$((curvt + 1))"
|
||||
fi
|
||||
fi
|
||||
|
||||
eend ${retval} "Error stopping ${myservice}"
|
||||
return ${retval}
|
||||
}
|
||||
|
||||
# vim: set ts=4 :
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2009 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Id$
|
||||
|
||||
depend() {
|
||||
need localmount
|
||||
}
|
||||
|
||||
start() {
|
||||
if get_bootparam "nox" ; then
|
||||
touch /etc/.noxdm
|
||||
fi
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/sbin/runscript
|
||||
# $Header: /var/cvsroot/gentoo-x86/media-sound/alsa-utils/files/alsasound.initd-r6,v 1.1 2014/06/23 21:34:42 ssuominen Exp $
|
||||
# $Id$
|
||||
# Copyright 1999-2014 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-apps/busybox/files/ntpd.initd,v 1.2 2012/12/21 03:15:28 blueness Exp $
|
||||
# $Id$
|
||||
|
||||
command="/bin/busybox ntpd"
|
||||
command_args="${NTPD_OPTS}"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2013 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-apps/busybox/files/watchdog.initd,v 1.3 2013/04/27 07:47:23 vapier Exp $
|
||||
# $Id$
|
||||
|
||||
command="/bin/busybox watchdog"
|
||||
command_args="${WATCHDOG_OPTS}"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2015 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-fs/cryptsetup/files/1.5.1-dmcrypt.rc,v 1.9 2015/04/12 22:04:22 vapier Exp $
|
||||
# $Id$
|
||||
|
||||
depend() {
|
||||
before checkfs fsck
|
||||
|
||||
@@ -20,7 +20,7 @@ start() {
|
||||
--pidfile "$DOCKER_PIDFILE" \
|
||||
--stdout "$DOCKER_LOGFILE" \
|
||||
--stderr "$DOCKER_LOGFILE" \
|
||||
-- -d -p "$DOCKER_PIDFILE" \
|
||||
-- daemon -p "$DOCKER_PIDFILE" \
|
||||
$DOCKER_OPTS
|
||||
eend $?
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-libs/gpm/files/gpm.rc6-2,v 1.2 2012/10/28 11:35:56 vapier Exp $
|
||||
# $Id$
|
||||
|
||||
#NB: Config is in /etc/conf.d/gpm
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2013 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/files/nginx.initd-r2,v 1.1 2013/05/13 12:18:11 dev-zero Exp $
|
||||
# $Id$
|
||||
|
||||
extra_commands="configtest"
|
||||
extra_started_commands="upgrade reload"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/mail-mta/postfix/files/postfix.rc6.2.7,v 1.2 2012/03/07 10:27:37 eras Exp $
|
||||
# $Id$
|
||||
|
||||
extra_started_commands="reload abort flush"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/net-misc/rsync/files/rsyncd.init.d-r1,v 1.1 2012/03/22 22:01:21 idl0r Exp $
|
||||
# $Id$
|
||||
|
||||
command="/usr/bin/rsync"
|
||||
command_args="--daemon ${RSYNC_OPTS}"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2013 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/net-p2p/transmission/files/transmission-daemon.initd.9,v 1.1 2013/09/07 12:10:01 ssuominen Exp $
|
||||
# $Id$
|
||||
|
||||
extra_started_commands="reload"
|
||||
description="Transmission is a fast, easy and free bittorrent client"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2014 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License, v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/files/xdm.initd-11,v 1.1 2014/04/14 16:19:25 chithanh Exp $
|
||||
# $Id$
|
||||
|
||||
# This is here to serve as a note to myself, and future developers.
|
||||
#
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2009 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/files/xdm-setup.initd-1,v 1.1 2010/04/13 10:07:39 scarabeus Exp $
|
||||
# $Id$
|
||||
|
||||
depend() {
|
||||
need localmount
|
||||
|
||||
Reference in New Issue
Block a user