mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-15 11:57:59 +00:00
Adjust packaging for 1.6.0~alpha1
This commit is contained in:
Vendored
+14
-28
@@ -1,43 +1,29 @@
|
||||
#!/bin/sh
|
||||
# postinst script for aptly-api
|
||||
#
|
||||
# see: dh_installdeb(1)
|
||||
|
||||
set -e
|
||||
|
||||
# summary of how this script can be called:
|
||||
# * <postinst> `configure' <most-recently-configured-version>
|
||||
# * <old-postinst> `abort-upgrade' <new version>
|
||||
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
|
||||
# <new-version>
|
||||
# * <postinst> `abort-remove'
|
||||
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
|
||||
# <failed-install-package> <version> `removing'
|
||||
# <conflicting-package> <version>
|
||||
# for details, see http://www.debian.org/doc/debian-policy/ or
|
||||
# the debian-policy package
|
||||
|
||||
# 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
|
||||
adduser --system --home /var/lib/aptly-api --no-create-home aptly-api
|
||||
addgroup --system aptly-api
|
||||
adduser aptly-api aptly-api
|
||||
useradd --system --user-group --create-home --home-dir /var/lib/aptly-api aptly-api
|
||||
fi
|
||||
|
||||
# setup /var/lib/aptly-api
|
||||
if [ ! -d /var/lib/aptly-api ]; then
|
||||
mkdir -p /var/lib/aptly-api
|
||||
fi
|
||||
chown aptly-api:aptly-api /var/lib/aptly-api
|
||||
# set config file permissions not world readable as it may contain secrets
|
||||
chown root:aptly-api /etc/aptly.conf
|
||||
chmod 640 /etc/aptly.conf
|
||||
|
||||
# set config file permissions
|
||||
# it may contain secrets so it is not world readable
|
||||
chown root:aptly-api /etc/aptly-api.conf
|
||||
chmod 640 /etc/aptly-api.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)
|
||||
|
||||
Reference in New Issue
Block a user