diff options
author | Roger Leigh <rleigh@debian.org> | 2012-10-16 22:50:47 +0100 |
---|---|---|
committer | Roger Leigh <rleigh@debian.org> | 2012-10-16 22:50:47 +0100 |
commit | 6457e4d9c11ded6edacb7b53ed1da32577474b43 (patch) | |
tree | 3aa1d1013077daf669fbb47235989d71d8ef2826 | |
parent | 5e2e8dd36bf9a3dc27abb8dbd9a0f4545f4f887f (diff) | |
download | schroot-6457e4d9c11ded6edacb7b53ed1da32577474b43.tar.gz |
debian: Create lock directory on upgrade and startup
-rwxr-xr-x | debian/schroot.init | 14 | ||||
-rw-r--r-- | debian/schroot.postinst | 16 |
2 files changed, 30 insertions, 0 deletions
diff --git a/debian/schroot.init b/debian/schroot.init index 968f5c68..ccf1d807 100755 --- a/debian/schroot.init +++ b/debian/schroot.init @@ -70,6 +70,20 @@ end_sessions() case "$1" in start|restart|force-reload) + # Delete /var/lock/schroot if it's not root:root 0700, or if + # it's not a directory. + if [ -e /var/lock/schroot ]; then + if [ "$(stat -c "%u %g %a" /var/lock/schroot)" != "0 0 700" ]; then + rm -rf /var/lock/schroot + fi + if [ ! -d /var/lock/schroot ]; then + rm -rf /var/lock/schroot + fi + fi + if [ ! -d /var/lock/schroot ]; then + mkdir -m 0700 /var/lock/schroot + fi + if [ "$START_ACTION" = "end" ] || [ "$SESSIONS_RECOVER" = "end" ] ; then end_sessions else diff --git a/debian/schroot.postinst b/debian/schroot.postinst index 8e35d40e..f8380436 100644 --- a/debian/schroot.postinst +++ b/debian/schroot.postinst @@ -39,6 +39,22 @@ if dpkg --compare-versions "$2" lt "1.6.0-1"; then update-rc.d -f schroot remove >/dev/null fi +if dpkg --compare-versions "$2" lt "1.6.4-1"; then + # Delete /var/lock/schroot if it's not root:root 0700, or if + # it's not a directory. + if [ -e /var/lock/schroot ]; then + if [ "$(stat -c "%u %g %a" /var/lock/schroot)" != "0 0 700" ]; then + rm -rf /var/lock/schroot + fi + if [ ! -d /var/lock/schroot ]; then + rm -rf /var/lock/schroot + fi + fi + if [ ! -d /var/lock/schroot ]; then + mkdir -m 0700 /var/lock/schroot + fi +fi + # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. |