deb-simple/packaging/scripts/preinst.deb

37 lines
729 B
Bash

#! /bin/sh
# preinst script for deb-simple
set -e
addsimpleuser() {
if ! getent passwd deb-simple > /dev/null; then
adduser --quiet --system --group \
--disabled-login \
--home /var/lib/deb-simple \
--no-create-home \
--shell /bin/false \
deb-simple
fi
}
createdirectories() {
mkdir -p /opt/deb-simple /var/lib/deb-simple/repo || true
chown -R deb-simple:deb-simple /var/lib/deb-simple
}
case "$1" in
install)
addsimpleuser
createdirectories
;;
upgrade)
addsimpleuser
createdirectories
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 0
;;
esac
exit 0