aboutsummaryrefslogtreecommitdiffstats
path: root/packager/hooks
diff options
context:
space:
mode:
authorCyril Rohr <cyril.rohr@gmail.com>2015-12-10 08:55:21 +0000
committerCyril Rohr <cyril.rohr@gmail.com>2015-12-10 09:02:58 +0000
commitfa8bf0f1d7f6f57f26491d210dfe673f5e49d29a (patch)
tree719825be71114c1c1bd7fa92607f907f888aab92 /packager/hooks
parent9a2e43bff28ac92f180109fe900a6997614ea5a8 (diff)
downloadgitea-fa8bf0f1d7f6f57f26491d210dfe673f5e49d29a.tar.gz
gitea-fa8bf0f1d7f6f57f26491d210dfe673f5e49d29a.zip
Fix postinstall to use GOGS_CUSTOM instead of symlinking
Diffstat (limited to 'packager/hooks')
-rwxr-xr-xpackager/hooks/postinst24
1 files changed, 24 insertions, 0 deletions
diff --git a/packager/hooks/postinst b/packager/hooks/postinst
new file mode 100755
index 0000000000..561080effd
--- /dev/null
+++ b/packager/hooks/postinst
@@ -0,0 +1,24 @@
+#!/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"
+
+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}
+
+${CLI} config:set GOGS_CUSTOM=/etc/${APP_NAME}
+
+# scale
+${CLI} scale web=1 || true
+
+# restart the service
+service gogs restart || true