foreman-packaging/plugins/ruby-foreman-remote-execution/debian/postinst @ 85bf37f5
85bf37f5 | Stephen Benjamin | #!/bin/sh
|
|
# postinst script for foreman-*
|
|||
#
|
|||
# see: dh_installdeb(1)
|
|||
if [ ! -z "${DEBUG}" ]; then
|
|||
set -x
|
|||
else
|
|||
set -e
|
|||
fi
|
|||
. /usr/share/debconf/confmodule
|
|||
LOGFILE='/var/log/foreman-install.log'
|
|||
PLUGIN='foreman_remote_execution'
|
|||
# if this script aborts with an error dpkg can
|
|||
# hang if daemons have been started
|
|||
trap db_stop EXIT
|
|||
BUNDLE=bundle
|
|||
[ -h /usr/bin/foreman-ruby ] && BUNDLE="/usr/bin/foreman-ruby /usr/bin/bundle"
|
|||
# Update gems
|
|||
export HOME=/usr/share/foreman
|
|||
cd /usr/share/foreman
|
|||
if [ ! -z "${DEBUG}" ]; then
|
|||
if $BUNDLE show $PLUGIN >/dev/null 2>&1; then
|
|||
$BUNDLE update $PLUGIN --local
|
|||
else
|
|||
$BUNDLE install --local --no-prune
|
|||
fi
|
|||
else
|
|||
if $BUNDLE show $PLUGIN >/dev/null 2>&1; then
|
|||
$BUNDLE update $PLUGIN --local 2>&1 >> $LOGFILE
|
|||
else
|
|||
$BUNDLE install --local --no-prune 2>&1 >> $LOGFILE
|
|||
fi
|
|||
fi
|
|||
# DB migrate/seed after install
|
|||
if [ -f /usr/share/foreman/config/database.yml ]; then
|
|||
if [ ! -z "${DEBUG}" ]; then
|
|||
/usr/sbin/foreman-rake db:migrate || true
|
|||
/usr/sbin/foreman-rake db:seed || true
|
|||
/usr/sbin/foreman-rake apipie:cache:index || true
|
|||
else
|
|||
/usr/sbin/foreman-rake db:migrate >> $LOGFILE 2>&1 || true
|
|||
/usr/sbin/foreman-rake db:seed >> $LOGFILE 2>&1 || true
|
|||
/usr/sbin/foreman-rake apipie:cache:index >> $LOGFILE 2>&1 || true
|
|||
fi
|
|||
fi
|
|||
# Own all the core files
|
|||
chown -Rf foreman:foreman '/usr/share/foreman'
|
|||
#DEBHELPER#
|
|||
exit 0
|