From 28059229b20fd9a325cf1de300bc07a67770a170 Mon Sep 17 00:00:00 2001 From: Praveen Arimbrathodiyil Date: Thu, 24 Sep 2015 12:14:52 +0530 Subject: [PATCH] copy adduser.sh from diaspora-common --- debian/adduser.sh | 19 +++++++++++++++++++ debian/install | 1 + debian/postinst | 3 ++- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100755 debian/adduser.sh diff --git a/debian/adduser.sh b/debian/adduser.sh new file mode 100755 index 0000000000..1deaae7a65 --- /dev/null +++ b/debian/adduser.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# add diaspora system user (requires adduser >= 3.34) +# don't muck around with this unless you KNOW what you're doing +user=gitlab + +echo "Creating/updating $user user account..." +adduser --system --home /usr/share/$user \ + --gecos "$user system user" --shell /bin/false \ + --quiet --disabled-password --disabled-login $user || { + # adduser failed. Why? + if [ `getent passwd $user|awk -F ':' '{print $3}'` -gt 999 ] >/dev/null ; then + echo "Non-system user $user found. I will not overwrite a non-system" >&2 + echo "user. Remove the user and reinstall diaspora." >&2 + exit 1 + fi + # unknown adduser error, simply exit + exit 1 + } diff --git a/debian/install b/debian/install index f85a93f55e..1e3852728d 100644 --- a/debian/install +++ b/debian/install @@ -1,4 +1,5 @@ debian/gitlab-debian.conf etc/gitlab +debian/adduser.sh usr/lib/gitlab/scripts app usr/share/gitlab bin usr/share/gitlab CHANGELOG usr/share/gitlab diff --git a/debian/postinst b/debian/postinst index 80c794d531..e8d57d2a71 100755 --- a/debian/postinst +++ b/debian/postinst @@ -30,8 +30,9 @@ case "$1" in configure) . /etc/gitlab/gitlab-debian.conf + . /usr/lib/gitlab/scripts/adduser.sh chown -R ${gitlab_user}: ${gitlab_home} - cd ${diaspora_home} + cd ${gitlab_home} echo "Setting up environment varibales..." export RAILS_ENV=production