This file is indexed.

postinst is in hoteldruid 2.2.2-1.

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
#!/bin/sh
# postinst script for hoteldruid
#
# 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>
#        * <postinst> `abort-remove'
#        * <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


# Source debconf library.
. /usr/share/debconf/confmodule


case "$1" in
  configure)
    db_get hoteldruid/configure-apache || true
    if [ "$RET" = "true" ]; then


      # Write Apache configuration file
      apacheconf=`tempfile`
      cat >> $apacheconf <<-EOF
Alias /hoteldruid/pages /var/lib/hoteldruid/pages
Alias /hoteldruid /usr/share/hoteldruid

<Directory /usr/share/hoteldruid/>
	Options +FollowSymLinks
EOF
      db_get hoteldruid/restrict-localhost || true
      if [ "$RET" = "true" ]; then # Access from localhost
        echo "	Require local" >> $apacheconf
      else  # Globally accessible
        echo "	Require all granted" >> $apacheconf
      fi
      cat >> $apacheconf <<-EOF
</Directory>

<Directory /var/lib/hoteldruid/pages>
	Options +FollowSymLinks
	AllowOverride All
	Require all granted
</Directory>

<Directory /var/lib/hoteldruid/data>
	Require all denied
</Directory>
EOF

     ucf --debconf-ok $apacheconf /etc/hoteldruid/apache2.conf
     ucfr hoteldruid /etc/hoteldruid/apache2.conf

      # Remove temporary file
      rm $apacheconf;

      if [ -e /etc/hoteldruid/apache2.conf ]; then
        chmod 0644 /etc/hoteldruid/apache2.conf
      fi


      # Remove old configuration symlink for apache 2.2
      if [ -e /etc/apache2/conf.d/hoteldruid.conf ]
      then
        rm /etc/apache2/conf.d/hoteldruid.conf
      fi
      # Remove possible user compatibility symlink for apache 2.4
      if [ -h /etc/apache2/conf-available/hoteldruid.conf ]
      then
        rm /etc/apache2/conf-available/hoteldruid.conf
      fi
      if [ -d /etc/apache2/conf-available -a ! -e /etc/apache2/conf-available/hoteldruid.conf ]
      then
        ln -s /etc/hoteldruid/apache2.conf /etc/apache2/conf-available/hoteldruid.conf
        if [ -e /usr/share/apache2/apache2-maintscript-helper ]
        then
          . /usr/share/apache2/apache2-maintscript-helper
          apache2_invoke enconf hoteldruid
        fi
      fi

      db_get hoteldruid/restart-webserver
      if [ "$RET" = "true" ]; then
        invoke-rc.d apache2 force-reload 3>/dev/null || true
      fi
    fi


  # Write file with administrator username and password
  PASS_FILE="/var/lib/hoteldruid/data/ini.php"
  db_get hoteldruid/administrator-username
  if [ -n "$RET" ] && [ ! -e "$PASS_FILE" ]; then
    cat >> $PASS_FILE <<-EOF
<?php

define('C_ADMIN_NAME','$RET');
EOF
    db_get hoteldruid/administrator-password
    if [ -n "$RET" ]; then
      SALT=$(</dev/urandom tr -dc A-Za-z0-9 | head -c 19)
      SALT="=$SALT"
      PASS=$(echo -n "$RET$SALT" | md5sum -b | cut -d' ' -f1)
      cat >> $PASS_FILE <<-EOF
define('C_ADMIN_PASS','$PASS');
define('C_ADMIN_SALT','$SALT');
define('C_ADMIN_MD5P','1');
EOF
    fi
    cat >> $PASS_FILE <<-EOF

?>
EOF

    if [ -e "$PASS_FILE" ]; then
        chmod 0600 $PASS_FILE
        chown www-data:www-data $PASS_FILE
    fi

  fi
  db_set hoteldruid/administrator-username ""
  db_reset hoteldruid/administrator-password

  ;;

  abort-upgrade|abort-remove|abort-deconfigure)
  ;;

  *)
    echo "postinst called with unknown argument \`$1'" >&2
    exit 1
  ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.



exit 0