diff --git a/debian/adduser.sh b/debian/adduser.sh index 5c484e2925..8d9ea8e8e5 100755 --- a/debian/adduser.sh +++ b/debian/adduser.sh @@ -8,9 +8,9 @@ test -n "${gitlab_user}" || gitlab_user="gitlab" # Create gitlab user with home in /var/lib echo "Creating/updating ${gitlab_user} user account..." -adduser --system --home /var/lib/${gitlab_user} --gecos "${gitlab_user} user" --shell /bin/sh \ +adduser --system --home ${gitlab_data_dir} --gecos "${gitlab_user} user" --shell /bin/sh \ --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} +echo "Making ${gitlab_user} owner of ${gitlab_data_dir}..." +chown -R ${gitlab_user} ${gitlab_data_dir} diff --git a/debian/conf/gitlab-debian.conf.example b/debian/conf/gitlab-debian.conf.example index fc938d5472..b84973353d 100644 --- a/debian/conf/gitlab-debian.conf.example +++ b/debian/conf/gitlab-debian.conf.example @@ -1,6 +1,5 @@ RAILS_ENV=production DB=postgres -gitlab_user=gitlab gitlab_app_root=/usr/share/gitlab gitlab_data_dir=/var/lib/gitlab gitlab_cache_path=/var/cache/gitlab diff --git a/debian/postinst b/debian/postinst index ad7751992c..035996838d 100755 --- a/debian/postinst +++ b/debian/postinst @@ -44,6 +44,14 @@ 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}) +# Read gitlab_user from debconf db +db_get gitlab/user +gitlab_user=${RET:-gitlab} >/dev/null + +if ! grep gitlab_user ${gitlab_debian_conf_private}; then + echo "gitlab_user=${gitlab_user}" >> ${gitlab_debian_conf_private} +fi + # Create gitlab user . /usr/lib/gitlab/scripts/adduser.sh