[DRE-commits] [diaspora-installer] 01/05: Add third party service integration options to debconf
Balasankar C
balasankarc-guest at moszumanska.debian.org
Sun Nov 15 09:41:27 UTC 2015
This is an automated email from the git hooks/post-receive script.
balasankarc-guest pushed a commit to branch debconf
in repository diaspora-installer.
commit 9840a1941f84f8120f1228a9012bf4173472f2d2
Author: Balasankar C <balasankarc at autistici.org>
Date: Sun Nov 15 15:01:31 2015 +0530
Add third party service integration options to debconf
---
debian/diaspora-common.postinst | 202 +++++++++++++++++++++++++++++++--------
debian/diaspora-common.templates | 46 +++++++++
2 files changed, 210 insertions(+), 38 deletions(-)
diff --git a/debian/diaspora-common.postinst b/debian/diaspora-common.postinst
index 3f0cfb6..add5bac 100755
--- a/debian/diaspora-common.postinst
+++ b/debian/diaspora-common.postinst
@@ -29,73 +29,199 @@ set -e
case "$1" in
configure)
# Source varibales
- . /etc/diaspora/diaspora-common.conf
+ . /etc/diaspora/diaspora-common.conf
# Check if there is another version installed
if ! test -z $2
then
# Evaluate major and minor versions of diaspora
. /usr/lib/diaspora-common/scripts/diaspora-versions.sh
- if test $(echo "${installed_diaspora_major_version} < 0.5" |bc) -eq 1
+ if test $(echo "${installed_diaspora_major_version} < 0.5" |bc) -eq 1
then
# Show debconf questions
- . /usr/share/debconf/confmodule
+ . /usr/share/debconf/confmodule
echo "Be ready for long running database migrations..."
else
if test $(echo "${installed_diaspora_minor_version} < ${diaspora_minor_version}" |bc) -eq 1
then
- echo "Trying update from ${installed_diaspora_version}..."
+ echo "Trying update from ${installed_diaspora_version}..."
fi
fi
else
# Show debconf questions
- . /usr/share/debconf/confmodule
- . /usr/share/dbconfig-common/dpkg/postinst.pgsql
+ . /usr/share/debconf/confmodule
+ . /usr/share/dbconfig-common/dpkg/postinst.pgsql
- dbc_dbname="diaspora_production"
- dbc_dbuser="diaspora"
+ dbc_dbname="diaspora_production"
+ dbc_dbuser="diaspora"
- dbc_go diaspora-common $@
+ dbc_go diaspora-common $@
- # Get ssl choice
- db_get diaspora-common/ssl
- if [ "${RET}" = "true" ]; then
- db_go
- # Configure pod address.
- db_get diaspora-common/url
- echo "SSL enabled, configuring nginx for ${RET}..."
- /usr/lib/diaspora-common/scripts/set-env-nginx.sh ${RET}
- db_go
- else
- db_go
- # Configure pod address.
- db_get diaspora-common/url
- 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
- ${diaspora_scripts}/adduser.sh
+ # Get ssl choice
+ db_get diaspora-common/ssl
+ if [ "${RET}" = "true" ]; then
+ db_go
+ # Configure pod address.
+ db_get diaspora-common/url
+ echo "SSL enabled, configuring nginx for ${RET}..."
+ /usr/lib/diaspora-common/scripts/set-env-nginx.sh ${RET}
+ db_go
+ else
+ db_go
+ # Configure pod address.
+ db_get diaspora-common/url
+ 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
+
+ # Check if user want to connect to some third party services
+ db_input high diaspora-common/services || true
+ db_go
+ db_get diaspora-common/services
+ echo "Services List"
+ selectedservices=$RET
+ if [ "$RET" != "" ]; then
+ #Check if Facebook is selected
+ service="Facebook"
+ if [ "${selectedservices#*$service}" != "$RET" ]; then
+ db_beginblock
+ db_input high diaspora-common/facebook_app_id || true
+ db_go
+ db_input high diaspora-common/facebook_secret || true
+ db_go
+ db_endblock
+ db_get diaspora-common/facebook_app_id
+ facebook_app_id=$RET
+ db_get diaspora-common/facebook_secret
+ facebook_secret=$RET
+ # Repeat the questions if user leave any of the two blank
+ while [ "$facebook_app_id" = "" ] || [ "$facebook_secret" = "" ]; do
+ db_beginblock
+ db_input high diaspora-common/facebook_app_id || true
+ db_go
+ db_input high diaspora-common/facebook_secret || true
+ db_go
+ db_endblock
+ db_get diaspora-common/facebook_app_id
+ facebook_app_id=$RET
+ db_get diaspora-common/facebook_secret
+ facebook_secret=$RET
+ done
+ echo export SERVICES_FACEBOOK_ENABLE=true >> /etc/diaspora.conf
+ echo export SERVICES_FACEBOOK_APP_ID=$facebook_app_id >> /etc/diaspora.conf
+ echo export SERVICES_FACEBOOK_SECRET=$facebook_secret >> /etc/diaspora.conf
+ fi
+ service="Twitter"
+ if [ "${selectedservices#*$service}" != "$RET" ]; then
+ db_beginblock
+ db_input high diaspora-common/twitter_key || true
+ db_go
+ db_input high diaspora-common/twitter_secret || true
+ db_go
+ db_endblock
+ db_get diaspora-common/twitter_key
+ twitter_key=$RET
+ db_get diaspora-common/twitter_secret
+ twitter_secret=$RET
+ # Repeat the questions if user leave any of the two blank
+ while [ "$twitter_key" = "" ] || [ "$twitter_secret" = "" ]; do
+ db_beginblock
+ db_input high diaspora-common/twitter_key || true
+ db_go
+ db_input high diaspora-common/twitter_secret || true
+ db_go
+ db_endblock
+ db_get diaspora-common/twitter_key
+ twitter_key=$RET
+ db_get diaspora-common/twitter_secret
+ twitter_secret=$RET
+ done
+ echo export SERVICES_TWITTER_ENABLE=true >> /etc/diaspora.conf
+ echo export SERVICES_TWITTER_KEY=$twitter_key >> /etc/diaspora.conf
+ echo export SERVICES_TWITTER_SECRET=$twitter_secret >> /etc/diaspora.conf
+ fi
+ service="Tumblr"
+ if [ "${selectedservices#*$service}" != "$RET" ]; then
+ db_beginblock
+ db_input high diaspora-common/tumblr_key || true
+ db_go
+ db_input high diaspora-common/tumblr_secret || true
+ db_go
+ db_endblock
+ db_get diaspora-common/tumblr_key
+ tumblr_key=$RET
+ db_get diaspora-common/tumblr_secret
+ tumblr_secret=$RET
+ # Repeat the questions if user leave any of the two blank
+ while [ "$tumblr_key" = "" ] || [ "$tumblr_secret" = "" ]; do
+ db_beginblock
+ db_input high diaspora-common/tumblr_key || true
+ db_go
+ db_input high diaspora-common/tumblr_secret || true
+ db_go
+ db_endblock
+ db_get diaspora-common/tumblr_key
+ tumblr_key=$RET
+ db_get diaspora-common/tumblr_secret
+ tumblr_secret=$RET
+ done
+ echo export SERVICES_TUMBLR_ENABLE=true >> /etc/diaspora.conf
+ echo export SERVICES_TUMBLR_KEY=$tumblr_key >> /etc/diaspora.conf
+ echo export SERVICES_TUMBLR_SECRET=$tumblr_secret >> /etc/diaspora.conf
+ fi
+ service="Wordpress"
+ if [ "${selectedservices#*$service}" != "$RET" ]; then
+ db_beginblock
+ db_input high diaspora-common/wordpress_client_id || true
+ db_go
+ db_input high diaspora-common/wordpress_secret || true
+ db_go
+ db_endblock
+ db_get diaspora-common/wordpress_client_id
+ wordpress_client_id=$RET
+ db_get diaspora-common/wordpress_secret
+ wordpress_secret=$RET
+ # Repeat the questions if user leave any of the two blank
+ while [ "$wordpress_client_id" = "" ] || [ "$wordpress_secret" = "" ]; do
+ db_beginblock
+ db_input high diaspora-common/wordpress_client_id || true
+ db_go
+ db_input high diaspora-common/wordpress_secret || true
+ db_go
+ db_endblock
+ db_get diaspora-common/wordpress_client_id
+ wordpress_client_id=$RET
+ db_get diaspora-common/wordpress_secret
+ wordpress_secret=$RET
+ done
+ echo export SERVICES_WORDPRESS_ENABLE=true >> /etc/diaspora.conf
+ echo export SERVICES_WORDPRESS_CLIENT_ID=$wordpress_client_id >> /etc/diaspora.conf
+ echo export SERVICES_WORDPRESS_SECRET=$wordpress_secret >> /etc/diaspora.conf
+ fi
+ fi
+ ${diaspora_scripts}/adduser.sh
${diaspora_scripts}/grantpriv.sh
- mkdir -p ${diaspora_nginx_log}
- mkdir -p ${diaspora_home}
- chown -R ${diaspora_user}: ${diaspora_home}
- db_stop
+ mkdir -p ${diaspora_nginx_log}
+ mkdir -p ${diaspora_home}
+ chown -R ${diaspora_user}: ${diaspora_home}
+ db_stop
fi
- ;;
+ ;;
abort-upgrade|abort-remove|abort-deconfigure)
- ;;
+ ;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
- esac
+esac
#DEBHELPER#
diff --git a/debian/diaspora-common.templates b/debian/diaspora-common.templates
index c083ca3..e902a33 100644
--- a/debian/diaspora-common.templates
+++ b/debian/diaspora-common.templates
@@ -50,3 +50,49 @@ _Description: Backup your database
# su postgres -c 'pg_dump diaspora_production -f /var/lib/postgresql/diaspora_production.sql'
.
# su postgres -c 'psql -d diaspora_production -f /var/lib/postgresql/diaspora_production.sql'
+
+Template: diaspora-common/services
+Type: multiselect
+Choices: Facebook, Twitter, Tumblr, Wordpress
+_Description: Enable third party services?
+ Diaspora can connect with different services.
+
+Template:diaspora-common/facebook_app_id
+Type: string
+_Description: Facebook App ID
+ Give your Facebook App ID. This can not be blank.
+
+Template:diaspora-common/facebook_secret
+Type: string
+_Description: Facebook Secret
+ Give your Facebook Secret. This can not be blank.
+
+Template:diaspora-common/twitter_key
+Type: string
+_Description: Twitter Key
+ Give your Twitter Key. This can not be blank.
+
+Template:diaspora-common/twitter_secret
+Type: string
+_Description: Twitter Secret
+ Give your Twitter Secret. This can not be blank.
+
+Template:diaspora-common/tumblr_key
+Type: string
+_Description: Tumblr Key
+ Give your Tumblr Key. This can not be blank.
+
+Template:diaspora-common/tumblr_secret
+Type: string
+_Description: Tumblr Secret
+ Give your Tumblr Secret. This can not be blank.
+
+Template:diaspora-common/wordpress_client_id
+Type: string
+_Description: Wordpress Client ID
+ Give your Wordpress Client ID. This can not be blank.
+
+Template:diaspora-common/wordpress_secret
+Type: string
+_Description: Wordpress Secret
+ Give your Wordpress Secret. This can not be blank.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/diaspora-installer.git
More information about the Pkg-ruby-extras-commits
mailing list