[DRE-commits] [gitlab] 01/03: add dpkg trigger to recreate Gemfile.lock
Praveen Arimbrathodiyil
praveen at moszumanska.debian.org
Sun Dec 11 16:39:21 UTC 2016
This is an automated email from the git hooks/post-receive script.
praveen pushed a commit to branch master
in repository gitlab.
commit daece03c7a90bab30b8e9c0ba1330261a6e3dd70
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date: Thu Dec 8 23:46:56 2016 +0530
add dpkg trigger to recreate Gemfile.lock
---
debian/adduser.sh | 2 ++
debian/gitlab.triggers | 1 +
debian/postinst | 68 +++++++++++++++++++++++++++++++++++---------------
3 files changed, 51 insertions(+), 20 deletions(-)
diff --git a/debian/adduser.sh b/debian/adduser.sh
index 2649fdc..5c484e2 100755
--- a/debian/adduser.sh
+++ b/debian/adduser.sh
@@ -12,3 +12,5 @@ adduser --system --home /var/lib/${gitlab_user} --gecos "${gitlab_user} user" --
--quiet --disabled-password --group ${gitlab_user} || {
echo "Proceeding with existing ${gitlab_user} user..."
}
+echo "Making ${gitlab_user} owner of /var/lib/${gitlab_user}..."
+chown -R ${gitlab_user} /var/lib/${gitlab_user}
diff --git a/debian/gitlab.triggers b/debian/gitlab.triggers
new file mode 100644
index 0000000..e64f8f7
--- /dev/null
+++ b/debian/gitlab.triggers
@@ -0,0 +1 @@
+interest-noawait /usr/lib/ruby/vendor_ruby
diff --git a/debian/postinst b/debian/postinst
index 5d94f71..4858540 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -7,6 +7,9 @@
set -e
+# Show debconf questions
+. /usr/share/debconf/confmodule
+
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
@@ -25,28 +28,51 @@ set -e
# installation fails and the `postinst' is called with `abort-upgrade',
# `abort-remove' or `abort-deconfigure'.
+#######################################################################
+# Read and export debian specific configuration
+# Only exported variables will be passed on to gitlab app
+#######################################################################
+
+# Bootstrap config file - first try
+gitlab_debian_conf_example=/usr/share/doc/gitlab/gitlab-debian.conf.example
+export $(cat ${gitlab_debian_conf_example})
+# second try
+test -f ${gitlab_debian_conf_private} || \
+cp ${gitlab_debian_conf_example} ${gitlab_debian_conf_private}
+export $(cat ${gitlab_debian_conf_private})
+
+# If /etc/gitlab/gitlab-debian.conf is already present, use it
+test -f ${gitlab_debian_conf} && export $(cat ${gitlab_debian_conf})
+
+# Create gitlab user
+. /usr/lib/gitlab/scripts/adduser.sh
+
+#######################################################################
+# update Gemfile.lock, always
+#######################################################################
+su ${gitlab_user} -s /bin/sh -c 'truncate -s 0 ${gitlab_data_dir}/Gemfile.lock'
+cd ${gitlab_app_root}
+if ! su ${gitlab_user} -s /bin/sh -c 'bundle --local --quiet'; then
+ if [ "$1" = "triggered" ]; then
+ # probably triggered in the middle of an system upgrade; ignore failure
+ # but abort here
+ echo "#########################################################################"
+ echo "# Failed to detect gitlab dependencies; if you are in the middle of an #"
+ echo "# upgrade, this is probably fine, there will be another attempt later. #"
+ echo "# #"
+ echo "# If you are NOT in the middle of an upgrade, there is probably a real #"
+ echo "# issue. Please report a bug. #"
+ echo "#########################################################################"
+ exit 0
+ else
+ # something is really broken
+ exit 1
+ fi
+fi
+cd - >/dev/null
case "$1" in
configure)
- # Show debconf questions
- . /usr/share/debconf/confmodule
-
- # Read and export debian specific configuration
- # Only exported variables will be passed on to gitlab app
- # Bootstrap config file - first try
- gitlab_debian_conf_example=/usr/share/doc/gitlab/gitlab-debian.conf.example
- export $(cat ${gitlab_debian_conf_example})
- # second try
- test -f ${gitlab_debian_conf_private} || \
- cp ${gitlab_debian_conf_example} ${gitlab_debian_conf_private}
- export $(cat ${gitlab_debian_conf_private})
-
- # If /etc/gitlab/gitlab-debian.conf is already present, use it
- test -f ${gitlab_debian_conf} && export $(cat ${gitlab_debian_conf})
-
- # Create gitlab user
- . /usr/lib/gitlab/scripts/adduser.sh
-
gitlab_builds_log=${gitlab_log_dir}/builds
gitlab_repo_path=${gitlab_data_dir}/repositories
gitlab_uploads_path=${gitlab_data_dir}/public/uploads
@@ -222,8 +248,10 @@ EOF
echo "Running final rake tasks and tweaks..."
. /usr/lib/gitlab/scripts/rake-tasks.sh
+ ;;
-
+ triggered)
+ # Already handled
;;
abort-upgrade|abort-remove|abort-deconfigure)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/gitlab.git
More information about the Pkg-ruby-extras-commits
mailing list