services: Don't touch services already listed in the config
If service already listed in the config files, then ignore status in the profiles variables.
This commit is contained in:
parent
b6e5d3df69
commit
2b50111650
@ -7,16 +7,27 @@
|
|||||||
# NB: install2 is not a rootfs, handling differs either
|
# NB: install2 is not a rootfs, handling differs either
|
||||||
|
|
||||||
STATUS=`mktemp`
|
STATUS=`mktemp`
|
||||||
|
CONFDIR=/usr/share/install2
|
||||||
|
CHECK_FILES=
|
||||||
|
|
||||||
. shell-config
|
. shell-config
|
||||||
|
|
||||||
switch() {
|
switch() {
|
||||||
|
[ -n "$CHECK_FILES" ] && \
|
||||||
|
egrep -qs "^[[:blank:]]*$1(.service|.socket)?[[:blank:]]*$" \
|
||||||
|
$CHECK_FILES && return ||:
|
||||||
|
|
||||||
case "$2" in
|
case "$2" in
|
||||||
on|off)
|
on|off)
|
||||||
shell_config_set "$STATUS" "$1" "$2";;
|
shell_config_set "$STATUS" "$1" "$2";;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for f in services-on services-off systemd-enabled systemd-disabled; do
|
||||||
|
[ -s "$CONFDIR/$f" ] || continue
|
||||||
|
CHECK_FILES="$CHECK_FILES $CONFDIR/$f"
|
||||||
|
done
|
||||||
|
|
||||||
# defaults (most likely features.in ones)
|
# defaults (most likely features.in ones)
|
||||||
for i in $GLOBAL_DEFAULT_SERVICES_ENABLE; do switch $i on; done
|
for i in $GLOBAL_DEFAULT_SERVICES_ENABLE; do switch $i on; done
|
||||||
for i in $GLOBAL_DEFAULT_SERVICES_DISABLE; do switch $i off; done
|
for i in $GLOBAL_DEFAULT_SERVICES_DISABLE; do switch $i off; done
|
||||||
@ -32,11 +43,11 @@ SERVICES="$(echo $SERVICES | sort -u)"
|
|||||||
for i in $SERVICES; do
|
for i in $SERVICES; do
|
||||||
onoff="$(shell_config_get "$STATUS" "$i")"
|
onoff="$(shell_config_get "$STATUS" "$i")"
|
||||||
[ -n "$onoff" ] || continue
|
[ -n "$onoff" ] || continue
|
||||||
echo "$i" >> /usr/share/install2/services-"$onoff"
|
echo "$i" >> "$CONFDIR"/services-"$onoff"
|
||||||
done
|
done
|
||||||
|
|
||||||
cp -a /usr/share/install2/{services-on,systemd-enabled}
|
cp -a "$CONFDIR"/{services-on,systemd-enabled}
|
||||||
cp -a /usr/share/install2/{services-off,systemd-disabled}
|
cp -a "$CONFDIR"/{services-off,systemd-disabled}
|
||||||
|
|
||||||
rm "$STATUS"
|
rm "$STATUS"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user