mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-15 07:00:52 +00:00
44 lines
1.2 KiB
Bash
Executable File
44 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
# source debconf library
|
|
. /usr/share/debconf/confmodule
|
|
|
|
case "$1" in
|
|
configure|reconfigure)
|
|
# create an aptly-api group and user
|
|
if ! getent passwd aptly-api > /dev/null; then
|
|
useradd --system --user-group --create-home --home-dir /var/lib/aptly-api aptly-api
|
|
fi
|
|
|
|
# set config file permissions not world readable as it may contain secrets
|
|
chown root:aptly-api /etc/aptly.conf
|
|
chmod 640 /etc/aptly.conf
|
|
|
|
if [ -f /etc/aptly-api.conf.migrate ]; then
|
|
rootDir=`grep rootDir /etc/aptly-api.conf.migrate | sed 's_/var/lib/aptly-api_~_' | sed -n 's/.\+: "\([^"]\+\)".*/\1/p'`
|
|
if [ -n "$rootDir" ]; then
|
|
sed -i 's/\(.*"rootDir": "\)[^"]*\(".*\)/\1'$rootDir'\2/' /etc/aptly.conf
|
|
fi
|
|
echo "backing up /etc/aptly-api.conf to /etc/aptly-api.conf.old..."
|
|
mv /etc/aptly-api.conf.migrate /etc/aptly-api.conf.old
|
|
fi
|
|
;;
|
|
|
|
abort-upgrade|abort-remove|abort-deconfigure)
|
|
;;
|
|
|
|
*)
|
|
echo "postinst called with unknown argument \`$1'" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
# dh_installdeb will replace this with shell code automatically
|
|
# generated by other debhelper scripts.
|
|
|
|
#DEBHELPER#
|
|
|
|
exit 0
|