initial import
This commit is contained in:
32
dhcp/dhcp.install
Normal file
32
dhcp/dhcp.install
Normal file
@@ -0,0 +1,32 @@
|
||||
post_install() {
|
||||
if ! getent passwd dhcp &>/dev/null; then
|
||||
useradd -r -G adm -d /dev/null -s /bin/nologin dhcp >/dev/null
|
||||
fi
|
||||
|
||||
[[ -f var/lib/dhcp/dhcpd.leases ]] || : >var/lib/dhcp/dhcpd.leases
|
||||
[[ -f var/lib/dhcp/dhcpd6.leases ]] || : >var/lib/dhcp/dhcpd6.leases
|
||||
|
||||
if ! groups dhcp | grep adm &>/dev/null; then
|
||||
gpasswd -a dhcp adm >/dev/null
|
||||
fi
|
||||
dhcp_shell=$(getent passwd dhcp | cut -d: -f7)
|
||||
if [ "$dhcp_shell" != '/bin/nologin' ]; then
|
||||
chsh -s /bin/nologin dhcp &>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
if (( $(vercmp $2 4.2.4.2) < 0 )); then
|
||||
echo ">>> Lease directory moved from /var/state/dhcp"
|
||||
echo " to /var/lib/dhcp. Move your old lease files"
|
||||
echo " if you want to keep using them."
|
||||
fi
|
||||
|
||||
post_install
|
||||
}
|
||||
|
||||
post_remove() {
|
||||
if getent passwd dhcp &>/dev/null; then
|
||||
userdel dhcp >/dev/null
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user