diff --git a/debian/postinst b/debian/postinst index 1443310614..4c80c359f7 100755 --- a/debian/postinst +++ b/debian/postinst @@ -137,7 +137,6 @@ case "$1" in ln -sf ${gitlab_data_dir}/Gemfile.lock ${gitlab_app_root}/Gemfile.lock if ! [ -e ${gitlab_app_root}/.secret ] ; then - su ${gitlab_user} -s /bin/sh -c "touch ${gitlab_data_dir}/.secret" ln -s ${gitlab_data_dir}/.secret ${gitlab_app_root}/.secret fi diff --git a/debian/rake-tasks.sh b/debian/rake-tasks.sh index 156db7e075..b6e2572749 100755 --- a/debian/rake-tasks.sh +++ b/debian/rake-tasks.sh @@ -5,9 +5,17 @@ export $(cat /etc/gitlab/gitlab-debian.conf) if ! [ -f "${gitlab_app_root}/config/secrets.yml" ]; then echo "Creating secrets.yml..." - gitlab_app_secret=$(openssl rand -hex 64) + # Check if .secret file exist already in gitlab_app_root + # See if it is an empty file + test -e ${gitlab_app_root}/.secret &&\ + gitlab_app_secret=$(cat ${gitlab_app_root}/.secret);\ + test -n "${gitlab_app_secret}" ||\ + { gitlab_app_secret=$(openssl rand -hex 64) + cp ${gitlab_app_root}/config/secrets.yml.example ${gitlab_app_root}/config/secrets.yml sed -i "s/# db_key_base:/db_key_base: ${gitlab_app_secret}/" ${gitlab_app_root}/config/secrets.yml + echo ${gitlab_app_root} > ${gitlab_app_root}/.secret + } fi echo "Initializing database..." if [ "$(su postgres -c 'psql gitlab_production -c \\d')" = \