Packages: removed "loadconfig" and "saveconfig" actions.

This commit is contained in:
Andrei Belov
2018-09-26 15:24:49 +03:00
parent 6b8a992bfa
commit 446479b311
5 changed files with 4 additions and 118 deletions

View File

@@ -15,14 +15,9 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/unitd
NAME=unitd
DESC=unitd
CONFIG=/etc/unit/config
[ -r /etc/default/${NAME} ] && . /etc/default/${NAME}
if [ -n "$2" ]; then
CONFIG=$2
fi
#includes lsb functions
. /lib/lsb/init-functions
@@ -72,31 +67,8 @@ case "$1" in
log_end_msg 1
fi
;;
saveconfig)
curl -sS --unix-socket /var/run/control.unit.sock localhost >${CONFIG}.new
if [ $? -ne 0 ]; then
echo "Could not retreive configuration" >&2
rm -f ${CONFIG}.new
exit 1
fi
mv ${CONFIG}.new ${CONFIG}
echo "The following configuration has been saved to ${CONFIG}:"
cat ${CONFIG}
;;
loadconfig)
if [ ! -e ${CONFIG} ]; then
echo "Could not find ${CONFIG} for loading" >&2
exit 1
fi
echo "Loading configuration from ${CONFIG}..."
curl -sS -X PUT --data-binary @${CONFIG} --unix-socket /var/run/control.unit.sock localhost
if [ $? -ne 0 ]; then
echo "Loading failed!" >&2
exit 1
fi
;;
*)
echo "Usage: /etc/init.d/$NAME {start|status|stop|restart|reload|force-reload|saveconfig|loadconfig}" >&2
echo "Usage: /etc/init.d/$NAME {start|status|stop|restart|reload|force-reload}" >&2
exit 1
;;
esac