Also create nut user when installing nut-client package and do not delete it on purge anymore (Closes: #682000)
This commit is contained in:
parent
1cd02baa2d
commit
a6634bc58e
4 changed files with 64 additions and 8 deletions
4
debian/changelog
vendored
4
debian/changelog
vendored
|
@ -10,8 +10,10 @@ nut (2.6.4-3) UNRELEASED; urgency=low
|
||||||
* Add debian/patches/0001-fix-upsmon-regression.patch: Fix upsmon/upssched
|
* Add debian/patches/0001-fix-upsmon-regression.patch: Fix upsmon/upssched
|
||||||
regression (Taken from upstream) (Closes: #679513)
|
regression (Taken from upstream) (Closes: #679513)
|
||||||
* Move nut metapackage to Section: metapackages
|
* Move nut metapackage to Section: metapackages
|
||||||
|
* Also create nut user when installing nut-client package and do not delete
|
||||||
|
it on purge anymore (Closes: #682000)
|
||||||
|
|
||||||
-- Laurent Bigonville <bigon@debian.org> Thu, 09 Aug 2012 11:50:08 +0200
|
-- Laurent Bigonville <bigon@debian.org> Thu, 09 Aug 2012 21:18:03 +0200
|
||||||
|
|
||||||
nut (2.6.4-2) unstable; urgency=low
|
nut (2.6.4-2) unstable; urgency=low
|
||||||
|
|
||||||
|
|
60
debian/nut-client.postinst
vendored
Normal file
60
debian/nut-client.postinst
vendored
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
|
||||||
|
configure)
|
||||||
|
|
||||||
|
# make sure the nut user exists and has correct memberships
|
||||||
|
if ! getent group nut >/dev/null; then
|
||||||
|
addgroup --quiet --system nut
|
||||||
|
fi
|
||||||
|
if ! getent passwd nut >/dev/null; then
|
||||||
|
adduser --quiet --system --ingroup nut --home /var/lib/nut --no-create-home nut
|
||||||
|
elif ! groups nut | grep -qw nut; then
|
||||||
|
adduser nut nut
|
||||||
|
fi
|
||||||
|
# for Ubuntu, while waiting for a proper debconf
|
||||||
|
# if ! groups nut | grep -qw dialout; then
|
||||||
|
# adduser nut dialout
|
||||||
|
# fi
|
||||||
|
|
||||||
|
# make sure that conffiles are secured and have the correct ownerships
|
||||||
|
if [ -d /etc/nut/ ] ; then
|
||||||
|
chown root:nut /etc/nut/
|
||||||
|
fi
|
||||||
|
for file in nut.conf upsmon.conf upssched.conf ; do
|
||||||
|
if [ -f /etc/nut/$file ] ; then
|
||||||
|
chown root:nut /etc/nut/$file
|
||||||
|
chmod 640 /etc/nut/$file
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# make sure that /var/run/nut exists and has the correct ownerships
|
||||||
|
if [ ! -d /var/run/nut ] ; then
|
||||||
|
mkdir -p /var/run/nut
|
||||||
|
fi
|
||||||
|
if [ -d /var/run/nut ] ; then
|
||||||
|
chown root:nut /var/run/nut
|
||||||
|
chmod 770 /var/run/nut
|
||||||
|
fi
|
||||||
|
|
||||||
|
abort-upgrade)
|
||||||
|
# do nothing
|
||||||
|
;;
|
||||||
|
|
||||||
|
abort-remove)
|
||||||
|
# do nothing
|
||||||
|
;;
|
||||||
|
|
||||||
|
abort-deconfigure)
|
||||||
|
# do nothing
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "$0: incorrect arguments: $*" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
|
||||||
|
#DEBHELPER#
|
2
debian/nut-server.postinst
vendored
2
debian/nut-server.postinst
vendored
|
@ -22,7 +22,7 @@ case "$1" in
|
||||||
if [ -d /etc/nut/ ] ; then
|
if [ -d /etc/nut/ ] ; then
|
||||||
chown root:nut /etc/nut/
|
chown root:nut /etc/nut/
|
||||||
fi
|
fi
|
||||||
for file in nut.conf ups.conf upsd.conf upsmon.conf upsd.users upssched.conf ; do
|
for file in ups.conf upsd.conf upsd.users ; do
|
||||||
if [ -f /etc/nut/$file ] ; then
|
if [ -f /etc/nut/$file ] ; then
|
||||||
chown root:nut /etc/nut/$file
|
chown root:nut /etc/nut/$file
|
||||||
chmod 640 /etc/nut/$file
|
chmod 640 /etc/nut/$file
|
||||||
|
|
6
debian/nut-server.postrm
vendored
6
debian/nut-server.postrm
vendored
|
@ -14,12 +14,6 @@ case "$1" in
|
||||||
rm -f /etc/udev/rules.d/025_nut-usbups.rules
|
rm -f /etc/udev/rules.d/025_nut-usbups.rules
|
||||||
rm -f /etc/udev/rules.d/52_nut-usbups.rules
|
rm -f /etc/udev/rules.d/52_nut-usbups.rules
|
||||||
rm -f /etc/udev/rules.d/52-nut-usbups.rules
|
rm -f /etc/udev/rules.d/52-nut-usbups.rules
|
||||||
# remove the nut user
|
|
||||||
if [ -x "$(command -v deluser)" ]; then
|
|
||||||
deluser --quiet --system nut > /dev/null || true
|
|
||||||
else
|
|
||||||
echo >&2 "not removing nut system account because deluser command was not found"
|
|
||||||
fi
|
|
||||||
# handle a dpkg bug
|
# handle a dpkg bug
|
||||||
[ -d /etc/nut ] && rmdir --ignore-fail-on-non-empty /etc/nut >/dev/null 2>&1
|
[ -d /etc/nut ] && rmdir --ignore-fail-on-non-empty /etc/nut >/dev/null 2>&1
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in a new issue