1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvmconf: fix systemd unit existence check for lvmconf --services --startstopservices

We have to unset the LoadState variable from previous use when we check
for systemd unit state. We use this variable to check if systemd services
are loaded or not and if it is loaded, we issue systemctl commands to
enable/disable and start/stop the service. We don't issue these commands
if the unit is not loaded to avoid error messages which may confuse users.
This commit is contained in:
Peter Rajnoha 2017-04-05 11:06:56 +02:00
parent afa844817a
commit 448bf9491a
2 changed files with 5 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.170 -
==================================
Fix systemd unit existence check for lvmconf --services --startstopservices.
Check and use PATH_MAX buffers when creating vgrename device paths.
Version 2.02.169 - 28th March 2017

View File

@ -361,7 +361,8 @@ function set_service {
if [ "$type" = "systemd" ]; then
if [ "$action" = "activate" ]; then
for i in $@; do
eval $($SYSTEMCTL_BIN show $i -p LoadState)
unset LoadState
eval $($SYSTEMCTL_BIN show $i -p LoadState 2>/dev/null)
test "$LoadState" = "loaded" || continue
$SYSTEMCTL_BIN enable $i
if [ "$START_STOP_SERVICES" = "1" ]; then
@ -370,7 +371,8 @@ function set_service {
done
elif [ "$action" = "deactivate" ]; then
for i in $@; do
eval $($SYSTEMCTL_BIN show $i -p LoadState)
unset LoadState
eval $($SYSTEMCTL_BIN show $i -p LoadState 2>/dev/null)
test "$LoadState" = "loaded" || continue
$SYSTEMCTL_BIN disable $i
if [ "$START_STOP_SERVICES" = "1" ]; then