Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
PK ϚY[W&M M apache-include_all.shnu W+A #!/bin/sh
# File: apache-include_all.sh
# Changes:
# 20010219 Ola Lundqvist
# 20011022 Luca De Vitis
# Introduced the error variable.
# o /[[:space:]][[:space:]]*/[[:space:]]\+/
# Reduced the 3 assignment in the function to a single sed
# script.
# 20020116 Ola Lundqvist
# Documented the error variable.
# 20020412 Ola Lundqvist
# Added check for if the server is installed.
# Needs: $server - what apache server that should be configured.
# That can be any matching /etc/$server/*.conf
# $includefile - what file that should not be included.
# /usr/share/wwwconfig-common/apache-uncominclude.sh
# /usr/share/wwwconfig-common/apache-include.sh
# Description: Includes a file in a apache config file.
# If it is not included (and commented) it will be added
# at the bottom of the file.
# It first checks for if any in the server
# Sets: $status = {error, nothing, uncomment, include}
# $error = error message (if $status = error).
status=error
if [ -z "$includefile" ] ; then
error="No include file specified for apache-include_all.sh."
elif [ ! -f $includefile ] ; then
error="Includefile $includefile not found in apache-include_all.sh."
elif [ ! -d /etc/$server ] ; then
error="No server $server installed, unable to configure it."
else
status=nothing
if grep -e "Include[[:space:]]\+$includefile" /etc/$server/*.conf > /dev/null 2>&1; then
lstatus=nothing
log="${log}Include of $includefile found in apache config files."
for conffile in /etc/$server/*.conf; do
. /usr/share/wwwconfig-common/apache-uncominclude.sh
if [ "$status" = "uncomment" ] ; then
lstatus=$status
fi
done
status=$lstatus
else
conffile=/etc/$server/httpd.conf
. /usr/share/wwwconfig-common/apache-include.sh
status=include
fi
fi
PK ϚY[HԭG G pgsql-if-exec.shnu W+A #!/bin/sh
# File: pgsql-if-exec.sh
# Changes:
# 20010322 Ola Lundqvist
# 20011022 Luca De Vitis
# Introduced the error variable.
# Added the -d flag to $pgsqlcmd (not really needed but clearer)
# 20020116 Ola Lundqvist
# Documented the error variable.
# 20020125 Ola Lundqvist
# Added new status code.
# 20020126 Ola Lundqvist
# Removed need for $dbadmin.
# 20051009 Ola Lundqvist
# Use dbuser=false on check and then set it to true when exec.
# Thanks to Christoph Martin .
# Needs: $dbname - the database that user should have access to (optional)
# $dbserver - the server to connect to.
# $dbadmin - the administrator name.
# $dbadmpass - the administrator password (not supported).
# $statement - the statement to test if it can get data.
# which
# psql
# /usr/share/wwwconfig-common/pgsql.get
# Description: First checks a statement. If that statement is ok it executes the
# script.
# Sets: $status = {error, nothing, exec, execerror}
# $error = error message (if $status = error)
status=error
error=""
. /usr/share/wwwconfig-common/pgsql.get
use_dbuser=false
if [ -z "$dbserver" ] ; then
error="No database server specified."
elif [ ! -x $(which pgsql) ] ; then
error="No pgsql client to execute, install the pgsql client package and
run 'dpkg-reconfigure -plow packagename'."
elif ! eval $pgsqlcmd -d $systemdb -c "\"select usename from pg_shadow;\"" >/dev/null 2>&1 ; then
error="Error when trying to connect to the pgsql database.
This error can occur if you have no database to connect to, or
if the password was incorrect.
use: dpkg-reconfigure -plow packagename to reconfigure."
elif eval $pgsqlcmd -d $dbname -c "\"$statement\"" >/dev/null 2>&1 ; then
log="${log}Executing command to pgsql."
use_dbuser=true
if eval $pgsqlcmd -d $dbname < $sqlfile > /dev/null 2>&1 ; then
status=exec
else
status=execerror
error="Unable to run the sql script ($sqlfile)."
fi
else
status=nothing
fi
PK ϚY[a` apache-run.getnu W+A # File: apache-run.get
# Changes:
# 20010219 Ola Lundqvist
# 20011022 Luca De Vitis
# Allowed reinclusion.
# 20020116 Ola Lundqvist
# Documented the reinclusion.
# Needs: /usr/share/wwwconfig-common/apache.func
# $server - the apache server to use,
# anything that matches /etc/$server/*.conf.
# Description: Sets the webuser and webgroup that apache runs as.
# Sets: apache_run_get=done to allow reinclusion.
if [ -z "$apache_run_get" ] ; then
. /usr/share/wwwconfig-common/apache.func
getwwwoption User /etc/$server/httpd.conf
webuser=$(echo "$getwwwoption" | sed -e "q")
getwwwoption Group /etc/$server/httpd.conf
webgroup=$(echo "$getwwwoption" | sed -e "q")
apache_run_get="done"
fi
PK ϚY[lj& & apache-uninclude_all.shnu W+A #!/bin/sh
# File: apache-uninclude_all.sh
# Changes:
# 20010219 Ola Lundqvist
# 20011022 Luca De Vitis
# Introduced the error variable.
# 20020116 Ola Lundqvist
# Documented the error variable.
# 20020412 Ola Lundqvist
# If the server is not installed, then do nothing.
# Needs: $server - what apache server that should be configured.
# That can be any matching /etc/$server/*.conf
# $includefile - what file that should not not be included.
# /usr/share/wwwconfig-common/apache-uninclude.sh
# Description: Purges all include statements for that file in all apache config files.
# Sets: $status = {error, nothing, purge}
# $error = error message (if $status = error)
status=error
error=""
if [ -z "$includefile" ] ; then
error="No include file specified for apache-uninclude_all.sh"
elif [ ! -d /etc/$server ] ; then
status=nothing
error="No server $server installed, unable to deconfigure it."
else
status=nothing
if grep -e "Include[[:space:]]\+$includefile\b" /etc/$server/*.conf > /dev/null 2>&1; then
log="${log}Include of $includefile found in apache config files, purging."
for conffile in /etc/$server/*.conf; do
. /usr/share/wwwconfig-common/apache-uninclude.sh
done
status=purge
fi
fi
PK ϚY[f7 7
mysql.funcnu W+A # File: mysql.func
# Changes:
# 20010430 Ola Lundqvist
# 20020125 Ola Lundqvist
# Fixed multiple $tmpwhat matching lines, #115485.
# 20020126 Ola Lundqvist
# Added new variable found so that empty passwords will be
# correctly handled.
# Needs: /etc/mysql/my.cnf
# Description: Get a config value from my.cnf
# Usage: getmysqlopt section option
# Sets: $getmysqlopt = value
found=no
getmysqlopt() {
tmpcfgfile="$3"
tmpwhat="$2"
tmpsect="$1"
if grep -v '^#' $tmpcfgfile | grep "\[$tmpsect\]" >/dev/null 2>&1 ; then
getmysqlopt=$(grep -A 10 "\[$tmpsect\]" $tmpcfgfile | grep "^[[:space:]]*$tmpwhat[[:space:]]*=[[:space:]]*" | head -1 | sed "s|^[[:space:]]*$tmpwhat[[:space:]]*=[[:space:]]*||g; s|[[:space:]][[:space:]]*$||g;")
found=yes
fi
}
PK ϚY[yhTj j apache-include.shnu W+A #!/bin/sh
# File: apache-include.sh
# Changes:
# 20010219 Ola Lundqvist
# 20011022 Luca De Vitis
# Introduced the error variable.
# o /[[:space:]][[:space:]]*/[[:space:]]\+/
# 20020116 Ola Lundqvist
# Documented the error variable.
# Needs: $conffile - where the config file is.
# $includefile - what file that should not be included.
# /usr/share/wwwconfig-common/apache-uncominclude.sh
# Description: Includes a file in a apache config file.
# If it is not included (and commented) it will be added
# at the bottom of the file.
# Sets: $status = {error, nothing, include, uncomment}
# $error = error message (if $status = error).
status=error
if [ -z "$conffile" ] ; then
error="No config file specified in apache-include.sh"
elif [ -z "$includefile" ] ; then
error="No include file specified in apache-include.sh"
elif [ ! -f $conffile ] ; then
error="File $conffile not found!"
elif [ ! -f $includefile ] ; then
error="File $includefile not found!"
else
status=nothing
. /usr/share/wwwconfig-common/apache-uncominclude.sh
if [ "$status" = "nothing" ] ; then
if ! grep -e "Include[[:space:]]\+$includefile\b" $conffile > /dev/null 2>&1; then
status=include
log="${log}Including $includefile in $conffile."
echo "Include $includefile" >> $conffile
fi
fi
fi
PK ϚY['9# apache-index.shnu W+A #!/bin/sh
# File: apache-index.sh
# Changes:
# 20010219 Ola Lundqvist
# 20011022 Luca De Vitis
# Introduced the error variable.
# 20020116 Ola Lundqvist
# Documented the error variable.
# Needs: $index - the index file to add.
# $conffile - the config file to modify.
# Description: Adds an index to a apache config.
# Ie: adds to DirectoryIndex
# Sets: $status = {error, nothing, found, added}
# $error = error message (if $status = error)
status=error
error=""
if [ -z "$index" ] ; then
error="No index specified in apache-index.sh."
elif [ -z "$conffile" ] ; then
error="No config file specified in apache-index.sh."
elif [ ! -f $conffile ] ; then
error="Config file $conffile not found from apache-index.sh."
else
status=nothing
if grep "DirectoryIndex" $conffile >/dev/null 2>&1; then
if grep -e "DirectoryIndex.*\b$index\b" $conffile >/dev/null 2>&1; then
log="${log}$index settings in $conffile found!"
status=found
else
sed -e "s#\(DirectoryIndex.*\bindex.html\b\)#\1 $index#" < $conffile > $conffile.new
if grep -e "DirectoryIndex.*[[:space:]]\+$index\b" $conffile.new > /dev/null 2>&1; then
log="${log}$index index settings in $conffile added!"
mv $conffile.new $conffile
status=added
else
error="Error when adding $index index settings in $conffile!"
rm $conffile.new
fi
fi
fi
fi
PK ϚY[[p/=T T apache-uncominclude.shnu W+A #!/bin/sh
# File: apache-uncominclude.sh
# Changes:
# 20010219 Ola Lundqvist
# 20011022 Luca De Vitis
# Introduced the error variable.
# o /[[:space:]][[:space:]]*/[[:space:]]\+/
# Changed from "cat $conffile | sed" to "sed ... < $conffile"
# 20020116 Ola Lundqvist
# Documented the error variable.
# Needs: $conffile - The file that should be modified.
# $includefile - The file that should not be included.
# Description: Comments out a include statement.
# Sets: $status = {error, nothing, uncomment}
# $error = error message (if $status = error).
status=error
if [ -z "$conffile" ] ; then
error="No config file specified in apache-uncominclude.sh"
elif [ -z "$includefile" ] ; then
error="No include file specified in apache-uncominclude.sh"
elif [ ! -f $conffile ] ; then
error="File $conffile not found!"
elif [ ! -f $includefile ] ; then
error="File $includefile not found!"
else
status=nothing
if grep -e "^[[:space:]]*#[[:space:]]*Include[[:space:]]\+$includefile\b" $conffile > /dev/null 2>&1; then
log="${log}Uncommenting import for $includefile in $conffile"
status=uncomment
sed -e "s|^\([[:space:]]*\)#\([[:space:]]*Include[[:space:]][[:space:]]*$includefile\b\)|\1\2|g;" < $conffile > $conffile.new
mv $conffile.new $conffile
fi
fi
PK ϚY[ php-extensions.shnu W+A #!/bin/sh
# File: php-extensions.sh
# Changes:
# 20010219 Ola Lundqvist
# 20010222 Ola Lundqvist
# Needs: /usr/share/wwwconfig-common/php.get
# $extensions - what php extensions to check for!
# $checkextensions - what php extensions to check for if the
# corresponding php?-$ext package is installed.
# Description: Verifies the php config that the application will use.
# Ie the higher of php4 and php3.
. /usr/share/wwwconfig-common/php.get
for A in $checkextensions ; do
if [ -f /var/lib/dpkg/info/php?-$A.list ] ; then
extensions="$extensions $A"
fi
done
# Check for php3/4 files
if [ -f $phpini ]; then
# Make sure all the extensions are being loaded
for ext in $extensions; do
if grep -e "^[[:space:]]*extension.*\b$ext\.so" $phpini >/dev/null 2>&1; then
log="${log}$ext extension for $phpver found."
else
log="${log}$ext extension for $phpver added!"
echo "extension=$ext.so" >>$phpini
fi
done
fi
PK ϚY[=&a a
mysql-exec.shnu W+A #!/bin/sh
# File: mysql-exec.sh
# Changes:
# 20010224 Ola Lundqvist
# 20010322 Ola Lundqvist
# Fix for exec output.
# 20011022 Luca De Vitis
# Introduced the error variable.
# 20020116 Ola Lundqvist
# Documented the error variable.
# 20020125 Ola Lundqvist
# Added new status code.
# 20020126 Ola Lundqvist
# Corrected the documentation about what this file does.
# 20031027 Benoit Joly
# Patch small bug.
# 20040205 Jeroen van Wolffelaar
# Check merely for valid account, rather than for access to the
# mysql-database, so also regular mysqlusers can be used
# 20040705 Jeremy Laine
# Better check for mysql client command.
# Needs: $dbname - the database that user should have access to (optional)
# $dbserver - the server to connect to.
# $dbadmin - the databaseuser name.
# $dbadmpass - the databaseuser password.
# which
# mysql
# $sqlfile - the file containing the SQL statements to run.
# /usr/share/wwwconfig-coomon/mysql.get
# Description: Connect to mysql and run a sql script.
# Sets: $status = {error, exec, execerror}
# $error = error message (if $status = error)
status=error
error=""
. /usr/share/wwwconfig-common/mysql.get
if [ -z "$dbserver" ] ; then
error="No database server specified."
elif [ -z "$dbadmin" ] ; then
error="No database administrator specified."
elif [ -z $(which mysql) ] ; then
error="No mysql client to execute, install the mysql client package and
run 'dpkg-reconfigure -plow packagename'."
elif ! eval $mysqlcmd /dev/null 2>&1 ; then
error="Error when trying to connect to the mysql database.
This error can occur if you have no database to connect to, or
if the password was incorrect.
use: dpkg-reconfigure -plow packagename to reconfigure."
else
log="${log}Executing command to mysql."
if eval $mysqlcmd -f $dbname < $sqlfile > /dev/null 2>&1 ; then
status=exec
else
status=execerror
error="Unable to run the sql script ($sqlfile)."
fi
fi
PK ϚY[Ƴ mysql-ifnot-exec.shnu W+A #!/bin/sh
# File: mysql-ifnot-exec.sh
# Changes:
# 20010322 Ola Lundqvist
# 20011022 Luca De Vitis
# Introduced the error variable.
# 20020116 Ola Lundqvist
# Documented the error variable.
# 20020125 Ola Lundqvist
# Removed the dbadmpass check part.
# 20020125 Ola Lundqvist
# Added new status code.
# 20031219 Thomas Viehmann
# Patch to use eval in order to not break.
# 20040205 Jeroen van Wolffelaar
# Check merely for valid account, rather than for access to the
# mysql-database, so also regular mysqlusers can be used
# 20040705 Jeremy Laine
# Better check for mysql client command.
# Needs: $dbname - the database that user should have access to (optional)
# $dbserver - the server to connect to.
# $dbadmin - the databaseuser name.
# $dbadmpass - the databaseuser password.
# $statement - the statement to test if it can get data.
# which
# mysql
# /usr/share/wwwconfig-coomon/mysql.get
# Description: First checks a statement. If that statement is not ok it executes the
# script.
# Sets: $status = {error, nothing, exec, execerror}
# $error = error message (if $status = error)
status=error
error=""
. /usr/share/wwwconfig-common/mysql.get
if [ -z "$dbserver" ] ; then
error="No database server specified."
elif [ -z "$dbadmin" ] ; then
error="No database administrator specified."
elif [ -z "$statement" ] ; then
error="No statement to test for."
elif [ -z "$sqlfile" ] ; then
error="No sqlfile to execute."
elif [ ! -e "$sqlfile" ] ; then
error="Sqlfile $sqlfile not found."
elif [ -z $(which mysql) ] ; then
error="No mysql client to execute, install the mysql client package and
run 'dpkg-reconfigure -plow packagename'."
elif ! eval $mysqlcmd /dev/null 2>&1 ; then
error="Error when trying to connect to the mysql database.
This error can occur if you have no database to connect to, or
if the password was incorrect.
use: dpkg-reconfigure -plow packagename to reconfigure."
elif ! eval $mysqlcmd -f $dbname -e "\"$statement\"" >/dev/null 2>&1 ; then
log="${log}Executing command to mysql."
if eval $mysqlcmd -f $dbname < $sqlfile > /dev/null 2>&1 ; then
status=exec
else
status=execerror
error="Unable to run the sql script ($sqlfile)."
fi
else
status=nothing
fi
PK ϚY[pM>t t
confd-link.shnu W+A #!/bin/sh
# File: confd-link.sh
# Changes:
# 20081109 Norman Messtorff
# Initial version.
#
# Needs: $servers - the servers to link configurations in.
# $linkname - specify the link name
# $linkdestination_apache - specify the link destination (Apache config)
# $linkdestination_lighttpd - specify the link destination (lighttpd config)
# Description: Linking configurations into Webservers conf.d
# Sets: $status = {error, nothing, linked, removed}
# $error = error message (if $status = error)
status="nothing"
error=""
#
# Checking needed settings...
#
if [ -z "$servers" ]; then
status="error"
error="No servers specified in confd-link.sh"
elif [ -z "$linkname" ]; then
status="error"
error="No linkname specified in confd-link.sh"
else
#
# The link removal part...
#
if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
for A in $servers ; do
A=${A%,}
#
# lighttpd has no conf.d
#
if [ "$A" = "lighttpd" ]; then
linkpath="/etc/lighttpd/conf-available"
else
linkpath="/etc/$A/conf.d"
fi
#
# Is it existing and a symbolic link or are we going to do some unwished things?
#
if [ -L $linkpath/$linkname ]; then
if rm -f $linkpath/$linkname 2>&1 ; then
status="removed"
else
status="error"
error="ERROR! Couln't remove $linkpath/$linkname "
fi
else
status="error"
error="ERROR! $linkpath/$linkname is no symbolic link or doesn't exists."
fi
done
else
for A in $servers ; do
A=${A%,}
#
# lighttpd has no conf.d
#
if [ "$A" = "lighttpd" ]; then
linkpath="/etc/lighttpd/conf-available"
linkdestination=$linkdestination_lighttpd
else
linkpath="/etc/$A/conf.d"
linkdestination=$linkdestination_apache
fi
if [ -d $linkpath ]; then
if ln -s $linkdestination $linkpath/$linkname >/dev/null 2>&1 ; then
status="linked"
else
status="error"
error="ERROR! 'ln -s' returned an error. Could not create link in $linkpath"
fi
else
status="error"
error="ERROR! $linkpath doesn't exists. Could not create link in $linkpath"
fi
done
fi
fi
PK ϚY[u pgsql-userpass.getnu W+A # File: pgsql-userpass.get
# Changes:
# 20010224 Ola Lundqvist
# 20011022 Luca De Vitis
# Allowed reinclusion.
# Changed the piped commands with a single psql command using -A -q -t
# 20020116 Ola Lundqvist
# Documented the reinclusion.
# 20020126 Ola Lundqvist
# Added pgsql.get call.
# Removed check for reinclusion.
# Needs: $pgsqlcmd - the base sql command.
# $dbuser - the user to show the password for.
# $systemdb - the system db to use (optional)
# psql
# Description: Gets a password from
# Sets: $userpass = the fetched password.
# $status = {error, get}
userpass=""
status=error
if $pgsqlcmd -d $systemdb -c "select passwd from pg_shadow where usename='$dbuser'" > /dev/null 2>&1 ; then
status=get
userpass=$($pgsqlcmd -d $systemdb -q -t -A -c "select passwd from pg_shadow where usename='$dbuser'")
fi
PK ϚY[9j apache.funcnu W+A # File: apache.func
# Changes:
# 20010219 Ola Lundqvist
# 20010222 Ola Lundqvist
# 20010430 Ola Lundqvist
# Removed bash specific dependency.
# 20011022 Luca De Vitis
# Added set -e.
# 20020312 Ola Lundqvist
# Fixed getwwwoption get using suggestions from
# root@langhorst.com.
# Description: Functions for apache query or manipulation.
set -e
# Function: getwwwoption
# Author: Ola Lundqvist
# Date: 20010219, 20010222
# Description: Get the value of a apache config option.
# Parameters: 1 - The option to query for.
# 2 - a config file to query.
# Needs: The file that parameter two points to. (else it hangs)
# Sets: $getwwwoption = the option value.
getwwwoption() {
getwwwoption=""
if [ -f $2 ] ; then
if grep $1 $2 | grep -v "#" > /dev/null 2>&1 ; then
getwwwoption=$(sed -ne "/^[[:space:]]*$1[[:space:]]\+/ s|[[:space:]]*$1[[:space:]]\+\([^[:space:]]\+\)[[:space:]]*$|\1|pg;" < $2)
fi
fi
}
PK ϚY[~', , pgsql-allowip.shnu W+A #!/bin/sh
# File: pgsql-allowip.sh
# Changes:
# 20010225 Ola Lundqvist
# 20011022 Luca De Vitis
# Changed the sed script on line 18.
# Need only one regular expression.
# Needs:
# /etc/postgresql/postmaster.init or
# /etc/postgresql/postmaster.conf
# Description: Allows ip connections to database.
# Sets: $status = {error, nothing, restart, start}
# $error = error message (if $status = error)
status=error
if [ -f /etc/postgresql/postmaster.conf ] ; then
# Allowed by default so not change should be needed, but it will be
# done anyway, to make sure that it works.
status=nothing
if grep -e 'tcpip_socket' /etc/postgresql/postmaster.conf > /dev/null 2>&1 ; then
if ! grep -e '^[[:space:]]*tcpip_socket[[:space:]]*=[[:space:]]*1' \
/etc/postgresql/postmaster.conf > /dev/null 2>&1 ; then
sed -e 's/#[[:space:]]*tcpip_socket[[:space:]]*=.*/tcpip_socket=1/;' \
/etc/postgresql/postmaster.conf \
> /etc/postgresql/postmaster.conf.tmp
if grep 'tcpip_socket=1' \
/etc/postgresql/postmaster.conf.tmp \
> /dev/null 2>&1; then
cp /etc/postgresql/postmaster.conf \
/etc/postgresql/postmaster.conf.back > /dev/null 2>&1
mv /etc/postgresql/postmaster.conf.tmp \
/etc/postgresql/postmaster.conf > /dev/null 2>&1;
log="${log}Now restarting postgres to make this take effect."
status=restart
/etc/init.d/postgresql restart || true
log="${log}Waiting for the database to really start."
sleep 5
else
error="Local database configuration was not successful, trying anyway."
status=error
rm -f /etc/postgresql/postmaster.conf.tmp
fi
fi
fi
if ! ps xa | grep "postgresql/bin/postmaster" > /dev/null 2>&1 ; then
/etc/init.d/postgresql start || true
echo "Waiting for the database to really start."
status=start
sleep 5
fi
elif [ -f /etc/postgresql/postmaster.init ] ; then
if grep -e 'PGALLOWTCPIP' /etc/postgresql/postmaster.init \
> /dev/null 2>&1 ; then
if ! grep -e '^[[:space:]]*PGALLOWTCPIP=yes' \
/etc/postgresql/postmaster.init > /dev/null 2>&1 ; then
/bin/sed -e \
's#\# PGALLOWTCPIP=no#PGALLOWTCPIP=yes#;
s#\# PGALLOWTCPIP=yes#PGALLOWTCPIP=yes#' \
/etc/postgresql/postmaster.init \
> /etc/postgresql/postmaster.init.tmp
if grep 'PGALLOWTCPIP=yes' \
/etc/postgresql/postmaster.init.tmp \
>/dev/null 2>&1; then
cp /etc/postgresql/postmaster.init \
/etc/postgresql/postmaster.init.back > /dev/null 2>&1
mv /etc/postgresql/postmaster.init.tmp \
/etc/postgresql/postmaster.init >/dev/null 2>&1;
echo "Now restarting postgres to make this take effect."
status=restart
/etc/init.d/postgresql restart || true
echo "Waiting for the database to really start."
sleep 5
else
echo "Local database configuration was not successful, trying anyway."
status=error
rm -f /etc/postgresql/postmaster.init.tmp
fi
fi
fi
if ! ps xa | grep "postgresql/bin/postmaster" > /dev/null 2>&1 ; then
/etc/init.d/postgresql start || true
echo "Waiting for the database to really start."
status=start
sleep 5
fi
fi
PK ϚY[tG K K php.getnu W+A # File: php.get
# Changes:
# 20010219 Ola Lundqvist
# 20010430 Ola Lundqvist
# Removed bash specific dependency.
# 20011022 Luca De Vitis
# Allowed reinclusion.
# 20020116 Ola Lundqvist
# Documented the reinclusion.
# 20020126 Ola Lundqvist
# Removed reinclusion.
# Needs: /usr/share/wwwconfig-common/php.get
# $extensions - what php extensions to check for!
# Description: Sets the phpver and phpini variables to the version
# of php that are installed.
# Sets: $phpver = {php3, php4}
# $phpini = {/etc/php4/apache/php.ini, /etc/php3/apache/php3.ini}
for A in php3 php4 ; do
B=$(echo "$A" | sed -e "s|4||g;")
I=/etc/$A/apache/$B.ini
if [ -f $I ] ; then
phpver=$A
phpini=$I
fi
done
phpini=${phpini:-none}
PK ϚY[1 1 apache-include-postrm.shnu W+A #!/bin/sh
# File: apache-include-postrm.sh
# Changes:
# 20020228 Mark Eichin Initial version, based
# on extensive cut&paste from other apache*.sh scripts.
#
# Needs: $servers - which server to be cleaned up (anything
# recognized by apache-*include*.sh
# $includefile - what file that should be cleaned up.
# Description: Uses debian postrm arguments to choose to uninclude or
# cominclude the file in $includefile.
# Sets: $restart gets any servers that need restarting
# added to it, for later use by restart.sh. Also
# sets or passes through $error.
if [ -z "$servers" ] ; then
# error="No server list specified for apache-include-postrm.sh."
# actually, no servers just means no work for us, not an error.
:
elif [ -z "$includefile" ] ; then
error="No include file specified in apache-include-postrm.sh."
else
status=nothing
log="${log}Running postrm $1 scripts for $servers servers."
for server in $servers; do
case "$1" in
purge)
log="${log}using uninclude to purge $server."
. /usr/share/wwwconfig-common/apache-uninclude_all.sh
if [ "$status" = "purge" ] ; then
restart="$restart $server"
status=nothing # we already "consumed" the status
fi
;;
remove)
log="${log}using cominclude to remove $server."
. /usr/share/wwwconfig-common/apache-cominclude_all.sh
if [ "$status" = "comment" ] ; then
restart="$restart $server"
status=nothing # we already "consumed" the status
fi
;;
esac
done
fi
PK ϚY[.2iW autopatch_all.shnu W+A #!/bin/sh
# File: autopatch_all.sh
# Changes:
# 20010219 Ola Lundqvist
# 20011022 Luca De Vitis
# Introduced the error variable.
# Changed from "find ... -exec" to "find ... | while read etc."
# 20020116 Ola Lundqvist
# Documented the error variable.
# Fixed the patch while string.
# 20020412 Ola Lundqvist
# Indentation fixes.
# Needs: $patchdir - Where the patches are located.
# Description: Finds patches in a directory and applies them to the filesystem.
# Sets: $status = {error, nothing, patch}
# $error = error message (if $status = error)
status=error
error=""
if [ -z "$patchdir" ] ; then
error="No patch directory specified."
else
status=nothing
if [ -d $patchdir ] ; then
WWD=$PWD
cd /
find $patchdir -name "*.patch" | {
while read file; do
/usr/share/wwwconfig-common/autopatch.sh $file
done
}
cd $WWD
fi
fi
PK ϚY[O pgsql-nextsysid.getnu W+A # File: pgsql-nextsysid.get
# Changes:
# 20010224 Ola Lundqvist
# 20011022 Luca De Vitis
# Allowed reinclusion.
# Changed the piped commands with a single psql command using -A -q -t
# 20020116 Ola Lundqvist
# Documented the reinclusion.
# 20020126 Ola Lundqvist
# Fixed getting of next system id.
# 20020126 Ola Lundqvist
# Removed the reiclusion ability. It will recalculate now.
# Needs: $pgsqlcmd - the base sql command.
# $systemdb - the system db to use (optional)
# psql
# Description: Gets a password from
# Sets: $nextsysid = select max(usesysid) from pg_shadow; + 1
# $status = {error, get}
nextsysid=
status=error
error=""
if $pgsqlcmd -d $systemdb -c "select max(usesysid) from pg_shadow;" > /dev/null 2>&1 ; then
status=get
tmpid=$($pgsqlcmd -d $systemdb -c "select max(usesysid) from pg_shadow;" | grep "^[[:space:]]*[0-9][0-9]*[[:space:]]*$")
nextsysid=$((1 + $tmpid))
fi
PK ϚY[W-L L mysql-localadmpass.getnu W+A # File: mysql-localadmpass.get
# Changes:
# 20010430 Ola Lundqvist
# 20011022 Luca De Vitis
# Allowed reinclusion.
# 20020116 Ola Lundqvist
# Documented the reinclusion.
# 20020125 Ola Lundqvist
# Empty passwords will be handled in a lot better way.
# 20020126 Ola Lundqvist
# Added password string again. Only mysqladmin works that
# way, not mysql.
# Removed the dbadmpassfound variable and
# changed the status variable instead.
# 20020912 , applied by Ola Lundqvist
# mysql-localadmpass.get fails to get the user and password for
# mysql administration if they are not at /etc/mysql/my.cnf
# The solution is not to relay in the var "status" for stop the
# search, but in "found"
# Needs: /etc/mysql/my.cnf
# /usr/share/wwwconfig-common/mysql.func
# Description: Gets a user and passphrase (if found) from /etc/mysql/my.cnf
# Sets: $dbadmpass = a passphrase (if found), will most probably
# be empty because mysql can get it automaticly.
# $dbadmin = a username (if found)
# $status = {error, user, password, userpassword, nothing}
# $mysql_localadmpass_get=done (to allow reinclusion).
# $found = {yes, no}
if [ -z "$mysql_localadmpass_get" ] ; then
. /usr/share/wwwconfig-common/mysql.func
found=no
status=error
for A in /etc/mysql/my.cnf /var/lib/mysql/my.cnf ~/.my.cnf ; do
if [ -f $A -a "$found" = "no" ] ; then
status=""
getmysqlopt mysqladmin user $A
if [ "$found" = "yes" ] ; then
dbadmin=$getmysqlopt
status=${status}user
fi
getmysqlopt mysqladmin password $A
if [ "$found" = "yes" ] ; then
dbadmpass=$getmysqlopt
status=${status}password
fi
fi
done
mysql_localadmpass_get="done"
if [ -z "$status" ] ; then
status=nothing
fi
fi
PK ϚY[ mysql-createdb.shnu W+A #!/bin/sh
# File: mysql-createdb.sh
# Changes:
# 20010224 Ola Lundqvist
# 20011022 Luca De Vitis
# Introduced the error variable.
# 20020116 Ola Lundqvist
# Documented the error variable.
# 20020125 Ola Lundqvist
# Removed the dbadmpass check part.
# 20030815 Nikolai Prokoschenko
# Fixed grep statement for database detection.
# 20040205 Jeroen van Wolffelaar
# Jeremy
# Check merely for valid account, rather than for access to the
# mysql-database, so also regular mysqlusers can be used
# 20040705 Jeremy Laine
# Better check for mysql client command.
# Needs: $dbname - the database that user should have access to.
# $dbserver - the server to connect to.
# $dbadmin - the administrator name.
# $dbadmpass - the administrator password.
# which
# mysql
# /usr/share/wwwconfig-common/mysql.get
# Description: Creates a database.
# Sets: $status = {error, nothing, create}
# $error = error message (if $status = error)
status=error
error=""
. /usr/share/wwwconfig-common/mysql.get
if [ -z "$dbname" ] ; then
error="No database name specified. Have to know the name to create it."
elif [ -z "$dbserver" ] ; then
error="No database server specified."
elif [ -z "$dbadmin" ] ; then
error="No database administrator specified."
elif [ -z $(which mysql) ] ; then
error="No mysql client to execute, install the mysql client package and
run 'dpkg-reconfigure -plow packagename'."
elif ! eval $mysqlcmd /dev/null 2>&1 ; then
error="Error when trying to connect to the mysql database.
This error can occur if you have no database to connect to, or
if the password was incorrect.
use: dpkg-reconfigure -plow packagename to reconfigure."
else
if eval $mysqlcmd -f -B -e "\"show databases;\"" | grep -e "^$dbname$" > /dev/null 2>&1 ; then
log="${log}Database $dbname already exists."
status=nothing
else
log="${log}Creating database $dbname."
if eval $mysqlcmd -f -e "\"CREATE DATABASE $dbname;\"" ; then
if ! eval $mysqlcmd -f -B -e "\"show databases;\"" | grep -e "^$dbname$" > /dev/null 2>&1 ; then
error="Database $dbname NOT successfully created. You have to do it manually."
else
status=create
fi
else
error="Unable to run the create database script."
fi
fi
fi
PK ϚY[C pgsql-dropdb.shnu W+A #!/bin/sh
# File: pgsql-dropdb.sh
# Changes:
# 20010224 Luca De Vitis
# 20020116 Ola Lundqvist
# Documented the error variable.
# Needs: $dbname - the database that user should have access to.
# $dbserver - the server to connect to.
# $dbadmin - the administrator name.
# $dbadmpass - the administrator password (not supported)
# which
# pgsql
# /usr/share/wwwconfig-common/pgsql.get
# Description: Drops a database.
# Sets: $status = {error, nothing, drop}
# $error = error message (if status = error).
status=error
error=""
. /usr/share/wwwconfig-common/pgsql.get
use_dbuser=false
if [ -z "$dbname" ] ; then
error="No database name specified. Have to know the name to create it."
elif [ -z "$dbserver" ] ; then
error="No database server specified."
elif [ -z "$dbadmin" ] ; then
error="No database administrator specified."
elif [ ! -x $(which psql) ] ; then
error="No pgsql client to execute."
elif ! eval $pgsqlcmd -d $systemdb -c "\"\"" >/dev/null 2>&1 ; then
error="Error when trying to connect to the pgsql database.
This error can occur if you have no database to connect to, or
if the password was incorrect.
use: dpkg-reconfigure -plow packagename to reconfigure."
else
if eval $pgsqlcmd -d $dbname -c "\"\"" > /dev/null 2>&1 ; then
log="${log}Droping database $dbname."
if eval $pgsqlcmd -d $systemdb -c "\"DROP DATABASE $dbname;\"" > /dev/null 2>&1 ; then
if eval $pgsqlcmd -d $dbname -c "\"\"" > /dev/null 2>&1 ; then
error="Database $dbname NOT successfully droped. You have to do it manually."
else
status=drop
fi
else
error="Unable to run the drop database script."
fi
else
log="${log}Database $dbname does not exist."
status=nothing
fi
fi
PK ϚY[ }@ @ pgsql-ifnot-exec.shnu W+A #!/bin/sh
# File: pgsql-ifnot-exec.sh
# Changes:
# 20010322 Ola Lundqvist
# 20011022 Luca De Vitis
# Introduced the error variable.
# Added the -d flag to $pgsqlcmd (not really needed but clearer)
# 20020116 Ola Lundqvist
# Documented the error variable.
# 20020125 Ola Lundqvist
# Added new status code.
# 20020126 Ola Lundqvist
# Removed need for $dbadmin.
# 20051009 Ola Lundqvist
# Use dbuser=false on check and then set it to true when exec.
# Thanks to Christoph Martin .
# Needs: $dbname - the database that user should have access to (optional)
# $dbserver - the server to connect to.
# $dbadmin - the administrator name.
# $dbadmpass - the administrator password (not supported).
# $statement - the statement to test if it can get data.
# which
# psql
# /usr/share/wwwconfig-common/pgsql.get
# Description: First checks a statement. If that statement is not ok it executes the
# script.
# Sets: $status = {error, nothing, exec, execerror}
# $error = error message (if $status = error)
status=error
error=""
. /usr/share/wwwconfig-common/pgsql.get
use_dbuser=false
if [ -z "$dbserver" ] ; then
error="No database server specified."
elif [ ! -x $(which pgsql) ] ; then
error="No pgsql client to execute, install the pgsql client package and
run 'dpkg-reconfigure -plow packagename'."
elif ! eval $pgsqlcmd -d $systemdb -c "\"select usename from pg_shadow;\"" >/dev/null 2>&1 ; then
error="Error when trying to connect to the pgsql database.
This error can occur if you have no database to connect to, or
if the password was incorrect.
use: dpkg-reconfigure -plow packagename to reconfigure."
elif ! $pgsqlcmd -d $dbname -c "\"$statement\"" >/dev/null 2>&1 ; then
log="${log}Executing command to pgsql."
use_dbuser=true
if $pgsqlcmd -d $dbname < $sqlfile > /dev/null 2>&1 ; then
status=exec
else
status=execerror
error="Unable to run the sql script ($sqlfile)."
fi
else
status=nothing
fi
PK ϚY[zf# # mysql-dropdb.shnu W+A #!/bin/sh
# File: mysql-dropdb.sh
# Changes:
# 20010224 Luca De Vitis
# 20020116 Ola Lundqvist
# Documented the error variable.
# 20020125 Ola Lundqvist
# Removed the dbadmpass check part.
# 20031219 Thomas Viehmann
# Patch to use eval in order to not break.
# 20040205 Jeroen van Wolffelaar
# Jeremy
# Check merely for valid account, rather than for access to the
# mysql-database, so also regular mysqlusers can be used
# 20040705 Jeremy Laine
# Better check for mysql client command.
# Needs: $dbname - the database that user should have access to.
# $dbserver - the server to connect to.
# $dbadmin - the administrator name.
# $dbadmpass - the administrator password.
# which
# mysql
# /usr/share/wwwconfig-common/mysql.get
# Description: Creates a database.
# Sets: $status = {error, nothing, create}
# $error = error message (if status = error).
status=error
error=""
. /usr/share/wwwconfig-common/mysql.get
if [ -z "$dbname" ] ; then
error="No database name specified. Have to know the name to create it."
elif [ -z "$dbserver" ] ; then
error="No database server specified."
elif [ -z "$dbadmin" ] ; then
error="No database administrator specified."
elif [ -z $(which mysql) ] ; then
error="No mysql client to execute, install the mysql client package and
run 'dpkg-reconfigure -plow packagename'."
elif ! eval $mysqlcmd /dev/null 2>&1 ; then
error="Error when trying to connect to the mysql database.
This error can occur if you have no database to connect to, or
if the password was incorrect.
use: dpkg-reconfigure -plow packagename to reconfigure."
else
if eval $mysqlcmd -f -e "\"show databases;\"" | grep -e "^$dbname" > /dev/null 2>&1 ; then
log="${log}Droping database $dbname."
if eval $mysqlcmd -f -e "\"DROP DATABASE $dbname;\"" ; then
if eval $mysqlcmd -f -e "\"show databases;\"" | grep -e "^$dbname" > /dev/null 2>&1 ; then
error="Database $dbname NOT successfully droped. You have to do it manually."
else
status=drop
fi
else
error="Unable to run the drop database script."
fi
else
status=nothing
log="${log}Database $dbname already exists."
fi
fi
PK ϚY[L mysql-dropuser.shnu W+A #!/bin/sh
# File: mysql-dropuser.sh
# Changes:
# 20010224 Luca De Vitis
# 20020116 Ola Lundqvist
# Documented the error variable.
# 20020125 Ola Lundqvist
# Removed the dbadmpass check part.
# 20031219 Thomas Viehmann
# Patch to use eval in order to not break.
# 20040705 Jeremy Laine
# Better check for mysql client command.
# Needs: $dbuser - the user name to create (or replace).
# $dballow - what hosts to allow (defaults to %).
# $dbname - the database that user should have access to.
# $dbpass - the password to use.
# $dbserver - the server to connect to.
# $dbadmin - the administrator name.
# $dbadmpass - the administrator password.
# which
# mysql
# /usr/share/wwwconfig-coomon/mysql.get
# Description: Creates or replaces a database user.
# Sets: $status = {error, nothing, drop }
# $error = error message (if status = error).
dballow=${dballow:-%}
status=error
error=""
. /usr/share/wwwconfig-common/mysql.get
if [ -z "$dbuser" ] ; then
error="No database user specified. Can not drop it if it does not exist."
elif [ -z "$dbserver" ] ; then
error="No database server specified."
elif [ -z "$dbadmin" ] ; then
error="No database administrator specified."
elif [ -z $(which mysql) ] ; then
echo "No mysql client to execute, install the mysql client package and
run 'dpkg-reconfigure -plow packagename'."
elif ! eval $mysqlcmd -f mysql -e "\"show tables;\"" >/dev/null 2>&1 ; then
error="Error when trying to connect to the mysql database.
This error can occur if you have no database to connect to, or
if the password was incorrect.
use: dpkg-reconfigure -plow packagename to reconfigure."
else
log="${log}Droping database user $dbuser."
if eval $mysqlcmd -f mysql -e "\"select User from user;\"" | grep $dbuser >/dev/null 2>&1 ; then
if eval $mysqlcmd -f mysql -e "\"
CONNECT mysql;
DELETE FROM user
WHERE user='$dbuser';
DELETE FROM db
WHERE user='$dbuser';
flush privileges;
\"" > /dev/null 2>&1 ; then
if eval $mysqlcmd -f mysql -e "\"select user.user,db.user from user,db;\"" | grep $dbuser >/dev/null 2>&1 ; then
error="Database user $dbuser NOT successfully droped. You have to do it manually."
else
status=drop
fi
else
error="Unable to run the drop user script."
fi
else
status=nothing
log="${log}User $dbuser does not exists."
fi
fi
PK ϚY[Jdž: : apache-index_all.shnu W+A #!/bin/sh
# File: apache-index_all.sh
# Changes:
# 20010219 Ola Lundqvist
# 20010222 Ola Lundqvist
# 20011022 Luca De Vitis
# Introduced the error variable.
# 20020116 Ola Lundqvist
# Documented the error variable, also fixed a bug in one of
# the error messages.
# 20020412 Ola Lundqvist
# Added check for if the server is installed or not.
# Needs: $index - the index file to add.
# $server - the server to use.
# Anything that matches /etc/$server/*.conf
# Description: Adds an index to the servers apache config.
# Ie: adds to DirectoryIndex
# Sets: $status = {error, nothing, found, added}
# $error = error message (if $status = error)
lstatus=error
if [ -z "$index" ] ; then
error="No index specified in apache-index_all.sh."
elif [ -z "$server" ] ; then
error="No server specified in apache-index_all.sh."
elif [ ! -d /etc/$server ] ; then
error="No server $server installed, unable to configure it."
else
lstatus=nothing
for conffile in /etc/$server/srm.conf /etc/$server/httpd.conf ; do
. /usr/share/wwwconfig-common/apache-index.sh
if [ "$lstatus" != "added" -a "$lstatus" != "error" ] ; then
lstatus=$status
fi
if [ "$status" = "added" ] ; then
lstatus=added
fi
done
fi
status=$lstatus
PK ϚY[,j mysql-if-exec.shnu W+A #!/bin/sh
# File: mysql-if-exec.sh
# Changes:
# 20010322 Ola Lundqvist
# 20011022 Luca De Vitis
# Introduced the error variable.
# 20020116 Ola Lundqvist
# Documented the error variable.
# 20020125 Ola Lundqvist
# Removed the dbadmpass check part.
# 20020125 Ola Lundqvist
# Added new status code.
# 20031219 Thomas Viehmann
# Patch to use eval in order to not break.
# 20040205 Jeroen van Wolffelaar
# Check merely for valid account, rather than for access to the
# mysql-database, so also regular mysqlusers can be used
# 20040705 Jeremy Laine
# Better check for mysql client command.
# Needs: $dbname - the database that user should have access to
# (optional)
# $dbserver - the server to connect to.
# $dbadmin - the databaseuser name.
# $dbadmpass - the databaseuser password.
# $statement - the statement to test if it can get data.
# which
# mysql
# /usr/share/wwwconfig-coomon/mysql.get
# Description: First checks a statement. If that statement is ok it executes the
# script.
# Sets: $status = {error, nothing, exec, execerror}
# $error = error message (if $status = error)
status=error
error=""
. /usr/share/wwwconfig-common/mysql.get
if [ -z "$dbserver" ] ; then
error="No database server specified."
elif [ -z "$dbadmin" ] ; then
error="No database administrator specified."
elif [ -z "$statement" ] ; then
error="No statement to test for."
elif [ -z "$sqlfile" ] ; then
error="No sqlfile to execute."
elif [ ! -e "$sqlfile" ] ; then
error="Sqlfile $sqlfile not found."
elif [ -z $(which mysql) ] ; then
error="No mysql client to execute, install the mysql client package and
run 'dpkg-reconfigure -plow packagename'."
elif ! eval $mysqlcmd /dev/null 2>&1 ; then
error="Error when trying to connect to the mysql database.
This error can occur if you have no database to connect to, or
if the password was incorrect.
use: dpkg-reconfigure -plow packagename to reconfigure."
elif eval $mysqlcmd -f $dbname -e "\"$statement\"" >/dev/null 2>&1 ; then
log="${log}Executing command to mysql."
if eval $mysqlcmd -f $dbname < $sqlfile > /dev/null 2>&1 ; then
status=exec
else
status=execerror
error="Unable to run the sql script ($sqlfile)."
fi
else
status=nothing
fi
PK ϚY[6,Ry y autopatch.shnu W+A #!/bin/sh
# File: autopatch.sh
# Changes:
# 20010219 Ola Lundqvist
# 20020116 Ola Lundqvist
# Introduced and deocumented the error variable.
# Arguments: $1 - Where the patch is located.
# Description: Finds patches in a directory and applies them to the filesystem.
# Sets: status={error, nothing, patch}
# error = error message (if $status = error).
status=error
error=""
if [ -z "$1" ] ; then
error="No patch file [arg 1] specified."
elif [ ! -f $1 ] ; then
error="Can not find patch file $1."
else
status=patch
error="Autopatching, using $1."
patch -p0 -i $1
fi
PK ϚY[J4 apache-cominclude.shnu W+A #!/bin/sh
# File: apache-cominclude.sh
# Changes:
# 20010219 Ola Lundqvist
# 20011022 Luca De Vitis
# Introduced the error variable.
# o /[[:space:]][[:space:]]*/[[:space:]]\+/
# Changed from "cat $conffile | sed" to "sed ... < $conffile"
# 20020116 Ola Lundqvist
# Documented the error variable.
# Needs: $conffile - The file that should be modified.
# $includefile - The file that should be commented out.
# Description: Comments out a include statement.
# Sets: $status = {error, nothing, comment}
# $error = error message (if $status = error).
status=error
if [ -z "$conffile" ] ; then
error="No config file specified in apache-cominclude.sh"
elif [ -z "$includefile" ] ; then
error="No include file specified in apache-cominclude.sh"
elif [ ! -f $conffile ] ; then
error="File $conffile not found!"
elif [ ! -f $includefile ] ; then
error="File $includefile not found!"
else
status=nothing
if grep -e "^[[:space:]]*Include[[:space:]]\+$includefile\b" $conffile > /dev/null 2>&1; then
log="${log}Commenting import for $includefile in $conffile."
status=comment
sed -e "s#^\( *\)\(Include *$includefile\b\)#\1\#\2#" < $conffile > $conffile.new
mv $conffile.new $conffile
fi
fi
PK ϚY[qI apache-addtype_all.shnu W+A #!/bin/sh
# File: apache-addtype_all.sh
# Changes:
# 20010305 Ola Lundqvist
# 20011022 Luca De Vitis
# Introduced the error variable.
# 20020116 Ola Lundqvist
# Documented the error variable.
# 20020412 Ola Lundqvist
# Added check for installed server.
# Needs: /usr/share/wwwconfig-common/php.get
# $typestr - A string of the type (like: application/x-httpd-php)
# $server - the apache server type.
# $extension - The extension to add (like: .php3)
# Description: Adds a AddType if it is not already there.
# Sets: $status = {error, nothing, added, lineadded, uncommented}
# $error = error message (if $status = error).
. /usr/share/wwwconfig-common/php.get
status=error
if [ -z "$typestr" ] ; then
error="No type to add."
elif [ -z "$server" ] ; then
error="No apache server defined."
elif [ -z "$extension" ] ; then
error="No extension to add with $typestr."
elif [ ! -d /etc/$server ] ; then
error="No server $server installed, unable to configure it."
elif [ -f $phpini ] ; then
A=${extension#.}
if grep -e "^[[:space:]]*AddType[[:space:]]\+$typestr[[:space:]]\+.*\.$A\b" /etc/$server/*.conf > /dev/null 2>&1 ; then
status=nothing
elif grep -e "^[[:space:]]*AddType[[:space:]]\+$typestr[[:space:]]\+" /etc/$server/*.conf > /dev/null 2>&1 ; then
for conffile in /etc/$server/*.conf ; do
if grep -e "^[[:space:]]*AddType[[:space:]]\+$typestr[[:space:]]\+" $conffile > /dev/null 2>&1 ; then
log="${log}Adding extension $extension to AddType $typestr line in $conffile."
sed -e "s#^\([[:space:]]*AddType[[:space:]]\+$typestr\b.*\)#\1 $extension#;" < $conffile > $conffile.new
status=added
mv $conffile.new $conffile
fi
done
elif grep -e "^[[:space:]]*#[[:space:]]*AddType[[:space:]]\+$typestr[[:space:]]\+.*\.$A\b" /etc/$server/*.conf > /dev/null 2>&1 ; then
for conffile in /etc/$server/*.conf ; do
if grep -e "^[[:space:]]*#[[:space:]]*AddType[[:space:]]\+$typestr[[:space:]]\+.*\.$A\b" $conffile > /dev/null 2>&1 ; then
log="${log}Uncommenting AddType $typestr line in $conffile."
sed -e "s#^\([[:space:]]*\)\\#\([[:space:]]*AddType[[:space:]]\+$typestr\b.*\.$A\b.*\)#\1\2#;" < $conffile > $conffile.new
status=uncommented
mv $conffile.new $conffile
fi
done
else
log="${log}Type file not found for extension $extension, adding a line to httpd.conf.]n"
echo "AddType $typestr $extension" >> /etc/$server/httpd.conf
status="lineadded"
fi
fi
PK ϚY[۬k
apache-php.shnu W+A #!/bin/sh
# File: apache-php.sh
# Changes:
# 20010219 Ola Lundqvist
# 20011022 Luca De Vitis
# Introduced the error variable.
# o /[[:space:]][[:space:]]*/[[:space:]]\+/
# o / */[[:space:]]\+/
# o / */[[:space:]]*/
# 20020116 Ola Lundqvist
# Documented the error variable.
# 20040525 Jeremy Laine
# Switched to modules-config.
# 20040806 Pierre Habouzit
# Changed from modules-config to apache-modconf. Just a name
# change, no functionality changed.
# 20040820 Jeremy Laine
# Replace remaining calls to modules-config by apache-modconf.
# Needs: $phpver - the php version to use.
# $phpini - the php config file to use.
# $server - the apache server to use,
# anything that matches /etc/$server/*.conf
# Description: Verifies that the php module is loaded in the apache config file.
# Sets: $status = {error, nothing, include, uncomment}
# $error = error message (if $status = error)
status=error
error=""
if [ -z "$phpver" ] ; then
error="No php version to check for."
elif [ -z "$phpini" ] ; then
error="No php ini file to check for."
elif [ ! -f $phpini ] ; then
error="Php config file $phpini not found."
elif [ -z $(which apache-modconf) ] ; then
error="Could not find apache-modconf."
else
phpverm="mod_"$phpver
phpstatus=`apache-modconf $server query $phpverm || true`
if [ -z "$phpstatus" ] ; then
apache-modconf $server enable $phpverm
# Uncomment successful.
status=uncomment
else
status=nothing
fi
fi
PK ϚY[O"~0 0 pgsql.getnu W+A # File: pgsql.get
# Changes:
# 20010224 Ola Lundqvist
# 20011022 Luca De Vitis
# Allowed reinclusion.
# 20020116 Ola Lundqvist
# Documented the reinclusion.
# 20020126 Ola Lundqvist
# Added defaults for dbadmin and documented all defaults.
# Removed the reinclusion. No high computation and it will work
# fine anyway.
# 20020926 Ola Lundqvist
# Arndt Schnewald
# Changed so that sudo is no longer needed. Patch description
# and code from Arndt Schnewald.
# This really solves a big issue with wwwconfig-common.
# 20020926 Ola Lundqvist
# Arndt Schnewald
# Minor fix from Arndt Schnewald that fix problem if someone
# use a non-sh compatible shell.
# 20080327 Morten Werner Forsbring
# Support for postgres 8.x.
# Needs: $dbserver - the server to connect to (defaults to localhost).
# $dbadmin - the administrator name (defaults to postgres).
# $dbadmpass - the administrator password (not supported).
# Sets: $pgsqlcmd so that administration access are prepared
# $systemdb - the name of the system db.
if [ -z "$dbadmin" ] ; then
dbadmin=postgres
fi
if [ -z "$dbserver" ] ; then
dbserver=localhost
fi
if [ -z "$systemdb" ] ; then
systemdb=template1
fi
if [ "$dbserver" != "localhost" ] ; then
hostopt="-h '$dbserver'"
fi
use_dbuser=true
pgsqlcmd()
{
if [ "$use_dbuser" = true ]; then
local user="$dbuser"
local pass="$dbpass"
else
local user="$dbadmin"
local pass="$dbadmpass"
fi
_psql_args=
while [ $# -gt 0 ]
do
_psql_args="$_psql_args '`echo \"$1\" | sed -e \"s/'/'\\\\\\''/g\"`'"
shift
done
MYUID=`id -un`
if [ -z "$hostopt" -a \( "$MYUID" = root -o "$UID" = "$user" \) ] && grep -q ^"$user": /etc/passwd ; then
su -s /bin/sh $user -c "psql $hostopt $_psql_args"
else
PGPASSDIR=`mktemp -d`
if [ $? -ne 0 ]; then
exit 1
fi
PGPASSFILE=$PGPASSDIR/.pgpass
export PGPASSFILE
if [ ! -z "$pass" ] ; then
OLDUMASK=`umask`
umask 077
echo "*:*:*:$user:$pass" > $PGPASSFILE
umask $OLDUMASK
fi
eval psql -U "$user" $hostopt $_psql_args
rm -rf "$PGPASSDIR"
fi
}
pgsqlcmd=pgsqlcmd
PK ϚY[(TH
pgsql-dropuser.shnu W+A #!/bin/sh
# File: pgsql-dropuser.sh
# Changes:
# 20010224 Luca De Vitis
# 20020116 Ola Lundqvist
# Documented the error variable.
# 20041002 Raphal Enrici
# Quoted $dbuser so that the username can contain '-'.
# 20040322 Ola Lundqvist
# Added use_dbuser=false after pgsql.get as suggested by
# Uwe Steinmann .
# Needs: $dbuser - the user name to drop
# $dbname - the database that user should have access to.
# $dbpass - the password to use.
# $dbserver - the server to connect to.
# $dbadmin - the administrator name.
# $dbadmpass - the administrator password (not supported).
# which
# pgsql
# /usr/share/wwwconfig-common/pgsql.get
# Description: Drops a user.
# Sets: $status = {error, nothing, drop}
# $error = error message (if status = error).
status=error
error=""
. /usr/share/wwwconfig-common/pgsql.get
use_dbuser=false
#. pgsql.get
if [ -z "$dbuser" ] ; then
error="No database user specified. Can not drop it if it does not exist."
elif [ -z "$dbserver" ] ; then
error="No database server specified."
elif [ -z "$dbadmin" ] ; then
error="No database administrator specified."
elif [ ! -x $(which psql) ] ; then
error="No pgsql client to execute."
elif ! eval $pgsqlcmd -q -d $systemdb -c "\"SELECT usename FROM pg_shadow;\"" >/dev/null 2>&1 ; then
error="Error when trying to connect to the pgsql database.
This error can occur if you have no database to connect to, or
if the password was incorrect.
use: dpkg-reconfigure -plow packagename to reconfigure."
else
TMPU=$(eval $pgsqlcmd -d $systemdb -q -t -A -c "\"SELECT usename FROM pg_shadow WHERE usename='$dbuser';\"")
if [ "$TMPU" = "$dbuser" ] ; then
if eval $pgsqlcmd -q -d $systemdb -c "\"DROP USER "'\"'"$dbuser"'\"'";\"" ; then
TMPU=$(eval $pgsqlcmd -d $systemdb -q -t -A -c "\"SELECT usename FROM pg_shadow WHERE usename='$dbuser';\"")
if [ -z "$TMPU" ] ; then
log="${log}User $dbuser dropped."
status=drop
else
error="User $dbuser NOT successfully dropped. You have to do it manually."
fi
else
error="Unable to run the drop user script."
fi
else
log="${log}User $dbuser does not exists in pg_shadow."
status=nothing
fi
fi
PK ϚY[㐤\ \
restart.shnu W+A #!/bin/sh
# File: restart.sh
# Changes:
# 20010219 Ola Lundqvist
# 20010430 Ola Lundqvist
# Removed bash specific issues.
# 20011022 Luca De Vitis
# Introduced the error variable.
# 20020116 Ola Lundqvist
# Documented the error variable.
# 20020126 Ola Lundqvist
# Better error handing for this one.
# 20020317 Ola Lundqvist
# Applied simple patch from
# "Luca - De Whiskey's - De Vitis"
# 20061118 Ola Lundqvist
# Applied patch from Frederic Schutz
# to make sure that restart failure do not break postinst.
# 20080611 Ola Lundqvist
# Now uses invoke-rc.d instead if available.
# Needs: $servers - the servers to check for.
# $restart - where it searches for if it exists.
# Description: Restarts a server if it is found in the restart variable.
# Sets: $status = {error, nothing, restart}
# $restarted = the ones that are restarted in order.
# $error = error message (if $status = error)
# Note: $restart can be somthing like this: "apache exim"
status="nothing"
error=""
if [ -z "$servers" ] ; then
status="error"
error="No servers specified in restart.sh."
else
restart=" $restart "
for A in $servers ; do
verify=$(echo "$restart" | sed -e "s| $A ||g;")
if [ "$verify" != "$restart" ] ; then
log="${log}$A needs to be restarted."
if [ -x /usr/sbin/invoke-rc.d ] && [ -x /etc/init.d/$A ] ; then
if ! /usr/sbin/invoke-rc.d $A restart >/dev/null 2>&1 3>&1 4>&1 5>&1; then
status="error"
error="ERROR! /usr/sbin/invoke-rc.d $A restart, returned an error. $A could not be restarted."
fi
elif [ -x /etc/init.d/$A ] ; then
if ! /etc/init.d/$A restart >/dev/null 2>&1 3>&1 4>&1 5>&1; then
status="error"
error="ERROR! /etc/init.d/$A returned an error. $A could not be restarted."
fi
elif [ -x /usr/sbin/invoke-rc.d ] ; then
if ! /usr/sbin/invoke-rc.d $A restart >/dev/null 2>&1 3>&1 4>&1 5>&1; then
status="error"
error="ERROR! /usr/sbin/invoke-rc.d $A restart, returned an error. $A could not be restarted."
fi
else
status="error"
error="ERROR! /etc/init.d/$A or /usr/sbin/invoke-rc.d is not installed (or not executable)."
fi
fi
done
fi
PK ϚY[چ mysql-createuser.shnu W+A #!/bin/sh
# File: mysql-createuser.sh
# Changes:
# 20010224 Ola Lundqvist
# 20011022 Luca De Vitis
# Introduced the error variable.
# 20020116 Ola Lundqvist
# Documented the error variable.
# 20020125 Ola Lundqvist
# Removed the dbadmpass check part.
# 20031027 Benoit Joly
# Patch small bug.
# 20040204 Jeroen van Wolffelaar
# Use proper GRANT for compatibility with added MySQL 4
# features, now all privileges are granted (excluding GRANT)
# Needs: $dbuser - the user name to create (or replace).
# $dballow - what hosts to allow (defaults to %).
# $dbname - the database that user should have access to.
# $dbpass - the password to use.
# $dbserver - the server to connect to.
# $dbadmin - the administrator name.
# $dbadmpass - the administrator password.
# which
# mysql
# /usr/share/wwwconfig-coomon/mysql.get
# Description: Creates or replaces a database user.
# Sets: $status = {error, nothing, include, uncomment}
# $error = error message (if $status = error)
dballow=${dballow:-%}
status=error
error=""
. /usr/share/wwwconfig-common/mysql.get
if [ -z "$dbuser" ] ; then
error="No database user specified. Can not create it if it does not exist."
elif [ -z "$dbserver" ] ; then
error="No database server specified."
elif [ -z "$dbadmin" ] ; then
error="No database administrator specified."
elif [ -z $(which mysql) ] ; then
echo "No mysql client to execute, install the mysql client package and
run 'dpkg-reconfigure -plow packagename'."
elif ! eval $mysqlcmd -f mysql -e "\"show tables;\"" >/dev/null 2>&1 ; then
error="Error when trying to connect to the mysql database.
This error can occur if you have no database to connect to, or
if the password was incorrect.
use: dpkg-reconfigure -plow packagename to reconfigure."
else
log="${log}Creating or resetting database user ($dbuser)."
script="
GRANT ALL PRIVILEGES ON \`$dbname\`.* TO \`$dbuser\`@'$dballow'
IDENTIFIED BY '$dbpass';
GRANT ALL PRIVILEGES ON \`$dbname\`.* TO \`$dbuser\`@localhost
IDENTIFIED BY '$dbpass';
flush privileges;
"
if eval $mysqlcmd -f mysql -e '"$script"' ; then
if ! eval $mysqlcmd -f mysql -e '"select User from user;"' | grep $dbuser >/dev/null 2>&1 ; then
error="Database user $dbuser NOT successfully added. You have to do it manually."
else
status=create
fi
else
error="Unable to run the create user script."
fi
fi
PK ϚY[ qd d
exim-trust.shnu W+A #!/bin/sh
# File: exim-trust.sh
# Changes:
# 20010219 Ola Lundqvist
# 20011022 Luca De Vitis
# Introduced the error variable.
# o / */[[:space:]]*/
# 20020116 Ola Lundqvist
# Documented the error variable.
# Needs: $trustuser - The user that exim should trust.
# Description: Makes exim to trust a user.
# Sets: $status = {error, nothing, trust}
# $error = error message (if $status = error)
status=error
error=""
EXIMCONF=/etc/exim/exim.conf
if [ -e $EXIMCONF ]; then
status=nothing
if grep -e "trusted_users.*\b$trustuser\b" $EXIMCONF >/dev/null 2>&1; then
log="${log}The user $trustuser is already trusted by Exim."
elif grep -e "trusted_users.*=" $EXIMCONF >/dev/null 2>&1; then
status=trust
log="${log}Modifying $EXIMCONF to add $trustuser as a trusted user."
sed -e "s#\(trusted_users[[:space:]]*=.*\)#\1:$trustuser#" < $EXIMCONF > $EXIMCONF.tmp
cp $EXIMCONF $EXIMCONF.bak >/dev/null 2>&1
if grep -e "trusted_users[[:space:]]*=.*\b$trustuser\b" $EXIMCONF.tmp >/dev/null 2>&1; then
mv $EXIMCONF.tmp $EXIMCONF >/dev/null 2>&1;
else
error="The script failed while adding $trustuser to the trusted users in Exim."
status=error
rm -f $EXIMCONF.tmp
fi
else
error="No trusted user line in exim, you have to add that line manually."
fi
fi
PK ϚY[TR R apache-cominclude_all.shnu W+A #!/bin/sh
# File: apache-cominclude_all.sh
# Changes:
# 20010219 Ola Lundqvist
# 20011022 Luca De Vitis
# Introduced the error variable.
# o /[[:space:]][[:space:]]*/[[:space:]]\+/
# 20020116 Ola Lundqvist
# Documented the error variable.
# 20020412 Ola Lundqvist
# Do nothing when the server is not installed.
# Needs: $server - what apache server that should be configured.
# That can be any matching /etc/$server/*.conf
# $includefile - what file that should not not be included.
# /usr/share/wwwconfig-common/apache-cominclude.sh
# Description: Purges all include statements for that file in all apache config files.
# Sets: $status = {error, nothing, comment}
# $error = error message (if $status = error)
status=error
if [ -z "$includefile" ] ; then
error="No include file specified for apache-cominclude_all.sh"
elif [ ! -d /etc/$server ] ; then
status=nothing
error="No server to configure, do nothing."
else
status=nothing
if grep -e "^[[:space:]]*Include[[:space:]]\+$includefile\b" /etc/$server/*.conf > /dev/null 2>&1; then
log="${log}Include of $includefile found in apache config files, commenting."
for conffile in /etc/$server/*.conf; do
. /usr/share/wwwconfig-common/apache-cominclude.sh
done
status=comment
fi
fi
PK ϚY[vr mysql.getnu W+A # File: mysql.get
# Changes:
# 20010224 Ola Lundqvist
# 20011022 Luca De Vitis
# Allowed reinclusion.
# 20020116 Ola Lundqvist
# Documented the reinclusion.
# 20020126 Ola Lundqvist
# Removed the reinclusion.
# 20040216 Marc Horowitz
# Support using a socket connection to the server
# 20040915 Ola Lundqvist
# Quote mysql password so it can have other chars in it.
# 20060314 Ola Lundqvist ,
# Manu Benoit
# Allow passwords to contain quotes.
# 20080424 Ola Lundqvist
# Removed single quotes for dbserver according to bug report
# #477624 from Bryan McLellan .
# Needs: $dbserver - the server to connect to.
# $dbadmin - the administrator name.
# $dbadmpass - the administrator password.
# Sets: $mysqlcmd so that administration access are prepared
if [ -z "$dbserver" ] || [ "$dbserver" = "localhost" ]; then
hostopt=""
dbserver=localhost
else
case "$dbserver" in
:*)
dbsocket=`echo $dbserver | sed -e 's/^://'`
hostopt="-S $dbsocket"
;;
*)
hostopt="-h $dbserver"
;;
esac
fi
if [ -z "$dbadmpass" ] ; then
log="${log}No password used."
passopt=""
else
passopt="--password='"`echo "$dbadmpass" | sed -e "s/'/'"'"'"'"'"'"'/g"`"'"
fi
mysqlcmd="mysql $hostopt $passopt -u $dbadmin"
PK ϚY[f\ \ pgsql-createuser.shnu W+A #!/bin/sh
# File: pgsql-createuser.sh
# Changes:
# 20010224 Ola Lundqvist
# 20011022 Luca De Vitis
# Introduced the error variable.
# Changed the if statement on line 39 with a single psql command
# using -A -q -t and changing th query
# 20020116 Ola Lundqvist
# Documented the error variable.
# 20020126 Ola Lundqvist
# Fixing postgres issues. Indenting correct.
# Fixed insert command, removed '' which should not be there.
# Removed need for $dbadmin.
# 20041002 Raphal Enrici
# Quoted $dbuser so that the username can contain '-'.
# Needs: $dbuser - the user name to create (or replace).
# $dbname - the database that user should have access to.
# $dbpass - the password to use.
# $dbserver - the server to connect to.
# $dbadmin - the administrator name.
# $dbadmpass - the administrator password (not supported).
# which
# psql
# /usr/share/wwwconfig-coomon/pgsql.get
# Description: Creates or replaces a database user.
# Sets: $status = {error, nothing, create, changepass}
# $error = error message (if $status = error)
status=error
error=""
. /usr/share/wwwconfig-common/pgsql.get
use_dbuser=false
#. pgsql.get
if [ -z "$dbuser" ] ; then
error="No database user specified. Can not create it if it does not exist."
elif [ -z "$dbserver" ] ; then
error="No database server specified."
elif [ ! -x $(which psql) ] ; then
error="No pgsql client to execute."
elif ! eval $pgsqlcmd -d $systemdb -c "\"SELECT usename FROM pg_shadow;\"" >/dev/null 2>&1 ; then
##
error="Error when trying to connect to the pgsql database.
This error can occur if you have no database to connect to, or
if the password was incorrect.
use: dpkg-reconfigure -plow packagename to reconfigure."
##
else
tmpuser=$(eval $pgsqlcmd -d $systemdb -q -t -A -c "\"SELECT usename FROM pg_shadow WHERE usename='$dbuser';\"")
if [ "$tmpuser" = "$dbuser" ] ; then
. /usr/share/wwwconfig-common/pgsql-userpass.get
# . pgsql-userpass.get
status=nothing
if [ "$userpass" != "$dbpass" ] ; then
if eval $pgsqlcmd -d $systemdb -c "\"ALTER USER "'\"'"$dbuser"'\"'" WITH PASSWORD '$dbpass'\"" > /dev/null 2>&1 ; then
log="${log}Password changed for pgsql user $dbuser."
status=changepass
else
status=error
error="Can not change password for database user $dbuser."
fi
fi
else
. /usr/share/wwwconfig-common/pgsql-nextsysid.get
# . pgsql-nextsysid.get
if [ "$status" = "error" ] ; then
error="Unable to create user $dbuser. Something is wrong with the database."
elif eval $pgsqlcmd -d $systemdb -c "\"CREATE USER "'\"'"$dbuser"'\"'" WITH SYSID $nextsysid PASSWORD '$dbpass'\"" ; > /dev/null 2>&1; then
tmpuser=$(eval $pgsqlcmd -d $systemdb -q -t -A -c "\"SELECT usename FROM pg_shadow WHERE usename='$dbuser'\"")
if [ "$tmpuser" = "$dbuser" ] ; then
log="${log}Pgsql user $dbuser created."
status=create
else
error="User $dbuser not created."
status=error
fi
else
error="Can not create user $dbuser, problem with connection."
status=error
fi
fi
fi
PK ϚY[ Es s
pgsql-exec.shnu W+A #!/bin/sh
# File: pgsql-exec.sh
# Changes:
# 20010224 Ola Lundqvist
# 20011022 Luca De Vitis
# Introduced the error variable.
# Added the -d flag to $pgsqlcmd (not really needed but clearer)
# 20020116 Ola Lundqvist
# Documented the error variable.
# 20020125 Ola Lundqvist
# Added new status code.
# 20020126 Ola Lundqvist
# Removed need for $dbadmin.
# 20051009 Ola Lundqvist
# Use dbuser=false on check and then set it to true when exec.
# Thanks to Christoph Martin .
# Needs: $dbname - the database that user should have access to (optional)
# $dbserver - the server to connect to.
# $dbadmin - the administrator name.
# $dbadmpass - the administrator password (not supported).
# which
# psql
# /usr/share/wwwconfig-coomon/pgsql.get
# Description: Creates or replaces a database user.
# Sets: $status = {error, exec, execerror}
# $error = error message (if $status = error)
status=error
error=""
. /usr/share/wwwconfig-common/pgsql.get
use_dbuser=false
if [ -z "$dbserver" ] ; then
error="No database server specified."
elif [ ! -x $(which pgsql) ] ; then
error="No pgsql client to execute, install the pgsql client package and
run 'dpkg-reconfigure -plow packagename'."
elif ! eval $pgsqlcmd $systemdb -c "\"select usename from pg_shadow;\"" >/dev/null 2>&1 ; then
error="Error when trying to connect to the pgsql database.
This error can occur if you have no database to connect to, or
if the password was incorrect.
use: dpkg-reconfigure -plow packagename to reconfigure."
else
log="${log}Executing command to pgsql."
use_dbuser=true
if eval $pgsqlcmd -d $dbname < $sqlfile > /dev/null 2>&1 ; then
status=exec
else
status=execerror
error="Unable to run the sql script ($sqlfile)."
fi
fi
PK ϚY[7 apache-uninclude.shnu W+A #!/bin/sh
# File: apache-uninclude.sh
# Changes:
# 20010219 Ola Lundqvist
# 20011022 Luca De Vitis
# Introduced the error variable.
# o /[[:space:]][[:space:]]*/[[:space:]]\+/
# Changed from "cat $conffile | grep" to "grep ... < $conffile"
# 20020116 Ola Lundqvist
# Documented the error variable.
# Needs: $conffile - The config file to pruge from.
# $includefile - The file that should not not be included.
# Description: Purges all include statements for that file in the apache config file.
# Sets: $status = {error, nothing, purge}
# $error = error message (if $status = error)
status=error
if [ -z "$conffile" ] ; then
error="No config file specified for apache-uninclude.sh"
elif [ -z "$includefile" ] ; then
error="No include file specified for apache-uninclude.sh"
elif [ ! -f $conffile ] ; then
error="File $conffile not found!"
else
status=nothing
GREP="Include[[:space:]]\+$includefile\b"
if grep -e "$GREP" $conffile > /dev/null 2>&1; then
log="${log}Include of $includefile found in $conffile file, purging."
status=purge
grep -v -e "$GREP" < $conffile > $conffile.purg
mv $conffile.purg $conffile
fi
fi
PK ϚY[0s pgsql-createdb.shnu W+A #!/bin/sh
# File: pgsql-createdb.sh
# Changes:
# 20010224 Ola Lundqvist
# 20011022 Luca De Vitis
# Introduced the error variable.
# 20020116 Ola Lundqvist
# Documented the error variable.
# 20020126 Ola Lundqvist
# Removed need for $dbadmin.
# 20041217 Ola Lundqvist
# Fix but in CREATE DATABASE statement, using suggestion from
# Laurent Simonneau.
# Needs: $dbname - the database that user should have access to.
# $dbserver - the server to connect to.
# $dbadmin - the administrator name.
# $dbadmpass - the administrator password
# $dbuser - the database's owner if set
# which
# pgsql
# /usr/share/wwwconfig-common/pgsql.get
# Description: Creates a database.
# Sets: $status = {error, nothing, create}
# $error = error message (if $status = error)
status=error
error=""
. /usr/share/wwwconfig-common/pgsql.get
use_dbuser=false
if [ -z "$dbname" ] ; then
error="No database name specified. Have to know the name to create it."
elif [ -z "$dbserver" ] ; then
error="No database server specified."
elif [ ! -x $(which psql) ] ; then
error="No pgsql client to execute."
#elif [ ! -x /usr/bin/pg_wrapper ] ; then
# error="Postgres wrappers do not exist, install postgresql-client package."
elif ! eval $pgsqlcmd -d $systemdb -c "\"\"" >/dev/null 2>&1 ; then
error="Error when trying to connect to the pgsql database.
This error can occur if you have no database to connect to, or
if the password was incorrect.
use: dpkg-reconfigure -plow packagename to reconfigure."
else
if eval $pgsqlcmd -d $dbname -c "\"\"" > /dev/null 2>&1 ; then
log="${log}Database $dbname already exists."
status=nothing
else
my_dbuser="postgres"
if [ ! -z "$dbuser" ]; then
my_dbuser="$dbuser"
fi
log="${log}Creating database $dbname."
if eval $pgsqlcmd -d $systemdb -c "\"CREATE DATABASE $dbname WITH OWNER \\\"$my_dbuser\\\";\"" > /dev/null 2>&1 ; then
if ! eval $pgsqlcmd -d $dbname -c "\"\"" > /dev/null 2>&1 ; then
error="Database $dbname NOT successfully created. You have to do it manually."
else
status=create
fi
else
error="Unable to run the create database script."
fi
fi
fi
PK ϚY[W&M M apache-include_all.shnu W+A PK ϚY[HԭG G pgsql-if-exec.shnu W+A PK ϚY[a` apache-run.getnu W+A PK ϚY[lj& & b apache-uninclude_all.shnu W+A PK ϚY[f7 7
mysql.funcnu W+A PK ϚY[yhTj j @ apache-include.shnu W+A PK ϚY['9# ! apache-index.shnu W+A PK ϚY[[p/=T T ' apache-uncominclude.shnu W+A PK ϚY[ Y- php-extensions.shnu W+A PK ϚY[=&a a
w1 mysql-exec.shnu W+A PK ϚY[Ƴ : mysql-ifnot-exec.shnu W+A PK ϚY[pM>t t
C confd-link.shnu W+A PK ϚY[u L pgsql-userpass.getnu W+A PK ϚY[9j fP apache.funcnu W+A PK ϚY[~', , T pgsql-allowip.shnu W+A PK ϚY[tG K K a php.getnu W+A PK ϚY[1 1 d apache-include-postrm.shnu W+A PK ϚY[.2iW l autopatch_all.shnu W+A PK ϚY[O p pgsql-nextsysid.getnu W+A PK ϚY[W-L L ?t mysql-localadmpass.getnu W+A PK ϚY[ { mysql-createdb.shnu W+A PK ϚY[C pgsql-dropdb.shnu W+A PK ϚY[ }@ @ ߌ pgsql-ifnot-exec.shnu W+A PK ϚY[zf# # b mysql-dropdb.shnu W+A PK ϚY[L Ğ mysql-dropuser.shnu W+A PK ϚY[Jdž: : apache-index_all.shnu W+A PK ϚY[,j - mysql-if-exec.shnu W+A PK ϚY[6,Ry y autopatch.shnu W+A PK ϚY[J4 apache-cominclude.shnu W+A PK ϚY[qI apache-addtype_all.shnu W+A PK ϚY[۬k
apache-php.shnu W+A PK ϚY[O"~0 0 pgsql.getnu W+A PK ϚY[(TH
: pgsql-dropuser.shnu W+A PK ϚY[㐤\ \
restart.shnu W+A PK ϚY[چ mysql-createuser.shnu W+A PK ϚY[ qd d
T exim-trust.shnu W+A PK ϚY[TR R apache-cominclude_all.shnu W+A PK ϚY[vr mysql.getnu W+A PK ϚY[f\ \ pgsql-createuser.shnu W+A PK ϚY[ Es s
4 pgsql-exec.shnu W+A PK ϚY[7 apache-uninclude.shnu W+A PK ϚY[0s ! pgsql-createdb.shnu W+A PK * * .
+