wwwconfig-common-0.3.0/0000755000000000000000000000000012726357676011725 5ustar wwwconfig-common-0.3.0/debian/0000755000000000000000000000000012726357676013147 5ustar wwwconfig-common-0.3.0/debian/changelog.unstable0000644000000000000000000000333311173250440016607 0ustar wwwconfig-common (0.0.5-1) unstable; urgency=low * Removes dependency of bash, closes: #91807. * Fixed tab issue in apache config files, closes: #95113. * Added a script that gets the password and user from my.cnf (mysql). -- Ola Lundqvist Mon, 30 Apr 2001 13:47:10 +0200 wwwconfig-common (0.0.4-2) unstable; urgency=low * Bashism errors, closes: #91807. -- Ola Lundqvist Tue, 27 Mar 2001 10:58:40 +0100 wwwconfig-common (0.0.4-1) unstable; urgency=low * Added mysql/pgsql-if/ifnot-exec.sh scripts. -- Ola Lundqvist Tue, 13 Mar 2001 16:35:22 +0100 wwwconfig-common (0.0.3-3) unstable; urgency=low * Fixed better output when it can not access the database, closes: #88996. -- Ola Lundqvist Tue, 13 Mar 2001 16:35:22 +0100 wwwconfig-common (0.0.3-2) unstable; urgency=low * Fixed a problem with adding users to mysql. -- Ola Lundqvist Wed, 07 Mar 2001 12:58:16 +0100 wwwconfig-common (0.0.3-1) unstable; urgency=low * Added a AddType function to fix dcl. -- Ola Lundqvist Mon, 05 Mar 2001 18:39:34 +0100 wwwconfig-common (0.0.2-2) unstable; urgency=low * Fixed apache.func so that it match only the specified and nothing more. In some cases there was some error there. -- Ola Lundqvist Mon, 19 Feb 2001 20:39:34 +0100 wwwconfig-common (0.0.2-1) unstable; urgency=low * Added support for some mysql manipulations. -- Ola Lundqvist Mon, 19 Feb 2001 20:39:34 +0100 wwwconfig-common (0.0.1-1) unstable; urgency=low * Initial Release. -- Ola Lundqvist Mon, 19 Feb 2001 20:39:34 +0100 Local variables: mode: debian-changelog End: wwwconfig-common-0.3.0/debian/changelog.stable0000644000000000000000000000333111173250440016242 0ustar wwwconfig-common (0.0.5-1) stable; urgency=low * Removes dependency of bash, closes: #91807. * Fixed tab issue in apache config files, closes: #95113. * Added a script that gets the password and user from my.cnf (mysql). -- Ola Lundqvist Mon, 30 Apr 2001 13:47:10 +0200 wwwconfig-common (0.0.4-2) unstable; urgency=low * Bashism errors, closes: #91807. -- Ola Lundqvist Tue, 27 Mar 2001 10:58:40 +0100 wwwconfig-common (0.0.4-1) unstable; urgency=low * Added mysql/pgsql-if/ifnot-exec.sh scripts. -- Ola Lundqvist Tue, 13 Mar 2001 16:35:22 +0100 wwwconfig-common (0.0.3-3) unstable; urgency=low * Fixed better output when it can not access the database, closes: #88996. -- Ola Lundqvist Tue, 13 Mar 2001 16:35:22 +0100 wwwconfig-common (0.0.3-2) unstable; urgency=low * Fixed a problem with adding users to mysql. -- Ola Lundqvist Wed, 07 Mar 2001 12:58:16 +0100 wwwconfig-common (0.0.3-1) unstable; urgency=low * Added a AddType function to fix dcl. -- Ola Lundqvist Mon, 05 Mar 2001 18:39:34 +0100 wwwconfig-common (0.0.2-2) unstable; urgency=low * Fixed apache.func so that it match only the specified and nothing more. In some cases there was some error there. -- Ola Lundqvist Mon, 19 Feb 2001 20:39:34 +0100 wwwconfig-common (0.0.2-1) unstable; urgency=low * Added support for some mysql manipulations. -- Ola Lundqvist Mon, 19 Feb 2001 20:39:34 +0100 wwwconfig-common (0.0.1-1) unstable; urgency=low * Initial Release. -- Ola Lundqvist Mon, 19 Feb 2001 20:39:34 +0100 Local variables: mode: debian-changelog End: wwwconfig-common-0.3.0/debian/rules0000755000000000000000000000044212726357577014227 0ustar #!/usr/bin/make -f %: dh $@ override_dh_auto_install: # Add here commands to install the package into debian/wwwconfig-common. cp *.func *.get *.sh $(CURDIR)/debian/wwwconfig-common/usr/share/wwwconfig-common rm -f $(CURDIR)/debian/wwwconfig-common/usr/share/wwwconfig-common/test.sh wwwconfig-common-0.3.0/debian/wwwconfig-common.docs0000644000000000000000000000001711173250440017267 0ustar AUTHORS README wwwconfig-common-0.3.0/debian/changelog0000644000000000000000000004113012726357624015011 0ustar wwwconfig-common (0.3.0) unstable; urgency=high * Updated to place a link in conf-available for apache2. So far it does not call a2enconf configfile. Maybe it should but we skip that for now and let the admin do that manually. Closes: #823518. * Updated to standards version 3.9.6. * Updated from debhelper 4 to 9 compatibility. * Added dependency to misc:Depends. * Simplified the rules file. -- Ola Lundqvist Thu, 09 Jun 2016 23:19:46 +0200 wwwconfig-common (0.2.2) unstable; urgency=low * Suggest apache2 instead of apache. Related to but not solving #293141. -- Ola Lundqvist Mon, 01 Nov 2010 21:22:14 +0100 wwwconfig-common (0.2.1) unstable; urgency=low * Applied a small correction to the README file. Thanks to shaulkarl@yahoo.com for the fix. Closes: #506822. -- Ola Lundqvist Tue, 25 Nov 2008 08:00:25 +0100 wwwconfig-common (0.2.0) unstable; urgency=low * Added support for apache conf.d files. Feature provided by Norman Messtorff . Closes: #237292. -- Ola Lundqvist Sun, 9 Nov 2008 21:17:03 +0100 wwwconfig-common (0.1.2) unstable; urgency=low * Now uses invoke-rc.d if available. Closes: #484857. -- Ola Lundqvist Wed, 11 Jun 2008 20:30:12 +0200 wwwconfig-common (0.1.1) unstable; urgency=low * Removed single quotes for dbserver according to bug report from Bryan McLellan , closes: #477624. -- Ola Lundqvist Thu, 24 Apr 2008 09:20:08 +0200 wwwconfig-common (0.1.0) unstable; urgency=low * Applied patch from Morten Werner Forsbring to support postgres 8.X. Closes: #472926. This change is not backwards compatible with earlier versions which means that it should not be backported to etch. -- Ola Lundqvist Sat, 29 Mar 2008 20:35:11 +0100 wwwconfig-common (0.0.48) unstable; urgency=low * Applied patch from Frederic Schutz to make sure that even if restart fail, the postinst script do not break, closes: #399115. -- Ola Lundqvist Sat, 18 Nov 2006 10:29:22 +0100 wwwconfig-common (0.0.47) unstable; urgency=low * Correction of wrong filenames in comments, closes: #392331. Thanks to Ivar Smolin . -- Ola Lundqvist Wed, 11 Oct 2006 21:30:07 +0200 wwwconfig-common (0.0.46) unstable; urgency=low * Changed build-depends-indep to build depends. * Changed to standards version 3.7.2. * Added required build target binary-arch, even if not really used. -- Ola Lundqvist Sun, 9 Jul 2006 22:54:21 +0200 wwwconfig-common (0.0.45) unstable; urgency=low * Now allow quotes in password, closes: #341154. Thanks to Manu Benoît for the fix. * Updated standards version to 3.6.2. * Updated to debhelper 4 compatibility. * Corrected FSF address in copyright file. * Added all copyright holders to debian/copyright file. -- Ola Lundqvist Fri, 17 Mar 2006 17:23:10 +0100 wwwconfig-common (0.0.44) unstable; urgency=low * Fixed typo in pgsql-ifnot-exec.sh, closes: #326615. Thanks to gregor herrmann for pointing this out. * Manually incorporated a fix from Christoph Martin that allow pgsql-exec.sh to work properly, closes: #322584. -- Ola Lundqvist Sun, 9 Oct 2005 14:00:42 +0200 wwwconfig-common (0.0.43) unstable; urgency=low * Added fix to pgsql-dropuser.sh as suggested by Uwe Steinmann , closes: #300861. -- Ola Lundqvist Tue, 22 Mar 2005 17:21:24 +0100 wwwconfig-common (0.0.42) unstable; urgency=low * Fixed bug in pgsql-createdb so that users with a '-' caracter can be used. Thanks to Laurent Simonneau for the suggestion, closes: #285917. -- Ola Lundqvist Fri, 17 Dec 2004 06:49:50 +0100 wwwconfig-common (0.0.41) unstable; urgency=medium * Applied patch from Raphael Enrici so that users can have a '-' character in it, closes: #274291. -- Ola Lundqvist Sat, 2 Oct 2004 10:33:49 +0200 wwwconfig-common (0.0.40) unstable; urgency=medium * Quoted passopt to mysql so it can have strange characters in it, closes: #269317. -- Ola Lundqvist Wed, 15 Sep 2004 16:05:51 +0200 wwwconfig-common (0.0.39) unstable; urgency=high * Replaced modules-config by apache-modconf some more. Thanks to Jeremy Laine for the patch. -- Ola Lundqvist Fri, 20 Aug 2004 13:31:55 +0200 wwwconfig-common (0.0.38) unstable; urgency=low * As Pierre Habouzit suggested I have changed from modules-config to apache-modconf in apache-php.sh. Just a name change, no functionality changed. Closes: #263350. -- Ola Lundqvist Fri, 6 Aug 2004 22:37:27 +0200 wwwconfig-common (0.0.37) unstable; urgency=low * Applied patch from Hilko Bengen for better postgres support, closes: #263813. * Updated standards version to 3.6.1. -- Ola Lundqvist Fri, 6 Aug 2004 14:03:58 +0200 wwwconfig-common (0.0.36) unstable; urgency=low * Fixed issue in cooperation with dpsyco-mysql. Thanks to Jacob Lundqvist for pointing it out and the fix. -- Ola Lundqvist Thu, 22 Jul 2004 23:09:11 +0200 wwwconfig-common (0.0.35) unstable; urgency=low * Added patch from Jeremy Laine so apache-php.sh uses modules config from apache instead, closes: #223309. * Added patch from Hilko Bengen that adds much better postgres support, closes: #235988. * Added patch from Jeremy that together with Jeroen van Wolffelaar patch for mysql-exec.sh from previous upload fixes this bug, closes: #231186. * Added patch from Jeremy Laine that uses a new and better way to check for mysql client command, closes: #247862. * Closing bugs from previous upload: Marc Horowitz, closes: #232815, #232816. Jeroen van Wolffelaar, closes: #231117. -- Ola Lundqvist Mon, 5 Jul 2004 22:50:59 +0200 wwwconfig-common (0.0.34) unstable; urgency=low * Added patch from Jeroen van Wolffelaar . This changes the old mysql.{user,db} mangling with the proper and preferred mysql granting syntax. * Added patch from Jeroen van Wolffelaar . Fixes hostopt not reset propery problem. * Added patch from Jeroen van Wolffelaar . It makes mysql-exec.sh work for nonadmins too. * Added patch from Marc Horowitz . Getmysqlopt now ignores comments. * Added patch from Marc Horowitz . Support for socket connection to server. -- Ola Lundqvist Mon, 16 Feb 2004 14:34:38 +0100 wwwconfig-common (0.0.33) unstable; urgency=low * Added patch from Thomas Viehmann that fixes mysql exec problem. -- Ola Lundqvist Fri, 19 Dec 2003 11:52:27 +0100 wwwconfig-common (0.0.32) unstable; urgency=low * Applied two patches from Benoit Joly that fix two eval issues, closes: #217747, #217750. -- Ola Lundqvist Mon, 27 Oct 2003 11:03:52 +0100 wwwconfig-common (0.0.31) unstable; urgency=low * Appling patch from Loic Dachary (OuoU) that fixes an eval problem in mysql-createdb, closes: #210532. -- Ola Lundqvist Mon, 15 Sep 2003 22:06:53 +0200 wwwconfig-common (0.0.30) unstable; urgency=low * Fixed postgres value error, closes: #150371. * Updated standards version from 3.5.8 to 3.5.10. * Added patch from Thomas Poindessous , closes: #203435. * Modified all other mysql and pgsql in the same way as the patch from Tomas do. -- Ola Lundqvist Fri, 29 Aug 2003 22:57:53 +0200 wwwconfig-common (0.0.29) unstable; urgency=low * Added patch from Nikolai Prokoschenko that fixes a bug in database detection routine for mysql, closes: #205585. -- Ola Lundqvist Fri, 15 Aug 2003 21:54:49 +0200 wwwconfig-common (0.0.28) unstable; urgency=low * Fixing password quoting, closes: #203435. -- Ola Lundqvist Mon, 4 Aug 2003 14:46:56 +0200 wwwconfig-common (0.0.27) unstable; urgency=low * Fixed postgres insert error using suggestion from uwe@steinmann.cx (Uwe Steinmann), closes: #198853. -- Ola Lundqvist Tue, 1 Jul 2003 12:01:55 +0200 wwwconfig-common (0.0.26) unstable; urgency=low * Fixed multiple line issue, closes: #146463, #146784, #147680, #148161. -- Ola Lundqvist Tue, 1 Apr 2003 18:16:19 +0200 wwwconfig-common (0.0.25) unstable; urgency=low * Corrected some minor documentation in the mysql-exec.sh script. * Added AUTHORS documentation. * Corrected short description field in control file. * Changed standards version from 3.5.7 to 3.5.8. -- Ola Lundqvist Sat, 15 Feb 2003 17:20:50 +0100 wwwconfig-common (0.0.24) unstable; urgency=low * Minor fix from Arndt Schönewald that fix potential problems if someone use a non-sh compatible shell. -- Ola Lundqvist Mon, 30 Sep 2002 07:07:26 +0200 wwwconfig-common (0.0.23) unstable; urgency=low * Applied changes from Arndt Schönewald that fixes all the sudo related bugs. Closes: #160406, #156075, #140306, #140437, #142924, #147675, #148979, #154619. Thanks a lot for this patch because it has annoyed me for a long time! * Updated to latest policy version 3.5.7. -- Ola Lundqvist Thu, 26 Sep 2002 11:50:11 +0200 wwwconfig-common (0.0.22) unstable; urgency=low * Fixed mysql-localadmpass.get using patch from hec@espuny.net, closes: #160557. -- Ola Lundqvist Thu, 12 Sep 2002 08:12:00 +0200 wwwconfig-common (0.0.21) unstable; urgency=low * Fixed a bug in pgsql-allowip.sh that could make it stall. This only affects people who has an old postgres server (or have not purged it). Closes: #158739. -- Ola Lundqvist Mon, 2 Sep 2002 11:01:21 +0200 wwwconfig-common (0.0.20) unstable; urgency=low * Mysql-createuser can now have other status than error, close: #150083. * Fixed psql-dropdb.sh, closes: #151741. Thanks to Luigi Gangitano for the patch. -- Ola Lundqvist Wed, 17 Jul 2002 09:03:14 +0200 wwwconfig-common (0.0.19) unstable; urgency=low * Better error checking if the apache server is not installed properly. -- Ola Lundqvist Fri, 12 Apr 2002 12:35:09 +0200 wwwconfig-common (0.0.18) unstable; urgency=low * Exim configuration issues fixed using modified patch from Wolfgang Sourdeau , closes: #142041. -- Ola Lundqvist Wed, 10 Apr 2002 10:28:14 +0200 wwwconfig-common (0.0.17) unstable; urgency=low * Added apache-include-postrm.sh from eichin@thok.org (Mark W. Eichin), closes: #139296. -- Ola Lundqvist Fri, 5 Apr 2002 21:48:45 +0200 wwwconfig-common (0.0.16) unstable; urgency=low * Applied simple patch from Luca - De Whiskey's - De Vitis, , closes: #136899. * Added more hits and documentation, closes: #136135. -- Ola Lundqvist Sun, 17 Mar 2002 23:28:37 +0100 wwwconfig-common (0.0.15) unstable; urgency=low * Updated description, closes: #137067. * Applied patch from Luca, closes: #137986. * Fixed getwwwoption, closes: #136205. -- Ola Lundqvist Tue, 12 Mar 2002 21:58:09 +0100 wwwconfig-common (0.0.14) unstable; urgency=low * Fixed echo bug, closes: #131158. -- Ola Lundqvist Tue, 5 Feb 2002 13:09:49 +0100 wwwconfig-common (0.0.13) unstable; urgency=low * Fixed new statuscode for database run scripts. * Put back the password string. mysql-admin does not work as mysql. * Fixed automatic uncommenting. * Fixed empty password handling. - Removed the dbadmpassfound variable and changed the status variable instead. (MySQL) * Fixed syntax error in wwwconfig-common. * Fixed a lot of postgres issues, closes: #93560. * Fixed indention. -- Ola Lundqvist Fri, 25 Jan 2002 22:29:26 +0100 wwwconfig-common (0.0.12) unstable; urgency=low * Fixed multiple lines problem, thanks Joerg Friedrich for the patch, closes: #115485. * Probably fixed 117188. -- Ola Lundqvist Fri, 25 Jan 2002 13:11:29 +0100 wwwconfig-common (0.0.11) unstable; urgency=low * Applied patch from Stephen R. Darragh, closes: #119679. * Applied a big patch from luca@debian.org that introduces a error variable, allows reinclusion of all *.get files and also added four new scripts {mysql,pgsql}-drop{user,db}.sh, closes: #116604. - Changed regular expressions o /[[:space:]][[:space:]]*/[[:space:]]\+/ o / */[[:space:]]\+/ o / */[[:space:]]*/ - Changed from "cat $conffile | sed" to "sed ... < $conffile" - Fixed autopatch. - Added the -d flag to $pgsqlcmd (not really needed but clearer) - Changed the piped commands with a single psql command using -A -q -t * Fixed autopatch (again). * Fixed build-dep lintial error. -- Ola Lundqvist Wed, 16 Jan 2002 12:02:13 +0100 wwwconfig-common (0.0.10) unstable; urgency=low * Fixed restart problem, closes: #110781. * Postgres issues should have been fixed now, closes: #95864. -- Ola Lundqvist Mon, 17 Sep 2001 22:32:22 +0200 wwwconfig-common (0.0.9) unstable; urgency=low * Fixed error message when the client database executable can not be found. -- Ola Lundqvist Fri, 31 Aug 2001 08:26:00 +0200 wwwconfig-common (0.0.8) unstable; urgency=low * Fixed postgres problem when creating db, closes: #109384. * Fixing problem with postgres, horde hang on a grep statement, closes: #110291. * Fix problem with tomcat, workaround, closes: #108690. -- Ola Lundqvist Thu, 23 Aug 2001 12:24:36 +0200 wwwconfig-common (0.0.7) unstable; urgency=low * Applied the patch from Piotr Roszatycki , that fixes some sed problems, closes: #108838. -- Ola Lundqvist Mon, 20 Aug 2001 23:02:04 +0200 wwwconfig-common (0.0.6) unstable; urgency=low * Fix for restart problem. * Updated the documentation for how packages should handle this package, closes: #107329. * Now reads configuration informaition from more than one file (mysql), closes: #98435. * Fixed postgres incompabilities and config output, closes: #95862. -- Ola Lundqvist Mon, 13 Aug 2001 18:56:17 +0200 wwwconfig-common (0.0.5-1) unstable; urgency=low * Removes dependency of bash, closes: #91807. * Fixed tab issue in apache config files, closes: #95113. * Added a script that gets the password and user from my.cnf (mysql). -- Ola Lundqvist Mon, 30 Apr 2001 13:47:10 +0200 wwwconfig-common (0.0.4-2) unstable; urgency=low * Bashism errors, closes: #91807. -- Ola Lundqvist Tue, 27 Mar 2001 10:58:40 +0100 wwwconfig-common (0.0.4-1) unstable; urgency=low * Added mysql/pgsql-if/ifnot-exec.sh scripts. -- Ola Lundqvist Tue, 13 Mar 2001 16:35:22 +0100 wwwconfig-common (0.0.3-3) unstable; urgency=low * Fixed better output when it can not access the database, closes: #88996. -- Ola Lundqvist Tue, 13 Mar 2001 16:35:22 +0100 wwwconfig-common (0.0.3-2) unstable; urgency=low * Fixed a problem with adding users to mysql. -- Ola Lundqvist Wed, 07 Mar 2001 12:58:16 +0100 wwwconfig-common (0.0.3-1) unstable; urgency=low * Added a AddType function to fix dcl. -- Ola Lundqvist Mon, 05 Mar 2001 18:39:34 +0100 wwwconfig-common (0.0.2-2) unstable; urgency=low * Fixed apache.func so that it match only the specified and nothing more. In some cases there was some error there. -- Ola Lundqvist Mon, 19 Feb 2001 20:39:34 +0100 wwwconfig-common (0.0.2-1) unstable; urgency=low * Added support for some mysql manipulations. -- Ola Lundqvist Mon, 19 Feb 2001 20:39:34 +0100 wwwconfig-common (0.0.1-1) unstable; urgency=low * Initial Release. -- Ola Lundqvist Mon, 19 Feb 2001 20:39:34 +0100 wwwconfig-common-0.3.0/debian/copyright0000644000000000000000000000340212726357221015063 0ustar This package was debianized by Ola Lundqvist on Mon, 19 Feb 2001 20:39:34 +0100. This is a native debian package. If you do not use debian you will probably have no use of it. Copyright: Copyright (C) 2000-2006,2008,2016 Ola Lundqvist Copyright (C) 2008 Bryan McLellan Copyright (C) 2008 Morten Werner Forsbring Copyright (C) 2005 Christoph Martin Copyright (C) 2004 Hilko Bengen Copyright (C) 2004 Jeremy Laine Copyright (C) 2003 Loic Dachary (OuoU) Copyright (C) 2003 Jeroen van Wolffelaar Copyright (C) 2003 Benoit Joly Copyright (C) 2003 Thomas Viehmann Copyright (C) 2002 Arndt Schönewald Copyright (C) 2002 Stephen R. Darragh Copyright (C) 2001 Luca De Vitis License: wwwconfig-common is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. wwwconfig-common is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License with your Debian GNU system, in /usr/share/common-licenses/GPL, or with the Debian GNU gnupg source package as the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. wwwconfig-common-0.3.0/debian/compat0000644000000000000000000000000212726357342014333 0ustar 9 wwwconfig-common-0.3.0/debian/control0000644000000000000000000000065212726357501014540 0ustar Source: wwwconfig-common Section: web Priority: optional Maintainer: Ola Lundqvist Build-Depends: debhelper (>> 9.0.0) Standards-Version: 3.9.6 Package: wwwconfig-common Architecture: all Suggests: mysql-client, postgresql-client, apache2 Depends: ${misc:Depends} Description: Debian web auto configuration A package to provide common setup scripts for some packages that need apache, php and a database. wwwconfig-common-0.3.0/debian/wwwconfig-common.dirs0000644000000000000000000000003311173250440017276 0ustar usr/share/wwwconfig-common wwwconfig-common-0.3.0/confd-link.sh0000755000000000000000000000442612726356504014303 0ustar #!/bin/sh # File: confd-link.sh # Changes: # 20160609 Ola Lundqvist # Changed as apache2 directory is now called conf-available too. # 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" ] || [ "$A" = "apache" ]; then linkpath="/etc/$A/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" ] || [ "$A" = "apache" ]; then linkpath="/etc/$A/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 wwwconfig-common-0.3.0/mysql.func0000644000000000000000000000146711173250440013727 0ustar # 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 } wwwconfig-common-0.3.0/README0000644000000000000000000000271012726357073012574 0ustar wwwconfig-common for Debian --------------------------- This package is used by some packages to prevent errors from duplication and ease the setup of new packages that uses a webserver and some other tools. Note! This package will not depend on any packages that are not critical. So if the package that uses this package to do a certain thing, it should depend the extra packages that this functionality requires, like mysql-client and similar. These packages are at most suggested by this package. If you are packaging applications for apache the debian-apache@lists.debian.org may be something for you. Copyright (C) 2000-2006,2008,2016 Ola Lundqvist Copyright (C) 2008 Bryan McLellan Copyright (C) 2008 Morten Werner Forsbring Copyright (C) 2005 Christoph Martin Copyright (C) 2004 Hilko Bengen Copyright (C) 2004 Jeremy Laine Copyright (C) 2003 Loic Dachary (OuoU) Copyright (C) 2003 Jeroen van Wolffelaar Copyright (C) 2003 Benoit Joly Copyright (C) 2003 Thomas Viehmann Copyright (C) 2002 Arndt Schönewald Copyright (C) 2002 Stephen R. Darragh Copyright (C) 2001 Luca De Vitis -- Ola Lundqvist , Mon, 19 Feb 2001 20:39:34 +0100 wwwconfig-common-0.3.0/mysql-createuser.sh0000755000000000000000000000476611173250441015557 0ustar #!/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 wwwconfig-common-0.3.0/mysql.get0000644000000000000000000000271511173250440013550 0ustar # 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" wwwconfig-common-0.3.0/pgsql-createuser.sh0000755000000000000000000000613411173250441015527 0ustar #!/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 Raphaël 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 wwwconfig-common-0.3.0/pgsql-dropdb.sh0000755000000000000000000000337011173250441014636 0ustar #!/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 wwwconfig-common-0.3.0/apache-cominclude.sh0000755000000000000000000000240311173250441015575 0ustar #!/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 wwwconfig-common-0.3.0/mysql-if-exec.sh0000755000000000000000000000460611173250440014725 0ustar #!/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 wwwconfig-common-0.3.0/autopatch.sh0000755000000000000000000000117111173250440014224 0ustar #!/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 wwwconfig-common-0.3.0/mysql-ifnot-exec.sh0000755000000000000000000000460411173250441015445 0ustar #!/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 wwwconfig-common-0.3.0/COPYING0000644000000000000000000004311611173250441012736 0ustar GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. wwwconfig-common-0.3.0/mysql-dropdb.sh0000755000000000000000000000444311173250441014657 0ustar #!/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 wwwconfig-common-0.3.0/patches/0000755000000000000000000000000012726357676013354 5ustar wwwconfig-common-0.3.0/patches/bug-210632-mysql-createuser-eval.author0000644000000000000000000000004611173250440022310 0ustar Loic Dachary (OuoU) wwwconfig-common-0.3.0/patches/bug-137986-pgsql-dropuser.author0000644000000000000000000000006411173250440021071 0ustar "Luca - De Whiskey\'s - De Vitis" wwwconfig-common-0.3.0/patches/bug-217747-wwwconfig-common_mysql-exec.patch0000644000000000000000000000064011173250440023340 0ustar --- mysql-exec.sh.old 2003-10-26 06:07:01.000000000 -0500 +++ mysql-exec.sh 2003-10-26 06:07:19.000000000 -0500 @@ -42,7 +42,7 @@ use: dpkg-reconfigure -plow packagename to reconfigure." else log="${log}Executing command to mysql." - if $mysqlcmd -f $dbname < $sqlfile > /dev/null 2>&1 ; then + if eval $mysqlcmd -f $dbname < $sqlfile > /dev/null 2>&1 ; then status=exec else status=execerror wwwconfig-common-0.3.0/patches/bug-137986-pgsql-dropuser.patch0000644000000000000000000000241211173250440020665 0ustar --- /usr/share/wwwconfig-common/pgsql-dropuser.sh Tue Feb 5 13:11:15 2002 +++ pgsql-dropuser.sh Tue Mar 12 12:37:22 2002 @@ -30,16 +30,16 @@ error="No database administrator specified." elif [ ! -x $(which psql) ] ; then error="No pgsql client to execute." -elif ! $pgsqlcmd -d $systemdb -c "SELECT usename FROM pg_shadow;" >/dev/null 2>&1 ; then +elif ! $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 - if [ $($pgsqlcmd -d $systemdb -q -t -A -c "SELECT usename FROM pg_shadow WHERE usename='$dbuser';") = "$dbuser" ] ; then - if $pgsqlcmd -d $systemdb -c " + if [ "$($pgsqlcmd -d $systemdb -q -t -A -c "SELECT usename FROM pg_shadow WHERE usename='$dbuser';")" = "$dbuser" ] ; then + if $pgsqlcmd -q -d $systemdb -c " DELETE FROM pg_shadow - WHERE usename='$dbuser';" > /dev/null 2>&1 ; then + WHERE usename='$dbuser';" ; then if [ -z "$($pgsqlcmd -d $systemdb -q -t -A -c "SELECT usename FROM pg_shadow WHERE usename='$dbuser';")" ] ; then log="${log}User $dbuser droped." status=drop wwwconfig-common-0.3.0/patches/bug-225424-grant-all-privileges.patch0000644000000000000000000000341211173250440021710 0ustar diff -ur wwwconfig-common-0.0.33/mysql-createuser.sh wwwconfig-common-0.0.33-new/mysql-createuser.sh --- wwwconfig-common-0.0.33/mysql-createuser.sh 2003-10-27 11:04:51.000000000 +0100 +++ wwwconfig-common-0.0.33-new/mysql-createuser.sh 2004-02-04 16:58:14.000000000 +0100 @@ -10,6 +10,9 @@ # 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. @@ -48,41 +51,11 @@ else log="${log}Creating or resetting database user ($dbuser)." script=" - CONNECT mysql; + GRANT ALL PRIVILEGES ON \`$dbname\`.* TO \`$dbuser\`@'$dballow' + IDENTIFIED BY '$dbpass'; - REPLACE INTO user ( host, user, password ) - VALUES ( - '$dballow', - '$dbuser', - password( '$dbpass' ) - ); - - REPLACE INTO user ( host, user, password ) - VALUES ( - 'localhost', - '$dbuser', - password( '$dbpass' ) - ); - - REPLACE INTO db ( host, db, user, select_priv, insert_priv, update_priv, - delete_priv, create_priv, drop_priv ) - VALUES ( - '$dballow', - '$dbname', - '$dbuser', - 'Y', 'Y', 'Y', 'Y', - 'Y', 'Y' - ); - - REPLACE INTO db ( host, db, user, select_priv, insert_priv, update_priv, - delete_priv, create_priv, drop_priv ) - VALUES ( - 'localhost', - '$dbname', - '$dbuser', - 'Y', 'Y', 'Y', 'Y', - 'Y', 'Y' - ); + GRANT ALL PRIVILEGES ON \`$dbname\`.* TO \`$dbuser\`@localhost + IDENTIFIED BY '$dbpass'; flush privileges; " wwwconfig-common-0.3.0/patches/bug-231117-hostopt-not-reset-propery.patch0000644000000000000000000000217311173250440022773 0ustar Package: wwwconfig-common Version: 0.0.34-0.1~jeroen1 Severity: minor Tags: patch $hostopt is in mysql.get not reset if dbserver is local. If mysq.get was previously called with a remote host, you cannot connect to the local mysql anymore with wwwconfig-common unless you reset hostopt yourself (which would be hack). --Jeroen diff -ur wwwconfig-common-0.0.34/mysql.get wwwconfig-common-0.0.34.2/mysql.get --- wwwconfig-common-0.0.34/mysql.get 2003-08-04 14:47:43.000000000 +0200 +++ wwwconfig-common-0.0.34.2/mysql.get 2004-02-04 17:36:09.000000000 +0100 @@ -12,10 +12,10 @@ # $dbadmpass - the administrator password. # Sets: $mysqlcmd so that administration access are prepared -if [ -z "$dbserver" ] ; then +if [ -z "$dbserver" ] || [ "$dbserver" = "localhost" ]; then + hostopt="" dbserver=localhost -fi -if [ "$dbserver" != "localhost" ] ; then +else hostopt="-h '$dbserver'" fi if [ -z "$dbadmpass" ] ; then -- System Information: Debian Release: testing/unstable Architecture: i386 Kernel: Linux frodo 2.6.0 #1 Sun Feb 1 17:50:42 CET 2004 i686 Locale: LANG=nl_NL@euro, LC_CTYPE=nl_NL@euro -- no debconf information wwwconfig-common-0.3.0/patches/bug-203435-mysql-creatdb.sh.author0000644000000000000000000000005411173250440021240 0ustar Thomas Poindessous wwwconfig-common-0.3.0/patches/bug-203435-mysql-creatdb.sh.diff0000644000000000000000000000263411173250440020654 0ustar --- mysql-createdb.sh 2003-08-15 21:56:14.000000000 +0200 +++ /usr/share/wwwconfig-common/mysql-createdb.sh 2003-08-19 23:51:13.000000000 +0200 @@ -35,19 +35,19 @@ elif [ ! -x $(which mysql) ] ; then error="No mysql client to execute, install the mysql client package and run 'dpkg-reconfigure -plow packagename'." -elif ! $mysqlcmd -f mysql -e "show tables;" >/dev/null 2>&1 ; then +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 - if $mysqlcmd -f -B -e "show databases;" | grep -e "^$dbname$" > /dev/null 2>&1 ; then + 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 $mysqlcmd -f -e "CREATE DATABASE $dbname;" ; then - if ! $mysqlcmd -f -B -e "show databases;" | grep -e "^$dbname$" > /dev/null 2>&1 ; then + 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 wwwconfig-common-0.3.0/patches/bug-205585-mysql-createdb.sh.patch0000644000000000000000000000161311173250440021214 0ustar --- /usr/share/wwwconfig-common/mysql-createdb.sh 2003-08-04 14:47:53.000000000 +0200 +++ mysql-createdb.sh 2003-08-15 16:01:48.000000000 +0200 @@ -39,13 +39,13 @@ if the password was incorrect. use: dpkg-reconfigure -plow packagename to reconfigure." else - if $mysqlcmd -f -e "show databases;" | grep -e "^$dbname" > /dev/null 2>&1 ; then + if $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 $mysqlcmd -f -e "CREATE DATABASE $dbname;" ; then - if ! $mysqlcmd -f -e "show databases;" | grep -e "^$dbname" > /dev/null 2>&1 ; then + if ! $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 wwwconfig-common-0.3.0/patches/bug-116604.patch0000644000000000000000000021473111173250440015671 0ustar diff -N -u -r wwwconfig-common-0.0.10/apache-addtype_all.sh wwwconfig-common-0.0.10-luca/apache-addtype_all.sh --- wwwconfig-common-0.0.10/apache-addtype_all.sh Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/apache-addtype_all.sh Sat Oct 20 18:51:58 2001 @@ -12,37 +12,36 @@ status=error if [ -z "$typestr" ] ; then - echo "No type to add." + error="No type to add." elif [ -z "$server" ] ; then - echo "No apache server defined." + error="No apache server defined." elif [ -z "$extension" ] ; then - echo "No extension to add with $typestr." + error="No extension to add with $typestr." elif [ -f $phpini ] ; then A=${extension#.} - if grep -e "^[[:space:]]*AddType[[:space:]][[:space:]]*$typestr[[:space:]][[:space:]]*.*\.$A\b" /etc/$server/*.conf > /dev/null 2>&1 ; then - status=nothing - elif grep -e "^[[:space:]]*AddType[[:space:]][[:space:]]*$typestr[[:space:]][[:space:]]*" /etc/$server/*.conf > /dev/null 2>&1 ; then - for conffile in /etc/$server/*.conf ; do - if grep -e "^[[:space:]]*AddType[[:space:]][[:space:]]*$typestr[[:space:]][[:space:]]*" $conffile > /dev/null 2>&1 ; then - echo "Adding extension $extension to AddType $typestr line in $conffile." - cat $conffile | sed -e "s#^\( *AddType *$typestr\b.*\)#\1 $extension#;" > $conffile.new - status=added - mv $conffile.new $conffile - fi - done - elif grep -e "^[[:space:]]*#[[:space:]]*AddType[[:space:]][[:space:]]*$typestr[[:space:]][[: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:]][[:space:]]*$typestr[[:space:]][[:space:]]*.*\.$A\b" $conffile > /dev/null 2>&1 ; then - echo "Uncommenting AddType $typestr line in $conffile." - cat $conffile | sed -e "s#^\( *\)\\#\( *AddType *$typestr\b.*\.$A\b.*\)#\1\2#;" > $conffile.new - status=uncommented - mv $conffile.new $conffile - fi - done + 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.\n" + 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.\n" + 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 - echo "Type file not found for extension $extension, adding a line to httpd.conf." - echo "" >> /etc/$server/httpd.conf - echo "AddType $typestr $extension" >> /etc/$server/httpd.conf - status="lineadded" + log="${log}Type file not found for extension $extension, adding a line to httpd.conf.]n" + echo -e "\nAddType $typestr $extension" >> /etc/$server/httpd.conf + status="lineadded" fi fi diff -N -u -r wwwconfig-common-0.0.10/apache-cominclude.sh wwwconfig-common-0.0.10-luca/apache-cominclude.sh --- wwwconfig-common-0.0.10/apache-cominclude.sh Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/apache-cominclude.sh Sat Oct 20 18:52:27 2001 @@ -9,19 +9,19 @@ status=error if [ -z "$conffile" ] ; then - echo "No config file specified in apache-cominclude.sh" + error="No config file specified in apache-cominclude.sh" elif [ -z "$includefile" ] ; then - echo "No include file specified in apache-cominclude.sh" + error="No include file specified in apache-cominclude.sh" elif [ ! -f $conffile ] ; then - echo "File $conffile not found!" + error="File $conffile not found!" elif [ ! -f $includefile ] ; then - echo "File $includefile not found!" + error="File $includefile not found!" else - status=nothing - if grep -e "^[[:space:]]*Include[[:space:]][[:space:]]*$includefile\b" $conffile > /dev/null 2>&1; then - echo "Commenting import for $includefile in $conffile." - status=comment - cat $conffile | /bin/sed -e "s#^\( *\)\(Include *$includefile\b\)#\1\#\2#" > $conffile.new - mv $conffile.new $conffile - fi + status=nothing + if grep -e "^[[:space:]]*Include[[:space:]]\+$includefile\b" $conffile > /dev/null 2>&1; then + log="${log}Commenting import for $includefile in $conffile.\n" + status=comment + sed -e "s#^\( *\)\(Include *$includefile\b\)#\1\#\2#" < $conffile > $conffile.new + mv $conffile.new $conffile + fi fi diff -N -u -r wwwconfig-common-0.0.10/apache-cominclude_all.sh wwwconfig-common-0.0.10-luca/apache-cominclude_all.sh --- wwwconfig-common-0.0.10/apache-cominclude_all.sh Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/apache-cominclude_all.sh Sat Oct 20 18:52:20 2001 @@ -11,14 +11,14 @@ status=error if [ -z "$includefile" ] ; then - echo "No include file specified for apache-cominclude_all.sh" + error="No include file specified for apache-cominclude_all.sh" else - status=nothing - if grep -e "^[[:space:]]*Include[[:space:]][[:space:]]*$includefile\b" /etc/$server/*.conf > /dev/null 2>&1; then - echo "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 + 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.\n" + for conffile in /etc/$server/*.conf; do + . /usr/share/wwwconfig-common/apache-cominclude.sh + done + status=comment + fi fi diff -N -u -r wwwconfig-common-0.0.10/apache-include.sh wwwconfig-common-0.0.10-luca/apache-include.sh --- wwwconfig-common-0.0.10/apache-include.sh Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/apache-include.sh Sat Oct 20 19:10:16 2001 @@ -12,22 +12,21 @@ status=error if [ -z "$conffile" ] ; then - echo "No config file specified in apache-include.sh" + error="No config file specified in apache-include.sh" elif [ -z "$includefile" ] ; then - echo "No include file specified in apache-include.sh" + error="No include file specified in apache-include.sh" elif [ ! -f $conffile ] ; then - echo "File $conffile not found!" + error="File $conffile not found!" elif [ ! -f $includefile ] ; then - echo "File $includefile not found!" + error="File $includefile not found!" else - status=nothing - . /usr/share/wwwconfig-common/apache-uncominclude.sh - if [ "$status" = "nothing" ] ; then - if ! grep -e "Include[[:space:]][[:space:]]*$includefile\b" $conffile > /dev/null 2>&1; then - status=include - echo "Including $includefile in $conffile." - echo "" >> $conffile - echo "Include $includefile" >> $conffile + 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.\n" + echo -e "\nInclude $includefile" >> $conffile + fi fi - fi fi diff -N -u -r wwwconfig-common-0.0.10/apache-include_all.sh wwwconfig-common-0.0.10-luca/apache-include_all.sh --- wwwconfig-common-0.0.10/apache-include_all.sh Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/apache-include_all.sh Sat Oct 20 19:02:26 2001 @@ -15,24 +15,24 @@ status=error if [ -z "$includefile" ] ; then - echo "No include file specified for apache-include_all.sh." + error="No include file specified for apache-include_all.sh." elif [ ! -f $includefile ] ; then - echo "Includefile $includefile not found in apache-include_all.sh." + error="Includefile $includefile not found in apache-include_all.sh." else - status=nothing - if grep -e "Include[[:space:]][[:space:]]*$includefile" /etc/$server/*.conf > /dev/null 2>&1; then - lstatus=nothing - echo "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 + 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.\n" + 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 diff -N -u -r wwwconfig-common-0.0.10/apache-index.sh wwwconfig-common-0.0.10-luca/apache-index.sh --- wwwconfig-common-0.0.10/apache-index.sh Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/apache-index.sh Sat Oct 20 19:22:11 2001 @@ -10,30 +10,28 @@ status=error if [ -z "$index" ] ; then - echo "No index specified in apache-index.sh." + error="No index specified in apache-index.sh." elif [ -z "$conffile" ] ; then - echo "No config file specified in apache-index.sh." + error="No config file specified in apache-index.sh." elif [ ! -f $conffile ] ; then - echo "Config file $conffile not found from apache-index.sh." + 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 - echo "$index settings in $conffile found!" - status=found - else - /bin/sed -e "s#\(DirectoryIndex.*\bindex.html\b\)#\1 $index#" \ - $conffile > $conffile.new - if grep -e "DirectoryIndex.*[[:space:]][[:space:]]*$index\b" \ - $conffile.new > /dev/null 2>&1; then - echo "$index index settings in $conffile added!" - mv $conffile.new $conffile - status=added - else - echo "Error when adding $index index settings in $conffile!" - rm $conffile.new - fi + 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!\n" + 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!\n" + mv $conffile.new $conffile + status=added + else + error="Error when adding $index index settings in $conffile!" + rm $conffile.new + fi + fi fi - fi fi diff -N -u -r wwwconfig-common-0.0.10/apache-index_all.sh wwwconfig-common-0.0.10-luca/apache-index_all.sh --- wwwconfig-common-0.0.10/apache-index_all.sh Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/apache-index_all.sh Sat Oct 20 19:15:09 2001 @@ -11,19 +11,19 @@ lstatus=error if [ -z "$index" ] ; then - echo "No index specified in apache-index_all.sh." + error="No index specified in apache-index_all.sh." elif [ -z "$server" ] ; then - echo "No server specified in apache-index_all.sh." + error=echo "No server specified in apache-index_all.sh." 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 + 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 diff -N -u -r wwwconfig-common-0.0.10/apache-php.sh wwwconfig-common-0.0.10-luca/apache-php.sh --- wwwconfig-common-0.0.10/apache-php.sh Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/apache-php.sh Sat Oct 20 19:27:24 2001 @@ -11,25 +11,25 @@ status=error if [ -z "$phpver" ] ; then - echo "No php version to check for." + error="No php version to check for." elif [ -z "$phpini" ] ; then - echo "No php ini file to check for." + error="No php ini file to check for." elif [ ! -f $phpini ] ; then - echo "Php config file $phpini not found." + error="Php config file $phpini not found." else - phpverm=$phpver"_module" - if grep -e "^[[:space:]]*#[[:space:]]*LoadModule[[:space:]][[:space:]]*$phpverm" /etc/$server/httpd.conf > /dev/null 2>&1; then - # Uncommenting - /bin/sed -e "s#\( *\)\# *\(LoadModule $phpverm\)#\1\2#" /etc/$server/httpd.conf > /etc/$server/httpd.conf.tmp - status=uncomment - if grep -e "^[[:space:]]*LoadModule[[:space:]][[:space:]]*$phpverm" /etc/$server/httpd.conf.tmp >/dev/null 2>&1; then - # Uncomment successful. - cp /etc/$server/httpd.conf /etc/$server/httpd.conf.back >/dev/null 2>&1 - mv /etc/$server/httpd.conf.tmp /etc/$server/httpd.conf - else - # Uncomment unsuccessful. - status=error - rm /etc/$server/httpd.conf.tmp + phpverm=$phpver"_module" + if grep -e "^[[:space:]]*#[[:space:]]*LoadModule[[:space:]]\+$phpverm" /etc/$server/httpd.conf > /dev/null 2>&1; then + # Uncommenting + sed -e "s#\([[:space:]]*\)\#[[:space:]]\+\(LoadModule $phpverm\)#\1\2#" /etc/$server/httpd.conf > /etc/$server/httpd.conf.tmp + status=uncomment + if grep -e "^[[:space:]]*LoadModule[[:space:]]\+$phpverm" /etc/$server/httpd.conf.tmp >/dev/null 2>&1; then + # Uncomment successful. + cp /etc/$server/httpd.conf /etc/$server/httpd.conf.back >/dev/null 2>&1 + mv /etc/$server/httpd.conf.tmp /etc/$server/httpd.conf + else + # Uncomment unsuccessful. + status=error + rm /etc/$server/httpd.conf.tmp + fi fi - fi fi diff -N -u -r wwwconfig-common-0.0.10/apache-run.get wwwconfig-common-0.0.10-luca/apache-run.get --- wwwconfig-common-0.0.10/apache-run.get Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/apache-run.get Sat Oct 20 20:44:46 2001 @@ -6,9 +6,12 @@ # anything that matches /etc/$server/*.conf. # Description: Sets the webuser and webgroup that apache runs as. -. /usr/share/wwwconfig-common/apache.func - -getwwwoption User /etc/$server/httpd.conf -webuser=$getwwwoption -getwwwoption Group /etc/$server/httpd.conf -webgroup=$getwwwoption +if [ -z "$apache_run_get" ] ; then + . /usr/share/wwwconfig-common/apache.func + + getwwwoption User /etc/$server/httpd.conf + webuser=$getwwwoption + getwwwoption Group /etc/$server/httpd.conf + webgroup=$getwwwoption + apache_run_get="done" +fi diff -N -u -r wwwconfig-common-0.0.10/apache-uncominclude.sh wwwconfig-common-0.0.10-luca/apache-uncominclude.sh --- wwwconfig-common-0.0.10/apache-uncominclude.sh Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/apache-uncominclude.sh Sat Oct 20 19:32:50 2001 @@ -9,19 +9,19 @@ status=error if [ -z "$conffile" ] ; then - echo "No config file specified in apache-uncominclude.sh" + error="No config file specified in apache-uncominclude.sh" elif [ -z "$includefile" ] ; then - echo "No include file specified in apache-uncominclude.sh" + error="No include file specified in apache-uncominclude.sh" elif [ ! -f $conffile ] ; then - echo "File $conffile not found!" + error="File $conffile not found!" elif [ ! -f $includefile ] ; then - echo "File $includefile not found!" + error="File $includefile not found!" else - status=nothing - if grep -e "^[[:space:]]*#[[:space:]]*Include[[:space:]][[:space:]]*$includefile\b" $conffile > /dev/null 2>&1; then - echo "Uncommenting import for $includefile in $conffile" - status=uncomment - cat $conffile | /bin/sed -e "s#^\(\ *\)\# *\(Include *$includefile\b\)#\1\2#" > $conffile.new - mv $conffile.new $conffile - fi + 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\n" + status=uncomment + sed -e "s#^\(\[[:space:]]*\)\#[[:space:]]*\(Include[[:space:]]*$includefile\b\)#\1\2#" < $conffile > $conffile.new + mv $conffile.new $conffile + fi fi diff -N -u -r wwwconfig-common-0.0.10/apache-uninclude.sh wwwconfig-common-0.0.10-luca/apache-uninclude.sh --- wwwconfig-common-0.0.10/apache-uninclude.sh Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/apache-uninclude.sh Sat Oct 20 19:39:10 2001 @@ -9,18 +9,18 @@ status=error if [ -z "$conffile" ] ; then - echo "No config file specified for apache-uninclude.sh" + error="No config file specified for apache-uninclude.sh" elif [ -z "$includefile" ] ; then - echo "No include file specified for apache-uninclude.sh" + error="No include file specified for apache-uninclude.sh" elif [ ! -f $conffile ] ; then - echo "File $conffile not found!" + error="File $conffile not found!" else - status=nothing - GREP="Include[[:space:]][[:space:]]*$includefile\b" - if grep -e "$GREP" $conffile > /dev/null 2>&1; then - echo "Include of $includefile found in $conffile file, purging." - status=purge - cat $conffile | grep -v -e "$GREP" > $conffile.purg - mv $conffile.purg $conffile - fi + 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.\n" + status=purge + grep -v -e "$GREP" < $conffile > $conffile.purg + mv $conffile.purg $conffile + fi fi diff -N -u -r wwwconfig-common-0.0.10/apache-uninclude_all.sh wwwconfig-common-0.0.10-luca/apache-uninclude_all.sh --- wwwconfig-common-0.0.10/apache-uninclude_all.sh Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/apache-uninclude_all.sh Sat Oct 20 19:35:50 2001 @@ -11,14 +11,14 @@ status=error if [ -z "$includefile" ] ; then - echo "No include file specified for apache-uninclude_all.sh" + error="No include file specified for apache-uninclude_all.sh" else - status=nothing - if grep -e "Include[[:space:]][[:space:]]*$includefile\b" /etc/$server/*.conf > /dev/null 2>&1; then - echo "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 + 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.\n" + for conffile in /etc/$server/*.conf; do + . /usr/share/wwwconfig-common/apache-uninclude.sh + done + status=purge + fi fi diff -N -u -r wwwconfig-common-0.0.10/apache.func wwwconfig-common-0.0.10-luca/apache.func --- wwwconfig-common-0.0.10/apache.func Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/apache.func Sat Oct 20 18:57:43 2001 @@ -15,12 +15,10 @@ # 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=$(grep -e "^[[:space:]]*$1[[:space:]][[:space:]]*" $2 | grep -v "#") - getwwwoption=$(echo "$getwwwoption" | sed -e "s|[[:space:]]*$1[[:space:]][[:space:]]*||g;") - getwwwoption=$(echo $getwwwoption) - fi - fi + 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:]]\+||pg;" < $2) + fi + fi } diff -N -u -r wwwconfig-common-0.0.10/autopatch.sh wwwconfig-common-0.0.10-luca/autopatch.sh --- wwwconfig-common-0.0.10/autopatch.sh Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/autopatch.sh Sat Oct 20 19:46:27 2001 @@ -8,11 +8,11 @@ status=error if [ -z "$1" ] ; then - echo "No patch file [arg 1] specified." + echo "No patch file [arg 1] specified." elif [ ! -f $1 ] ; then - echo "Can not find patch file $1." + echo "Can not find patch file $1." else - status=patch - echo "Autopatching horde, using $1." - patch -p0 -i $1 + status=patch + echo "Autopatching horde, using $1." + patch -p0 -i $1 fi diff -N -u -r wwwconfig-common-0.0.10/autopatch_all.sh wwwconfig-common-0.0.10-luca/autopatch_all.sh --- wwwconfig-common-0.0.10/autopatch_all.sh Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/autopatch_all.sh Sat Oct 20 19:44:59 2001 @@ -8,13 +8,15 @@ status=error if [ -z "$patchdir" ] ; then - echo "No patch directory specified." + error="No patch directory specified." else - status=nothing - if [ -d $patchdir ] ; then - WWD=$PWD - cd / - find $patchdir -name "*.patch" -exec /usr/share/wwwconfig-common/autopatch.sh {} \; - cd $WWD - fi + 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 diff -N -u -r wwwconfig-common-0.0.10/exim-trust.sh wwwconfig-common-0.0.10-luca/exim-trust.sh --- wwwconfig-common-0.0.10/exim-trust.sh Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/exim-trust.sh Sat Oct 20 19:50:08 2001 @@ -8,23 +8,22 @@ status=error if [ -e /etc/exim.conf ]; then - status=nothing - if grep -e "trusted_users.*\b$trustuser\b" /etc/exim.conf >/dev/null 2>&1; then - echo "The user $trustuser is already trusted by Exim" - elif grep -e "trusted_users.*=" /etc/exim.conf >/dev/null 2>&1; then - status=trust - echo "Modifying /etc/exim.conf to add $trustuser as a trusted user."; - /bin/sed -e "s#\(trusted_users *=.*\)#\1:$trustuser#" \ - /etc/exim.conf > /etc/exim.conf.tmp - cp /etc/exim.conf /etc/exim.conf.bak >/dev/null 2>&1 - if grep -e "trusted_users *=.*\b$trustuser\b" /etc/exim.conf.tmp >/dev/null 2>&1; then - mv /etc/exim.conf.tmp /etc/exim.conf >/dev/null 2>&1; + status=nothing + if grep -e "trusted_users.*\b$trustuser\b" /etc/exim.conf >/dev/null 2>&1; then + log="${log}The user $trustuser is already trusted by Exim.\n" + elif grep -e "trusted_users.*=" /etc/exim.conf >/dev/null 2>&1; then + status=trust + log="${log}Modifying /etc/exim.conf to add $trustuser as a trusted user.\n" + sed -e "s#\(trusted_users[[:space:]]*=.*\)#\1:$trustuser#" < /etc/exim.conf > /etc/exim.conf.tmp + cp /etc/exim.conf /etc/exim.conf.bak >/dev/null 2>&1 + if grep -e "trusted_users[[:space:]]*=.*\b$trustuser\b" /etc/exim.conf.tmp >/dev/null 2>&1; then + mv /etc/exim.conf.tmp /etc/exim.conf >/dev/null 2>&1; + else + error="The script failed while adding $trustuser to the trusted users in Exim." + status=error + rm -f /etc/exim.conf.tmp + fi else - echo "The script failed while adding $trustuser to the trusted users in Exim." - status=error - rm -f /etc/exim.conf.tmp + error="No trusted user line in exim, you have to add that line manually." fi - else - echo "No trusted user line in exim, you have to add that line manually." - fi fi diff -N -u -r wwwconfig-common-0.0.10/mysql-createdb.sh wwwconfig-common-0.0.10-luca/mysql-createdb.sh --- wwwconfig-common-0.0.10/mysql-createdb.sh Fri Aug 31 08:26:16 2001 +++ wwwconfig-common-0.0.10-luca/mysql-createdb.sh Sun Oct 21 13:09:20 2001 @@ -17,36 +17,35 @@ . /usr/share/wwwconfig-common/mysql.get if [ -z "$dbname" ] ; then - echo "No database name specified. Have to know the name to create it." + error="No database name specified. Have to know the name to create it." elif [ -z "$dbserver" ] ; then - echo "No database server specified." + error="No database server specified." elif [ -z "$dbadmin" ] ; then - echo "No database administrator specified." + error="No database administrator specified." elif [ -z "$dbadmpass" ] ; then - echo "No database ($dbadmin) administrator password specified." + error="No database ($dbadmin) administrator password specified." elif [ ! -x $(which mysql) ] ; then - echo "No mysql client to execute, install the mysql client package and" - echo "run 'dpkg-reconfigure -plow packagename'." + error="No mysql client to execute, install the mysql client package and\n + run 'dpkg-reconfigure -plow packagename'." elif ! $mysqlcmd -f mysql -e "show tables;" >/dev/null 2>&1 ; then - echo "Error when trying to connect to the mysql database." - echo "This error can occur if you have no database to connect to, or" - echo "if the password was incorrect." - echo "use: dpkg-reconfigure -plow packagename to reconfigure." + error="Error when trying to connect to the mysql database.\n + This error can occur if you have no database to connect to, or\n + if the password was incorrect.\n + use: dpkg-reconfigure -plow packagename to reconfigure." else - if $mysqlcmd -f -e "show databases;" | grep -e "^$dbname" > /dev/null 2>&1 ; then - echo "Database $dbname already exists." - status=nothing - else - echo "Creating database $dbname." - status=create - if $mysqlcmd -f -e "CREATE DATABASE $dbname;" ; then - if ! $mysqlcmd -f -e "show databases;" | grep -e "^$dbname" > /dev/null 2>&1 ; then - echo "Database user $dbuser NOT successfully created. You have to do it manually." - status=error - fi + if $mysqlcmd -f -e "show databases;" | grep -e "^$dbname" > /dev/null 2>&1 ; then + log="${log}Database $dbname already exists.\n" + status=nothing else - status=error - echo "Unable to run the create user script." + log="${log}Creating database $dbname.\n" + if $mysqlcmd -f -e "CREATE DATABASE $dbname;" ; then + if ! $mysqlcmd -f -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 fi diff -N -u -r wwwconfig-common-0.0.10/mysql-createuser.sh wwwconfig-common-0.0.10-luca/mysql-createuser.sh --- wwwconfig-common-0.0.10/mysql-createuser.sh Fri Aug 31 08:26:16 2001 +++ wwwconfig-common-0.0.10-luca/mysql-createuser.sh Sat Oct 20 19:57:35 2001 @@ -21,68 +21,68 @@ . /usr/share/wwwconfig-common/mysql.get if [ -z "$dbuser" ] ; then - echo "No database user specified. Can not create it if it does not exist." + error="No database user specified. Can not create it if it does not exist." elif [ -z "$dbserver" ] ; then - echo "No database server specified." + error="No database server specified." elif [ -z "$dbadmin" ] ; then - echo "No database administrator specified." + error="No database administrator specified." elif [ -z "$dbadmpass" ] ; then - echo "No database ($dbadmin) administrator password specified." + error="No database ($dbadmin) administrator password specified." elif [ ! -x $(which mysql) ] ; then - echo "No mysql client to execute, install the mysql client package and" - echo "run 'dpkg-reconfigure -plow packagename'." + echo "No mysql client to execute, install the mysql client package and\n + run 'dpkg-reconfigure -plow packagename'." elif ! $mysqlcmd -f mysql -e "show tables;" >/dev/null 2>&1 ; then - echo "Error when trying to connect to the mysql database." - echo "This error can occur if you have no database to connect to, or" - echo "if the password was incorrect." - echo "use: dpkg-reconfigure -plow packagename to reconfigure." + error="Error when trying to connect to the mysql database.\n + This error can occur if you have no database to connect to, or\n + if the password was incorrect.\n + use: dpkg-reconfigure -plow packagename to reconfigure." else - echo "Creating or resetting database user ($dbuser)." - if $mysqlcmd -f mysql -e " + log="${log}Creating or resetting database user ($dbuser).\n" + if $mysqlcmd -f mysql -e " CONNECT mysql; REPLACE INTO user ( host, user, password ) VALUES ( - '$dballow', - '$dbuser', - password( '$dbpass' ) + '$dballow', + '$dbuser', + password( '$dbpass' ) ); REPLACE INTO user ( host, user, password ) VALUES ( - 'localhost', - '$dbuser', - password( '$dbpass' ) + 'localhost', + '$dbuser', + password( '$dbpass' ) ); REPLACE INTO db ( host, db, user, select_priv, insert_priv, update_priv, delete_priv, create_priv, drop_priv ) VALUES ( - '$dballow', - '$dbname', - '$dbuser', - 'Y', 'Y', 'Y', 'Y', - 'Y', 'Y' + '$dballow', + '$dbname', + '$dbuser', + 'Y', 'Y', 'Y', 'Y', + 'Y', 'Y' ); REPLACE INTO db ( host, db, user, select_priv, insert_priv, update_priv, delete_priv, create_priv, drop_priv ) VALUES ( - 'localhost', - '$dbname', - '$dbuser', - 'Y', 'Y', 'Y', 'Y', - 'Y', 'Y' + 'localhost', + '$dbname', + '$dbuser', + 'Y', 'Y', 'Y', 'Y', + 'Y', 'Y' ); flush privileges; " > /dev/null 2>&1 ; then - if ! $mysqlcmd -f mysql -e "select User from user;" | grep $dbuser >/dev/null 2>&1 ; then - echo "Database user $dbuser NOT successfully added. You have to do it manually." + if ! $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." + fi + else + error="Unable to run the create user script." fi - else - echo "Unable to run the create user script." - fi fi diff -N -u -r wwwconfig-common-0.0.10/mysql-dropdb.sh wwwconfig-common-0.0.10-luca/mysql-dropdb.sh --- wwwconfig-common-0.0.10/mysql-dropdb.sh Thu Jan 1 01:00:00 1970 +++ wwwconfig-common-0.0.10-luca/mysql-dropdb.sh Sun Oct 21 13:30:37 2001 @@ -0,0 +1,51 @@ +#!/bin/sh +# File: mysql-createdb.sh +# Author: Ola Lundqvist +# Date: 20010224 +# 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} + +status=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 "$dbadmpass" ] ; then + error="No database ($dbadmin) administrator password specified." +elif [ ! -x $(which mysql) ] ; then + error="No mysql client to execute, install the mysql client package and\n + run 'dpkg-reconfigure -plow packagename'." +elif ! $mysqlcmd -f mysql -e "show tables;" >/dev/null 2>&1 ; then + error="Error when trying to connect to the mysql database.\n + This error can occur if you have no database to connect to, or\n + if the password was incorrect.\n + use: dpkg-reconfigure -plow packagename to reconfigure." +else + if $mysqlcmd -f -e "show databases;" | grep -e "^$dbname" > /dev/null 2>&1 ; then + log="${log}Droping database $dbname.\n" + if $mysqlcmd -f -e "DROP DATABASE $dbname;" ; then + if $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.\n" + fi +fi diff -N -u -r wwwconfig-common-0.0.10/mysql-dropuser.sh wwwconfig-common-0.0.10-luca/mysql-dropuser.sh --- wwwconfig-common-0.0.10/mysql-dropuser.sh Thu Jan 1 01:00:00 1970 +++ wwwconfig-common-0.0.10-luca/mysql-dropuser.sh Sun Oct 21 14:02:09 2001 @@ -0,0 +1,66 @@ +#!/bin/sh +# File: mysql-createuser.sh +# Author: Luca - De Whiskey's - De Vitis +# Date: 20010224 +# 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 } + +dballow=${dballow:-%} + +status=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 "$dbadmpass" ] ; then + error="No database ($dbadmin) administrator password specified." +elif [ ! -x $(which mysql) ] ; then + echo "No mysql client to execute, install the mysql client package and\n + run 'dpkg-reconfigure -plow packagename'." +elif ! $mysqlcmd -f mysql -e "show tables;" >/dev/null 2>&1 ; then + error="Error when trying to connect to the mysql database.\n + This error can occur if you have no database to connect to, or\n + if the password was incorrect.\n + use: dpkg-reconfigure -plow packagename to reconfigure." +else + log="${log}Droping database user $dbuser.\n" + if $mysqlcmd -f mysql -e "select User from user;" | grep $dbuser >/dev/null 2>&1 ; then + if $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 $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.\n" + fi +fi diff -N -u -r wwwconfig-common-0.0.10/mysql-exec.sh wwwconfig-common-0.0.10-luca/mysql-exec.sh --- wwwconfig-common-0.0.10/mysql-exec.sh Fri Aug 31 08:26:16 2001 +++ wwwconfig-common-0.0.10-luca/mysql-exec.sh Sat Oct 20 19:59:05 2001 @@ -17,24 +17,24 @@ . /usr/share/wwwconfig-common/mysql.get if [ -z "$dbserver" ] ; then - echo "No database server specified." + error="No database server specified." elif [ -z "$dbadmin" ] ; then - echo "No database administrator specified." + error="No database administrator specified." elif [ -z "$dbadmpass" ] ; then - echo "No database ($dbadmin) administrator password specified." + error="No database ($dbadmin) administrator password specified." elif [ ! -x $(which mysql) ] ; then - echo "No mysql client to execute, install the mysql client package and" - echo "run 'dpkg-reconfigure -plow packagename'." + error="No mysql client to execute, install the mysql client package and\n + run 'dpkg-reconfigure -plow packagename'." elif ! $mysqlcmd -f mysql -e "show tables;" >/dev/null 2>&1 ; then - echo "Error when trying to connect to the mysql database." - echo "This error can occur if you have no database to connect to, or" - echo "if the password was incorrect." - echo "use: dpkg-reconfigure -plow packagename to reconfigure." + error="Error when trying to connect to the mysql database.\n + This error can occur if you have no database to connect to, or\n + if the password was incorrect.\n + use: dpkg-reconfigure -plow packagename to reconfigure." else - echo "Executing command to mysql." - if $mysqlcmd -f $dbname < $sqlfile > /dev/null 2>&1 ; then - status=exec - else - echo "Unable to run the sql script ($sqlfile)." - fi + log="${log}Executing command to mysql.\n" + if $mysqlcmd -f $dbname < $sqlfile > /dev/null 2>&1 ; then + status=exec + else + error="Unable to run the sql script ($sqlfile)." + fi fi diff -N -u -r wwwconfig-common-0.0.10/mysql-if-exec.sh wwwconfig-common-0.0.10-luca/mysql-if-exec.sh --- wwwconfig-common-0.0.10/mysql-if-exec.sh Fri Aug 31 08:26:16 2001 +++ wwwconfig-common-0.0.10-luca/mysql-if-exec.sh Sat Oct 20 20:05:36 2001 @@ -19,32 +19,32 @@ . /usr/share/wwwconfig-common/mysql.get if [ -z "$dbserver" ] ; then - echo "No database server specified." + error="No database server specified." elif [ -z "$dbadmin" ] ; then - echo "No database administrator specified." + error="No database administrator specified." elif [ -z "$dbadmpass" ] ; then - echo "No database ($dbadmin) administrator password specified." + error="No database ($dbadmin) administrator password specified." elif [ -z "$statement" ] ; then - echo "No statement to test for." + error="No statement to test for." elif [ -z "$sqlfile" ] ; then - echo "No sqlfile to execute." + error="No sqlfile to execute." elif [ ! -e "$sqlfile" ] ; then - echo "Sqlfile $sqlfile not found." + error="Sqlfile $sqlfile not found." elif [ ! -x $(which mysql) ] ; then - echo "No mysql client to execute, install the mysql client package and" - echo "run 'dpkg-reconfigure -plow packagename'." + error="No mysql client to execute, install the mysql client package and\n + run 'dpkg-reconfigure -plow packagename'." elif ! $mysqlcmd -f mysql -e "show tables;" >/dev/null 2>&1 ; then - echo "Error when trying to connect to the mysql database." - echo "This error can occur if you have no database to connect to, or" - echo "if the password was incorrect." - echo "use: dpkg-reconfigure -plow packagename to reconfigure." + error="Error when trying to connect to the mysql database.\n + This error can occur if you have no database to connect to, or\n + if the password was incorrect.\n + use: dpkg-reconfigure -plow packagename to reconfigure." elif $mysqlcmd -f $dbname -e "$statement" >/dev/null 2>&1 ; then - echo "Executing command to mysql." - if $mysqlcmd -f $dbname < $sqlfile > /dev/null 2>&1 ; then - status=exec - else - echo "Unable to run the sql script ($sqlfile)." - fi + log="${log}Executing command to mysql.\n" + if $mysqlcmd -f $dbname < $sqlfile > /dev/null 2>&1 ; then + status=exec + else + error="Unable to run the sql script ($sqlfile)." + fi else - status=nothing + status=nothing fi diff -N -u -r wwwconfig-common-0.0.10/mysql-ifnot-exec.sh wwwconfig-common-0.0.10-luca/mysql-ifnot-exec.sh --- wwwconfig-common-0.0.10/mysql-ifnot-exec.sh Fri Aug 31 08:26:16 2001 +++ wwwconfig-common-0.0.10-luca/mysql-ifnot-exec.sh Sat Oct 20 20:07:15 2001 @@ -19,32 +19,32 @@ . /usr/share/wwwconfig-common/mysql.get if [ -z "$dbserver" ] ; then - echo "No database server specified." + error="No database server specified." elif [ -z "$dbadmin" ] ; then - echo "No database administrator specified." + error="No database administrator specified." elif [ -z "$dbadmpass" ] ; then - echo "No database ($dbadmin) administrator password specified." + error="No database ($dbadmin) administrator password specified." elif [ -z "$statement" ] ; then - echo "No statement to test for." + error="No statement to test for." elif [ -z "$sqlfile" ] ; then - echo "No sqlfile to execute." + error="No sqlfile to execute." elif [ ! -e "$sqlfile" ] ; then - echo "Sqlfile $sqlfile not found." + error="Sqlfile $sqlfile not found." elif [ ! -x $(which mysql) ] ; then - echo "No mysql client to execute, install the mysql client package and" - echo "run 'dpkg-reconfigure -plow packagename'." + error="No mysql client to execute, install the mysql client package and\n + run 'dpkg-reconfigure -plow packagename'." elif ! $mysqlcmd -f mysql -e "show tables;" >/dev/null 2>&1 ; then - echo "Error when trying to connect to the mysql database." - echo "This error can occur if you have no database to connect to, or" - echo "if the password was incorrect." - echo "use: dpkg-reconfigure -plow packagename to reconfigure." + error="Error when trying to connect to the mysql database.\n + This error can occur if you have no database to connect to, or\n + if the password was incorrect.\n + use: dpkg-reconfigure -plow packagename to reconfigure." elif ! $mysqlcmd -f $dbname -e "$statement" >/dev/null 2>&1 ; then - echo "Executing command to mysql." - if $mysqlcmd -f $dbname < $sqlfile > /dev/null 2>&1 ; then - status=exec - else - echo "Unable to run the sql script ($sqlfile)." - fi + log="${log}Executing command to mysql.\n" + if $mysqlcmd -f $dbname < $sqlfile > /dev/null 2>&1 ; then + status=exec + else + error="Unable to run the sql script ($sqlfile)." + fi else - status=nothing + status=nothing fi diff -N -u -r wwwconfig-common-0.0.10/mysql-localadmpass.get wwwconfig-common-0.0.10-luca/mysql-localadmpass.get --- wwwconfig-common-0.0.10/mysql-localadmpass.get Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/mysql-localadmpass.get Sat Oct 20 20:47:57 2001 @@ -8,19 +8,22 @@ # $dbadmin = a username (if found) # $status = {error, noadminsel, get} -. /usr/share/wwwconfig-common/mysql.func - -userpass="" -status=error -for A in /etc/mysql/my.cnf /var/lib/mysql/my.cnf ~/.my.cnf ; do - if [ -f $A ] ; then - getmysqlopt mysqladmin user $A - if [ ! -z "$getmysqlopt" ] ; then - dbadmin=$getmysqlopt - fi - getmysqlopt mysqladmin password $A - if [ ! -z "$getmysqlopt" ] ; then - dbadmpass=$getmysqlopt - fi - fi -done +if [ -z "$mysql_localadmpass_get" ] ; then + . /usr/share/wwwconfig-common/mysql.func + + userpass="" + status=error + for A in /etc/mysql/my.cnf /var/lib/mysql/my.cnf ~/.my.cnf ; do + if [ -f $A ] ; then + getmysqlopt mysqladmin user $A + if [ ! -z "$getmysqlopt" ] ; then + dbadmin=$getmysqlopt + fi + getmysqlopt mysqladmin password $A + if [ ! -z "$getmysqlopt" ] ; then + dbadmpass=$getmysqlopt + fi + fi + done + mysql_localadmpass_get="done" +fi diff -N -u -r wwwconfig-common-0.0.10/mysql.get wwwconfig-common-0.0.10-luca/mysql.get --- wwwconfig-common-0.0.10/mysql.get Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/mysql.get Sun Oct 21 13:00:10 2001 @@ -6,15 +6,18 @@ # $dbadmpass - the administrator password. # Sets: $mysqlcmd so that administration access are prepared -if [ -z "$dbserver" ] ; then - dbserver=localhost +if [ -z "$mysql_get" ]; then + if [ -z "$dbserver" ] ; then + dbserver=localhost + fi + if [ "$dbserver" != "localhost" ] ; then + hostopt="-h $dbserver" + fi + if [ -z "$dbadmpass" ] ; then + log="${log}No password used.\n" + else + passopt="--password=$dbadmpass" + fi + mysqlcmd="mysql $hostopt $passopt -u $dbadmin" + mysql_get="done" fi -if [ "$dbserver" != "localhost" ] ; then - hostopt="-h $dbserver" -fi -if [ -z "$dbadmpass" ] ; then - echo "No password used." -else - passopt="--password=$dbadmpass" -fi -mysqlcmd="mysql $hostopt $passopt -u $dbadmin" diff -N -u -r wwwconfig-common-0.0.10/pgsql-allowip.sh wwwconfig-common-0.0.10-luca/pgsql-allowip.sh --- wwwconfig-common-0.0.10/pgsql-allowip.sh Wed Aug 29 18:10:51 2001 +++ wwwconfig-common-0.0.10-luca/pgsql-allowip.sh Sat Oct 20 20:24:02 2001 @@ -9,74 +9,72 @@ 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 - /bin/sed -e \ - 's#\#[[:space:]]*tcpip_socket[[:space:]]*=[[:space:]]*0#tcpip_socket=1#; - s#\#[[:space:]]*tcpip_socket[[:space:]]=[[:space:]]*1#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; - echo "Now restarting postgres to make this take effect." - status=restart - /etc/init.d/postgresql restart || true + # 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.\n" + status=restart + /etc/init.d/postgresql restart || true + log="${log}Waiting for the database to really start.\n" + 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 - else - echo "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' > /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 + if grep -e 'PGALLOWTCPIP' > /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 - 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 diff -N -u -r wwwconfig-common-0.0.10/pgsql-createdb.sh wwwconfig-common-0.0.10-luca/pgsql-createdb.sh --- wwwconfig-common-0.0.10/pgsql-createdb.sh Wed Aug 29 17:11:06 2001 +++ wwwconfig-common-0.0.10-luca/pgsql-createdb.sh Sun Oct 21 11:31:14 2001 @@ -17,35 +17,32 @@ . /usr/share/wwwconfig-common/pgsql.get if [ -z "$dbname" ] ; then - echo "No database name specified. Have to know the name to create it." + error="No database name specified. Have to know the name to create it." elif [ -z "$dbserver" ] ; then - echo "No database server specified." + error="No database server specified." elif [ -z "$dbadmin" ] ; then - echo "No database administrator specified." -#elif [ -z "$dbadmpass" ] ; then -# echo "No database ($dbadmin) administrator password specified." + error="No database administrator specified." elif [ ! -x $(which psql) ] ; then - echo "No pgsql client to execute." -elif ! $pgsqlcmd $systemdb -c "" >/dev/null 2>&1 ; then - echo "Error when trying to connect to the pgsql database." - echo "This error can occur if you have no database to connect to, or" - echo "if the password was incorrect." - echo "use: dpkg-reconfigure -plow packagename to reconfigure." + error="No pgsql client to execute." +elif ! $pgsqlcmd -d $systemdb -c "" >/dev/null 2>&1 ; then + error="Error when trying to connect to the pgsql database.\n + This error can occur if you have no database to connect to, or\n + if the password was incorrect.\n + use: dpkg-reconfigure -plow packagename to reconfigure." else - if $pgsqlcmd $dbname -c "" > /dev/null 2>&1 ; then - echo "Database $dbname already exists." - status=nothing - else - echo "Creating database $dbname." - status=create - if $pgsqlcmd -c "CREATE DATABASE $dbname;" template1 > /dev/null 2>&1 ; then - if ! $pgsqlcmd $dbname -c "" > /dev/null 2>&1 ; then - echo "Database $dbname NOT successfully created. You have to do it manually." - status=error - fi + if $pgsqlcmd -d $dbname -c "" > /dev/null 2>&1 ; then + log="${log}Database $dbname already exists.\n" + status=nothing else - status=error - echo "Unable to run the create database script." + log="${log}Creating database $dbname.\n" + if $pgsqlcmd -c -d $systemdb "CREATE DATABASE $dbname;" > /dev/null 2>&1 ; then + if ! $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 fi diff -N -u -r wwwconfig-common-0.0.10/pgsql-createuser.sh wwwconfig-common-0.0.10-luca/pgsql-createuser.sh --- wwwconfig-common-0.0.10/pgsql-createuser.sh Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/pgsql-createuser.sh Sun Oct 21 11:17:23 2001 @@ -15,57 +15,52 @@ # Sets: $status = {error, nothing, create, changepass} status=error - . /usr/share/wwwconfig-common/pgsql.get #. pgsql.get if [ -z "$dbuser" ] ; then - echo "No database user specified. Can not create it if it does not exist." + error="No database user specified. Can not create it if it does not exist." elif [ -z "$dbserver" ] ; then - echo "No database server specified." + error="No database server specified." elif [ -z "$dbadmin" ] ; then - echo "No database administrator specified." -#elif [ -z "$dbadmpass" ] ; then -# echo "No database ($dbadmin) administrator password specified." + error="No database administrator specified." elif [ ! -x $(which psql) ] ; then - echo "No pgsql client to execute." -elif ! $pgsqlcmd $systemdb -c "select usename from pg_shadow;" >/dev/null 2>&1 ; then - echo "Error when trying to connect to the pgsql database." - echo "This error can occur if you have no database to connect to, or" - echo "if the password was incorrect." - echo "use: dpkg-reconfigure -plow packagename to reconfigure." + error="No pgsql client to execute." +elif ! $pgsqlcmd -d $systemdb -c "SELECT usename FROM pg_shadow;" >/dev/null 2>&1 ; then + error="Error when trying to connect to the pgsql database.\n + This error can occur if you have no database to connect to, or\n + if the password was incorrect.\n + use: dpkg-reconfigure -plow packagename to reconfigure." else - CANCREATE=f - CANADDUSER=f - if $pgsqlcmd $systemdb -c "select usename from pg_shadow;" \ - | grep -e "^[[:space:]]$dbuser" > /dev/null 2>&1 ; then - . /usr/share/wwwconfig-common/pgsql-userpass.get + if [ $($pgsqlcmd -d $systemdb -q -t -A -c "SELECT usename FROM pg_shadow WHERE usename='$dbuser';") = "$dbuser" ] ; then + . /usr/share/wwwconfig-common/pgsql-userpass.get # . pgsql-userpass.get - status=nothing - if [ "$userpass" != "$dbpass" ] ; then -# echo "Need to change user ($dbuser) password." - if $pgsqlcmd $systemdb -c "UPDATE pg_shadow SET passwd='$dbpass' WHERE usename='$dbuser'" > /dev/null 2>&1 ; then - echo "Password changed for pgsql user $dbuser." - status=changepass - fi + status=nothing + if [ "$userpass" != "$dbpass" ] ; then + if $pgsqlcmd -d $systemdb -c " + UPDATE pg_shadow + SET passwd='$dbpass' + WHERE usename='$dbuser'" > /dev/null 2>&1 ; then + log="${log}Password changed for pgsql user $dbuser.\n" + status=changepass + 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 $pgsqlcmd -c " + INSERT INTO pg_shadow + (usename, usesysid, usecreatedb, usetrace, usesuper, usecatupd, passwd) + VALUES + ('$dbuser', $nextsysid, '${dbusercc:-'f'}', 't', '${dbusercau:-'f'}','t','$dbpass') + " > /dev/null 2>&1; then + if [ $($pgsqlcmd -d $systemdb -q -t -A -c "SELECT usename FROM pg_shadow WHERE usename='$dbuser';") = "$dbuser" ] ; then + log="${log}Pgsql user $dbuser created.\n" + status=create + else + status=error + fi + fi fi - else - . /usr/share/wwwconfig-common/pgsql-nextsysid.get -# . pgsql-nextsysid.get - if [ "$status" = "error" ] ; then - echo "Unable to create user $dbuser. Something is wrong with the database." - elif $pgsqlcmd -c " - INSERT INTO pg_shadow - (usename, usesysid, usecreatedb, usetrace, usesuper, usecatupd, passwd) - VALUES - ('$dbuser', $nextsysid, '$CANCREATE', 't', '$CANADDUSER','t','$dbpass') - " > /dev/null 2>&1; then - if $pgsqlcmd $systemdb -c "select usename from pg_shadow;" \ - | grep -e "^[[:space:]]$dbuser" > /dev/null 2>&1 ; then - echo "Pgsql user $dbuser created." - status=create - else - status=error - fi - fi - fi fi diff -N -u -r wwwconfig-common-0.0.10/pgsql-dropdb.sh wwwconfig-common-0.0.10-luca/pgsql-dropdb.sh --- wwwconfig-common-0.0.10/pgsql-dropdb.sh Thu Jan 1 01:00:00 1970 +++ wwwconfig-common-0.0.10-luca/pgsql-dropdb.sh Sun Oct 21 11:30:50 2001 @@ -0,0 +1,48 @@ +#!/bin/sh +# File: pgsql-dropdb.sh +# Author: Luca - De Whiskey's - De Vitis +# Date: 20010224 +# 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} + +status=error + +. /usr/share/wwwconfig-common/pgsql.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 [ ! -x $(which psql) ] ; then + error="No pgsql client to execute." +elif ! $pgsqlcmd -d $systemdb -c "" >/dev/null 2>&1 ; then + error="Error when trying to connect to the pgsql database.\n + This error can occur if you have no database to connect to, or\n + if the password was incorrect.\n + use: dpkg-reconfigure -plow packagename to reconfigure." +else + if $pgsqlcmd -d $dbname -c "" > /dev/null 2>&1 ; then + log="${log}Droping database $dbname.\n" + if $pgsqlcmd -c -d $systemdb "DROP DATABASE $dbname;" > /dev/null 2>&1 ; then + if $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.\n" + status=nothing + fi +fi diff -N -u -r wwwconfig-common-0.0.10/pgsql-dropuser.sh wwwconfig-common-0.0.10-luca/pgsql-dropuser.sh --- wwwconfig-common-0.0.10/pgsql-dropuser.sh Thu Jan 1 01:00:00 1970 +++ wwwconfig-common-0.0.10-luca/pgsql-dropuser.sh Sun Oct 21 11:17:52 2001 @@ -0,0 +1,51 @@ +#!/bin/sh +# File: pgsql-dropuser.sh +# Author: Luca - De Whiskey's - De Vitis +# Date: 20010224 +# 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} + +status=error +. /usr/share/wwwconfig-common/pgsql.get +#. 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 ! $pgsqlcmd -d $systemdb -c "SELECT usename FROM pg_shadow;" >/dev/null 2>&1 ; then + error="Error when trying to connect to the pgsql database.\n + This error can occur if you have no database to connect to, or\n + if the password was incorrect.\n + use: dpkg-reconfigure -plow packagename to reconfigure." +else + if [ $($pgsqlcmd -d $systemdb -q -t -A -c "SELECT usename FROM pg_shadow WHERE usename='$dbuser';") = "$dbuser" ] ; then + if $pgsqlcmd -d $systemdb -c " + DELETE FROM pg_shadow + WHERE usename='$dbuser';" > /dev/null 2>&1 ; then + if [ -z "$($pgsqlcmd -d $systemdb -q -t -A -c "SELECT usename FROM pg_shadow WHERE usename='$dbuser';")" ] ; then + log="${log}User $dbuser droped.\n" + status=drop + else + error="User $dbuser NOT successfully droped. 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.\n" + status=nothing + fi +fi diff -N -u -r wwwconfig-common-0.0.10/pgsql-exec.sh wwwconfig-common-0.0.10-luca/pgsql-exec.sh --- wwwconfig-common-0.0.10/pgsql-exec.sh Fri Aug 31 08:26:16 2001 +++ wwwconfig-common-0.0.10-luca/pgsql-exec.sh Sat Oct 20 20:27:54 2001 @@ -16,24 +16,22 @@ . /usr/share/wwwconfig-common/pgsql.get if [ -z "$dbserver" ] ; then - echo "No database server specified." + error="No database server specified." elif [ -z "$dbadmin" ] ; then - echo "No database administrator specified." -#elif [ -z "$dbadmpass" ] ; then -# echo "No database ($dbadmin) administrator password specified." + error="No database administrator specified." elif [ ! -x $(which pgsql) ] ; then - echo "No pgsql client to execute, install the pgsql client package and" - echo "run 'dpkg-reconfigure -plow packagename'." + error="No pgsql client to execute, install the pgsql client package and\n + run 'dpkg-reconfigure -plow packagename'." elif ! $pgsqlcmd $systemdb -c "select usename from pg_shadow;" >/dev/null 2>&1 ; then - echo "Error when trying to connect to the pgsql database." - echo "This error can occur if you have no database to connect to, or" - echo "if the password was incorrect." - echo "use: dpkg-reconfigure -plow packagename to reconfigure." + error="Error when trying to connect to the pgsql database.\n + This error can occur if you have no database to connect to, or\n + if the password was incorrect.\n + use: dpkg-reconfigure -plow packagename to reconfigure." else - echo "Executing command to pgsql." - if $pgsqlcmd $dbname < $sqlfile > /dev/null 2>&1 ; then - status=exec - else - echo "Unable to run the sql script ($sqlfile)." - fi + log="${log}Executing command to pgsql.\n" + if $pgsqlcmd -d $dbname < $sqlfile > /dev/null 2>&1 ; then + status=exec + else + error="Unable to run the sql script ($sqlfile)." + fi fi diff -N -u -r wwwconfig-common-0.0.10/pgsql-if-exec.sh wwwconfig-common-0.0.10-luca/pgsql-if-exec.sh --- wwwconfig-common-0.0.10/pgsql-if-exec.sh Fri Aug 31 08:26:16 2001 +++ wwwconfig-common-0.0.10-luca/pgsql-if-exec.sh Sat Oct 20 20:30:15 2001 @@ -18,26 +18,24 @@ . /usr/share/wwwconfig-common/pgsql.get if [ -z "$dbserver" ] ; then - echo "No database server specified." + error="No database server specified." elif [ -z "$dbadmin" ] ; then - echo "No database administrator specified." -#elif [ -z "$dbadmpass" ] ; then -# echo "No database ($dbadmin) administrator password specified." + error="No database administrator specified." elif [ ! -x $(which pgsql) ] ; then - echo "No pgsql client to execute, install the pgsql client package and" - echo "run 'dpkg-reconfigure -plow packagename'." -elif ! $pgsqlcmd $systemdb -c "select usename from pg_shadow;" >/dev/null 2>&1 ; then - echo "Error when trying to connect to the pgsql database." - echo "This error can occur if you have no database to connect to, or" - echo "if the password was incorrect." - echo "use: dpkg-reconfigure -plow packagename to reconfigure." -elif $pgsqlcmd $dbname -c "$statement" >/dev/null 2>&1 ; then - echo "Executing command to pgsql." - if $pgsqlcmd $dbname < $sqlfile > /dev/null 2>&1 ; then - status=exec - else - echo "Unable to run the sql script ($sqlfile)." - fi + error="No pgsql client to execute, install the pgsql client package and\n + run 'dpkg-reconfigure -plow packagename'." +elif ! $pgsqlcmd -d $systemdb -c "select usename from pg_shadow;" >/dev/null 2>&1 ; then + error="Error when trying to connect to the pgsql database.\n + This error can occur if you have no database to connect to, or\n + if the password was incorrect.\n + use: dpkg-reconfigure -plow packagename to reconfigure." +elif $pgsqlcmd -d $dbname -c "$statement" >/dev/null 2>&1 ; then + log="${log}Executing command to pgsql.\n" + if $pgsqlcmd -d $dbname < $sqlfile > /dev/null 2>&1 ; then + status=exec + else + error="Unable to run the sql script ($sqlfile)." + fi else - status=nothing + status=nothing fi diff -N -u -r wwwconfig-common-0.0.10/pgsql-ifnot-exec.sh wwwconfig-common-0.0.10-luca/pgsql-ifnot-exec.sh --- wwwconfig-common-0.0.10/pgsql-ifnot-exec.sh Fri Aug 31 08:26:16 2001 +++ wwwconfig-common-0.0.10-luca/pgsql-ifnot-exec.sh Sat Oct 20 20:35:25 2001 @@ -18,26 +18,24 @@ . /usr/share/wwwconfig-common/pgsql.get if [ -z "$dbserver" ] ; then - echo "No database server specified." + error="No database server specified." elif [ -z "$dbadmin" ] ; then - echo "No database administrator specified." -#elif [ -z "$dbadmpass" ] ; then -# echo "No database ($dbadmin) administrator password specified." + error="No database administrator specified." elif [ ! -x $(which pgsql) ] ; then - echo "No pgsql client to execute, install the pgsql client package and" - echo "run 'dpkg-reconfigure -plow packagename'." -elif ! $pgsqlcmd $systemdb -c "select usename from pg_shadow;" >/dev/null 2>&1 ; then - echo "Error when trying to connect to the pgsql database." - echo "This error can occur if you have no database to connect to, or" - echo "if the password was incorrect." - echo "use: dpkg-reconfigure -plow packagename to reconfigure." -elif ! $pgsqlcmd $dbname -c "$statement" >/dev/null 2>&1 ; then - echo "Executing command to pgsql." - if $pgsqlcmd $dbname < $sqlfile > /dev/null 2>&1 ; then - status=exec - else - echo "Unable to run the sql script ($sqlfile)." - fi + error="No pgsql client to execute, install the pgsql client package and\n + run 'dpkg-reconfigure -plow packagename'." +elif ! $pgsqlcmd -d $systemdb -c "select usename from pg_shadow;" >/dev/null 2>&1 ; then + error="Error when trying to connect to the pgsql database.\n + This error can occur if you have no database to connect to, or\n + if the password was incorrect.\n + use: dpkg-reconfigure -plow packagename to reconfigure." +elif ! $pgsqlcmd -d $dbname -c "$statement" >/dev/null 2>&1 ; then + log="${log}Executing command to pgsql.\n" + if $pgsqlcmd -d $dbname < $sqlfile > /dev/null 2>&1 ; then + status=exec + else + error="Unable to run the sql script ($sqlfile)." + fi else - status=nothing + status=nothing fi diff -N -u -r wwwconfig-common-0.0.10/pgsql-nextsysid.get wwwconfig-common-0.0.10-luca/pgsql-nextsysid.get --- wwwconfig-common-0.0.10/pgsql-nextsysid.get Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/pgsql-nextsysid.get Sat Oct 20 21:14:15 2001 @@ -8,10 +8,12 @@ # Sets: $nextsysid = select max(usesysid) from pg_shadow; + 1 # $status = {error, get} -nextsysid=0 -status=error -if $pgsqlcmd $systemdb -c "select max(usesysid) from pg_shadow" > /dev/null 2>&1 ; then - status=get - nextsysid=$($pgsqlcmd $systemdb -c "select max(usesysid) from pg_shadow" | grep -v " max" | grep -v -- "---" | grep -v "row" | grep -v -e "^$") - nextsysid=$((1 + $nextsysid)) +fi [ -z "$pgsql_nextsysid_get" ] ; then + nextsysid=0 + status=error + if $pgsqlcmd -d $systemdb -c "select max(usesysid) from pg_shadow" > /dev/null 2>&1 ; then + status=get + $((1 + $(psql -U postgres -d template1 -q -t -A -c "select max(usesysid) from pg_shadow"))) + fi + pgsql_nextsysid_get="done" fi diff -N -u -r wwwconfig-common-0.0.10/pgsql-userpass.get wwwconfig-common-0.0.10-luca/pgsql-userpass.get --- wwwconfig-common-0.0.10/pgsql-userpass.get Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/pgsql-userpass.get Sat Oct 20 21:17:50 2001 @@ -9,9 +9,12 @@ # Sets: $userpass = the fetched password. # $status = {error, get} -userpass="" -status=error -if $pgsqlcmd $systemdb -c "select passwd from pg_shadow where usename='$dbuser'" > /dev/null 2>&1 ; then - status=get - userpass=$($pgsqlcmd $systemdb -c "select passwd from pg_shadow where usename='$dbuser'" | grep -v " passwd" | grep -v -- "------" | grep -v "row" | grep -v -e "^$" | sed -e "s|[[:space:]]||g;") +if [ -z "$pgsql_userpass_get" ] ; then + userpass="" + status=error + if $pgsqlcmd $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'") + pgsql_userpass_get="done" + fi fi diff -N -u -r wwwconfig-common-0.0.10/pgsql.get wwwconfig-common-0.0.10-luca/pgsql.get --- wwwconfig-common-0.0.10/pgsql.get Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/pgsql.get Sat Oct 20 21:07:28 2001 @@ -7,18 +7,16 @@ # Sets: $pgsqlcmd so that administration access are prepared # $systemdb - the name of the system db. -if [ -z "$dbserver" ] ; then - dbserver=localhost +if [ -z "$pgsql_get" ] ; then + if [ -z "$dbserver" ] ; then + dbserver=localhost + fi + if [ "$dbserver" != "localhost" ] ; then + hostopt="-h $dbserver" + fi + passopt="" + pgsqlcmd="psql $hostopt $passopt -U $dbadmin" + + systemdb=template1 + pgsql_get="done" fi -if [ "$dbserver" != "localhost" ] ; then - hostopt="-h $dbserver" -fi -passopt="" -#if [ -z "$dbadmpass" ] ; then -# echo "No password used." -#else -# passopt="--password=$dbadmpass" -#fi -pgsqlcmd="psql $hostopt $passopt -U $dbadmin" - -systemdb=template1 diff -N -u -r wwwconfig-common-0.0.10/php-extensions.sh wwwconfig-common-0.0.10-luca/php-extensions.sh --- wwwconfig-common-0.0.10/php-extensions.sh Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/php-extensions.sh Sat Oct 20 20:37:46 2001 @@ -12,21 +12,21 @@ . /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 + 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 - echo "$ext extension for $phpver found." - else - echo "$ext extension for $phpver added!" - echo "extension=$ext.so" >>$phpini - fi + if grep -e "^[[:space:]]*extension.*\b$ext\.so" $phpini >/dev/null 2>&1; then + log="${log}$ext extension for $phpver found.\n" + else + log="${log}$ext extension for $phpver added!\n" + echo "extension=$ext.so" >>$phpini + fi done fi diff -N -u -r wwwconfig-common-0.0.10/php.get wwwconfig-common-0.0.10-luca/php.get --- wwwconfig-common-0.0.10/php.get Thu Aug 23 12:19:16 2001 +++ wwwconfig-common-0.0.10-luca/php.get Sat Oct 20 21:18:58 2001 @@ -9,12 +9,15 @@ # 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} +if [ -z "$php_get" ] ; then + 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} + php_get="done" +fi diff -N -u -r wwwconfig-common-0.0.10/restart.sh wwwconfig-common-0.0.10-luca/restart.sh --- wwwconfig-common-0.0.10/restart.sh Mon Sep 17 22:32:34 2001 +++ wwwconfig-common-0.0.10-luca/restart.sh Sat Oct 20 20:39:57 2001 @@ -11,18 +11,18 @@ # Note: $restart can be somthing like this: "apache exim" if [ -z "$servers" ] ; then - echo "No servers specified in restart.sh." + 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 - echo "$A needs to be restarted:" - if [ -x /etc/init.d/$A ] ; then - /etc/init.d/$A restart - else - echo "ERROR! But /etc/init.d/$A is not installed (or not executable)." - fi - fi - done + 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.\n" + if [ -x /etc/init.d/$A ] ; then + /etc/init.d/$A restart + else + error="ERROR! But /etc/init.d/$A is not installed (or not executable)." + fi + fi + done fi wwwconfig-common-0.3.0/patches/restart.patch0000644000000000000000000000342511173250440016035 0ustar Package: wwwconfig-common Version: 0.0.47 Severity: important Tags: patch If the command "/etc/init.d/$A restart" called from restart.sh fails (for example, if the web server can not be started because port 80 is already used by another program), the script will stop and fail, making the postinst script of the calling package fail as well. I believe that restart.sh should catch the error and return it in the "error" environment variable, so postinst (or another calling script) can handle it in the way it sees fit. See (RC) bug #398638 for an example (package w3c-markup-validator). The following patch fixes it for me; there may be other ways to do it. It works with a modified version of w3c-markup-validator (where postinst has been modified to notice the error), but I obviously can't upload the modified package for now. --- restart.sh 2006-10-11 21:31:57.000000000 +0200 +++ restart.sh.new 2006-11-17 20:14:35.000000000 +0100 @@ -33,7 +33,10 @@ if [ "$verify" != "$restart" ] ; then log="${log}$A needs to be restarted." if [ -x /etc/init.d/$A ] ; then - /etc/init.d/$A restart >/dev/null 2>&1 3>&1 4>&1 5>&1 + 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 else status="error" error="ERROR! But /etc/init.d/$A is not installed (or not executable)." -- System Information: Debian Release: 4.0 APT prefers testing APT policy: (500, 'testing') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.17-2-686-bigmem Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) -- no debconf information wwwconfig-common-0.3.0/patches/bug-224326-eval-mysqlfix.author0000644000000000000000000000004011173250440020656 0ustar Thomas Viehmann wwwconfig-common-0.3.0/patches/bug-235988-better-postgres-suport.patch0000644000000000000000000000606111173250440022366 0ustar From: Hilko Bengen Date: Mon, 08 Mar 2004 18:33:15 +0100 retitle 235988 Patch for better Postgres support tags 235988 +patch thanks The attached diff provides two changes to the PostgreSQL support in wwwconfig-common: (1) psql-createuser.sh uses the SQL command CREATE USER rather than modifying the pg_shadow table directly. This has the benefit of proper passwords being added to the record (2) the pgsqlcmd() function provided in psql.get now knows about several authentication mechanisms: a) Connection via Unix domain socket; su postgres -c $COMMAND: This mechanism needs no password and works on the default PostgreSQL installation that is provided by Debian. Of course, this requires that the script is run as root or postgres (which is the case in maintainer scripts). b) Setting the PGUSER, PGPASSWORD environment variables. The PostgreSQL documentation mentions that PGPASSWORD is considered deprecated because of security functions and advises that one should use a file $HOME/.pgpass. It works for now, but generating a directory, setting $HOME and writing a .pgpass file should also be possible in the script. Cheers, -Hilko diff -uir wwwconfig-common-0.0.34/pgsql-createuser.sh wwwconfig-common-0.0.34.0hillu1/pgsql-createuser.sh --- wwwconfig-common-0.0.34/pgsql-createuser.sh 2003-08-31 13:30:26.000000000 +0200 +++ wwwconfig-common-0.0.34.0hillu1/pgsql-createuser.sh 2004-03-08 16:39:56.000000000 +0100 @@ -66,7 +66,7 @@ # . 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 "\"INSERT INTO pg_shadow (usename, usesysid, usecreatedb, usesuper, usecatupd, passwd) VALUES ('$dbuser', $nextsysid, '${dbusercc:-f}', 'f', '${dbusercau:-f}','$dbpass')\"" > /dev/null 2>&1; then + 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." diff -uir wwwconfig-common-0.0.34/pgsql.get wwwconfig-common-0.0.34.0hillu1/pgsql.get --- wwwconfig-common-0.0.34/pgsql.get 2003-08-31 13:30:26.000000000 +0200 +++ wwwconfig-common-0.0.34.0hillu1/pgsql.get 2004-03-08 18:02:18.000000000 +0100 @@ -36,7 +36,6 @@ if [ "$dbserver" != "localhost" ] ; then hostopt="-h '$dbserver'" fi -passopt="" pgsqlcmd() { @@ -47,7 +46,18 @@ shift done - su -s /bin/sh $dbadmin -c "psql $hostopt $passopt $_psql_args" + MYUID=`id -un` + if [ -z "$hostopt" -a \( "$MYUID" = root -o "$UID" = "$dbadmin" \) ] && grep -q ^"$dbadmin": /etc/passwd ; then + su -s /bin/sh $dbadmin -c "psql $hostopt $_psql_args" + else + export PGUSER="$dbadmin" + if [ ! -z "$dbadmpass" ] ; then + export PGPASSWORD="$dbadmpass" + fi + eval psql $hostopt $_psql_args + unset PGUSER + unset PGPASSWORD + fi } pgsqlcmd=pgsqlcmd wwwconfig-common-0.3.0/patches/bug-232815-getmysqlopt-ignore-comments.patch0000644000000000000000000000210311173250440023352 0ustar Package: wwwconfig-common Version: 0.0.33 Severity: normal Tags: patch I have some commented-out sections in my .my.cnf file, and these are not properly ignored. This patch fixes this problem: --- mysql.func.dpkg-dist 2004-02-14 19:03:11.000000000 -0500 +++ mysql.func 2004-02-14 18:57:38.000000000 -0500 @@ -17,7 +17,7 @@ tmpwhat="$2" tmpsect="$1" - if grep "\[$tmpsect\]" $tmpcfgfile >/dev/null 2>&1 ; then + 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 The script also sets found=yes even if the requested option is not present. This is probably a bug, too, but I don't have a patch for that. -- System Information: Debian Release: testing/unstable Architecture: sparc Kernel: Linux pulse-plasma-gun 2.4.21 #1 Thu Aug 7 20:30:12 EDT 2003 sparc64 Locale: LANG=C, LC_CTYPE=C -- no debconf information wwwconfig-common-0.3.0/patches/bug-263350-now-apache-modconf.patch0000644000000000000000000000324211173250440021326 0ustar From: Jeremy Lainé Hej Ola, I noticed that wwwconfig-common 0.0.38 is supposed to replace calls to modules-config by apache-modconf, however only one call was replaced and the "which" test is still applied to modules-config, leaving the apache-php.sh script in an odd intermediate situation. The attached patch replaces the remaining calls to modules-config by apache-modconf. Med vänliga hälsningar, Jeremy --- wwwconfig-common/apache-php.sh 2004-08-06 22:39:27.000000000 +0200 +++ wwwconfig-common/apache-php.sh 2004-08-20 11:04:07.000000000 +0200 @@ -14,6 +14,8 @@ # 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, @@ -31,13 +33,13 @@ error="No php ini file to check for." elif [ ! -f $phpini ] ; then error="Php config file $phpini not found." -elif [ -z $(which modules-config) ] ; then - error="Could not find modules-config." +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 - modules-config $server enable $phpverm + apache-modconf $server enable $phpverm # Uncomment successful. status=uncomment else wwwconfig-common-0.3.0/patches/bug-232816-support-for-socket-connection.patch0000644000000000000000000000201011173250440023577 0ustar Package: wwwconfig-common Version: 0.0.33 Severity: normal Tags: patch The mysql-server package out of the box only supports socket connections; mysql.set doesn't know how to deal with this. This patch uses the same convention as php's mysql_connect function, so that a "server" of the form :/path/to/socket will use a socket to connect to the mysql server. --- mysql.get.dpkg-dist 2004-02-14 19:04:08.000000000 -0500 +++ mysql.get 2004-02-14 18:41:30.000000000 -0500 @@ -16,7 +16,15 @@ dbserver=localhost fi if [ "$dbserver" != "localhost" ] ; then - hostopt="-h '$dbserver'" + 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." -- System Information: Debian Release: testing/unstable Architecture: sparc Kernel: Linux pulse-plasma-gun 2.4.21 #1 Thu Aug 7 20:30:12 EDT 2003 sparc64 Locale: LANG=C, LC_CTYPE=C -- no debconf information wwwconfig-common-0.3.0/patches/bug-119679.author0000644000000000000000000000007711173250440016107 0ustar From: "Stephen R. Darragh" Fixes: Bug #119679. wwwconfig-common-0.3.0/patches/pgsql-sudo-to-su-potential-problem-fix.patchdescription0000644000000000000000000000555411173250440026204 0ustar Hi Ola, thanks a lot for your fast reaction and the honorable mention of my name in the change log! There is one small improvement that just came to my mind: If we turn the line su $dbadmin -c "psql $hostopt $passopt $_psql_args" into su $dbadmin -s /bin/sh -c "psql $hostopt $passopt $_psql_args" then it will work even for those who have changed the login shell for the postgres user to something weird (like csh or /bin/false). I don't know if anybody does this, but still... Best regards, Arndt On Thu, Sep 26, 2002 at 08:29:43AM +0200, Ola Lundqvist wrote: > On Wed, Sep 25, 2002 at 05:03:34PM +0200, Arndt Schoenewald wrote: > > Hi Ola, > > Hi > > > it is nice that you try to come up with the big and cool solution > > (splitting packages), but people keep getting bitten by this problem > > again and again, so we need a fix or workaround soon. I just spent two > > hours figuring out why phpgroupware wouldn't work after installation. > > That is really great. You spent less time and solved it. :) > > > It should be perfectly possible to use "su" instead of "sudo", just as > > > > su posgres -c "psql -d template1 -c ''" > > > > works just as well as > > > > sudo -u posgres psql -d template1 -c '' > > > > The problem is that "su" takes command and args as one single string, > > which we must assemble while getting the quoting right. Here is how to > > do it: > > That is the problem I was hit by too. > > > pgsqlcmd() > > { > > _psql_args= > > while [ $# -gt 0 ] > > do > > _psql_args="$_psql_args '`echo \"$1\" | sed -e \"s/'/'\\\\\\''/g\"`'" > > shift > > done > > Ahh that one may do the trick. > > > su $dbadmin -c "psql $hostopt $passopt $_psql_args" > > } > > > > pgsqlcmd=pgsqlcmd > > > > Just replace the line 'pgsqlcmd="sudo -u $dbadmin psql $hostopt $passopt"' > > with above code in /usr/share/wwwconfig-common/pgsql.get, and the problem > > is solved, phpgroupware installs fine and database and user are created. > > That is really great. > > > Yes, this solution may look strange, but is perfectly normal and portable > > Bourne shell programming. I have tested it with bash, ash, and pdksh. > > I'll do this Linko:ping today so I hope that I can upload this today. > > Thanks a lot for the patch. This is what is so great about open source! > > Regards, > > // Ola > > > Best regards, > > Arndt > > > > PS: There is a small typo in /var/lib/dpkg/info/phpgroupware.config; > > line 60 has "flase" instead of "false". I think this issue is too small > > to file a full blown bug report for it. > > You can always file a minor one. :) Yeah, sorry, this is of course not your business. This must go to the maintainer of the phpgroupware package. > Regards, > > // Ola -- Arndt Schönewald , Software Developer Quelltext AG (http://www.quelltext-ag.de), Dortmund, Germany wwwconfig-common-0.3.0/patches/bug-116604.changes0000644000000000000000000000636311173250440016202 0ustar wwwconfig-common (0.0.10) unstable; urgency=low * *.*: - Reapplied indentation. - Replaced various echo with variables, so one can decide to print or to log the information to file. next step will be the use of gettext. * *.get: - Added a check to avoid multiple inclusion of the same file. Since (for example), postinst scripts use createuser and createdb it is not usefull to include mysql.get or pgsql.get twice. * apache-addtype_all.sh: - Changed regular expressions o /[[:space:]][[:space:]]*/[[:space:]]\+/ o / */[[:space:]]\+/ o / */[[:space:]]*/ - Changed from "cat $conffile | sed" to "sed ... < $conffile" * apache-cominclude_all.sh: - Changed regular expressions o /[[:space:]][[:space:]]*/[[:space:]]\+/ * apache-cominclude.sh: - Changed regular expressions o /[[:space:]][[:space:]]*/[[:space:]]\+/ - Changed from "cat $conffile | sed" to "sed ... < $conffile" * apache.func: - Changed regular expressions o /[[:space:]][[:space:]]*/[[:space:]]\+/ - Reduced the 3 assignment in the function to a single sed script. * apache-include_all.sh: - Changed regular expressions o /[[:space:]][[:space:]]*/[[:space:]]\+/ * apache-include.sh: - Changed regular expressions o /[[:space:]][[:space:]]*/[[:space:]]\+/ * apache-index.sh: - Changed regular expressions o /[[:space:]][[:space:]]*/[[:space:]]\+/ * apache-php.sh: - Changed regular expressions o /[[:space:]][[:space:]]*/[[:space:]]\+/ o / */[[:space:]]\+/ o / */[[:space:]]*/ * apache-uncominclude.sh: - Changed regular expressions o /[[:space:]][[:space:]]*/[[:space:]]\+/ - Changed from "cat $conffile | sed" to "sed ... < $conffile" * apache-uninclude_all.sh: - Changed regular expressions o /[[:space:]][[:space:]]*/[[:space:]]\+/ * apache-uninclude.sh: - Changed regular expressions o /[[:space:]][[:space:]]*/[[:space:]]\+/ - Changed from "cat $conffile | grep" to "grep ... < $conffile" * autopatch_all.sh: - Changed from "find ... -exec" to "find ... | while read etc." * exim-trust.sh: - Changed regular expressions o / */[[:space:]]*/ * pgsql-allowip.sh: - Changed the sed script on line 18. Need only one regular expression. * pgsql-exec.sh: - Added the -d flag to $pgsqlcmd (not really needed but clearer) * pgsql-if-exec.sh: - Added the -d flag to $pgsqlcmd (not really needed but clearer) * pgsql-ifnot-exec.sh: - Added the -d flag to $pgsqlcmd (not really needed but clearer) * pgsql-nextsysid.get: - Changed the piped commands with a single psql command using -A -q -t * pgsql-userpass.get: - Changed the piped commands with a single psql command using -A -q -t * pgsql-createuser.sh: - Changed the if statement on line 39 with a single psql command using -A -q -t and changing th query * Created {mysql,pgsql}-drop{user,db}.sh * I may have missed to include other minor changes. -- Luca - De Whiskey's - De vitis Mon, 17 Sep 2001 22:32:22 +0200 Local variables: mode: debian-changelog End: wwwconfig-common-0.3.0/patches/bug-119679.patch0000644000000000000000000000151611173250440015703 0ustar Index: debian/woody/wwwconfig-common/apache-addtype_all.sh diff -u debian/woody/wwwconfig-common/apache-addtype_all.sh:1.1 debian/woody/wwwconfig-common/apache-addtype_all.sh:1.2 --- debian/woody/wwwconfig-common/apache-addtype_all.sh:1.1 Tue Jan 15 15:02:57 2002 +++ debian/woody/wwwconfig-common/apache-addtype_all.sh Wed Jan 16 17:32:45 2002 @@ -17,6 +17,10 @@ echo "No apache server defined." elif [ -z "$extension" ] ; then echo "No extension to add with $typestr." +elif [ ! -d "/etc/$server" ] ; then + echo "Warning: Could not find configuration directory /etc/$server" + echo "Doing nothing for $server" + status=nothing elif [ -f $phpini ] ; then A=${extension#.} if grep -e "^[[:space:]]*AddType[[:space:]][[:space:]]*$typestr[[:space:]][[:space:]]*.*\.$A\b" /etc/$server/*.conf > /dev/null 2>&1 ; then wwwconfig-common-0.3.0/patches/bug-116604.author0000644000000000000000000000006311173250440016063 0ustar From: Luca De_Vitis wwwconfig-common-0.3.0/patches/filename-things.patch0000644000000000000000000001135411173250440017423 0ustar diff -u -r wwwconfig-common-0.0.46/apache-addtype_all.sh wwwconfig-common-patched/apache-addtype_all.sh --- wwwconfig-common-0.0.46/apache-addtype_all.sh 2002-04-12 13:35:19.000000000 +0300 +++ wwwconfig-common-patched/apache-addtype_all.sh 2006-10-11 12:44:40.711838136 +0300 @@ -1,5 +1,5 @@ #!/bin/sh -# File: php-extensions.sh +# File: apache-addtype_all.sh # Changes: # 20010305 Ola Lundqvist # 20011022 Luca De Vitis diff -u -r wwwconfig-common-0.0.46/apache.func wwwconfig-common-patched/apache.func --- wwwconfig-common-0.0.46/apache.func 2002-03-12 22:44:13.000000000 +0200 +++ wwwconfig-common-patched/apache.func 2006-10-11 12:53:58.210085520 +0300 @@ -1,4 +1,4 @@ -# File: apache-include.sh +# File: apache.func # Changes: # 20010219 Ola Lundqvist # 20010222 Ola Lundqvist diff -u -r wwwconfig-common-0.0.46/apache-index_all.sh wwwconfig-common-patched/apache-index_all.sh --- wwwconfig-common-0.0.46/apache-index_all.sh 2002-04-12 13:35:19.000000000 +0300 +++ wwwconfig-common-patched/apache-index_all.sh 2006-10-11 12:53:38.141136464 +0300 @@ -1,5 +1,5 @@ #!/bin/sh -# File: apache-index.sh +# File: apache-index_all.sh # Changes: # 20010219 Ola Lundqvist # 20010222 Ola Lundqvist diff -u -r wwwconfig-common-0.0.46/autopatch_all.sh wwwconfig-common-patched/autopatch_all.sh --- wwwconfig-common-0.0.46/autopatch_all.sh 2002-04-12 13:35:19.000000000 +0300 +++ wwwconfig-common-patched/autopatch_all.sh 2006-10-11 12:54:06.726790784 +0300 @@ -1,5 +1,5 @@ #!/bin/sh -# File: autopatch.sh +# File: autopatch_all.sh # Changes: # 20010219 Ola Lundqvist # 20011022 Luca De Vitis diff -u -r wwwconfig-common-0.0.46/mysql-dropdb.sh wwwconfig-common-patched/mysql-dropdb.sh --- wwwconfig-common-0.0.46/mysql-dropdb.sh 2004-07-06 00:47:12.000000000 +0300 +++ wwwconfig-common-patched/mysql-dropdb.sh 2006-10-11 12:54:26.121842288 +0300 @@ -1,5 +1,5 @@ #!/bin/sh -# File: mysql-createdb.sh +# File: mysql-dropdb.sh # Changes: # 20010224 Luca De Vitis # 20020116 Ola Lundqvist diff -u -r wwwconfig-common-0.0.46/mysql-dropuser.sh wwwconfig-common-patched/mysql-dropuser.sh --- wwwconfig-common-0.0.46/mysql-dropuser.sh 2004-07-06 00:47:12.000000000 +0300 +++ wwwconfig-common-patched/mysql-dropuser.sh 2006-10-11 12:54:32.349895480 +0300 @@ -1,5 +1,5 @@ #!/bin/sh -# File: mysql-createuser.sh +# File: mysql-dropuser.sh # Changes: # 20010224 Luca De Vitis # 20020116 Ola Lundqvist diff -u -r wwwconfig-common-0.0.46/mysql-ifnot-exec.sh wwwconfig-common-patched/mysql-ifnot-exec.sh --- wwwconfig-common-0.0.46/mysql-ifnot-exec.sh 2004-07-06 00:47:12.000000000 +0300 +++ wwwconfig-common-patched/mysql-ifnot-exec.sh 2006-10-11 12:54:40.670630536 +0300 @@ -1,5 +1,5 @@ #!/bin/sh -# File: mysql-if-exec.sh +# File: mysql-ifnot-exec.sh # Changes: # 20010322 Ola Lundqvist # 20011022 Luca De Vitis diff -u -r wwwconfig-common-0.0.46/pgsql-if-exec.sh wwwconfig-common-patched/pgsql-if-exec.sh --- wwwconfig-common-0.0.46/pgsql-if-exec.sh 2005-10-09 15:16:42.000000000 +0300 +++ wwwconfig-common-patched/pgsql-if-exec.sh 2006-10-11 12:54:57.178121016 +0300 @@ -1,5 +1,5 @@ #!/bin/sh -# File: pgsql-exec.sh +# File: pgsql-if-exec.sh # Changes: # 20010322 Ola Lundqvist # 20011022 Luca De Vitis diff -u -r wwwconfig-common-0.0.46/pgsql-ifnot-exec.sh wwwconfig-common-patched/pgsql-ifnot-exec.sh --- wwwconfig-common-0.0.46/pgsql-ifnot-exec.sh 2005-10-09 15:16:42.000000000 +0300 +++ wwwconfig-common-patched/pgsql-ifnot-exec.sh 2006-10-11 12:55:06.111762896 +0300 @@ -1,5 +1,5 @@ #!/bin/sh -# File: pgsql-exec.sh +# File: pgsql-ifnot-exec.sh # Changes: # 20010322 Ola Lundqvist # 20011022 Luca De Vitis diff -u -r wwwconfig-common-0.0.46/pgsql-nextsysid.get wwwconfig-common-patched/pgsql-nextsysid.get --- wwwconfig-common-0.0.46/pgsql-nextsysid.get 2002-01-27 00:42:38.000000000 +0200 +++ wwwconfig-common-patched/pgsql-nextsysid.get 2006-10-11 12:55:12.686763344 +0300 @@ -1,4 +1,4 @@ -# File: pgsql-userpass.get +# File: pgsql-nextsysid.get # Changes: # 20010224 Ola Lundqvist # 20011022 Luca De Vitis diff -u -r wwwconfig-common-0.0.46/restart.sh wwwconfig-common-patched/restart.sh --- wwwconfig-common-0.0.46/restart.sh 2002-03-18 00:29:00.000000000 +0200 +++ wwwconfig-common-patched/restart.sh 2006-10-11 12:55:26.091725480 +0300 @@ -1,5 +1,5 @@ #!/bin/sh -# File: apache-include.sh +# File: restart.sh # Changes: # 20010219 Ola Lundqvist # 20010430 Ola Lundqvist wwwconfig-common-0.3.0/patches/pgsql-8.x.patch0000644000000000000000000000301611173250440016106 0ustar Package: wwwconfig-common Version: 0.0.48 Severity: normal Tags: patch Hi, from postgres 8.X, the client (psql) use getpwuid_r to find the .dbpass-file, not the environment variable HOME as it used to in postgres 7.4. This breaks the part of pgsql.get in wwwconfig-common that creates a temporary HOME where a .dbpass is created (and removed). IMO it would be more elegant to use the PGPASSFILE environment variable than changing HOME anyway, so I have written and tested a patch that does this. - Werner diff -ruN wwwconfig-common-0.0.48.orig/pgsql.get wwwconfig-common-0.0.48/pgsql.get --- wwwconfig-common-0.0.48.orig/pgsql.get 2004-08-06 14:04:41.000000000 +0200 +++ wwwconfig-common-0.0.48/pgsql.get 2008-03-27 09:46:51.000000000 +0100 @@ -60,24 +60,23 @@ 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 - OLDHOME=$HOME - HOME=`mktemp -d` + PGPASSDIR=`mktemp -d` if [ $? -ne 0 ]; then exit 1 fi - export HOME + PGPASSFILE=$PGPASSDIR/.pgpass + export PGPASSFILE if [ ! -z "$pass" ] ; then OLDUMASK=`umask` umask 077 - echo "*:*:*:$user:$pass" > $HOME/.pgpass + echo "*:*:*:$user:$pass" > $PGPASSFILE umask $OLDUMASK fi eval psql -U "$user" $hostopt $_psql_args - rm -rf "$HOME" - HOME=$OLDHOME + rm -rf "$PGPASSDIR" fi } wwwconfig-common-0.3.0/patches/bug-247862-other-command-check.patch0000644000000000000000000001165711173250440021514 0ustar From: Jeremy Laine Date: Fri, 07 May 2004 17:21:59 +0200 Package: wwwconfig-common Version: 0.0.34 Severity: normal Tags: patch The mysql-* scripts use the following test to determine if a mysql client is present : [...] elif [ ! -x $(which mysql) ] ; then echo "No mysql client to execute, install the mysql client package and run 'dpkg-reconfigure -plow packagename'." [...] The problem is that "! -x" does not return true on an empty string! A better test would be simply to test if the string returned by "which" is empty like this: [...] elif [ -z $(which mysql] ; then [...] Attached is a patch that fixes this problem. Regards, Jeremy diff -ur /usr/share/wwwconfig-common/mysql-createdb.sh ./mysql-createdb.sh --- /usr/share/wwwconfig-common/mysql-createdb.sh 2004-02-16 14:35:15.000000000 +0100 +++ ./mysql-createdb.sh 2004-05-07 17:13:09.000000000 +0200 @@ -32,7 +32,7 @@ error="No database server specified." elif [ -z "$dbadmin" ] ; then error="No database administrator specified." -elif [ ! -x $(which mysql) ] ; then +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 -f mysql -e "\"show tables;\"" >/dev/null 2>&1 ; then diff -ur /usr/share/wwwconfig-common/mysql-createuser.sh ./mysql-createuser.sh --- /usr/share/wwwconfig-common/mysql-createuser.sh 2004-02-16 14:35:15.000000000 +0100 +++ ./mysql-createuser.sh 2004-05-07 17:13:52.000000000 +0200 @@ -40,7 +40,7 @@ error="No database server specified." elif [ -z "$dbadmin" ] ; then error="No database administrator specified." -elif [ ! -x $(which mysql) ] ; then +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 diff -ur /usr/share/wwwconfig-common/mysql-dropdb.sh ./mysql-dropdb.sh --- /usr/share/wwwconfig-common/mysql-dropdb.sh 2004-02-16 14:35:15.000000000 +0100 +++ ./mysql-dropdb.sh 2004-05-07 17:13:24.000000000 +0200 @@ -30,7 +30,7 @@ error="No database server specified." elif [ -z "$dbadmin" ] ; then error="No database administrator specified." -elif [ ! -x $(which mysql) ] ; then +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 -f mysql -e "\"show tables;\"" >/dev/null 2>&1 ; then diff -ur /usr/share/wwwconfig-common/mysql-dropuser.sh ./mysql-dropuser.sh --- /usr/share/wwwconfig-common/mysql-dropuser.sh 2004-02-16 14:35:15.000000000 +0100 +++ ./mysql-dropuser.sh 2004-05-07 17:14:16.000000000 +0200 @@ -34,7 +34,7 @@ error="No database server specified." elif [ -z "$dbadmin" ] ; then error="No database administrator specified." -elif [ ! -x $(which mysql) ] ; then +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 diff -ur /usr/share/wwwconfig-common/mysql-exec.sh ./mysql-exec.sh --- /usr/share/wwwconfig-common/mysql-exec.sh 2004-02-16 14:35:15.000000000 +0100 +++ ./mysql-exec.sh 2004-05-07 17:12:53.000000000 +0200 @@ -37,7 +37,7 @@ error="No database server specified." elif [ -z "$dbadmin" ] ; then error="No database administrator specified." -elif [ ! -x $(which mysql) ] ; then +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 diff -ur /usr/share/wwwconfig-common/mysql-if-exec.sh ./mysql-if-exec.sh --- /usr/share/wwwconfig-common/mysql-if-exec.sh 2004-02-16 14:35:15.000000000 +0100 +++ ./mysql-if-exec.sh 2004-05-07 17:14:36.000000000 +0200 @@ -44,7 +44,7 @@ error="No sqlfile to execute." elif [ ! -e "$sqlfile" ] ; then error="Sqlfile $sqlfile not found." -elif [ ! -x $(which mysql) ] ; then +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 diff -ur /usr/share/wwwconfig-common/mysql-ifnot-exec.sh ./mysql-ifnot-exec.sh --- /usr/share/wwwconfig-common/mysql-ifnot-exec.sh 2004-02-16 14:35:15.000000000 +0100 +++ ./mysql-ifnot-exec.sh 2004-05-07 17:14:49.000000000 +0200 @@ -43,7 +43,7 @@ error="No sqlfile to execute." elif [ ! -e "$sqlfile" ] ; then error="Sqlfile $sqlfile not found." -elif [ ! -x $(which mysql) ] ; then +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 wwwconfig-common-0.3.0/patches/bug-231186-make-mysql-exec.sh-work-for-nonadmins-too.patch0000644000000000000000000001210211173250440025620 0ustar Package: wwwconfig-common Version: 0.0.34-0.1~jeroen3 Severity: wishlist Tags: patch Please have mysql-*-exec.sh scripts be usuable for a series of sql statements by a nonadmin too. This is extremely useful for my package, as the user password for the database is stored and rembered, but the root password for MySQL isn't. So, on upgrade etc. there is then no need to ask for the MySQL root password (again). I hope you can apply this soon, as my package depends on it, otherwise I need to work around it by supplying my own script. This will not break anything. This is a patch to do so (it makes the pre-exec check more easily satisfyable): diff -ur wwwconfig-common-0.0.33.orig/mysql-exec.sh wwwconfig-common-0.0.33/mysql-exec.sh --- wwwconfig-common-0.0.33.orig/mysql-exec.sh 2003-10-27 11:04:51.000000000 +0100 +++ wwwconfig-common-0.0.33/mysql-exec.sh 2004-02-05 01:43:08.000000000 +0100 @@ -14,10 +14,13 @@ # 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 # 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. +# $dbadmin - the databaseuser name. +# $dbadmpass - the databaseuser password. # which # mysql # $sqlfile - the file containing the SQL statements to run. @@ -37,7 +40,7 @@ elif [ ! -x $(which mysql) ] ; then error="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 +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. diff -ur wwwconfig-common-0.0.33.orig/mysql-if-exec.sh wwwconfig-common-0.0.33/mysql-if-exec.sh --- wwwconfig-common-0.0.33.orig/mysql-if-exec.sh 2003-12-19 11:51:55.000000000 +0100 +++ wwwconfig-common-0.0.33/mysql-if-exec.sh 2004-02-05 01:42:48.000000000 +0100 @@ -12,11 +12,14 @@ # 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 # 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. +# $dbadmin - the databaseuser name. +# $dbadmpass - the databaseuser password. # $statement - the statement to test if it can get data. # which # mysql @@ -44,7 +47,7 @@ elif [ ! -x $(which mysql) ] ; then error="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 +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. diff -ur wwwconfig-common-0.0.33.orig/mysql-ifnot-exec.sh wwwconfig-common-0.0.33/mysql-ifnot-exec.sh --- wwwconfig-common-0.0.33.orig/mysql-ifnot-exec.sh 2003-12-19 11:51:48.000000000 +0100 +++ wwwconfig-common-0.0.33/mysql-ifnot-exec.sh 2004-02-05 01:43:06.000000000 +0100 @@ -12,10 +12,13 @@ # 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 # 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. +# $dbadmin - the databaseuser name. +# $dbadmpass - the databaseuser password. # $statement - the statement to test if it can get data. # which # mysql @@ -43,7 +46,7 @@ elif [ ! -x $(which mysql) ] ; then error="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 +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. -- System Information: Debian Release: testing/unstable Architecture: i386 Kernel: Linux frodo 2.6.0 #1 Sun Feb 1 17:50:42 CET 2004 i686 Locale: LANG=nl_NL@euro, LC_CTYPE=nl_NL@euro -- no debconf information wwwconfig-common-0.3.0/patches/bug-210632-mysql-createuser-eval.patch0000644000000000000000000000303111173250440022102 0ustar Package: wwwconfig-common Version: 0.0.30 Severity: important Missing eval in mysql-createuser breaks it, except when the admin user has no password. Here is a patch: --- mysql-createuser.sh.~1~ 2003-08-29 23:30:07.000000000 +0200 +++ mysql-createuser.sh 2003-09-12 16:48:31.000000000 +0200 @@ -38,14 +38,14 @@ elif [ ! -x $(which mysql) ] ; then echo "No mysql client to execute, install the mysql client package and run 'dpkg-reconfigure -plow packagename'." -elif ! $mysqlcmd -f mysql -e "show tables;" >/dev/null 2>&1 ; then +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)." - if $mysqlcmd -f mysql -e " + script=" CONNECT mysql; REPLACE INTO user ( host, user, password ) @@ -83,8 +83,10 @@ ); flush privileges; - - " > /dev/null 2>&1 ; then +" + + + 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." -- System Information: Debian Release: testing/unstable Architecture: i386 Kernel: Linux bou 2.4.20-3-686 #1 Sat Jun 7 22:34:55 EST 2003 i686 Locale: LANG=C, LC_CTYPE=C -- no debconf information wwwconfig-common-0.3.0/patches/bug-223309-modules-config.author0000644000000000000000000000047111173250440021000 0ustar Jeremy Lainé It has come to my attention that older versions of modules-config do not support the "query" command, and therefore return with a non-zero status if issued the "query" command. The following patch takes this into account. It is against wwwconfig-common version 0.34. Jeremy wwwconfig-common-0.3.0/patches/bug-263813-better-postgres-support.patch0000644000000000000000000001546411173250440022541 0ustar From: Hilko Bengen diff -uir /usr/share/wwwconfig-common/pgsql-createdb.sh 0.0.36hillu1/pgsql-createdb.sh --- /usr/share/wwwconfig-common/pgsql-createdb.sh 2004-07-22 23:10:04.000000000 +0200 +++ 0.0.36hillu1/pgsql-createdb.sh 2004-08-05 22:16:27.000000000 +0200 @@ -11,7 +11,8 @@ # 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) +# $dbadmpass - the administrator password +# $dbuser - the database's owner if set # which # pgsql # /usr/share/wwwconfig-common/pgsql.get @@ -24,6 +25,8 @@ . /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 @@ -42,8 +45,12 @@ 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;\"" > /dev/null 2>&1 ; then + 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 diff -uir /usr/share/wwwconfig-common/pgsql-createuser.sh 0.0.36hillu1/pgsql-createuser.sh --- /usr/share/wwwconfig-common/pgsql-createuser.sh 2004-07-22 23:10:04.000000000 +0200 +++ 0.0.36hillu1/pgsql-createuser.sh 2004-08-05 22:16:27.000000000 +0200 @@ -12,10 +12,6 @@ # Fixing postgres issues. Indenting correct. # Fixed insert command, removed '' which should not be there. # Removed need for $dbadmin. -# 20040705 Hilko Bengen -# Uses the SQL command CREATE USER rather than modifying the -# pg_shadow table directly. This has the benefit of -# proper passwords being added to the record. # Needs: $dbuser - the user name to create (or replace). # $dbname - the database that user should have access to. # $dbpass - the password to use. @@ -33,6 +29,9 @@ 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." @@ -54,10 +53,7 @@ # . pgsql-userpass.get status=nothing if [ "$userpass" != "$dbpass" ] ; then - if eval $pgsqlcmd -d $systemdb -c "\" - UPDATE pg_shadow - SET passwd='$dbpass' - WHERE usename='$dbuser'\"" > /dev/null 2>&1 ; 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 @@ -71,7 +67,7 @@ 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';\"") + 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 diff -uir /usr/share/wwwconfig-common/pgsql-dropdb.sh 0.0.36hillu1/pgsql-dropdb.sh --- /usr/share/wwwconfig-common/pgsql-dropdb.sh 2004-07-22 23:10:04.000000000 +0200 +++ 0.0.36hillu1/pgsql-dropdb.sh 2004-08-05 22:16:27.000000000 +0200 @@ -20,6 +20,8 @@ . /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 diff -uir /usr/share/wwwconfig-common/pgsql-dropuser.sh 0.0.36hillu1/pgsql-dropuser.sh --- /usr/share/wwwconfig-common/pgsql-dropuser.sh 2004-07-22 23:10:04.000000000 +0200 +++ 0.0.36hillu1/pgsql-dropuser.sh 2004-08-05 22:15:41.000000000 +0200 @@ -38,15 +38,13 @@ 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 "\" - DELETE FROM pg_shadow - WHERE usename='$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 droped." + log="${log}User $dbuser dropped." status=drop else - error="User $dbuser NOT successfully droped. You have to do it manually." + error="User $dbuser NOT successfully dropped. You have to do it manually." fi else error="Unable to run the drop user script." diff -uir /usr/share/wwwconfig-common/pgsql.get 0.0.36hillu1/pgsql.get --- /usr/share/wwwconfig-common/pgsql.get 2004-07-22 23:10:04.000000000 +0200 +++ 0.0.36hillu1/pgsql.get 2004-08-05 22:13:18.000000000 +0200 @@ -18,9 +18,6 @@ # Arndt Schönewald # Minor fix from Arndt Schönewald that fix problem if someone # use a non-sh compatible shell. -# 20040705 Hilko Bengen -# The pgsqlcmd() function provided in psql.get now knows about -# several authentication mechanisms: # Needs: $dbserver - the server to connect to (defaults to localhost). # $dbadmin - the administrator name (defaults to postgres). # $dbadmpass - the administrator password (not supported). @@ -40,8 +37,18 @@ 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 @@ -50,16 +57,27 @@ done MYUID=`id -un` - if [ -z "$hostopt" -a \( "$MYUID" = root -o "$UID" = "$dbadmin" \) ] && grep -q ^"$dbadmin": /etc/passwd ; then - su -s /bin/sh $dbadmin -c "psql $hostopt $_psql_args" + 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 - export PGUSER="$dbadmin" - if [ ! -z "$dbadmpass" ] ; then - export PGPASSWORD="$dbadmpass" + OLDHOME=$HOME + HOME=`mktemp -d` + if [ $? -ne 0 ]; then + exit 1 fi - eval psql $hostopt $_psql_args - unset PGUSER - unset PGPASSWORD + export HOME + + if [ ! -z "$pass" ] ; then + OLDUMASK=`umask` + umask 077 + echo "*:*:*:$user:$pass" > $HOME/.pgpass + umask $OLDUMASK + fi + + eval psql -U "$user" $hostopt $_psql_args + + rm -rf "$HOME" + HOME=$OLDHOME fi } wwwconfig-common-0.3.0/patches/bug-274291-quote-postgres-user.patch0000644000000000000000000000723411173250440021651 0ustar Package: wwwconfig-common Version: 0.0.40 Hope this one is not a dup. While installing the "drupal" package which depends on wwwconfig-common and specifying a database user name containing a '-' caracter in its name (www-data in my case) I had the following error message and the user creation failed: ERROR: syntax error at or near "-" at character 16 This error message seems to be due to the "CREATE USER" line in /usr/share/wwwconfig-common/pgsql-createuser.sh which gives: CREATE USER www-data WITH SYSID PASSWORD ''; because of the minus in the username it should be: CREATE USER "www-data" WITH SYSID PASSWORD 'the password'; This is also the case for the "alter user" statement just before. You can reproduce this directly in psql: postgres@slashcnam:~$ psql -d template1 Welcome to psql 7.4.5, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help on internal slash commands \g or terminate with semicolon to execute query \q to quit template1=# create user www-data password 'blabla'; ERROR: syntax error at or near "-" at character 16 template1=# create user "www-data" password 'blabla'; CREATE USER template1=#\q The pgsql-dropuser.sh should suffer from the same "bug". Follows a proposal for a patch. I only tested the one concerning pgsql-createuser.sh. Thanks for your fine work. Regards, Raphaël Patch proposal: :::::::::::::: pgsql-createuser.sh.diff-u :::::::::::::: --- /usr/share/wwwconfig-common/pgsql-createuser.sh.old 2004-09-15 16:07:11.000000000 +0200 +++ /usr/share/wwwconfig-common/pgsql-createuser.sh 2004-09-30 21:55:14.000000000 +0200 @@ -53,7 +53,7 @@ # . 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 + 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 @@ -66,7 +66,7 @@ # . 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 + 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." :::::::::::::: pgsql-dropuser.sh.diff-u # PLEASE NOTE THIS ONE IS FULLY UNTESTED!!! :::::::::::::: --- /usr/share/wwwconfig-common/pgsql-dropuser.sh.old 2004-09-30 22:06:21.000000000 +0200 +++ /usr/share/wwwconfig-common/pgsql-dropuser.sh 2004-09-30 22:07:11.000000000 +0200 @@ -38,7 +38,7 @@ 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 + 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." wwwconfig-common-0.3.0/patches/bug-225424-grant-all-privileges.author0000644000000000000000000000210211173250440022106 0ustar From: Jeroen van Wolffelaar Delivered-To: 225424@bugs.debian.org Resent-Sender: Debian BTS X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on chrystal.opal.dhs.org X-Spam-Status: No, hits=0.0 required=5.0 tests=none autolearn=no version=2.60 X-Spam-Level: [-- Bilaga #1 --] [-- Typ: text/plain, Kodning: 7bit, Storlek: 0,7K --] tag 225424 + patch retitle 225424 wwwconfig-common: Grant all privileges with mysql-createuser thanks Hi, Attached is a patch to do so. This changes the old mysql.{user,db} mangling with the proper and preferred mysql granting syntax. Therefore, it works with both mysql 3 and mysql4 (mysql3 has no seperate lock and temporary table permissions). It also added, compared to the current version, alter and index privileges. One could already do so by dropping and creating, alter & index is merely much more convenient and fast. Patch tested and it works-for-me(tm): - on mysql 4.0.16 (sarge) - on mysql 3.23.49 (woody) - tested with and without the user already existing --Jeroen wwwconfig-common-0.3.0/patches/bug-223309-modules-config.patch0000644000000000000000000000322011173250440020570 0ustar --- /usr/share/wwwconfig-common/apache-php.sh 2004-02-16 14:35:15.000000000 +0100 +++ apache-php.sh 2004-05-24 13:09:13.000000000 +0200 @@ -9,6 +9,8 @@ # o / */[[:space:]]*/ # 20020116 Ola Lundqvist # Documented the error variable. +# 20040525 Jeremy Laine +# Switched to modules-config. # Needs: $phpver - the php version to use. # $phpini - the php config file to use. # $server - the apache server to use, @@ -26,20 +28,16 @@ error="No php ini file to check for." elif [ ! -f $phpini ] ; then error="Php config file $phpini not found." +elif [ -z $(which modules-config) ] ; then + error="Could not find modules-config." else - phpverm=$phpver"_module" - if grep -e "^[[:space:]]*#[[:space:]]*LoadModule[[:space:]]\+$phpverm" /etc/$server/httpd.conf > /dev/null 2>&1; then - # Uncommenting - sed -e "s#\([[:space:]]*\)\#[[:space:]]\+\(LoadModule $phpverm\)#\1\2#" /etc/$server/httpd.conf > /etc/$server/httpd.conf.tmp - status=uncomment - if grep -e "^[[:space:]]*LoadModule[[:space:]]\+$phpverm" /etc/$server/httpd.conf.tmp >/dev/null 2>&1; then - # Uncomment successful. - cp /etc/$server/httpd.conf /etc/$server/httpd.conf.back >/dev/null 2>&1 - mv /etc/$server/httpd.conf.tmp /etc/$server/httpd.conf - else - # Uncomment unsuccessful. - status=error - rm /etc/$server/httpd.conf.tmp - fi + phpverm="mod_"$phpver + phpstatus=`modules-config $server query $phpverm || true` + if [ -z "$phpstatus" ] ; then + modules-config $server enable $phpverm + # Uncomment successful. + status=uncomment + else + status=nothing fi fi wwwconfig-common-0.3.0/patches/bug-217750-wwwconfig-common_mysql-createuser.patch0000644000000000000000000000110311173250440024543 0ustar --- mysql-createuser.sh.old 2003-10-26 06:27:26.000000000 -0500 +++ mysql-createuser.sh 2003-10-26 06:44:30.000000000 -0500 @@ -86,9 +86,9 @@ " - if ! eval $mysqlcmd -f mysql -e '"$script"' ; then + 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 + 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 wwwconfig-common-0.3.0/patches/bug-231186-make-mysql-exec.sh-work-for-nonadmins-too-more.patch0000644000000000000000000000350311173250440026565 0ustar From: Jeremy Date: Fri, 7 May 2004 17:50:06 +0200 Attached is a patch that fixes mysql-(create|drop)db.sh. I have tested it and it works fines. I don't really have any merit for this patch, I just did the same thing as Jeroen did for the mysql-*-exec scripts! I have purposefully not patched mysql-(create|drop)user.sh as the logic of those scripts is slightly different and they require some more thinking. Regards, Jeremy diff -ur /usr/share/wwwconfig-common/mysql-createdb.sh ./mysql-createdb.sh --- /usr/share/wwwconfig-common/mysql-createdb.sh 2004-02-16 14:35:15.000000000 +0100 +++ ./mysql-createdb.sh 2004-05-07 17:33:47.000000000 +0200 @@ -35,7 +35,7 @@ elif [ ! -x $(which mysql) ] ; then error="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 +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. diff -ur /usr/share/wwwconfig-common/mysql-dropdb.sh ./mysql-dropdb.sh --- /usr/share/wwwconfig-common/mysql-dropdb.sh 2004-02-16 14:35:15.000000000 +0100 +++ ./mysql-dropdb.sh 2004-05-07 17:34:22.000000000 +0200 @@ -33,7 +33,7 @@ elif [ ! -x $(which mysql) ] ; then error="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 +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. wwwconfig-common-0.3.0/patches/bug-224326-eval-mysqlfix.patch0000644000000000000000000000525511173250440020470 0ustar diff -urN wwwconfig-common-0.0.32~/mysql-dropdb.sh wwwconfig-common-0.0.32/mysql-dropdb.sh --- wwwconfig-common-0.0.32~/mysql-dropdb.sh 2003-08-31 13:30:26.000000000 +0200 +++ wwwconfig-common-0.0.32/mysql-dropdb.sh 2003-12-18 00:38:32.000000000 +0100 @@ -39,8 +39,8 @@ else if eval $mysqlcmd -f -e "\"show databases;\"" | grep -e "^$dbname" > /dev/null 2>&1 ; then log="${log}Droping database $dbname." - if $mysqlcmd -f -e "DROP DATABASE $dbname;" ; then - if $mysqlcmd -f -e "show databases;" | grep -e "^$dbname" > /dev/null 2>&1 ; then + 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 diff -urN wwwconfig-common-0.0.32~/mysql-dropuser.sh wwwconfig-common-0.0.32/mysql-dropuser.sh --- wwwconfig-common-0.0.32~/mysql-dropuser.sh 2003-08-31 13:30:26.000000000 +0200 +++ wwwconfig-common-0.0.32/mysql-dropuser.sh 2003-12-18 00:38:52.000000000 +0100 @@ -42,7 +42,7 @@ use: dpkg-reconfigure -plow packagename to reconfigure." else log="${log}Droping database user $dbuser." - if $mysqlcmd -f mysql -e "select User from user;" | grep $dbuser >/dev/null 2>&1 ; then + 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; diff -urN wwwconfig-common-0.0.32~/mysql-if-exec.sh wwwconfig-common-0.0.32/mysql-if-exec.sh --- wwwconfig-common-0.0.32~/mysql-if-exec.sh 2003-08-31 13:30:26.000000000 +0200 +++ wwwconfig-common-0.0.32/mysql-if-exec.sh 2003-12-18 00:35:27.000000000 +0100 @@ -49,7 +49,7 @@ 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 $mysqlcmd -f $dbname < $sqlfile > /dev/null 2>&1 ; then + if eval $mysqlcmd -f $dbname < $sqlfile > /dev/null 2>&1 ; then status=exec else status=execerror diff -urN wwwconfig-common-0.0.32~/mysql-ifnot-exec.sh wwwconfig-common-0.0.32/mysql-ifnot-exec.sh --- wwwconfig-common-0.0.32~/mysql-ifnot-exec.sh 2003-08-31 13:30:26.000000000 +0200 +++ wwwconfig-common-0.0.32/mysql-ifnot-exec.sh 2003-12-18 00:35:27.000000000 +0100 @@ -48,7 +48,7 @@ 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 $mysqlcmd -f $dbname < $sqlfile > /dev/null 2>&1 ; then + if eval $mysqlcmd -f $dbname < $sqlfile > /dev/null 2>&1 ; then status=exec else status=execerror wwwconfig-common-0.3.0/patches/pgsql-sudo-to-su.patchdescription0000644000000000000000000000304311173250440021754 0ustar Hi Ola, it is nice that you try to come up with the big and cool solution (splitting packages), but people keep getting bitten by this problem again and again, so we need a fix or workaround soon. I just spent two hours figuring out why phpgroupware wouldn't work after installation. It should be perfectly possible to use "su" instead of "sudo", just as su posgres -c "psql -d template1 -c ''" works just as well as sudo -u posgres psql -d template1 -c '' The problem is that "su" takes command and args as one single string, which we must assemble while getting the quoting right. Here is how to do it: pgsqlcmd() { _psql_args= while [ $# -gt 0 ] do _psql_args="$_psql_args '`echo \"$1\" | sed -e \"s/'/'\\\\\\''/g\"`'" shift done su $dbadmin -c "psql $hostopt $passopt $_psql_args" } pgsqlcmd=pgsqlcmd Just replace the line 'pgsqlcmd="sudo -u $dbadmin psql $hostopt $passopt"' with above code in /usr/share/wwwconfig-common/pgsql.get, and the problem is solved, phpgroupware installs fine and database and user are created. Yes, this solution may look strange, but is perfectly normal and portable Bourne shell programming. I have tested it with bash, ash, and pdksh. Best regards, Arndt PS: There is a small typo in /var/lib/dpkg/info/phpgroupware.config; line 60 has "flase" instead of "false". I think this issue is too small to file a full blown bug report for it. -- Arndt Schönewald , Software Developer Quelltext AG (http://www.quelltext-ag.de), Dortmund, Germany wwwconfig-common-0.3.0/patches/bug-205585-mysql-createdb.sh.author0000644000000000000000000000035011173250440021414 0ustar Nikolai Prokoschenko The script mysql-createdb.sh uses a buggy routine to determine whether a database exists. It is wrong in cases where db_200 and db_201 exist and db_2 is to be created. Patch attached. wwwconfig-common-0.3.0/AUTHORS0000644000000000000000000000241111173250440012743 0ustar 2000-2006,2008 Ola Lundqvist Main author and maintainer. 2008 Norman Messtorff Support for webserver conf.d handling. 2008 Bryan McLellan Correction for hostopt in mysql.get file. 2008 Morten Werner Forsbring Support for postgres 8.X. 2006 Frederic Schutz Restart fix. 2005 Christoph Martin Fixes for pgsql. 2004 Hilko Bengen Help with pgsql support. 2004 Jeremy Lainé Mysql and apache changes. 2003 Loic Dachary (OuoU) Changes in database manipulation. 2003 Jeroen van Wolffelaar Mysql changes. 2003 Benoit Joly Mysql changes. 2003 Thomas Viehmann Contributed with a patch so mysql calls are prefixed with eval. 2002 Stephen R. Darragh Fix to tell if apache configuration is not found. 2002 Arndt Schönewald Removed sudo dependency for postgres setup. 2001 Luca De Vitis Extra fatures for mysql, apache, pgsql and exim support. I might have missed someone here. The patches directory contains code that people have contributed with. wwwconfig-common-0.3.0/pgsql-dropuser.sh0000755000000000000000000000441211173250441015225 0ustar #!/bin/sh # File: pgsql-dropuser.sh # Changes: # 20010224 Luca De Vitis # 20020116 Ola Lundqvist # Documented the error variable. # 20041002 Raphaël 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 wwwconfig-common-0.3.0/exim-trust.sh0000755000000000000000000000254411173250440014362 0ustar #!/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 wwwconfig-common-0.3.0/apache-include.sh0000755000000000000000000000255211173250441015103 0ustar #!/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 wwwconfig-common-0.3.0/apache-addtype_all.sh0000755000000000000000000000473211173250441015744 0ustar #!/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 wwwconfig-common-0.3.0/apache-index_all.sh0000755000000000000000000000247211173250441015420 0ustar #!/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 wwwconfig-common-0.3.0/apache-index.sh0000755000000000000000000000262511173250441014570 0ustar #!/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 wwwconfig-common-0.3.0/pgsql-ifnot-exec.sh0000755000000000000000000000410011173250441015415 0ustar #!/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 wwwconfig-common-0.3.0/apache-uncominclude.sh0000755000000000000000000000252411173250441016144 0ustar #!/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 wwwconfig-common-0.3.0/apache-uninclude.sh0000755000000000000000000000231411173250441015442 0ustar #!/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 wwwconfig-common-0.3.0/pgsql-exec.sh0000755000000000000000000000356311173250441014314 0ustar #!/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 wwwconfig-common-0.3.0/php-extensions.sh0000755000000000000000000000173511173250440015226 0ustar #!/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 wwwconfig-common-0.3.0/php.get0000644000000000000000000000151311173250440013165 0ustar # 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} wwwconfig-common-0.3.0/apache-php.sh0000755000000000000000000000320611173250440014243 0ustar #!/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 wwwconfig-common-0.3.0/pgsql-createdb.sh0000755000000000000000000000432611173250441015137 0ustar #!/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 wwwconfig-common-0.3.0/pgsql.get0000644000000000000000000000446011173250441013531 0ustar # 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 Schönewald # Changed so that sudo is no longer needed. Patch description # and code from Arndt Schönewald. # This really solves a big issue with wwwconfig-common. # 20020926 Ola Lundqvist # Arndt Schönewald # Minor fix from Arndt Schönewald 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 wwwconfig-common-0.3.0/apache-include-postrm.sh0000755000000000000000000000346111173250441016425 0ustar #!/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 wwwconfig-common-0.3.0/pgsql-if-exec.sh0000755000000000000000000000410711173250441014703 0ustar #!/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 wwwconfig-common-0.3.0/apache-uninclude_all.sh0000755000000000000000000000244611173250441016300 0ustar #!/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 wwwconfig-common-0.3.0/mysql-exec.sh0000755000000000000000000000414111173250441014324 0ustar #!/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 wwwconfig-common-0.3.0/apache.func0000644000000000000000000000201311173250441013770 0ustar # 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 } wwwconfig-common-0.3.0/autopatch_all.sh0000755000000000000000000000166611173250440015065 0ustar #!/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 wwwconfig-common-0.3.0/mysql-localadmpass.get0000644000000000000000000000351411173250441016210 0ustar # 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 wwwconfig-common-0.3.0/pgsql-nextsysid.get0000644000000000000000000000176311173250440015563 0ustar # 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 wwwconfig-common-0.3.0/mysql-dropuser.sh0000755000000000000000000000465311173250440015252 0ustar #!/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 wwwconfig-common-0.3.0/apache-include_all.sh0000755000000000000000000000351511173250440015732 0ustar #!/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 wwwconfig-common-0.3.0/pgsql-userpass.get0000644000000000000000000000162711173250441015376 0ustar # 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 wwwconfig-common-0.3.0/mysql-createdb.sh0000755000000000000000000000462611173250441015161 0ustar #!/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 wwwconfig-common-0.3.0/restart.sh0000755000000000000000000000453411173250441013727 0ustar #!/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 wwwconfig-common-0.3.0/pgsql-allowip.sh0000755000000000000000000000605411173250440015034 0ustar #!/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 wwwconfig-common-0.3.0/apache-run.get0000644000000000000000000000141311173250441014421 0ustar # 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 wwwconfig-common-0.3.0/apache-cominclude_all.sh0000755000000000000000000000252211173250440016426 0ustar #!/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