]> granicus.if.org Git - sudo/commitdiff
Update polypkg from trunk.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 26 Jun 2014 21:50:52 +0000 (15:50 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 26 Jun 2014 21:50:52 +0000 (15:50 -0600)
pp

diff --git a/pp b/pp
index 2b37f4472a0bb4dad625cf63090ed890d93d1a51..8ffa5548750f55dd5177a7dab611a3c89e4b4a26 100755 (executable)
--- a/pp
+++ b/pp
@@ -1,6 +1,6 @@
 #!/bin/sh
-# Copyright 2012 Quest Software, Inc. ALL RIGHTS RESERVED
-pp_revision="371"
+# Copyright 2014 Quest Software, Inc. ALL RIGHTS RESERVED
+pp_revision="20140620"
  # Copyright 2012 Quest Software, Inc.  ALL RIGHTS RESERVED.
  #
  # Redistribution and use in source and binary forms, with or without
@@ -1255,7 +1255,7 @@ pp_load_service_vars () {
 
 pp_files_expand () {
     typeset _p _mode _group _owner _flags _path _optional _has_target _tree
-    typeset _path _file _tgt _m _o _g _f _type _lm _ll _lo _lg _ls _lx
+    typeset _target _file _tgt _m _o _g _f _type _lm _ll _lo _lg _ls _lx
     typeset _ignore _a
 
     test $# -eq 0 && return
@@ -2055,7 +2055,9 @@ pp_backend_aix () {
        (cd $pp_destdir && pp_verbose  /usr/sbin/backup -i -q -p -f -) \
           < $pp_wrkdir/bff.list \
          > $pp_wrkdir/$outbff || pp_error "backup failed"
-        $pp_aix_sudo /usr/sbin/installp -l -d $pp_wrkdir/$outbff
+       if test -n "$pp_aix_sudo" -o -x /usr/sbin/installp; then
+           $pp_aix_sudo /usr/sbin/installp -l -d $pp_wrkdir/$outbff
+       fi
 }
 
 pp_backend_aix_cleanup () {
@@ -2429,14 +2431,20 @@ pp_sd_service_script () {
            fi
        }
 
-       pp_running () {
-           if test ! -s "\$pidfile"; then
-               return 1
-           else
-               read pid < "\$pidfile"
-               kill -0 "\$pid" 2>/dev/null
-           fi
-       }
+        pp_running () {
+            if test -s "\$pidfile"; then
+                read pid < "\$pidfile" 2>/dev/null
+                if test \${pid:-0} -gt 1 && kill -0 "\$pid" 2>/dev/null; then
+                    # make sure command name matches
+                    c="\`echo $cmd | sed -e 's: .*::' -e 's:^.*/::'\`"
+                    pid="\`ps -p \$pid 2>/dev/null | sed -n \"s/^ *\(\$pid\) .*\$c *\$/\1/p\"\`"
+                    if test -n "\$pid"; then
+                        return 0
+                    fi
+                fi
+            fi
+            return 1
+        }
 
        case \$1 in
            start_msg) echo "Starting the \$svc service";;
@@ -3673,10 +3681,18 @@ _EOF
 
         # returns true if $svc is running
         pp_running () {
-            test -s "$pidfile" || return 1
-            read pid junk < "$pidfile" 2>/dev/null
-            test ${pid:-0} -gt 1 &&
-            kill -0 "$pid" 2>/dev/null
+            if test -s "$pidfile"; then
+                read pid < "$pidfile" 2>/dev/null
+                if test ${pid:-0} -gt 1 && kill -0 "$pid" 2>/dev/null; then
+                    # make sure command name matches up to the first 8 chars
+                    c="`echo $_cmd | sed -e 's: .*::' -e 's:^.*/::' -e 's/^\(........\).*$/\1/'`"
+                    pid="`ps -p $pid 2>/dev/null | sed -n \"s/^ *\($pid\) .*$c *$/\1/p\"`"
+                    if test -n "$pid"; then
+                        return 0
+                    fi
+                fi
+            fi
+            return 1
         }
 
         # prints a message describing $svc's running state
@@ -3743,12 +3759,12 @@ pp_solaris_remove_service () {
     file=${pp_solaris_service_script:-"/etc/init.d/${pp_solaris_service_script_name:-$svc}"}
 
     echo '
-'$file' stop >/dev/null 2>/dev/null
 if [ "x${PKG_INSTALL_ROOT}" = 'x' ]; then
     if [ -x /usr/sbin/svcadm ] ; then
-        # Likely un-needed, but just in case.
         /usr/sbin/svcadm disable -s '$svc' 2>/dev/null
         /usr/sbin/svccfg delete '$svc' 2>/dev/null
+    else
+        '$file' stop >/dev/null 2>/dev/null
     fi
 fi
     '
@@ -6294,6 +6310,8 @@ pp_rpm_service_make_init_script () {
        # Generated by PolyPackage ${pp_version}
        # ${copyright}
 
+       prog="`echo $cmd | sed -e 's: .*::' -e 's:^.*/::'`"
+
 .
 
     if test x"${svc_description}" = x"${pp_rpm_default_svc_description}"; then
@@ -6357,22 +6375,38 @@ pp_rpm_service_make_init_script () {
         #-- delivers signal $1 to the pidfile
         #   returns 0=success 1=failure
         pp_signal () {
-            if test -r "$pidfile"; then
-                read pid < $pidfile
+            if test -s "$pidfile"; then
+                read pid < "$pidfile" 2>/dev/null
                 kill "$@" "$pid" 2>/dev/null
             else
                 return 1
             fi
         }
 
+        #-- verifies that ${svc_name} is running
+        #   returns 0=success 1=failure
+        pp_running () {
+            if test -s "$pidfile"; then
+                read pid < "$pidfile" 2>/dev/null
+                if test ${pid:-0} -gt 1 && kill -0 "$pid" 2>/dev/null; then
+                    # make sure name matches
+                    pid="`ps -p $pid 2>/dev/null | sed -n \"s/^ *\($pid\) .*$prog *$/\1/p\"`"
+                    if test -n "$pid"; then
+                        return 0
+                    fi
+                fi
+            fi
+            return 1
+        }
+
         #-- prints information about the service status
         #   returns 0=running 1=crashed 3=stopped
         pp_status () {
             pp_msg "Checking for ${svc_name}"
-            if pp_signal -0; then
+           if pp_running; then
                 pp_success_msg "running"
                 return 0
-            elif test -r "$pidfile"; then
+            elif test -s "$pidfile"; then
                 pp_failure_msg "not running (crashed)"
                 return 1
             else