diff --git a/debian/postinst b/debian/postinst index e05fff732d..05685fbe81 100755 --- a/debian/postinst +++ b/debian/postinst @@ -34,24 +34,34 @@ case "$1" in # Read and export debian specific configuration # Only exported variables will be passed on to gitlab app gitlab_debian_conf=/etc/gitlab/gitlab-debian.conf - for i in $(cat ${gitlab_debian_conf}); do export $i; done + export $(cat ${gitlab_debian_conf}|xargs) # Create gitlab user . /usr/lib/gitlab/scripts/adduser.sh gitlab_repo_path=${gitlab_data_dir}/repositories - mkdir -p ${gitlab_repo_path} + + # Create directories and change ownership + for i in ${gitlab_repo_path} ${gitlab_pid_path} ${gitlab_log_dir}\ + ${gitlab_shell_log}; do + mkdir $i + chown -R ${gitlab_user}: $i + done + + # Customize permissions chmod -R ug+rwX,o-rwx ${gitlab_repo_path}/ chmod -R ug-s ${gitlab_repo_path}/ find ${gitlab_repo_path}/ -type d -print0 | xargs -0 chmod g+s - chown -R ${gitlab_user}: ${gitlab_home} - chown -R ${gitlab_user}: ${gitlab_data_dir} + for i in ${gitlab_home} ${gitlab_data_dir} ${gitlab_shell_root}; do + chown -R ${gitlab_user}: $i + done - mkdir -p ${gitlab_shell_log} - chown -R ${gitlab_user}: ${gitlab_shell_root} - chown -R ${gitlab_user}: ${gitlab_shell_log} su ${gitlab_user} -s /bin/sh -c "mkdir -p -m 750 ${gitlab_home}/public/uploads" + su ${gitlab_user} -s /bin/sh -c "mkdir -p ${gitlab_pid_path}/pids" + su ${gitlab_user} -s /bin/sh -c "mkdir -p ${gitlab_pid_path}/sockets" su ${gitlab_user} -s /bin/sh -c 'git config --global core.autocrlf "input"' + + # Commands below needs to be run from gitlab_home cd ${gitlab_home} # Obtain hostname from debconf db