Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / var / lib / dpkg / info / | server ip : 104.21.89.46 your ip : 172.69.17.43 H O M E |
Filename | /var/lib/dpkg/info/phpmyadmin.postinst |
Size | 4.31 kb |
Permission | rwxr-xr-x |
Owner | root : root |
Create time | 27-Apr-2025 10:12 |
Last modified | 30-Aug-2018 03:25 |
Last accessed | 06-Jul-2025 22:10 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
#!/bin/sh
# postinst script for phpmyadmin
set -e
avahi_install() {
if [ -d /etc/avahi/services/ -a ! -e /etc/avahi/services/phpmyadmin.service -a ! -L /etc/avahi/services/phpmyadmin.service ] ; then
ln -s ../../phpmyadmin/phpmyadmin.service /etc/avahi/services/
fi
}
desktop_install() {
if [ -d /usr/share/applications/ -a ! -e /usr/share/applications/phpmyadmin.desktop -a ! -L /usr/share/applications/phpmyadmin.desktop ] ; then
ln -s /etc/phpmyadmin/phpmyadmin.desktop /usr/share/applications/
fi
}
lighttpd_install() {
if [ ! -f /etc/lighttpd/conf-available/50-phpmyadmin.conf ] ; then
if which lighty-enable-mod >/dev/null 2>&1 ; then
ln -s ../../phpmyadmin/lighttpd.conf /etc/lighttpd/conf-available/50-phpmyadmin.conf
# We also need auth to protect setup.php
lighty-enable-mod phpmyadmin auth fastcgi fastcgi-php
avahi_install
desktop_install
else
echo "Lighttpd not installed, skipping"
fi
fi
}
apache_install() {
mkdir -p /etc/apache2/conf-available
ln -sf ../../phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)
if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
. /usr/share/apache2/apache2-maintscript-helper
apache2_invoke enconf phpmyadmin
elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
[ -d /etc/apache2/conf.d/ ] && [ ! -L /etc/apache2/conf.d/phpmyadmin.conf ] && ln -s ../conf-available/phpmyadmin.conf /etc/apache2/conf.d/phpmyadmin.conf
fi
avahi_install
desktop_install
}
. /usr/share/debconf/confmodule
. /usr/share/dbconfig-common/dpkg/postinst.mysql
dbc_generate_include_owner="root:www-data"
dbc_generate_include_perms="0640"
dbc_generate_include=php:/etc/phpmyadmin/config-db.php
if ! dbc_go phpmyadmin $@ ; then
echo 'Automatic configuration using dbconfig-common failed!'
fi
if [ "$1" = "configure" ]; then
# Generate secret for cookie encryption
if [ ! -f /var/lib/phpmyadmin/blowfish_secret.inc.php ]; then
touch /var/lib/phpmyadmin/blowfish_secret.inc.php
chgrp www-data /var/lib/phpmyadmin/blowfish_secret.inc.php
chmod 640 /var/lib/phpmyadmin/blowfish_secret.inc.php
printf "<?php\n\$cfg['blowfish_secret'] = '%s';\n" \
`perl -le 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..24)'` \
>> /var/lib/phpmyadmin/blowfish_secret.inc.php
fi
db_version 2.0
# The following only on a new install
if [ "$2" = "" ]; then
# Generate an htpasswd file for the web based setup
if [ ! -f /etc/phpmyadmin/htpasswd.setup ]; then
touch /etc/phpmyadmin/htpasswd.setup
chgrp www-data /etc/phpmyadmin/htpasswd.setup
chmod 0640 /etc/phpmyadmin/htpasswd.setup
db_get phpmyadmin/setup-username
setup_username=${RET:-admin}
db_get phpmyadmin/setup-password
if [ -n "$RET" ]; then
setup_password=`perl -le 'print crypt($ARGV[0], join("", map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..2)))' "$RET"`
else
setup_password="*"
fi
echo "$setup_username:$setup_password" > /etc/phpmyadmin/htpasswd.setup
db_reset phpmyadmin/setup-username || true
db_reset phpmyadmin/setup-password || true
if [ ! -f /var/lib/phpmyadmin/config.inc.php ]; then
touch /var/lib/phpmyadmin/config.inc.php
chgrp www-data /var/lib/phpmyadmin/config.inc.php
chmod 0640 /var/lib/phpmyadmin/config.inc.php
fi
fi
fi
# Fixup permissions
if [ -f /var/lib/phpmyadmin/config.inc.php ]; then
chmod 0640 /var/lib/phpmyadmin/config.inc.php
fi
if ! dpkg-statoverride --list /var/lib/phpmyadmin/tmp >/dev/null; then
chown -R www-data:www-data /var/lib/phpmyadmin/tmp
fi
# Configure Apache
db_get phpmyadmin/reconfigure-webserver
webservers="$RET"
for webserver in $webservers; do
webserver=${webserver%,}
if [ "$webserver" = "lighttpd" ] ; then
lighttpd_install
else
apache_install $1
fi
# Reload webserver in any case, configuration might have changed
# Redirection of 3 is needed because Debconf uses it and it might
# be inherited by webserver. See bug #446324.
if [ -f /etc/init.d/$webserver ] ; then
if [ -x /usr/sbin/invoke-rc.d ]; then
invoke-rc.d $webserver reload 3>/dev/null || true
else
/etc/init.d/$webserver reload 3>/dev/null || true
fi
fi
done
fi
exit 0
# postinst script for phpmyadmin
set -e
avahi_install() {
if [ -d /etc/avahi/services/ -a ! -e /etc/avahi/services/phpmyadmin.service -a ! -L /etc/avahi/services/phpmyadmin.service ] ; then
ln -s ../../phpmyadmin/phpmyadmin.service /etc/avahi/services/
fi
}
desktop_install() {
if [ -d /usr/share/applications/ -a ! -e /usr/share/applications/phpmyadmin.desktop -a ! -L /usr/share/applications/phpmyadmin.desktop ] ; then
ln -s /etc/phpmyadmin/phpmyadmin.desktop /usr/share/applications/
fi
}
lighttpd_install() {
if [ ! -f /etc/lighttpd/conf-available/50-phpmyadmin.conf ] ; then
if which lighty-enable-mod >/dev/null 2>&1 ; then
ln -s ../../phpmyadmin/lighttpd.conf /etc/lighttpd/conf-available/50-phpmyadmin.conf
# We also need auth to protect setup.php
lighty-enable-mod phpmyadmin auth fastcgi fastcgi-php
avahi_install
desktop_install
else
echo "Lighttpd not installed, skipping"
fi
fi
}
apache_install() {
mkdir -p /etc/apache2/conf-available
ln -sf ../../phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)
if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
. /usr/share/apache2/apache2-maintscript-helper
apache2_invoke enconf phpmyadmin
elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
[ -d /etc/apache2/conf.d/ ] && [ ! -L /etc/apache2/conf.d/phpmyadmin.conf ] && ln -s ../conf-available/phpmyadmin.conf /etc/apache2/conf.d/phpmyadmin.conf
fi
avahi_install
desktop_install
}
. /usr/share/debconf/confmodule
. /usr/share/dbconfig-common/dpkg/postinst.mysql
dbc_generate_include_owner="root:www-data"
dbc_generate_include_perms="0640"
dbc_generate_include=php:/etc/phpmyadmin/config-db.php
if ! dbc_go phpmyadmin $@ ; then
echo 'Automatic configuration using dbconfig-common failed!'
fi
if [ "$1" = "configure" ]; then
# Generate secret for cookie encryption
if [ ! -f /var/lib/phpmyadmin/blowfish_secret.inc.php ]; then
touch /var/lib/phpmyadmin/blowfish_secret.inc.php
chgrp www-data /var/lib/phpmyadmin/blowfish_secret.inc.php
chmod 640 /var/lib/phpmyadmin/blowfish_secret.inc.php
printf "<?php\n\$cfg['blowfish_secret'] = '%s';\n" \
`perl -le 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..24)'` \
>> /var/lib/phpmyadmin/blowfish_secret.inc.php
fi
db_version 2.0
# The following only on a new install
if [ "$2" = "" ]; then
# Generate an htpasswd file for the web based setup
if [ ! -f /etc/phpmyadmin/htpasswd.setup ]; then
touch /etc/phpmyadmin/htpasswd.setup
chgrp www-data /etc/phpmyadmin/htpasswd.setup
chmod 0640 /etc/phpmyadmin/htpasswd.setup
db_get phpmyadmin/setup-username
setup_username=${RET:-admin}
db_get phpmyadmin/setup-password
if [ -n "$RET" ]; then
setup_password=`perl -le 'print crypt($ARGV[0], join("", map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..2)))' "$RET"`
else
setup_password="*"
fi
echo "$setup_username:$setup_password" > /etc/phpmyadmin/htpasswd.setup
db_reset phpmyadmin/setup-username || true
db_reset phpmyadmin/setup-password || true
if [ ! -f /var/lib/phpmyadmin/config.inc.php ]; then
touch /var/lib/phpmyadmin/config.inc.php
chgrp www-data /var/lib/phpmyadmin/config.inc.php
chmod 0640 /var/lib/phpmyadmin/config.inc.php
fi
fi
fi
# Fixup permissions
if [ -f /var/lib/phpmyadmin/config.inc.php ]; then
chmod 0640 /var/lib/phpmyadmin/config.inc.php
fi
if ! dpkg-statoverride --list /var/lib/phpmyadmin/tmp >/dev/null; then
chown -R www-data:www-data /var/lib/phpmyadmin/tmp
fi
# Configure Apache
db_get phpmyadmin/reconfigure-webserver
webservers="$RET"
for webserver in $webservers; do
webserver=${webserver%,}
if [ "$webserver" = "lighttpd" ] ; then
lighttpd_install
else
apache_install $1
fi
# Reload webserver in any case, configuration might have changed
# Redirection of 3 is needed because Debconf uses it and it might
# be inherited by webserver. See bug #446324.
if [ -f /etc/init.d/$webserver ] ; then
if [ -x /usr/sbin/invoke-rc.d ]; then
invoke-rc.d $webserver reload 3>/dev/null || true
else
/etc/init.d/$webserver reload 3>/dev/null || true
fi
fi
done
fi
exit 0