Skip to content

zshrc: drop sv support from init.d functions #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 4 additions & 20 deletions etc/zsh/zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -2927,32 +2927,16 @@ compdef _functions edfunc
#m# f6 Reload() \kbd{service \em{process}}\quad\kbd{reload}
#m# f6 Force-Reload() \kbd{service \em{process}}\quad\kbd{force-reload}
#m# f6 Status() \kbd{service \em{process}}\quad\kbd{status}
if [[ -d /etc/init.d || -d /etc/service ]] ; then
if [[ -d /etc/init.d ]] ; then
function __start_stop () {
local action_="${1:l}" # e.g Start/Stop/Restart
local service_="$2"
local param_="$3"

local service_target_="$(readlink /etc/init.d/$service_)"
if [[ $service_target_ == "/usr/bin/sv" ]]; then
# runit
case "${action_}" in
start) if [[ -d /etc/service ]] && [[ ! -e /etc/service/$service_ ]]; then
$SUDO ln -s "/etc/sv/$service_" "/etc/service/"
else
$SUDO "/etc/init.d/$service_" "${action_}" "$param_"
fi ;;
# there is no reload in runits sysv emulation
reload) $SUDO "/etc/init.d/$service_" "force-reload" "$param_" ;;
*) $SUDO "/etc/init.d/$service_" "${action_}" "$param_" ;;
esac
if check_com -c service ; then
$SUDO service "$service_" "${action_}" "$param_"
else
# sysv/sysvinit-utils, upstart
if check_com -c service ; then
$SUDO service "$service_" "${action_}" "$param_"
else
$SUDO "/etc/init.d/$service_" "${action_}" "$param_"
fi
$SUDO "/etc/init.d/$service_" "${action_}" "$param_"
fi
}

Expand Down