This file is indexed.

postinst is in diaspora-common 0.5.7.1+debian2.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#! /bin/sh
# postinst script for diaspora-installer
# copied from postinst script for hplip
# $Id: hplip.postinst,v 1.1 2005/10/15 21:39:04 hmh Exp $
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#
# quoting from the policy:
#     Any necessary prompting should almost always be confined to the
#     post-installation script, and should be protected with a conditional
#     so that unnecessary prompting doesn't happen if a package's
#     installation fails and the `postinst' is called with `abort-upgrade',
#     `abort-remove' or `abort-deconfigure'.


case "$1" in
    configure)
        # Source varibales
        . /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
            then
                # Show debconf questions
                . /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}..."
                fi
            fi

        else
            # Show debconf questions
            . /usr/share/debconf/confmodule
            . /usr/share/dbconfig-common/dpkg/postinst

            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 ${diaspora_conf}
                then
                    echo export SERVERNAME=${RET} >> ${diaspora_conf}
                    export SERVERNAME=${RET}
                    echo export ENVIRONMENT_URL="http://$SERVERNAME:3000" >> ${diaspora_conf}
                fi
            fi

            # Check if user want to connect to some third party services
            db_get diaspora-common/services
            echo "Services List"
            selectedservices=$RET
            echo $selectedservices
            if [ "$RET" != "" ]; then
                #Check if Facebook is selected
                servicename="Facebook"
                if [ "${selectedservices#*$servicename}" != "$RET" ]; then
                    db_get diaspora-common/facebook_app_id
                    facebook_app_id=$RET
                    db_get diaspora-common/facebook_secret
                    facebook_secret=$RET
                    echo export SERVICES_FACEBOOK_ENABLE=true >> ${diaspora_conf}
                    echo export SERVICES_FACEBOOK_APP_ID=$facebook_app_id >> ${diaspora_conf}
                    echo export SERVICES_FACEBOOK_SECRET=$facebook_secret >> ${diaspora_conf}
                fi
                servicename="Twitter"
                if [ "${selectedservices#*$servicename}" != "$selectedservices" ]; then
                    db_get diaspora-common/twitter_key
                    twitter_key=$RET
                    db_get diaspora-common/twitter_secret
                    twitter_secret=$RET
                    echo export SERVICES_TWITTER_ENABLE=true >> ${diaspora_conf}
                    echo export SERVICES_TWITTER_KEY=$twitter_key >> ${diaspora_conf}
                    echo export SERVICES_TWITTER_SECRET=$twitter_secret >> ${diaspora_conf}
                fi
                servicename="Tumblr"
                if [ "${selectedservices#*$servicename}" != "$selectedservices" ]; then
                    db_get diaspora-common/tumblr_key
                    tumblr_key=$RET
                    db_get diaspora-common/tumblr_secret
                    tumblr_secret=$RET
                    echo export SERVICES_TUMBLR_ENABLE=true >> ${diaspora_conf}
                    echo export SERVICES_TUMBLR_KEY=$tumblr_key >> ${diaspora_conf}
                    echo export SERVICES_TUMBLR_SECRET=$tumblr_secret >> ${diaspora_conf}
                fi
                servicename="Wordpress"
                if [ "${selectedservices#*$servicename}" != "$selectedservices" ]; then
                    db_get diaspora-common/wordpress_client_id
                    wordpress_client_id=$RET
                    db_get diaspora-common/wordpress_secret
                    wordpress_secret=$RET
                    echo export SERVICES_WORDPRESS_ENABLE=true >> ${diaspora_conf}
                    echo export SERVICES_WORDPRESS_CLIENT_ID=$wordpress_client_id >> ${diaspora_conf}
                    echo export SERVICES_WORDPRESS_SECRET=$wordpress_secret >> ${diaspora_conf}
                fi
            fi
            ucf --debconf-ok ${diaspora_conf} /etc/diaspora.conf
            ucfr diaspora-common /etc/diaspora.conf
            ${diaspora_scripts}/adduser.sh
            ${diaspora_scripts}/grantpriv.sh
            ucf --debconf-ok ${diaspora_database_yml} /etc/diaspora/database.yml
            ucfr diaspora-common /etc/diaspora/database.yml
            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


# Automatically added by dh_installinit
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
	if [ -x "/etc/init.d/diaspora" ]; then
		update-rc.d diaspora defaults >/dev/null || exit $?
	fi
fi
# End automatically added section


exit 0