add debconf option

This commit is contained in:
Praveen Arimbrathodiyil 2016-01-16 15:43:30 +05:30
parent b8a8f4d7c1
commit 757cee6e00
3 changed files with 52 additions and 10 deletions

9
debian/config vendored Normal file → Executable file
View file

@ -6,3 +6,12 @@ set -e
echo "Call debconf to configure gitlab" echo "Call debconf to configure gitlab"
# source debconf stuffs # source debconf stuffs
. /usr/share/debconf/confmodule . /usr/share/debconf/confmodule
# What is your fqdn?
db_input high gitlab/fqdn || true
db_go
# Do you want https?
db_input high gitlab/ssl || true
db_go

View file

@ -1,9 +1,15 @@
Template: gitlab/dbpass Template: gitlab/fqdn
Type: note Type: string
_Description: PostgreSQL application password Default: localhost
You can leave the PostgreSQL application password blank, as the "ident" _Description: Fully qualified domain name for this instance of Gitlab:
authentication method is used, allowing the gitlab user on the system Please choose the domain name which should be used to access this
to connect to the gitlab database without a password. instance of Gitlab.
.
This should be the fully qualified name as seen from the Internet, with
the domain name that will be used to access the pod.
.
If a reverse proxy is used, give the hostname that the proxy server
responds to.
Template: gitlab/ssl Template: gitlab/ssl
Type: boolean Type: boolean
@ -21,3 +27,4 @@ _Description: Enable https?
You can disable https if you want to access Gitlab only locally, via You can disable https if you want to access Gitlab only locally, via
Unicorn on port 3000. If you disable https, Nginx configuration will be Unicorn on port 3000. If you disable https, Nginx configuration will be
skipped. skipped.

34
debian/postinst vendored
View file

@ -28,6 +28,10 @@ set -e
case "$1" in case "$1" in
configure) configure)
echo "I'm here............................"
# Show debconf questions
. /usr/share/debconf/confmodule
. /etc/gitlab/gitlab-debian.conf . /etc/gitlab/gitlab-debian.conf
. /usr/lib/gitlab/scripts/adduser.sh . /usr/lib/gitlab/scripts/adduser.sh
gitlab_repo_path=${gitlab_data_dir}/repositories gitlab_repo_path=${gitlab_data_dir}/repositories
@ -42,12 +46,10 @@ case "$1" in
su ${gitlab_user} -s /bin/sh -c "mkdir -p -m 750 ${gitlab_home}/public/uploads" su ${gitlab_user} -s /bin/sh -c "mkdir -p -m 750 ${gitlab_home}/public/uploads"
su ${gitlab_user} -s /bin/sh -c 'git config --global core.autocrlf "input"' su ${gitlab_user} -s /bin/sh -c 'git config --global core.autocrlf "input"'
cd ${gitlab_home} cd ${gitlab_home}
# Show debconf questions
. /usr/share/debconf/confmodule
echo "Create database if not present" echo "Create database if not present"
if ! su postgres -s /bin/sh -c "psql gitlab_production -c ''" if ! su postgres -s /bin/sh -c "psql gitlab_production -c ''"
then then
su postgres -c 'createdb gitlab_production' su postgres -c 'createdb gitlab_production'
fi fi
# Adjust database privileges # Adjust database privileges
@ -62,6 +64,30 @@ case "$1" in
echo "Running final rake tasks..." echo "Running final rake tasks..."
# Move these to rails-common # Move these to rails-common
. /usr/lib/gitlab/scripts/rake-tasks.sh . /usr/lib/gitlab/scripts/rake-tasks.sh
# Get ssl choice
db_get gitlab/ssl
if [ "${RET}" = "true" ]; then
db_go
# Configure instance address.
db_get gitlab/fqdn
echo "SSL enabled, configuring nginx for ${RET}..."
#/usr/lib/diaspora-common/scripts/set-env-nginx.sh ${RET}
db_go
else
db_go
# Configure instance address.
db_get gitlab/fqdn
echo "SSL disabled, skip nginx configuration for ${RET}..."
#if ! grep SERVERNAME /etc/diaspora.conf
#then
# echo export SERVERNAME=${RET} >> /etc/diaspora.conf
# export SERVERNAME=${RET}
# echo export ENVIRONMENT_URL="http://$SERVERNAME:3000" >> /etc/diaspora.conf
#fi
fi
db_stop
;; ;;
abort-upgrade|abort-remove|abort-deconfigure) abort-upgrade|abort-remove|abort-deconfigure)