handle move of state directory better in upgrades
[debian/sudo] / debian / sudo.postinst
index 2f4e54a8996756e5842f455cb16ff935cb5a9204..10dc14a8bc0cd8c8ace37b1dc662b7d15e911978 100644 (file)
@@ -30,6 +30,14 @@ if ( ! -f "/etc/sudoers") {
 
 }
 
+# handle state directory transition from /var/run/sudo to /var/lib/sudo,
+# moving any existing content over to avoid re-lecturing existing users
+if ( -d "/var/run/sudo") {
+       system ('mkdir -p /var/lib/sudo');
+       system ('mv /var/run/sudo/* /var/lib/sudo/');
+       system ('rmdir /var/run/sudo');
+}
+
 # make sure sudoers has the correct permissions and owner/group
 system ('chown root:root /etc/sudoers');
 system ('chmod 440 /etc/sudoers');