From f10812d6f1fac19badf1995711f41b4176d3111a Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 24 Jul 2007 18:40:20 +0000 Subject: [PATCH] Monotone-Parent: c3db91d7b98f4667ce24b3d38e6bd68d32909d57 Monotone-Revision: 7a08a009eef1e22acab77456f11e9b7e9d384c32 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-07-24T18:40:20 Monotone-Branch: ca.inverse.sogo --- Scripts/sogo | 50 -------------------------- Scripts/sogo-init.d-debian | 21 +++++++++++ Scripts/sogo-init.d-redhat | 21 +++++++++++ Scripts/sogod-0.9 | 22 +++++++++++- Scripts/sql-update-20070724.sh | 65 ++++++++++++++++++++++++++++++++++ 5 files changed, 128 insertions(+), 51 deletions(-) delete mode 100755 Scripts/sogo create mode 100755 Scripts/sql-update-20070724.sh diff --git a/Scripts/sogo b/Scripts/sogo deleted file mode 100755 index 5514064ae..000000000 --- a/Scripts/sogo +++ /dev/null @@ -1,50 +0,0 @@ -#! /bin/sh - -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin - -DAEMON=/usr/local/sbin/sogod-0.9 -NAME=sogo -DESC="Scalable OpenGroupware.Org" - -PIDFILE=/var/run/sogo/sogod.pid - -SOGO_ARGS="" - -if [ -f /etc/default/sogo ]; then - . /etc/default/sogo -fi - -test -x $DAEMON || exit 0 - -#set -e - -case "$1" in - start) - echo -n "Starting $DESC: " - start-stop-daemon -c sogo --pidfile $PIDFILE \ - -b --start --quiet --exec $DAEMON - echo "$NAME." - ;; - stop) - echo -n "Stopping $DESC: " - killall sogod-0.9 2> /dev/null - rm -f $PIDFILE - echo "$NAME." - ;; - restart|force-reload) - echo -n "Restarting $DESC: " - killall sogod-0.9 2> /dev/null - rm -f $PIDFILE - sleep 1 - start-stop-daemon -c sogo --pidfile $PIDFILE \ - -b --start --quiet --exec $DAEMON - echo "$NAME." - ;; - *) - N=/etc/init.d/$NAME - echo "Usage: $N {start|stop|restart|force-reload}" >&2 - exit 1 - ;; -esac - -exit 0 diff --git a/Scripts/sogo-init.d-debian b/Scripts/sogo-init.d-debian index 2044a40ab..db2a939b0 100755 --- a/Scripts/sogo-init.d-debian +++ b/Scripts/sogo-init.d-debian @@ -1,5 +1,26 @@ #! /bin/sh +# SOGo init script for Debian GNU/Linux +# +# Copyright (C) 2007 Inverse groupe conseil +# +# Author: Wolfgang Sourdeau +# +# This file 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. +# +# This file 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; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + PATH=/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/sogod-0.9 diff --git a/Scripts/sogo-init.d-redhat b/Scripts/sogo-init.d-redhat index ad94d06bf..68ac60d78 100755 --- a/Scripts/sogo-init.d-redhat +++ b/Scripts/sogo-init.d-redhat @@ -1,5 +1,26 @@ #!/bin/bash + +# SOGo init script for RedHat # +# Copyright (C) 2007 Inverse groupe conseil +# +# Author: Wolfgang Sourdeau +# +# This file 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. +# +# This file 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; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + # sogod Scalable OpenGroupware.org (Inverse edition) # # chkconfig: - 85 15 diff --git a/Scripts/sogod-0.9 b/Scripts/sogod-0.9 index 99584cece..d2a326b2a 100755 --- a/Scripts/sogod-0.9 +++ b/Scripts/sogod-0.9 @@ -1,9 +1,29 @@ #!/bin/sh +# SOGo daemon wrapper +# +# Copyright (C) 2007 Inverse groupe conseil +# +# Author: Wolfgang Sourdeau +# +# This file 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. +# +# This file 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; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + PIDFILE=/var/run/sogo/sogod.pid . /usr/lib/GNUstep/System/Library/Makefiles/GNUstep.sh echo $$ > $PIDFILE exec $GNUSTEP_LOCAL_ROOT/Tools/sogod-0.9 >& /var/log/sogo/sogod.log - diff --git a/Scripts/sql-update-20070724.sh b/Scripts/sql-update-20070724.sh new file mode 100755 index 000000000..65bd6893d --- /dev/null +++ b/Scripts/sql-update-20070724.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +# this script only work with PostgreSQL, which at this time is the only +# database really supported by SOGo/SOPE + +defaultusername=$USER +defaulthostname=localhost +defaultdatabase=$USER + +read -p "Username ($defaultusername): " username +read -p "Hostname ($defaulthostname): " hostname +read -p "Database ($defaultdatabase): " database + +if [ -z "$username" ] +then + username=$defaultusername +fi +if [ -z "$hostname" ] +then + hostname=$defaulthostname +fi +if [ -z "$database" ] +then + database=$defaultdatabase +fi + +echo "" +echo "You will now be requested your password thrice..." +echo "After that, a list of SQL operations will scroll." +echo "" + +sqlscript="" + +function renameFields() { + oldIFS="$IFS" + IFS=" " + set $fields + for field in $@ + do + part="`echo -e \"ALTER TABLE $table RENAME $field TO c_${field};\\n\"`"; + sqlscript="$sqlscript$part" + done + IFS="$oldIFS" +} + +table=sogo_user_profile +fields="uid defaults settings" +renameFields + +fields="uid startdate enddate cycleenddate title cycleinfo participants isallday iscycle classification status priority isopaque location orgmail partmails partstates sequence component" +tables=`psql -U $username -h $hostname $database -c "select split_part(c_quick_location, '/', 5) from sogo_folder_info where c_folder_type ilike 'Appointment';" | grep _quick` +for table in $tables; +do + renameFields +done + +fields="givenname cn sn l mail o ou telephonenumber screenname" +tables=`psql -U $username -h $hostname $database -c "select split_part(c_quick_location, '/', 5) from sogo_folder_info where c_folder_type ilike 'Contact';" | grep _quick` +for table in $tables; +do + renameFields +done + +sqlscript="$sqlscript;" +echo "$sqlscript" | psql -e -U $username -h $hostname $database