1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
#!/bin/sh
# postinst script for libx2go-server-db-perl
#
# 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 https://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "${1}" in
'configure')
mkdir -p '/etc/x2go/x2gosql/passwords'
chmod '700' '/etc/x2go/x2gosql/passwords'
touch '/etc/x2go/x2gosql/passwords/pgadmin'
chmod '600' '/etc/x2go/x2gosql/passwords/pgadmin'
touch '/etc/x2go/x2gosql/passwords/mysqladmin'
chmod '600' '/etc/x2go/x2gosql/passwords/mysqladmin'
# the SQLite3 X2Go session db has to be accessed as uid x2gouser
if ! dpkg-statoverride --list '/usr/lib/x2go/libx2go-server-db-sqlite3-wrapper' >'/dev/null'; then
dpkg-statoverride --add --update 'root' 'x2gouser' '2755' '/usr/lib/x2go/libx2go-server-db-sqlite3-wrapper'
fi
# setup up SQLite3 database, do nothing if PostgeSQL is already configured
#
# Note: The below code exists in x2goserver.postinst and libx2go-server-db.postinst
# It will only succeed if both packages are installed. As we cannot influence the
# installation order, we handle the session DB creation in both packages. One of
# them should succeed.
if [ -x '/usr/sbin/x2godbadmin' ] && [ -f '/etc/x2go/x2gosql/sql' ] && grep -E '^backend=sqlite.*' '/etc/x2go/x2gosql/sql' 1>'/dev/null'; then
if [ ! -f '/var/lib/x2go/x2go_sessions' ]; then
x2godbadmin --createdb
else
# make sure db permissions are set correctly
chown 'x2gouser:x2gouser' '/var/lib/x2go'
chown 'root:x2gouser' '/var/lib/x2go/x2go_sessions'
# egid x2gouser needs write access to the db dir (for temporary db journal file)
chmod '0770' '/var/lib/x2go'
# ... and to the db file itself, of course
chmod '0660' '/var/lib/x2go/x2go_sessions'
x2godbadmin --updatedb
fi
else
echo 'X2Go is configured to use a non-SQLite DB backend, leaving the database alone.'
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'
|