postinst is in guacamole 0.9.9+dfsg-1.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
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 | #!/bin/sh
#
# Simple postinst script for Guacamole which creates a "guacamole-web" group
# and sets the permissions of user-mapping.xml (a file which must sometimes
# contain plaintext passwords) appropriately.
#
# Exit on errors
set -e
# Use debconf
. /usr/share/debconf/confmodule
GUAC_GROUP="guacamole-web"
GUAC_FILES="/etc/guacamole/user-mapping.xml"
GUAC_FILE_OWNERSHIP="root:$GUAC_GROUP"
GUAC_FILE_MOD="640"
SC_USER="tomcat8"
# Convenience function for error conditions
fail() {
echo "$1" >&2
exit 1
}
# Create guacamole-web group if it does not exist
groupadd -fr "$GUAC_GROUP" ||\
fail "Could not create group \"$GUAC_GROUP\""
# Change ownership and permissions of Guacamole files
for FILE in $GUAC_FILES
do
# Update ownership
chown "$GUAC_FILE_OWNERSHIP" "$FILE" ||\
fail "Unable to change ownership of $FILE"
# Update permissions
chmod "$GUAC_FILE_MOD" "$FILE" ||\
fail "Unable to change permissions of $FILE"
done
# Add servlet container user to guacamole group
usermod --append -G "$GUAC_GROUP" "$SC_USER" ||\
fail "Could not add $SC_USER to group \"$GUAC_GROUP\""
# Restart Tomcat if asked
db_get guacamole-tomcat/restart-server
if [ "$RET" = "true" ]
then
invoke-rc.d tomcat8 restart
fi
# Configure webserver
if test -e /usr/share/apache2/apache2-maintscript-helper; then
db_stop
. /usr/share/apache2/apache2-maintscript-helper
apache2_invoke enmod proxy
apache2_invoke enmod proxy_http
apache2_invoke enmod proxy_wstunnel
apache2_invoke enconf guacamole
fi
exit 0
|