Browse Source

postinst: We were only fixing the permissions of /var/{lib,run,log}/tor when we
were not upgrading. Unfortunately the check doesn't work all that well usually
in cases where the package was removed (not purged) and then later re-installed
again. Now we ensure proper ownership and modes for all the directories and
files below /var/{lib,run,log}/tor (the dirs themselves included) every time we
run postinst.


svn:r13207

Peter Palfrader 17 years ago
parent
commit
d98d1ea0d9
2 changed files with 20 additions and 24 deletions
  1. 8 2
      debian/changelog
  2. 12 22
      debian/tor.postinst

+ 8 - 2
debian/changelog

@@ -6,8 +6,14 @@ tor (0.2.0.17-alpha-1+svn) experimental; urgency=low
     to some other range then they probably have a good reason for that.
     to some other range then they probably have a good reason for that.
   * postinst: change wording if debian-tor's homedir is wrong, do not
   * postinst: change wording if debian-tor's homedir is wrong, do not
     print anything if it is ok.
     print anything if it is ok.
-
+  * postinst: We were only fixing the permissions of /var/{lib,run,log}/tor
- -- Peter Palfrader <weasel@debian.org>  Mon, 21 Jan 2008 15:46:29 +0100
+    when we were not upgrading.  Unfortunately the check doesn't work all
+    that well usually in cases where the package was removed (not purged)
+    and then later re-installed again.  Now we ensure proper ownership
+    and modes for all the directories and files below /var/{lib,run,log}/tor
+    (the dirs themselves included) every time we run postinst.
+
+ -- Peter Palfrader <weasel@debian.org>  Mon, 21 Jan 2008 15:56:12 +0100
 
 
 tor (0.2.0.17-alpha-1) experimental; urgency=low
 tor (0.2.0.17-alpha-1) experimental; urgency=low
 
 

+ 12 - 22
debian/tor.postinst

@@ -30,28 +30,18 @@ else
 		debian-tor
 		debian-tor
 fi
 fi
 
 
-# ch{owning,moding} things around
+
-# We will do nothing across upgrades.
+find /var/lib/tor ! -user debian-tor -o ! -group debian-tor -print0 | xargs -0 --no-run-if-empty chown debian-tor:debian-tor
-
+find /var/lib/tor -type d -print0 | xargs -0 --no-run-if-empty chmod 02700
-if [ "$2" = "" ]; then
+find /var/lib/tor -type f -print0 | xargs -0 --no-run-if-empty chmod 00600
-    for i in lib log run; do
+
-	chown -R debian-tor:debian-tor /var/$i/tor
+find /var/run/tor ! -user debian-tor -o ! -group debian-tor -print0 | xargs -0 --no-run-if-empty chown debian-tor:debian-tor
-	chmod -R 700 /var/$i/tor
+find /var/run/tor -type d -print0 | xargs -0 --no-run-if-empty chmod 02750
-	find /var/$i/tor -type f -exec chmod 600 '{}' ';'
+find /var/run/tor -type f -print0 | xargs -0 --no-run-if-empty chmod 00600
-    done
+
-    chgrp -R adm  /var/log/tor
+find /var/log/tor ! -user debian-tor -o ! -group adm -print0 | xargs -0 --no-run-if-empty chown debian-tor:adm
-    chmod -R g+rX /var/log/tor
+find /var/log/tor -type d -print0 | xargs -0 --no-run-if-empty chmod 02750
-    chmod    g+s  /var/log/tor
+find /var/log/tor -type f -print0 | xargs -0 --no-run-if-empty chmod 00640
-else
-    # fix permissions of logs after 0.0.8+0.0.9pre5-1
-    if [ "$1" = "configure" ]; then
-        if dpkg --compare-versions "$2" le "0.0.8+0.0.9pre5-1" ; then
-            chgrp -R adm  /var/log/tor
-            chmod -R g+rX /var/log/tor
-            chmod    g+s  /var/log/tor
-        fi
-    fi
-fi
 
 
 #DEBHELPER#
 #DEBHELPER#