moved .deb install and update scripts into new iservchk script
authorRoland Hieber <devnull@localhost>
Sat, 6 Mar 2010 03:23:11 +0000 (04:23 +0100)
committerRoland Hieber <devnull@localhost>
Sat, 6 Mar 2010 03:23:11 +0000 (04:23 +0100)
debian/changelog
debian/postinst [deleted file]
debian/postrm
debian/prerm [deleted file]
debian/rules
iservchk/99errorreporter [new file with mode: 0644]
maint/update-config-from-iserv1.sh [new file with mode: 0755]
maint/update-config.sh [deleted file]
maint/update-database.php [new file with mode: 0755]
maint/update.php [deleted file]

index ad24523..35c6d8c 100644 (file)
@@ -1,3 +1,10 @@
+iserv-mod-error-reporter (10.03.06-1) testing; urgency=low
+
+  * Non-maintainer upload.
+  * test 
+
+ -- Roland Hieber (Package Signing Key) <roland.hieber@wilhelm-gym.net>  Sat, 06 Mar 2010 03:59:20 +0100
+
 iserv-mod-error-reporter (10.03.05-1) testing; urgency=low
 
   * fixed SQL rights for groups table (Warning: db_query(): ERROR: permission 
diff --git a/debian/postinst b/debian/postinst
deleted file mode 100644 (file)
index 8c50428..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-touch /usr/share/iserv/www/inc/mod_error-reporter/config.inc
-chmod g+w /usr/share/iserv/www/inc/mod_error-reporter/config.inc
-chgrp www-data /usr/share/iserv/www/inc/mod_error-reporter/config.inc
-# better let update.php do it because chkdb instantly drops old fields
-# chkdb -r
-chkpriv
-chklocale
-# run update script
-export PGDATABASE=iserv
-export PGUSER=postgres
-php /usr/share/iserv/modules/error-reporter/update.php
-#DEBHELPER#
index 4fdf0ba..e9338c4 100755 (executable)
@@ -1,9 +1,5 @@
 #!/bin/sh
-psql -c "DELETE FROM log_module WHERE module='Error Report Assistant';"
-chklocale
-
 #DEBHELPER#
-
 if [ "$1" = "purge" ]; then
   echo
   echo If you do not need the SQL tables anymore, remove them by running
diff --git a/debian/prerm b/debian/prerm
deleted file mode 100755 (executable)
index e912711..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-if [ "$1" = "purge" ]; then
-  rm -f /usr/share/iserv/www/inc/mod_error-reporter/config.inc
-fi;
-
-#DEBHELPER#
index e8b4a1d..55b5eb3 100755 (executable)
@@ -8,13 +8,11 @@ build:
 binary-indep: 
        [ ! -f Makefile ] || $(MAKE) clean
        dh_clean
-
        dh_testdir
        dh_testroot
        dh_clean -k 
        dh_installdirs
        $(MAKE) DESTDIR=$(CURDIR)/debian/iserv-mod-error-reporter install
-
        # we rather install the documentation via dh_installdocs
        rm -rf $(CURDIR)/debian/iserv-mod-error-reporter/usr/share/doc/iserv-mod-error-reporter
        dh_testdir
diff --git a/iservchk/99errorreporter b/iservchk/99errorreporter
new file mode 100644 (file)
index 0000000..7521b60
--- /dev/null
@@ -0,0 +1,7 @@
+Test 'import configuration from IServ 1' 
+  '[ ! -f /old/opt/iserv/idesk/inc/error-reporter/config.inc.rpmsave ]'
+  /usr/share/iserv/modules/error-reporter/update-config-from-iserv1.sh
+
+Test 'update old config'
+  '[ ! -f /usr/share/iserv/www/inc/mod_error-reporter/config.inc ]'
+  /usr/share/iserv/modules/error-reporter/update-config
diff --git a/maint/update-config-from-iserv1.sh b/maint/update-config-from-iserv1.sh
new file mode 100755 (executable)
index 0000000..7779e76
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash
+# called from iservchk if old config exists
+OLDCFG=/old/opt/iserv/idesk/inc/error-reporter/config.inc.rpmsave
+NEWCFG=/usr/share/iserv/www/inc/mod_error-reporter/config.inc
+
+touch $NEWCFG || exit 1;
+chmod u+wr $NEWCFG || exit 1;
+chown www-data $NEWCFG || exit 1;
+
+# filter unused options
+cat $OLDCFG|grep -v setAdminGroups|grep -v setLog|grep -v @package > $NEWCFG
+
+# convert admin groups to group privileges
+ADMGROUPS=$(grep setAdminGroups $OLDCFG|sed -e 's/,//g' -e "s/.*array[^(]*(\([^)]*\)).*/\1/" -e "s/[\"\']/ /g")
+for i in $ADMGROUPS; do
+  psql -c "INSERT INTO privileges_assign (act,privilege) VALUES('$i','mod_errorreporter_admin');" > /dev/null || exit 1;
+  echo "added adminship for group '$i'"
+done;
+
+rm -f $OLDCFG || (echo "Error: Please remove the old config file by hand!" && exit 1);
diff --git a/maint/update-config.sh b/maint/update-config.sh
deleted file mode 100755 (executable)
index 6b6f324..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-OLDCFG=/old/opt/iserv/idesk/inc/error-reporter/config.inc.rpmsave
-NEWCFG=/usr/share/iserv/www/inc/mod_error-reporter/config.inc
-
-if [ ! -e "$OLDCFG" ]; then
-  echo "$OLDCFG does not exist."
-  exit 1;
-fi;
-
-touch $NEWCFG || exit 1;
-chmod u+wr $NEWCFG || exit 1;
-chown www-data $NEWCFG || exit 1;
-
-# filter unused options
-cat $OLDCFG|grep -v setAdminGroups|grep -v setLog|grep -v @package > $NEWCFG
-
-# convert admin groups to group privileges
-ADMGROUPS=$(grep setAdminGroups $OLDCFG|sed -e 's/,//g' -e "s/.*array[^(]*(\([^)]*\)).*/\1/" -e "s/[\"\']/ /g")
-for i in $ADMGROUPS; do
-  psql -c "INSERT INTO privileges_assign (act,privilege) VALUES('$i','mod_errorreporter_admin');" > /dev/null || exit 1;
-  echo "added adminship for group '$i'"
-done;
-
-rm -f $OLDCFG || (echo "Error: Please remove the old config file by hand!" && exit 1);
diff --git a/maint/update-database.php b/maint/update-database.php
new file mode 100755 (executable)
index 0000000..2669c3f
--- /dev/null
@@ -0,0 +1,79 @@
+#!/usr/bin/php
+<?php
+/**
+ * @file update.php
+ * Perform the update operations like renaming SQL tables
+ * @author Roland Hieber (roland.hieber@wilhelm-gym.net)
+ * @date 23.10.2007
+ * 
+ * Copyright © 2007 Roland Hieber
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *  
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* this file is run by iservchk */
+require_once("/usr/share/iserv/www/inc/quote.inc");
+require_once("/usr/share/iserv/www/inc/db.inc");
+
+function doSql($cmd, $quiet = false) {
+  $i = 0;
+  $a = array();
+  $cmd = "psql -c ".qs($cmd);
+  $cmd = ($quiet) ? $cmd . ">/dev/null 2>&1" : $cmd;
+  exec($cmd, $a, $i);
+  return ($i == 0);
+}
+function printSql($cmd) { echo $cmd."\n"; return doSql($cmd); }
+function tableExists($table) {
+  return doSql("SELECT * FROM $table", tnue);
+}
+function columnExists($table, $col) {
+  return (doSql("SELECT $col FROM $table", true) and tableExists($table));
+}
+
+if(isset($_SERVER["REMOTE_ADDR"])) {
+  die("Run this script as root from the command line.");
+}
+
+/*** database schema updates **************************************************/
+echo "updating database schema... \n";
+
+/** table from pre-3.0 **/
+if(tableExists("errors") and !columnExists("errors", "pclabel")) {
+  printSql("ALTER TABLE errors RENAME COLUMN pc_number TO pclabel;");
+}
+
+/** table from 3.0 **/
+if(tableExists("errors") and !columnExists("errors", "pclabel")) {
+  printSql("INSERT INTO mod_errorreporter (er_date,er_act,er_machine,er_text,".
+    "er_comment,er_commentact,er_hidden) SELECT date,name,pclabel,text,".
+    "comment,commentby,hidden FROM errors;");
+  printSql("DROP TABLE errors;");
+}
+
+/** table from 4.0 **/
+if(tableExists("errorreports")) {
+  printSql("INSERT INTO mod_errorreporter (er_date,er_act,er_machine,er_text,".
+    "er_comment,er_commentact,er_hidden) SELECT er_date,er_act,er_machine,".
+    "er_text,er_comment,er_commentact,er_hidden FROM errorreports;"); 
+  printSql("DROP TABLE errorreports;");
+}
+
+echo "done.\n";
+?>
diff --git a/maint/update.php b/maint/update.php
deleted file mode 100644 (file)
index 8e31289..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-/**
- * @file update.php
- * Perform the update operations like renaming SQL tables
- * @author Roland Hieber (roland.hieber@wilhelm-gym.net)
- * @date 23.10.2007
- * 
- * Copyright © 2007 Roland Hieber
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- * 
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *  
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-require_once("/usr/share/iserv/www/inc/quote.inc");
-require_once("/usr/share/iserv/www/inc/db.inc");
-
-function doSql($cmd, $quiet = false) {
-  $i = 0;
-  $a = array();
-  $cmd = "psql -c ".qs($cmd);
-  $cmd = ($quiet) ? $cmd . ">/dev/null 2>&1" : $cmd;
-  exec($cmd, $a, $i);
-  return ($i == 0);
-}
-function printSql($cmd) { echo $cmd."\n"; return doSql($cmd); }
-function tableExists($table) {
-  return doSql("SELECT * FROM $table", tnue);
-}
-function columnExists($table, $col) {
-  return (doSql("SELECT $col FROM $table", true) and tableExists($table));
-}
-
-if(isset($_SERVER["REMOTE_ADDR"])) {
-  die("Run this script as root from the command line.");
-}
-
-/*** Generic update tasks *****************************************************/
-
-/** 8.08.07 **/
-$sOldCfg = "/old/opt/iserv/idesk/inc/error-reporter/config.inc.rpmsave";
-$sNewCfg = "/usr/share/iserv/www/inc/mod_error-reporter/config.inc";
-if(is_file($sOldCfg)) {
-  echo "taking over old config file... ";
-  exec("/usr/share/iserv/modules/error-reporter/update-config.sh", $a, $i);
-  if($i != 0) {
-    die();
-  }
-  echo "done.\n";
-}
-
-/*** database schema updates***************************************************/
-echo "updating database schema... \n";
-if(!tableExists("mod_errorreporter")) {
-  passthru("chkdb -r");
-}
-
-/** table from pre-3.0 **/
-if(tableExists("errors") and !columnExists("errors", "pclabel")) {
-  printSql("ALTER TABLE errors RENAME COLUMN pc_number TO pclabel;");
-}
-
-/** table from 3.0 **/
-if(tableExists("errors") and !columnExists("errors", "pclabel")) {
-  printSql("INSERT INTO mod_errorreporter (er_date,er_act,er_machine,er_text,".
-    "er_comment,er_commentact,er_hidden) SELECT date,name,pclabel,text,".
-    "comment,commentby,hidden FROM errors;");
-  printSql("DROP TABLE errors;");
-}
-
-/** table from 4.0 **/
-if(tableExists("errorreports")) {
-  printSql("INSERT INTO mod_errorreporter (er_date,er_act,er_machine,er_text,".
-    "er_comment,er_commentact,er_hidden) SELECT er_date,er_act,er_machine,".
-    "er_text,er_comment,er_commentact,er_hidden FROM errorreports;"); 
-  printSql("DROP TABLE errorreports;");
-}
-
-echo "done.\n";
-?>
This page took 0.052734 seconds and 4 git commands to generate.