Commit c84aa6be authored by Mikhail Efremov's avatar Mikhail Efremov Committed by Anton Midyukov

services: Fix generation of on/off services lists

If we already have systemd-{enabled,disabled} lists, then don't overwrite them, just add lists to them. Services presented in the lists should be filtered out from services-{on,off} lists already. This fixes commit 2b501116 "services: Don't touch services already listed in the config".
parent 368e3ce4
......@@ -46,8 +46,23 @@ for i in $SERVICES; do
echo "$i" >> "$CONFDIR"/services-"$onoff"
done
cp -a "$CONFDIR"/{services-on,systemd-enabled}
cp -a "$CONFDIR"/{services-off,systemd-disabled}
if [ -s "$CONFDIR"/services-on ]; then
if [ -s "$CONFDIR"/systemd-enabled ]; then
cat "$CONFDIR"/services-on >>"$CONFDIR"/systemd-enabled
rm "$CONFDIR"/services-on
else
cp -a "$CONFDIR"/{services-on,systemd-enabled}
fi
fi
if [ -s "$CONFDIR"/services-off ]; then
if [ -s "$CONFDIR"/systemd-disabled ]; then
cat "$CONFDIR"/services-off >>"$CONFDIR"/systemd-disabled
rm "$CONFDIR"/services-off
else
cp -a "$CONFDIR"/{services-off,systemd-disabled}
fi
fi
rm "$STATUS"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment