#!/bin/bash # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # postinst script for Hue # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `configure' # * `abort-upgrade' # * `abort-remove' `in-favour' # # * `abort-remove' # * `abort-deconfigure' `in-favour' # `removing' # # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package USER=hue DO="su $USER -s /bin/bash -c" # FIXME: jobbrowser HUE-10 APPS="about filebrowser help jobsub proxy useradmin shell" # We dont want ugly printouts of status during # install, etc export DESKTOP_LOGLEVEL=WARN export DESKTOP_LOG_DIR=/var/log/hue export ROOT=/usr/lib/hue mkdir -p $DESKTOP_LOG_DIR touch $DESKTOP_LOG_DIR/access.log touch $DESKTOP_LOG_DIR/error.log touch $DESKTOP_LOG_DIR/kt_renewer.log touch $DESKTOP_LOG_DIR/kt_renewer.out touch $DESKTOP_LOG_DIR/runcpserver.log touch $DESKTOP_LOG_DIR/runcpserver.out touch $DESKTOP_LOG_DIR/shell_input.log touch $DESKTOP_LOG_DIR/shell_output.log touch $DESKTOP_LOG_DIR/supervisor.log touch $DESKTOP_LOG_DIR/supervisor.out chown -R $USER:$USER $DESKTOP_LOG_DIR case "$1" in configure) # Install config alternatives update-alternatives --install /etc/hue/conf hue-conf /etc/hue/conf.empty 30 chown $USER $ROOT cd $ROOT chown $USER * chown -R $USER apps chown -R $USER build chown -R $USER ext chown -R $USER tools chown -R $USER desktop rm -f .installed.cfg build/env/stamp find . -name \*.pyc -exec rm {} \; $DO "make desktop" 2>&1 > /dev/null # If we're upgrading, copy their backed up db from the old version # and syncdb. if [ ! -z "$2" ]; then OLD_DB=/usr/share/hue/desktop/desktop.db.bak.$2 if [ -e $OLD_DB ]; then echo Upgrading old database... cp $OLD_DB /usr/share/hue/desktop/desktop.db fi fi $DO "./build/env/bin/hue syncdb --noinput" for app in $APPS ; do APP_DIR=$ROOT/apps/$app chown -R hue:hue $APP_DIR $DO "cd $ROOT; $ROOT/build/env/bin/python $ROOT/tools/app_reg/app_reg.py --install $APP_DIR" done # Take care of hue-shell setuid binary chown root:hue $APP_DIR/src/shell/build/setuid chmod 4750 $APP_DIR/src/shell/build/setuid ;; 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