[Pkg-ofed-commits] [srptools] 01/01: Make temp dir creation in preinst safer

Roland Fehrenbacher rfehren-guest at moszumanska.debian.org
Sat May 6 10:29:06 UTC 2017


This is an automated email from the git hooks/post-receive script.

rfehren-guest pushed a commit to branch master
in repository srptools.

commit 7aa944faab2dc9fa8e91487234205d1a6f052f3f
Author: Roland Fehrenbacher <rf at q-leap.de>
Date:   Sat May 6 10:28:25 2017 +0000

    Make temp dir creation in preinst safer
---
 debian/srptools.postinst | 9 ++++-----
 debian/srptools.preinst  | 8 ++++----
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/debian/srptools.postinst b/debian/srptools.postinst
index 04ed77a..aa678ee 100644
--- a/debian/srptools.postinst
+++ b/debian/srptools.postinst
@@ -24,21 +24,20 @@ case "$1" in
     if [ -n "$preversion" ]; then
       if dpkg --compare-versions "$preversion" lt "1.0.3-2"; then
         conffile=/etc/srp_daemon.conf
-        checkfile=/tmp/srptools-old-had-d
+        checkdir=/var/lib/srptools-old-had-d
         # Restore previous default config, if it was unmodified
         md5sum="$(md5sum $conffile | sed -e 's/ .*//')"
         old_md5sum="$(dpkg-query -W -f='${Conffiles}' srptools | \
             sed -n -e "\' $conffile ' { s/.* //; p }")"
         if [ "$md5sum" = "$old_md5sum" ]; then
-          checkfile=/tmp/srptools-old-had-d
-          if [ ! -e $checkfile ]; then
+          if [ ! -d $checkdir ]; then
             # Uncomment again only if original version didn't already have the
             # 'd' line.
             sed -i -e 's/^d$/#d/g' $conffile
           fi
         fi
-        if [ -e $checkfile ]; then
-          rm -f $checkfile
+        if [ -d $checkdir ]; then
+          rm -rf $checkdir
         fi
       fi
     fi
diff --git a/debian/srptools.preinst b/debian/srptools.preinst
index 6d84a47..76a2a18 100644
--- a/debian/srptools.preinst
+++ b/debian/srptools.preinst
@@ -24,16 +24,16 @@ case "$1" in
     if [ -n "$preversion" ]; then
       if dpkg --compare-versions "$preversion" lt "1.0.3-2"; then
         conffile=/etc/srp_daemon.conf
-        checkfile=/tmp/srptools-old-had-d
+        checkdir=/var/lib/srptools-old-had-d
         # Check whether old config already contains the new 'global' 'd'
-        # and set temporary file 
+        # and create temporary dir
         if grep -q '^\s*d\s*\#*' $conffile ; then
-          touch $checkfile
+          mkdir $checkdir
         fi
       fi
     fi
     ;;
-    abort-upgrade|abort-remove|abort-deconfigure)
+    install|abort-upgrade|abort-remove|abort-deconfigure)
     ;;
     *)
         echo "postinst called with unknown argument \`$1'" >&2

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ofed/srptools.git



More information about the Pkg-ofed-commits mailing list