35 lines
602 B
Bash
Executable File
35 lines
602 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
case $1 in
|
|
preinst)
|
|
exit 0
|
|
;;
|
|
postinst)
|
|
if ! getent group ntp 2>&1 > /dev/null; then
|
|
if groupadd -g 87 ntp; then
|
|
echo 'Created group ntp'
|
|
else
|
|
echo 'Failed to create group ntp!'
|
|
exit 1
|
|
fi
|
|
fi
|
|
if ! getent passwd ntp 2>&1 > /dev/null; then
|
|
if useradd -c "NTP service" -d /var/lib/ntp -g ntp \
|
|
-s /bin/false -u 87 ntp; then
|
|
echo 'Created user ntp'
|
|
else
|
|
echo 'Failed to create user ntp!'
|
|
exit 1
|
|
fi
|
|
fi
|
|
;;
|
|
prerm)
|
|
exit 0
|
|
;;
|
|
postrm)
|
|
exit 0
|
|
;;
|
|
esac
|