aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2014-10-28 13:31:53 +0000
committerColin Guthrie <colin@mageia.org>2014-10-28 13:31:53 +0000
commit698196044dfee2b84fcc8c92cc92d89d0ddd5e45 (patch)
treea35114073a4bb65f66d46dc44897191d95b086c0
parent832de704cf6546a1b38bd7aa68d8a1505eda4a49 (diff)
downloadrpm-helper-698196044dfee2b84fcc8c92cc92d89d0ddd5e45.tar
rpm-helper-698196044dfee2b84fcc8c92cc92d89d0ddd5e45.tar.gz
rpm-helper-698196044dfee2b84fcc8c92cc92d89d0ddd5e45.tar.bz2
rpm-helper-698196044dfee2b84fcc8c92cc92d89d0ddd5e45.tar.xz
rpm-helper-698196044dfee2b84fcc8c92cc92d89d0ddd5e45.zip
Deal with xinetd.d services properly (e.g. sane mga#14397)
-rw-r--r--NEWS2
-rwxr-xr-xadd-service6
-rwxr-xr-xdel-service8
3 files changed, 10 insertions, 6 deletions
diff --git a/NEWS b/NEWS
index c5062b6..2896b22 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+ * deal with xinetd.d services properly (e.g. sane mga#14397)
+
2014-10-27 Colin Guthrie <colin@mageia.org> 0.24.15
* don't leak failure exit code when no sysvinit script exists
* be quieter when disabling services on uninstall too
diff --git a/add-service b/add-service
index f30b81e..d04b4e5 100755
--- a/add-service
+++ b/add-service
@@ -78,7 +78,7 @@ find_unit() {
# If only a sysvinit service is given, then deal with a systemd unit of the same
# name. Specific specs can enable specific unit names as needed but this should
# catch the most common usage.
-if [ -z "$units" ]; then
+if [ -z "$units" -a -n "$srv" -a ! -f /etc/xinetd.d/$srv ]; then
units="$srv.service"
searchunit=$(find_unit $units)
if [ -n "$searchunit" ]; then
@@ -114,7 +114,7 @@ add_service() {
else
srv=
fi
- else
+ elif [ -n "$units" ]; then
for i in $units; do
[ $i != ${i%.service} ] && ! fgrep -qx ${i%.service} $LIST && continue
[ $i != ${i%.socket} ] && ! fgrep -qx ${i%.socket} $LIST && continue
@@ -146,7 +146,7 @@ add_service() {
# In order to enable switching back ot sysvinit, we should enable the
# sysvinit scripts too.
if [ -n "$srv" ]; then
- if [ -f /etc/rc.d/init.d/$srv -o -f /etc/xinet.d/$srv ]; then
+ if [ -f /etc/rc.d/init.d/$srv -o -f /etc/xinetd.d/$srv ]; then
/sbin/chkconfig --add $srv
if [ -r /etc/sysconfig/system ]; then
diff --git a/del-service b/del-service
index 388add9..55c26bf 100755
--- a/del-service
+++ b/del-service
@@ -87,15 +87,17 @@ if [ $num = 0 ]; then
if [ -z "$DURING_INSTALL" ]; then
if [ x$init = xsystemd ]; then
- /bin/systemctl stop $units
+ /bin/systemctl stop $units >/dev/null 2>&1
elif [ -n "srv" ]; then
/sbin/service $srv stop > /dev/null || :
fi
fi
/bin/systemctl --no-reload --quiet disable $units >/dev/null 2>&1
- if [ -n "$srv" -a -f /etc/rc.d/init.d/$srv ]; then
- /sbin/chkconfig --del $srv
+ if [ -n "$srv" ]; then
+ if [ -f /etc/rc.d/init.d/$srv -o -f /etc/xinetd.d/$srv ]; then
+ /sbin/chkconfig --del $srv
+ fi
fi
fi