add dpkg trigger to recreate Gemfile.lock

This commit is contained in:
Praveen Arimbrathodiyil 2016-12-08 23:46:56 +05:30
parent 370503b349
commit daece03c7a
3 changed files with 51 additions and 20 deletions

2
debian/adduser.sh vendored
View file

@ -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}

1
debian/gitlab.triggers vendored Normal file
View file

@ -0,0 +1 @@
interest-noawait /usr/lib/ruby/vendor_ruby

68
debian/postinst vendored
View file

@ -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)