Merge branch 'posttrans_for_rhel' into 'master'

Posttrans for rhel

Different way of handling #649 .

Also fixes #528

See merge request !402
This commit is contained in:
Marin Jankovski 2015-07-08 11:46:45 +00:00
commit f9169ba540
3 changed files with 30 additions and 39 deletions

View File

@ -3,35 +3,14 @@
# Perform necessary gitlab setup steps
# after package is installed.
#
PROGNAME=$(basename $0)
DEST_DIR=<%= install_dir %>
EXTERNAL_URL="http://gitlab.example.com"
usr_bin_symlinks="\
${DEST_DIR}/bin/gitlab-ctl \
${DEST_DIR}/bin/gitlab-rake \
${DEST_DIR}/bin/gitlab-rails \
${DEST_DIR}/bin/gitlab-ci-rake \
${DEST_DIR}/bin/gitlab-ci-rails \
"
symlink_command="ln -sf ${usr_bin_symlinks} /usr/bin/"
error_exit()
{
echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
exit 1
}
notify()
{
echo "gitlab: $1"
}
create_symlinks()
{
${symlink_command} || error_exit "Failed to create symlinks in /usr/bin"
}
create_config_template()
{
# Create a minimal gitlab.rb template if /etc/gitlab/gitlab.rb does not exist.
@ -114,33 +93,18 @@ else
get_fqdn_from_hostname
fi
create_symlinks
${DEST_DIR}/embedded/bin/symlink_ctl_cmds ${DEST_DIR}
create_config_template
fix_directory_permissions
print_welcome
case "$1" in
2)
# Looks like an RPM upgrade
${DEST_DIR}/bin/gitlab-ctl upgrade
;;
configure)
# Looks like a DEB install. We don't know if it is a fresh install or an
# upgrade.
${DEST_DIR}/bin/gitlab-ctl upgrade
;;
*)
if [ -x /bin/rpm ] ; then
# This might be a fresh RPM install, replacing the legacy 'gitlab' package.
# The postuninstall script of 'gitlab' will clobber our symlinks, so we
# kindly ask the user to recreate them.
notify
notify "If you just upgraded from GitLab 7.9 or earlier, please run the following"
notify "command:"
echo ""
notify "sudo ${symlink_command}"
echo ""
notify ""
fi
# No op.
;;
esac

View File

@ -6,7 +6,8 @@ DEST_DIR=<%= install_dir %>
case "$1" in
0)
# RPM install/upgrade
ln -sf ${DEST_DIR}/embedded/service/gitlab-shell/.gitlab_shell_secret ${DEST_DIR}/embedded/service/gitlab-rails/.gitlab_shell_secret
${DEST_DIR}/embedded/bin/symlink_ctl_cmds ${DEST_DIR}
${DEST_DIR}/bin/gitlab-ctl upgrade
;;
*)
# Noop.

View File

@ -0,0 +1,26 @@
#!/bin/sh
#
# Symlink the ctl commands
DEST_DIR=${1:-/opt/gitlab}
usr_bin_symlinks="\
${DEST_DIR}/bin/gitlab-ctl \
${DEST_DIR}/bin/gitlab-rake \
${DEST_DIR}/bin/gitlab-rails \
${DEST_DIR}/bin/gitlab-ci-rake \
${DEST_DIR}/bin/gitlab-ci-rails \
"
symlink_command="ln -sf ${usr_bin_symlinks} /usr/bin/"
error_exit()
{
echo "${1:-"Unknown Error"}" 1>&2
exit 1
}
create_symlinks()
{
${symlink_command} || error_exit "Failed to create symlinks in /usr/bin"
}
create_symlinks