2014-09-08 18:58:23 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
APP_NAME="gogs"
|
|
|
|
CLI="${APP_NAME}"
|
|
|
|
APP_USER=$(${CLI} config:get APP_USER)
|
|
|
|
APP_GROUP=$(${CLI} config:get APP_GROUP)
|
|
|
|
APP_CONFIG="/etc/${APP_NAME}/conf/app.ini"
|
|
|
|
|
|
|
|
case "$1" in
|
2014-11-19 22:43:12 +01:00
|
|
|
abort-upgrade|abort-remove|abort-deconfigure)
|
|
|
|
exit 0
|
|
|
|
;;
|
2014-09-08 18:58:23 +02:00
|
|
|
|
2014-11-19 22:43:12 +01:00
|
|
|
configure|*)
|
2014-09-08 18:58:23 +02:00
|
|
|
mkdir -p $(dirname ${APP_CONFIG})
|
|
|
|
chown ${APP_USER}.${APP_GROUP} $(dirname ${APP_CONFIG})
|
|
|
|
[ -f ${APP_CONFIG} ] || ${CLI} run cp conf/app.ini ${APP_CONFIG}
|
|
|
|
${CLI} config:set USER=${APP_USER}
|
|
|
|
sed -i "s|RUN_USER = git|RUN_USER = ${APP_USER}|" ${APP_CONFIG}
|
|
|
|
sed -i "s|RUN_MODE = dev|RUN_MODE = prod|" ${APP_CONFIG}
|
|
|
|
|
2014-11-19 19:18:30 +01:00
|
|
|
# setup symlink towards custom conf
|
|
|
|
mkdir -p /opt/${APP_NAME}/custom/conf
|
|
|
|
chown -R ${APP_USER}.${APP_GROUP} /opt/${APP_NAME}/custom
|
|
|
|
ln -f -s ${APP_CONFIG} /opt/${APP_NAME}/custom/conf/app.ini
|
|
|
|
|
2014-09-08 18:58:23 +02:00
|
|
|
# scale
|
|
|
|
${CLI} scale web=1 || true
|
2015-09-25 17:58:46 +02:00
|
|
|
|
2015-09-25 18:45:35 +02:00
|
|
|
# restart the service
|
2015-09-25 17:58:46 +02:00
|
|
|
service gogs restart || true
|
|
|
|
|
2014-09-08 18:58:23 +02:00
|
|
|
;;
|
2015-09-25 18:46:50 +02:00
|
|
|
|
2014-09-08 18:58:23 +02:00
|
|
|
esac
|