Control: tags -1 + patch

Please consider attached patch.

-- 
G..e
diff --git a/debian/changelog b/debian/changelog
index 464e751..b3a0bec 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+openrc (0.13.1-3) UNRELEASED; urgency=medium
+
+  * Fix postinst, make dangling links presence not fatal (Closes: #765785).
+
+ -- Gabriele Giacone <1o5g4...@gmail.com>  Sat, 25 Oct 2014 15:30:56 +0200
+
 openrc (0.13.1-2) unstable; urgency=medium
 
   [ Steven Chamberlain ]
diff --git a/debian/openrc.postinst b/debian/openrc.postinst
index 8438f00..b0f287c 100644
--- a/debian/openrc.postinst
+++ b/debian/openrc.postinst
@@ -9,22 +9,34 @@ if [ "${1}" = "configure" ] ; then
                [ -d /etc/rc${rl}.d ] || continue
 
                for f in $(ls -1 /etc/rc${rl}.d | egrep 'S[[:digit:]]{2}*'); do
-                       svc=$(readlink -f /etc/rc${rl}.d/${f})
-                       svc=$(basename ${svc})
-                       update-rc.d ${svc} enable ${rl}
+                       rclink=/etc/rc${rl}.d/${f}
+                       initsh=$(readlink -f ${rclink})
+                       svc=$(basename ${initsh})
+                       if [ -f ${initsh} ]; then
+                               update-rc.d ${svc} enable ${rl}
+                       else
+                               echo "*** WARNING: dangling link $rclink"
+                               echo $dsvcs|grep -qw ${svc} || dsvcs="$dsvcs 
${svc}"
+                       fi
                done
        done
 
        [ -d /etc/rc6.d ] && for f in $(ls -1 /etc/rc6.d | egrep 
'K[[:digit:]]{2}*'); do
-               svc=$(readlink -f /etc/rc6.d/${f})
-               # no need to duplicate services in the off runlevel
-               egrep -q '# Default-Start:\s+[S12345]' ${svc} && continue
+               rclink=/etc/rc6.d/${f}
+               initsh=$(readlink -f ${rclink})
+               svc=$(basename ${initsh})
+               if [ -f ${initsh} ]; then
+                       # no need to duplicate services in the off runlevel
+                       egrep -q '# Default-Start:\s+[S12345]' ${initsh} && 
continue
 
-               svc=$(basename ${svc})
-               # reboot is managed by transit as below
-               [ ${svc} = reboot ] && continue
+                       # reboot is managed by transit as below
+                       [ ${svc} = reboot ] && continue
 
-               update-rc.d ${svc} enable 6
+                       update-rc.d ${svc} enable 6
+               else
+                       echo "*** WARNING: dangling link $rclink"
+                       echo $dsvcs|grep -qw ${svc} || dsvcs="$dsvcs ${svc}"
+               fi
        done
 
        rc-update add savecache off
@@ -36,6 +48,15 @@ if [ "${1}" = "configure" ] ; then
 
        rc-update -u
 
+       if [ "$dsvcs" != "" ]; then
+               echo 
"**********************************************************************"
+               echo "*** WARNING: Found the following dangling links:"
+               for link in $dsvcs; do
+                       ls -l /etc/rc*.d/*$link
+               done
+               echo 
"**********************************************************************"
+       fi
+
        echo 
"**********************************************************************"
        echo "*** WARNING: if you are replacing sysv-rc by OpenRC, then you 
must ***"
        echo "*** reboot immediately using the following command:               
 ***"

Reply via email to