From: ivan Date: Tue, 8 Apr 2008 05:49:11 +0000 (+0000) Subject: debian packages! X-Git-Tag: root_of_webpay_support~732 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=207515697bfcc93b03227ea0b581b15cf89b1fbc debian packages! --- diff --git a/debian/README.Debian b/debian/README.Debian index b51eee8d5..829b543e4 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -1,6 +1,25 @@ -freeside for Debian +Freeside for Debian ------------------- - +1. +Edit /etc/apache2/envvars or /etc/apache2/apache2.conf and set User and Group +to freeside - -- Ivan Kohler , Thu, 12 Apr 2001 15:49:17 -0700 +2. +/etc/init.d/apache2 restart + +3. +Create one or more Freeside users (your internal sales/tech folks, not customer accounts): +$ su +# su freeside +$ freeside-adduser -g 1 desired_username +$ htpasswd /etc/freeside/htpasswd username +(enter password) + +4. +Go to http://your.host.name/freeside and log in. + +Optional but recommended. +(Hopefully) get an SSL certificate setup and change that to https:// + + -- Ivan Kohler Wed, 02 Apr 2008 01:46:20 -0700 diff --git a/debian/TODO b/debian/TODO new file mode 100644 index 000000000..15fed6914 --- /dev/null +++ b/debian/TODO @@ -0,0 +1,38 @@ + +test) freeside-webui /etc/apache/conf.d/freeside.conf + AuthUserFile is wrong (just fucked) + +test its working) somes sort of Alias /freeside /usr/share/freeside/www is needed + +test in postinst) freeside package var/cache/freeside/cache. + +test RT is missing. doh. get it working. + +test actually installing! + +--- rc2... right? --- + +freeside-selfservice-client doesn't install at all + +start freeside-sqlradius-radacctd from /etc/default/freeside too + +Added to README.Debian... do something else? +Ensure apache is set to run as User freeside. + +init script doesn't need to add /usr/local/bin. could start over from +init.d.ex or init.d.lsb.ex + +finish + +RT install locations (or for now: disable for unstable, enable for +experiemental. but try to get it finished off in time for lenny) + +debian/copyright administrivia + +AGPL drama + +upload + +AGPL drama or silent waiting for days or years + +profit! err diff --git a/debian/changelog b/debian/changelog index d8283b5d9..d53e90e84 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,6 @@ -freeside (1.4.1-1) unstable; urgency=low +freeside (1.9.0~cvs0-1) unstable; urgency=low - * Initial Release. + * Initial release - -- Ivan Kohler Thu, 12 Apr 2001 15:49:17 -0700 + -- Ivan Kohler Wed, 02 Apr 2008 01:46:20 -0700 -Local variables: -mode: debian-changelog -End: diff --git a/debian/compat b/debian/compat new file mode 100644 index 000000000..7ed6ff82d --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/conffiles.ex b/debian/conffiles.ex deleted file mode 100644 index 8686d2af8..000000000 --- a/debian/conffiles.ex +++ /dev/null @@ -1,7 +0,0 @@ -# -# If you want to use this conffile, remove all comments and put files that -# you want dpkg to process here using their absolute pathnames. -# See section 9.1 of the packaging manual. -# -# for example: -# /etc/freeside/freeside.conf diff --git a/debian/config b/debian/config new file mode 100644 index 000000000..4ffa236f3 --- /dev/null +++ b/debian/config @@ -0,0 +1,19 @@ +#!/bin/sh +# config script for freeside + +set -e + +# source debconf stuff +. /usr/share/debconf/confmodule + +# source dbconfig-common shell library, and call the hook function +if [ -f /usr/share/dbconfig-common/dpkg/config ]; then + # we support mysql and pgsql + dbc_dbtypes="pgsql, mysql" + + # source dbconfig-common stuff + . /usr/share/dbconfig-common/dpkg/config + dbc_go freeside $@ +fi + +# ... rest of your code ... diff --git a/debian/control b/debian/control index d7873b228..a8552a285 100644 --- a/debian/control +++ b/debian/control @@ -1,59 +1,59 @@ Source: freeside -Section: admin -Priority: optional +Section: misc +Priority: extra Maintainer: Ivan Kohler -Build-Depends: debhelper (>> 3.0.0) -Standards-Version: 3.5.2 +Build-Depends: debhelper (>= 5), perl (>= 5.8) +Standards-Version: 3.7.2 +Homepage: http://www.freeside.biz/freeside +Vcs-Browser: http://www.freeside.biz/cgi-bin/viewvc.cgi/freeside/ +Vcs-Cvs: :pserver:anonymous:anonymous@cvs.420.am:/home/cvs/cvsroot freeside Package: freeside -Architecture: any -Depends: freeside-lib -Recommends: freeside-doc, freeside-ui-web -Suggests: freeside-selfservice-server -Description: Billing and administration package for ISPs. - Freeside is a billing and account administration package for ISPs. It stores - customer information in an SQL database, and will update UNIX passwd and - shadow files, RADIUS users file and SQL databases, and configuration for - sendmail, qmail, BIND and/or Apache. It is also useful as a central database - of accounts/domains/web-space for a large number of machines. - -Package: freeside-doc Architecture: all -Description: Documentation for freeside - This package provides the HTML documentation for Freeside, a billing and - account administration package for ISPs. +Pre-Depends: freeside-lib, dbconfig-common +Depends: ${perl:Depends}, ${shlibs:Depends}, ${misc:Depends}, freeside-webui, debconf, adduser (>= 3.11) +Recommends: cron +Suggests: gnupg +Description: Billing and trouble ticketing for service providers + Freeside is a web-based billing and trouble ticketing application. It + includes features for ISPs, hosting providers, and VoIP providers, but can + also be used as a generic customer database, invoicing and membership + application. If you like buzzwords, call it an "BSS/OSS and CRM solution". Package: freeside-lib Architecture: all -Depends: libmime-base64-perl, libdigest-md5-perl, liburi-perl, libhtml-tagset-perl, libhtml-parser-perl, libnet-perl, liblocale-codes-perl, libnet-whois-perl, libwww-perl, libbusiness-creditcard-perl, libmailtools-perl, libtimedate-perl, libdate-manip-perl, libfile-counterfile-perl, libfreezethaw-perl, libtext-template-perl, libdbd-pg-perl, libdbix-datasource-perl, libdbix-dbschema-perl, libnet-ssh-perl, libnet-scp-perl, libapache-asp-perl, libtie-ixhash-perl, libtime-duration-perl, libhtml-widgets-selectlayers-perl, libstorable-perl, libapache-dbi-perl -Description: Freeside libraries and extension API - This package contains the libraries which implement the business logic and - backend functions of Freeside, a billing and account administration package - for ISPs. This package also contains the manual pages for the library API. - (? like a libmodule-perl package) - -Package: freeside-ui-web -Architecture: all -Depends: libhtml-mason-perl, libstring-approx-perl, freeside-lib, libapache-mod-perl|apache-perl -Suggests: libapache-mod-ssl|apache-ssl -Description: Easy-to-use web interface for Freeside - This package contains the web interface for Freeside, a billing and account - administration package for ISPs. This is what sales or support folks will - typically use to add new accounts, edit exiting accounts and so on. +Depends: ghostscript | gs-gpl, gsfonts, tetex-base, tetex-bin, libbusiness-creditcard-perl, libcache-cache-perl, libcache-simple-timedexpiry-perl, libclass-returnvalue-perl, libcrypt-passwdmd5-perl, libdate-manip-perl, libdbd-pg-perl | libdbd-mysql-perl, libdbi-perl, libdbix-dbschema-perl (>= 0.35), libdbix-searchbuilder-perl, libdigest-sha1-perl, libfile-counterfile-perl, libfile-rsync-perl, libfrontier-rpc-perl, libhtml-format-perl, libhtml-tree-perl, libipc-run3-perl, libipc-sharelite-perl, liblingua-en-nameparse-perl, liblocale-maketext-fuzzy-perl, liblocale-maketext-lexicon-perl, liblocale-subcountry-perl, liblog-dispatch-perl, libmailtools-perl (>= 2), libmime-perl (>= 5.424) | libmime-perl (< 5.421), libnet-scp-perl, libnet-ssh-perl, libnet-whois-raw-perl, libnetaddr-ip-perl, libnumber-format-perl, libregexp-common-perl, libstring-approx-perl, libstring-shellquote-perl, libterm-readkey-perl, libtest-inline-perl, libtext-autoformat-perl, libtext-csv-perl, libtext-template-perl, libtext-wrapper-perl, libtie-ixhash-perl, libtime-duration-perl, libtime-modules-perl, libtimedate-perl, libuniversal-require-perl, liburi-perl, libwant-perl, libwww-perl +Recommends: libdbd-pg-perl, libdbd-mysql-perl, rsync +Suggests: libbusiness-onlinepayment-perl +Description: Libraries for Freeside billing and trouble ticketing + Freeside is a web-based billing and trouble ticketing application. + . + This package provides the perl libraries and command line utilities. -Package: freeside-selfservice-server -Architecture: all -Depends: freeside-lib, libnet-ssh-perl, ssh -Description: - This package contains the server side of the customer self-service interface. - It is installed on a private backend machine, and opens an outgoing ssh - connection to one or more public web server(s). +#Package: freeside-bin +#Architecture: all +#Depends: freeside-lib +#Description: Command line tools for Freeside billing and trouble ticketing +# Freeside is a web-based billing and trouble ticketing application. +# . +# This package provides the command-line utilities. -Package: freeside-selfservice-client +Package: freeside-webui Architecture: all -Depends: libstorable-perl, libhttp-browserdetect-perl, libbusiness-creditcard-perl, ssh -Description: - This package contains the client side of the customer self-service interface. - It is typically installed on a public webserver and interfaces with - freeside-selfservice-server installed on a private backend machine. +Depends: freeside-lib, apache2, libapache2-mod-perl2, libapache2-request-perl, libapache-session-perl, libchart-perl, libcolor-scheme-perl, libdatetime-perl, libdatetime-format-strptime-perl, libgd-gd2-noxpm-perl | libgd-gd2-perl, libgd-graph-perl, libhtml-mason-perl, libhtml-scrubber-perl, libhtml-widgets-selectlayers-perl, libio-stringy-perl, libjson-perl, liblingua-en-inflect-perl, libmodule-versions-report-perl, libspreadsheet-writeexcel-perl, libtree-simple-perl, libyaml-perl +Recommends: libapache-dbi-perl +Description: Web interface for Freeside billing and trouble ticketing + Freeside is a web-based billing and trouble ticketing application. + . + This package provides the web interface for employees. +#Package: freeside-selfservice-client +#Architecture: all +#Description: End-customer interface to Freeside billing and trouble ticketing +# Freeside is a web-based billing and trouble ticketing application. +# . +# This package provides customer signup and self-service web interfaces and +# XML-RPC, PHP and Perl APIs. +# . +# In production use, this package is typically installed on a public web server, +# separate from the rest of the freeside-* packages. diff --git a/debian/copyright b/debian/copyright index e148fcec5..c409cb99e 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,10 +1,45 @@ This package was debianized by Ivan Kohler on -Thu, 12 Apr 2001 15:49:17 -0700. +Wed, 02 Apr 2008 01:46:20 -0700. -It was downloaded from +It was downloaded from -Upstream Author(s): +Upstream Author(s): -Copyright: + Freeside Internet Services, Inc. + +Copyright: + +Copyright (C) 2005-2008 Freeside Internet Services, Inc. +Copyright (C) 2000-2005 Ivan Kohler +Copyright (C) 1999 Silicon Interactive Software Design +All rights reserved + +before uploading to debian proper: + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This package 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU Affero General +Public License may someday be found in `/usr/share/common-licenses/AGPL'. +Until then, you can find it in `/usr/share/doc/freeside/AGPL'. + +The Debian packaging is (C) 2008, Ivan Kohler and +is licensed under the AGPL, see above. + +before uploading to debian proper, from httemplate/docs/license.html: +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. - diff --git a/debian/cron.d b/debian/cron.d new file mode 100644 index 000000000..f86db1b76 --- /dev/null +++ b/debian/cron.d @@ -0,0 +1,4 @@ +# +# Regular cron jobs for the freeside package +# +0 0 * * * freeside /usr/bin/freeside-daily fs_daily diff --git a/debian/cron.d.ex b/debian/cron.d.ex deleted file mode 100644 index 61c074da3..000000000 --- a/debian/cron.d.ex +++ /dev/null @@ -1,4 +0,0 @@ -# -# Regular cron jobs for the freeside package -# -0 4 * * * root freeside_maintenance diff --git a/debian/dbconfig-common.install b/debian/dbconfig-common.install new file mode 100644 index 000000000..31b5d1439 --- /dev/null +++ b/debian/dbconfig-common.install @@ -0,0 +1,90 @@ +#!/bin/sh + +. /etc/dbconfig-common/freeside.conf + +DB_USER=$dbc_dbuser +DB_PASSWORD=$dbc_dbpass + +# -- can't find a better place to hook this in. dammit. + +[ "$dbc_dbtype" = "pgsql" ] && DB_TYPE=Pg +[ "$dbc_dbtype" = "mysql" ] && DB_TYPE=mysql +#XXX ask dbc about a remote database etc. +DATASOURCE=DBI:${DB_TYPE}:dbname=${dbc_dbname} + +#debian/rules +FREESIDE_CONF=/etc/freeside +FREESIDE_CACHE=/var/cache/freeside +#XXX huh? +FREESIDE_EXPORT=/var/spool/freeside +DEFAULT_CONF=/usr/share/freeside/default_conf + +#XXX this rather seriously needs proper debian-style config file handling. + +#shamelessly lifted from Makefile create-config target +[ -e ${FREESIDE_CONF} ] || install -d -o freeside ${FREESIDE_CONF} + +touch ${FREESIDE_CONF}/secrets +chown freeside ${FREESIDE_CONF}/secrets +chmod 600 ${FREESIDE_CONF}/secrets + +[ -s ${FREESIDE_CONF}/secrets ] || echo -e "${DATASOURCE}\n${DB_USER}\n${DB_PASSWORD}" >${FREESIDE_CONF}/secrets +chmod 600 ${FREESIDE_CONF}/secrets +chown freeside ${FREESIDE_CONF}/secrets + +#XXX yuck! this too! +[ -e /var/opt/freeside/rt/etc/RT_Config.pm.dbc ] || cp /var/opt/freeside/rt/etc/RT_Config.pm.dbc.generic /var/opt/freeside/rt/etc/RT_Config.pm.dbc +perl -pi.generic -e "s/^\\s*Set\\s*\\(\s*\\\$DatabaseType.*\$/Set(\\\$DatabaseType, '$DB_TYPE');/" /var/opt/freeside/rt/etc/RT_Config.pm.dbc +mv /var/opt/freeside/rt/etc/RT_Config.pm.dbc /var/opt/freeside/rt/etc/RT_Config.pm +perl -pi -e "\ + s'_DBC_DBUSER_'${dbc_dbuser}'g;\ + s'_DBC_DBPASS_'${dbc_dbpass}'g;\ + s'_DBC_DBNAME_'${dbc_dbname}'g;\ +" /var/opt/freeside/rt/etc/RT_Config.pm + +#dunno how to hook this in where i need it... +#dbc_generate_include="template:/var/opt/freeside/rt/etc/RT_Config.pm" +#dbc_generate_include_args="-o template_infile=/var/opt/freeside/rt/etc/RT_Config.pm.dbc" + +install -o freeside -d "${FREESIDE_CACHE}/counters.${DATASOURCE}" +install -o freeside -d "${FREESIDE_CACHE}/cache.${DATASOURCE}" +install -o freeside -d "${FREESIDE_EXPORT}/export.${DATASOURCE}" + +if [ ! -d "${FREESIDE_CONF}/conf.${DATASOURCE}" ] ; then #don't clobber conf +install -o freeside -d "${FREESIDE_CONF}/conf.${DATASOURCE}" +#cp conf/[a-z]* "${FREESIDE_CONF}/conf.${DATASOURCE}" +cp -i `ls -d ${DEFAULT_CONF}/[a-z]* | grep -v CVS` "${FREESIDE_CONF}/conf.${DATASOURCE}" #-i just in case +chown -R freeside "${FREESIDE_CONF}/conf.${DATASOURCE}" +fi + +# -- back to your regularly schedule program... go ahead, create the db + +DOMAIN=`dnsdomainname` +if [ "$DOMAIN" = "localdomain" ]; then #freeside needs a valid domain + DOMAIN='example.com' +fi + +# XXX this should probably be handled by the _install_... +# dpkg-statoverride or something +chown freeside /etc/freeside + +su freeside -c "/usr/bin/freeside-setup -d $DOMAIN" +su freeside -c '/usr/bin/freeside-adduser -g 1 fs_queue' +su freeside -c '/usr/bin/freeside-adduser -g 1 fs_daily' +su freeside -c '/usr/bin/freeside-adduser -g 1 fs_selfservice' +su freeside -c '/usr/bin/freeside-adduser -g 1 fs_upgrade' + +#RT paths are bunk for deb proper + +chown freeside /var/opt/freeside/rt/etc/RT_Config.pm + +su freeside -c "/var/opt/freeside/rt/sbin/rt-setup-database --dba '$DB_USER' --dba-password '$DB_PASSWORD' --action schema" + +su freeside -c '/var/opt/freeside/rt/sbin/rt-setup-database --action insert_initial' + +su freeside -c '/var/opt/freeside/rt/sbin/rt-setup-database --action insert --datafile /var/opt/freeside/rt/etc/initialdata' + +#XXX this totally doesn't belong here, but what the hey +chown -R freeside /var/cache/freeside/masondata + +exit 0 diff --git a/debian/dbconfig-common.upgrade b/debian/dbconfig-common.upgrade new file mode 100644 index 000000000..cae9adbfe --- /dev/null +++ b/debian/dbconfig-common.upgrade @@ -0,0 +1,3 @@ +#!/bin/sh +su freeside -c '/usr/bin/freeside-upgrade fs_upgrade' +#RT upgrade diff --git a/debian/dirs b/debian/dirs deleted file mode 100644 index ca882bbb7..000000000 --- a/debian/dirs +++ /dev/null @@ -1,2 +0,0 @@ -usr/bin -usr/sbin diff --git a/debian/docs b/debian/docs deleted file mode 100644 index 16636bd92..000000000 --- a/debian/docs +++ /dev/null @@ -1,3 +0,0 @@ -INSTALL -README -TODO diff --git a/debian/ex.doc-base.package b/debian/ex.doc-base.package deleted file mode 100644 index 2a055d199..000000000 --- a/debian/ex.doc-base.package +++ /dev/null @@ -1,22 +0,0 @@ -Document: freeside -Title: Debian freeside Manual -Author: -Abstract: This manual describes what freeside is - and how it can be used to - manage online manuals on Debian systems. -Section: unknown - -Format: debiandoc-sgml -Files: /usr/share/doc/freeside/freeside.sgml.gz - -Format: postscript -Files: /usr/share/doc/freeside/freeside.ps.gz - -Format: text -Files: /usr/share/doc/freeside/freeside.text.gz - -Format: HTML -Index: /usr/share/doc/freeside/html/index.html -Files: /usr/share/doc/freeside/html/*.html - - diff --git a/debian/freeside-doc.docs b/debian/freeside-doc.docs deleted file mode 100644 index 299950c58..000000000 --- a/debian/freeside-doc.docs +++ /dev/null @@ -1,2 +0,0 @@ -#DOCS# - diff --git a/debian/freeside-doc.files b/debian/freeside-doc.files deleted file mode 100644 index 299950c58..000000000 --- a/debian/freeside-doc.files +++ /dev/null @@ -1,2 +0,0 @@ -#DOCS# - diff --git a/debian/freeside-webui.links b/debian/freeside-webui.links new file mode 100644 index 000000000..7ca403074 --- /dev/null +++ b/debian/freeside-webui.links @@ -0,0 +1,4 @@ +etc/freeside/apache2/freeside-alias.conf etc/apache2/conf.d/freeside-alias.conf +etc/freeside/apache2/freeside-base2.conf etc/apache2/conf.d/freeside-base2.conf +etc/freeside/apache2/freeside-rt.conf etc/apache2/conf.d/freeside-rt.conf + diff --git a/debian/freeside.apache-alias.conf b/debian/freeside.apache-alias.conf new file mode 100644 index 000000000..fdd4340e9 --- /dev/null +++ b/debian/freeside.apache-alias.conf @@ -0,0 +1 @@ +Alias /freeside/ /usr/share/freeside/www/ diff --git a/debian/freeside.default b/debian/freeside.default new file mode 100644 index 000000000..eca030610 --- /dev/null +++ b/debian/freeside.default @@ -0,0 +1,12 @@ +# Defaults for freeside initscript +# sourced by /etc/init.d/freeside +# installed at /etc/default/freeside by the maintainer scripts + +# +# This is a POSIX shell fragment +# + +# Additional options that are passed to the Freeside startup scripts. +SELFSERVICE_MACHINES="" + +#start freeside-sqlradius-radacctd from here too, etc. diff --git a/debian/freeside.docs b/debian/freeside.docs new file mode 100644 index 000000000..e845566c0 --- /dev/null +++ b/debian/freeside.docs @@ -0,0 +1 @@ +README diff --git a/debian/init.d.ex b/debian/init.d.ex index 57910493a..2480f515d 100644 --- a/debian/init.d.ex +++ b/debian/init.d.ex @@ -4,35 +4,106 @@ # This file should be used to construct scripts for /etc/init.d. # # Written by Miquel van Smoorenburg . -# Modified for Debian GNU/Linux +# Modified for Debian # by Ian Murdock . +# Further changes by Javier Fernandez-Sanguino # -# Version: @(#)skeleton 1.8 03-Mar-1998 miquels@cistron.nl +# Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl # -# This file was automatically customized by dh-make on Thu, 12 Apr 2001 15:49:17 -0700 -PATH=/sbin:/bin:/usr/sbin:/usr/bin +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/freeside NAME=freeside DESC=freeside -test -f $DAEMON || exit 0 +test -x $DAEMON || exit 0 + +LOGDIR=/var/log/freeside +PIDFILE=/var/run/$NAME.pid +DODTIME=1 # Time to wait for the server to die, in seconds + # If this value is set too low you might not + # let some servers to die gracefully and + # 'restart' will not work + +# Include freeside defaults if available +if [ -f /etc/default/freeside ] ; then + . /etc/default/freeside +fi set -e +running_pid() +{ + # Check if a given process pid's cmdline matches a given name + pid=$1 + name=$2 + [ -z "$pid" ] && return 1 + [ ! -d /proc/$pid ] && return 1 + cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1` + # Is this the expected child? + [ "$cmd" != "$name" ] && return 1 + return 0 +} + +running() +{ +# Check if the process is running looking at /proc +# (works for all users) + + # No pidfile, probably no daemon present + [ ! -f "$PIDFILE" ] && return 1 + # Obtain the pid and check it against the binary name + pid=`cat $PIDFILE` + running_pid $pid $NAME || return 1 + return 0 +} + +force_stop() { +# Forcefully kill the process + [ ! -f "$PIDFILE" ] && return + if running ; then + kill -15 $pid + # Is it really dead? + [ -n "$DODTIME" ] && sleep "$DODTIME"s + if running ; then + kill -9 $pid + [ -n "$DODTIME" ] && sleep "$DODTIME"s + if running ; then + echo "Cannot kill $LABEL (pid=$pid)!" + exit 1 + fi + fi + fi + rm -f $PIDFILE + return 0 +} + case "$1" in start) echo -n "Starting $DESC: " - start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ - --exec $DAEMON - echo "$NAME." + start-stop-daemon --start --quiet --pidfile $PIDFILE \ + --exec $DAEMON -- $DAEMON_OPTS + if running then + echo "$NAME." + else + echo " ERROR." + fi ;; stop) echo -n "Stopping $DESC: " - start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \ + start-stop-daemon --stop --quiet --pidfile $PIDFILE \ --exec $DAEMON echo "$NAME." ;; + force-stop) + echo -n "Forcefully stopping $DESC: " + force_stop + if ! running then + echo "$NAME." + else + echo " ERROR." + fi + ;; #reload) # # If the daemon can reload its config files on the fly @@ -45,24 +116,40 @@ case "$1" in # start-stop-daemon --stop --signal 1 --quiet --pidfile \ # /var/run/$NAME.pid --exec $DAEMON #;; - restart|force-reload) + force-reload) # # If the "reload" option is implemented, move the "force-reload" # option to the "reload" entry above. If not, "force-reload" is - # just the same as "restart". - # - echo -n "Restarting $DESC: " + # just the same as "restart" except that it does nothing if the + # daemon isn't already running. + # check wether $DAEMON is running. If so, restart + start-stop-daemon --stop --test --quiet --pidfile \ + /var/run/$NAME.pid --exec $DAEMON \ + && $0 restart \ + || exit 0 + ;; + restart) + echo -n "Restarting $DESC: " start-stop-daemon --stop --quiet --pidfile \ /var/run/$NAME.pid --exec $DAEMON - sleep 1 + [ -n "$DODTIME" ] && sleep $DODTIME start-stop-daemon --start --quiet --pidfile \ - /var/run/$NAME.pid --exec $DAEMON + /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS echo "$NAME." ;; + status) + echo -n "$LABEL is " + if running ; then + echo "running" + else + echo " not running." + exit 1 + fi + ;; *) N=/etc/init.d/$NAME # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 - echo "Usage: $N {start|stop|restart|force-reload}" >&2 + echo "Usage: $N {start|stop|restart|force-reload|status|force-stop}" >&2 exit 1 ;; esac diff --git a/debian/init.d.lsb.ex b/debian/init.d.lsb.ex new file mode 100644 index 000000000..12231294e --- /dev/null +++ b/debian/init.d.lsb.ex @@ -0,0 +1,281 @@ +#!/bin/sh +# +# Example init.d script with LSB support. +# +# Please read this init.d carefully and modify the sections to +# adjust it to the program you want to run. +# +# Copyright (c) 2007 Javier Fernandez-Sanguino +# +# This is free software; you may 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 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 +# the Debian operating system, in /usr/share/common-licenses/GPL; if +# not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA +# +### BEGIN INIT INFO +# Provides: freeside +# Required-Start: $network $local_fs +# Required-Stop: +# Should-Start: $named +# Should-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: +# Description: +# <...> +# <...> +### END INIT INFO + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin + +DAEMON=/usr/sbin/freeside # Introduce the server's location here +NAME=#PACKAGE # Introduce the short server's name here +DESC=#PACKAGE # Introduce a short description here +LOGDIR=/var/log/freeside # Log directory to use + +PIDFILE=/var/run/$NAME.pid + +test -x $DAEMON || exit 0 +test -x $DAEMON_WRAPPER || exit 0 + +. /lib/lsb/init-functions + +# Default options, these can be overriden by the information +# at /etc/default/$NAME +DAEMON_OPTS="" # Additional options given to the server + +DODTIME=10 # Time to wait for the server to die, in seconds + # If this value is set too low you might not + # let some servers to die gracefully and + # 'restart' will not work + +LOGFILE=$LOGDIR/$NAME.log # Server logfile +#DAEMONUSER=freeside # Users to run the daemons as. If this value + # is set start-stop-daemon will chuid the server + +# Include defaults if available +if [ -f /etc/default/$NAME ] ; then + . /etc/default/$NAME +fi + +# Use this if you want the user to explicitly set 'RUN' in +# /etc/default/ +#if [ "x$RUN" != "xyes" ] ; then +# log_failure_msg "$NAME disabled, please adjust the configuration to your needs " +# log_failure_msg "and then set RUN to 'yes' in /etc/default/$NAME to enable it." +# exit 1 +#fi + +# Check that the user exists (if we set a user) +# Does the user exist? +if [ -n "$DAEMONUSER" ] ; then + if getent passwd | grep -q "^$DAEMONUSER:"; then + # Obtain the uid and gid + DAEMONUID=`getent passwd |grep "^$DAEMONUSER:" | awk -F : '{print $3}'` + DAEMONGID=`getent passwd |grep "^$DAEMONUSER:" | awk -F : '{print $4}'` + else + log_failure_msg "The user $DAEMONUSER, required to run $NAME does not exist." + exit 1 + fi +fi + + +set -e + +running_pid() { +# Check if a given process pid's cmdline matches a given name + pid=$1 + name=$2 + [ -z "$pid" ] && return 1 + [ ! -d /proc/$pid ] && return 1 + cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1` + # Is this the expected server + [ "$cmd" != "$name" ] && return 1 + return 0 +} + +running() { +# Check if the process is running looking at /proc +# (works for all users) + + # No pidfile, probably no daemon present + [ ! -f "$PIDFILE" ] && return 1 + pid=`cat $PIDFILE` + running_pid $pid $DAEMON_WRAPPER || return 1 + return 0 +} + +start_server() { +# Start the process using the wrapper + if [ -z "$DAEMONUSER" ] ; then + start-stop-daemon --start --quiet --pidfile $PIDFILE \ + --exec $DAEMON -- $DAEMON_OPTS + errcode=$? + else +# if we are using a daemonuser then change the user id + start-stop-daemon --start --quiet --pidfile $PIDFILE \ + --chuid $DAEMONUSER \ + --exec $DAEMON -- $DAEMON_OPTS + errcode=$? + fi + return $errcode +} + +stop_server() { +# Stop the process using the wrapper + if [ -z "$DAEMONUSER" ] ; then + start-stop-daemon --stop --quiet --pidfile $PIDFILE \ + --exec $DAEMON + errcode=$ + else +# if we are using a daemonuser then look for process that match + start-stop-daemon --stop --quiet --pidfile $PIDFILE \ + --user $DAEMONUSER \ + --exec $DAEMON + errcode=$ + fi + + return $errcode +} + +reload_server() { + [ ! -f "$PIDFILE" ] && return 1 + pid=`cat $PIDFILE` # This is the daemon's pid + # Send a SIGHUP + kill -1 $pid + return $? +} + +force_stop() { +# Force the process to die killing it manually + [ ! -e "$PIDFILE" ] && return + if running ; then + kill -15 $pid + # Is it really dead? + sleep "$DIETIME"s + if running ; then + kill -9 $pid + sleep "$DIETIME"s + if running ; then + echo "Cannot kill $NAME (pid=$pid)!" + exit 1 + fi + fi + fi + rm -f $PIDFILE +} + + +case "$1" in + start) + log_daemon_msg "Starting $DESC " "$NAME" + # Check if it's running first + if running ; then + log_progress_msg "apparently already running" + log_end_msg 0 + exit 0 + fi + if start_server && running ; then + # It's ok, the server started and is running + log_end_msg 0 + else + # Either we could not start it or it is not running + # after we did + # NOTE: Some servers might die some time after they start, + # this code does not try to detect this and might give + # a false positive (use 'status' for that) + log_end_msg 1 + fi + ;; + stop) + log_daemon_msg "Stopping $DESC" "$NAME" + if running ; then + # Only stop the server if we see it running + stop_server + log_end_msg $? + else + # If it's not running don't do anything + log_progress_msg "apparently not running" + log_end_msg 0 + exit 0 + fi + ;; + force-stop) + # First try to stop gracefully the program + $0 stop + if running; then + # If it's still running try to kill it more forcefully + log_daemon_msg "Stopping (force) $DESC" "$NAME" + force_stop + log_end_msg $? + fi + ;; + restart|force-reload) + log_daemon_msg "Restarting $DESC" "$NAME" + stop_server + # Wait some sensible amount, some server need this + [ -n "$DIETIME" ] && sleep $DIETIME + start_server + running + log_end_msg $? + ;; + status) + + log_daemon_msg "Checking status of $DESC" "$NAME" + if running ; then + log_progress_msg "running" + log_end_msg 0 + else + log_progress_msg "apparently not running" + log_end_msg 1 + exit 1 + fi + ;; + # Use this if the daemon cannot reload + reload) + log_warning_msg "Reloading $NAME daemon: not implemented, as the daemon" + log_warning_msg "cannot re-read the config file (use restart)." + ;; + # And this if it cann + #reload) + # + # If the daemon can reload its config files on the fly + # for example by sending it SIGHUP, do it here. + # + # If the daemon responds to changes in its config file + # directly anyway, make this a do-nothing entry. + # + # log_daemon_msg "Reloading $DESC configuration files" "$NAME" + # if running ; then + # reload_server + # if ! running ; then + # Process died after we tried to reload + # log_progress_msg "died on reload" + # log_end_msg 1 + # exit 1 + # fi + # else + # log_progress_msg "server is not running" + # log_end_msg 1 + # exit 1 + # fi + #;; + + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/debian/manpage.1.ex b/debian/manpage.1.ex deleted file mode 100644 index ec542bb05..000000000 --- a/debian/manpage.1.ex +++ /dev/null @@ -1,60 +0,0 @@ -.\" Hey, EMACS: -*- nroff -*- -.\" First parameter, NAME, should be all caps -.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection -.\" other parameters are allowed: see man(7), man(1) -.TH FREESIDE SECTION "April 12, 2001" -.\" Please adjust this date whenever revising the manpage. -.\" -.\" Some roff macros, for reference: -.\" .nh disable hyphenation -.\" .hy enable hyphenation -.\" .ad l left justify -.\" .ad b justify to both left and right margins -.\" .nf disable filling -.\" .fi enable filling -.\" .br insert line break -.\" .sp insert n+1 empty lines -.\" for manpage-specific macros, see man(7) -.SH NAME -freeside \- program to do something -.SH SYNOPSIS -.B freeside -.RI [ options ] " files" ... -.br -.B bar -.RI [ options ] " files" ... -.SH DESCRIPTION -This manual page documents briefly the -.B freeside -and -.B bar -commands. -This manual page was written for the Debian GNU/Linux distribution -because the original program does not have a manual page. -Instead, it has documentation in the GNU Info format; see below. -.PP -.\" TeX users may be more comfortable with the \fB\fP and -.\" \fI\fP escape sequences to invode bold face and italics, -.\" respectively. -\fBfreeside\fP is a program that... -.SH OPTIONS -These programs follow the usual GNU command line syntax, with long -options starting with two dashes (`-'). -A summary of options is included below. -For a complete description, see the Info files. -.TP -.B \-h, \-\-help -Show summary of options. -.TP -.B \-v, \-\-version -Show version of program. -.SH SEE ALSO -.BR bar (1), -.BR baz (1). -.br -The programs are documented fully by -.IR "The Rise and Fall of a Fooish Bar" , -available via the Info system. -.SH AUTHOR -This manual page was written by Ivan Kohler , -for the Debian GNU/Linux system (but may be used by others). diff --git a/debian/manpage.sgml.ex b/debian/manpage.sgml.ex deleted file mode 100644 index 9bc3a8663..000000000 --- a/debian/manpage.sgml.ex +++ /dev/null @@ -1,143 +0,0 @@ - manpage.1'. You may view - the manual page with: `docbook-to-man manpage.sgml | nroff -man | - less'. A typical entry in a Makefile or Makefile.am is: - -manpage.1: manpage.sgml - docbook-to-man $< > $@ - --> - - - FIRSTNAME"> - SURNAME"> - - April 12, 2001"> - - SECTION"> - ivan-debian@420.am"> - - FREESIDE"> - - - Debian GNU/Linux"> - GNU"> -]> - - - -
- &dhemail; -
- - &dhfirstname; - &dhsurname; - - - 2001 - &dhusername; - - &dhdate; -
- - &dhucpackage; - - &dhsection; - - - &dhpackage; - - program to do something - - - - &dhpackage; - - - - - - - - DESCRIPTION - - This manual page documents briefly the - &dhpackage; and bar - commands. - - This manual page was written for the &debian; distribution - because the original program does not have a manual page. - Instead, it has documentation in the &gnu; - Info format; see below. - - &dhpackage; is a program that... - - - - OPTIONS - - These programs follow the usual GNU command line syntax, - with long options starting with two dashes (`-'). A summary of - options is included below. For a complete description, see the - Info files. - - - - - - - - Show summary of options. - - - - - - - - Show version of program. - - - - - - SEE ALSO - - bar (1), baz (1). - - The programs are documented fully by The Rise and - Fall of a Fooish Bar available via the - Info system. - - - AUTHOR - - This manual page was written by &dhusername; &dhemail; for - the &debian; system (but may be used by others). Permission is - granted to copy, distribute and/or modify this document under - the terms of the GNU Free Documentation - License, Version 1.1 or any later version published by the Free - Software Foundation; with no Invariant Sections, no Front-Cover - Texts and no Back-Cover Texts. - - -
- - diff --git a/debian/menu.ex b/debian/menu.ex deleted file mode 100644 index ddc947e9c..000000000 --- a/debian/menu.ex +++ /dev/null @@ -1,2 +0,0 @@ -?package(freeside):needs=X11|text|vc|wm section=Apps/see-menu-manual\ - title="freeside" command="/usr/bin/freeside" diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 000000000..5d045508a --- /dev/null +++ b/debian/postinst @@ -0,0 +1,54 @@ +#!/bin/sh +# postinst script for freeside +# +# see: dh_installdeb(1) + +set -e + +# source debconf stuff +. /usr/share/debconf/confmodule + +# source dbconfig-common stuff +. /usr/share/dbconfig-common/dpkg/postinst + +dbc_pgsql_createdb_encoding='sql_ascii' + +#echo "i should create the db here" +dbc_go freeside $@ +#echo "db should be craeted now" + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +case "$1" in + configure) + + a2enmod perl + + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + diff --git a/debian/postinst.ex b/debian/postinst.ex deleted file mode 100644 index c4d4bfba8..000000000 --- a/debian/postinst.ex +++ /dev/null @@ -1,47 +0,0 @@ -#! /bin/sh -# postinst script for freeside -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `configure' -# * `abort-upgrade' -# * `abort-remove' `in-favour' -# -# * `abort-deconfigure' `in-favour' -# `removing' -# -# for details, see /usr/share/doc/packaging-manual/ -# -# quoting from the policy: -# Any necessary prompting should almost always be confined to the -# post-installation script, and should be protected with a conditional -# so that unnecessary prompting doesn't happen if a package's -# installation fails and the `postinst' is called with `abort-upgrade', -# `abort-remove' or `abort-deconfigure'. - -case "$1" in - configure) - - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 0 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 - - diff --git a/debian/postrm b/debian/postrm new file mode 100644 index 000000000..c00844543 --- /dev/null +++ b/debian/postrm @@ -0,0 +1,48 @@ +#!/bin/sh +# postrm script for freeside +# +# see: dh_installdeb(1) + +set -e + +# source debconf stuff +. /usr/share/debconf/confmodule + +# source dbconfig-common stuff +if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then + . /usr/share/dbconfig-common/dpkg/postrm + dbc_go freeside $@ +fi + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/postrm.ex b/debian/postrm.ex deleted file mode 100644 index bed8abd3d..000000000 --- a/debian/postrm.ex +++ /dev/null @@ -1,36 +0,0 @@ -#! /bin/sh -# postrm script for freeside -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `remove' -# * `purge' -# * `upgrade' -# * `failed-upgrade' -# * `abort-install' -# * `abort-install' -# * `abort-upgrade' -# * `disappear' overwrit>r> -# for details, see /usr/share/doc/packaging-manual/ - -case "$1" in - purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) - - - ;; - - *) - echo "postrm called with unknown argument \`$1'" >&2 - exit 0 - -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - - diff --git a/debian/preinst b/debian/preinst new file mode 100644 index 000000000..50c89e140 --- /dev/null +++ b/debian/preinst @@ -0,0 +1,100 @@ +#!/bin/sh +# preinst script for freeside +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `install' +# * `install' +# * `upgrade' +# * `abort-upgrade' +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + install|upgrade) + + # If the package has default file it could be sourced, so that + # the local admin can overwrite the defaults + + [ -f "/etc/default/freeside" ] && . /etc/default/freeside + + # Sane defaults: + + [ -z "$FREESIDE_HOME" ] && FREESIDE_HOME=/home/freeside + [ -z "$FREESIDE_USER" ] && FREESIDE_USER=freeside + [ -z "$FREESIDE_NAME" ] && FREESIDE_NAME="Freeside" + [ -z "$FREESIDE_GROUP" ] && FREESIDE_GROUP=freeside + + [ -z "$RT_GROUP" ] && RT_GROUP=rt + + # Groups that the user will be added to, if undefined, then none. + ADDGROUP="rt" + + # create user to avoid running server as root + # 1. create group if not existing + if ! getent group | grep -q "^$FREESIDE_GROUP:" -; then + echo -n "Adding group $FREESIDE_GROUP.." + addgroup --quiet --system $FREESIDE_GROUP 2>/dev/null ||true + echo "..done" + fi + if ! getent group | grep -q "^$RT_GROUP:" -; then + echo -n "Adding group $RT_GROUP.." + addgroup --quiet --system $RT_GROUP 2>/dev/null ||true + echo "..done" + fi + # 2. create homedir if not existing + test -d $FREESIDE_HOME || mkdir $FREESIDE_HOME + # 3. create user if not existing + if ! getent passwd | grep -q "^$FREESIDE_USER:" -; then + echo -n "Adding system user $FREESIDE_USER.." + adduser --quiet \ + --system \ + --ingroup $FREESIDE_GROUP \ + --shell /bin/sh \ + --no-create-home \ + --disabled-password \ + $FREESIDE_USER 2>/dev/null || true + echo "..done" + fi + # 4. adjust passwd entry + usermod -c "$FREESIDE_NAME" \ + -d $FREESIDE_HOME \ + -g $FREESIDE_GROUP \ + $FREESIDE_USER + # 5. adjust file and directory permissions + if ! dpkg-statoverride --list $FREESIDE_HOME >/dev/null + then + chown -R $FREESIDE_USER:adm $FREESIDE_HOME + chmod u=rwx,g=rxs,o= $FREESIDE_HOME + fi + # 6. Add the user to the ADDGROUP group + if test -n $ADDGROUP + then + if ! groups $FREESIDE_USER | cut -d: -f2 | \ + grep -qw $ADDGROUP -; then + adduser $FREESIDE_USER $ADDGROUP + fi + fi + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/preinst.ex b/debian/preinst.ex deleted file mode 100644 index 0b42bb28f..000000000 --- a/debian/preinst.ex +++ /dev/null @@ -1,42 +0,0 @@ -#! /bin/sh -# preinst script for freeside -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `install' -# * `install' -# * `upgrade' -# * `abort-upgrade' -# -# For details see /usr/share/doc/packaging-manual/ - -case "$1" in - install|upgrade) -# if [ "$1" = "upgrade" ] -# then -# start-stop-daemon --stop --quiet --oknodo \ -# --pidfile /var/run/freeside.pid \ -# --exec /usr/sbin/freeside 2>/dev/null || true -# fi - ;; - - abort-upgrade) - ;; - - *) - echo "preinst called with unknown argument \`$1'" >&2 - exit 0 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 - - diff --git a/debian/prerm b/debian/prerm new file mode 100644 index 000000000..4c1748936 --- /dev/null +++ b/debian/prerm @@ -0,0 +1,46 @@ +#!/bin/sh +# prerm script for freeside +# +# see: dh_installdeb(1) + +set -e + +# source debconf stuff +. /usr/share/debconf/confmodule +# source dbconfig-common stuff +. /usr/share/dbconfig-common/dpkg/prerm +dbc_go freeside $@ + +# summary of how this script can be called: +# * `remove' +# * `upgrade' +# * `failed-upgrade' +# * `remove' `in-favour' +# * `deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + remove|upgrade|deconfigure) + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/prerm.ex b/debian/prerm.ex deleted file mode 100644 index ebb87c540..000000000 --- a/debian/prerm.ex +++ /dev/null @@ -1,37 +0,0 @@ -#! /bin/sh -# prerm script for freeside -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `remove' -# * `upgrade' -# * `failed-upgrade' -# * `remove' `in-favour' -# * `deconfigure' `in-favour' -# `removing' -# -# for details, see /usr/share/doc/packaging-manual/ - -case "$1" in - remove|upgrade|deconfigure) -# install-info --quiet --remove /usr/info/freeside.info.gz - ;; - failed-upgrade) - ;; - *) - echo "prerm called with unknown argument \`$1'" >&2 - exit 0 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 - - diff --git a/debian/rules b/debian/rules index 71016c406..2d9b643a8 100755 --- a/debian/rules +++ b/debian/rules @@ -1,113 +1,229 @@ #!/usr/bin/make -f -# Sample debian/rules that uses debhelper. -# GNU copyright 1997 by Joey Hess. -# -# This version is for a hypothetical package that builds an -# architecture-dependant package, as well as an architecture-independent -# package. - -# Uncomment this to turn on verbose mode. +# -*- makefile -*- + +# Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -# This is the debhelper compatability version to use. -export DH_COMPAT=3 +# If set to a true value then MakeMaker's prompt function will +# always return the default without waiting for user input. +#export PERL_MM_USE_DEFAULT=1 + +PERL ?= /usr/bin/perl +#PACKAGE = $(shell dh_listpackages) +PACKAGE = freeside +TMP = $(CURDIR)/debian/$(PACKAGE) +DBC_SCRIPTS = $(TMP)/usr/share/dbconfig-common/scripts/freeside + +#this is gotten from dbconfig-common +DB_TYPE = db_type_is_configured_during_pkg_install_by_dbconfig-common_not_at_build_time + +#no chance, it doesn't get backslash-interpolted now... +#DEBVERSION = `head -1 debian/changelog | cut -d')' -f1 | cut -c11-` +DEBVERSION = 1.7.3~rc2-1 +export VERSION = $(DEBVERSION) (Debian) + +export FREESIDE_CONF = /etc/freeside +export FREESIDE_LOG = /var/log/freeside +export FREESIDE_LOCK = /var/lock/freeside +export FREESIDE_CACHE = $(TMP)/var/cache/freeside +FREESIDE_CACHE = $(TMP)/var/cache/freeside + +#XXX huh? +export FREESIDE_EXPORT = /var/spool/freeside + +#XXX own subdir? +export MASON_HANDLER = $(TMP)-webui/usr/share/freeside/handler.pl + +export APACHE_VERSION = 2 +export FREESIDE_DOCUMENT_ROOT = $(TMP)-webui/usr/share/freeside/www +export INIT_FILE = $(TMP).init +export INIT_INSTALL = /bin/true +export HTTPD_RESTART = /bin/true +#export APACHE_CONF = $(TMP)-webui/etc/apache2/conf.d +export APACHE_CONF = $(TMP)-webui/etc/freeside/apache2 +export FREESIDE_RESTART = /bin/true + +#XXX root? +export INSTALLGROUP = adm + +export SELFSERVICE_MACHINES = + +#prompt ? XXX these are runtime, not buildtime :/ +export RT_DOMAIN = `dnsdomainname` +export RT_TIMEZONE = `cat /etc/timezone` + +export HOSTNAME = `hostname -f` +export FREESIDE_URL = http://$(HOSTNAME)/freeside/ + +#specific to deb pkg, for purposes of saving off a permanent copy of default +#config for postinst and that sort of thing +export DEFAULT_CONF = $(TMP)/usr/share/freeside/default_conf + +#XXX yuck. proper RT layout is entirely necessary +#this seems to infect way to much of RT with the build location, requiring +# a kludge to hack it out afterwords. look into using fakeroot (didn't +# realize it would need to be explicit argh) +# (but leaving it for now, otherwise can't get RT to put files where we need em) +export RT_PATH = $(TMP)/var/opt/freeside/rt + +# This has to be exported to make some magic below work. +export DH_OPTIONS configure: configure-stamp configure-stamp: dh_testdir # Add here commands to configure the package. - touch configure-stamp -build: configure-stamp build-stamp -build-stamp: + +build: build-stamp +build-stamp: dh_testdir + # Add commands to compile the package here + + ( cd FS/ && $(PERL) Makefile.PL INSTALLDIRS=vendor ) - # Add here commands to compile the package. - $(MAKE) + $(MAKE) -e perl-modules - touch build-stamp + #TEST# + + touch $@ clean: dh_testdir dh_testroot - rm -f build-stamp configure-stamp + dh_clean build-stamp install-stamp # Add here commands to clean up after the build process. - -$(MAKE) clean + $(MAKE) -e clean + #|| true #XXX freeside clean target fucked - dh_clean + dh_clean -install: DH_OPTIONS= -install: build +install: install-stamp +install-stamp: build-stamp dh_testdir dh_testroot dh_clean -k dh_installdirs - # Add here commands to install the package into debian/freeside. - $(MAKE) install DESTDIR=$(CURDIR)/debian/freeside + # Add here commands to install package into + # debian/-whatever. + ( cd FS/ && $(MAKE) -e DESTDIR=$(TMP)-lib install ) + + #install this for postinst later (no create-config) + install -d $(DEFAULT_CONF) + #install conf/[a-z]* $(DEFAULT_CONF) + #CVS is not [a-z] + install `ls -d conf/[a-z]* | grep -v CVS` $(DEFAULT_CONF) + + install -d $(FREESIDE_DOCUMENT_ROOT) + install -d $(FREESIDE_CACHE)/masondata #MASONDATA + $(MAKE) -e install-docs + + #hack the build dir out of Freeside too. oh yeah, sucky. + perl -p -i -e "\ + s'${TMP}(-webui)?''g;\ + " ${TMP}-webui/usr/share/freeside/handler.pl \ + ${TMP}/usr/share/perl5/FS/* \ + ${TMP}/usr/share/perl5/FS/*/* \ + ${TMP}/usr/bin/* + + rm -r $(FREESIDE_DOCUMENT_ROOT).* + + install -d $(APACHE_CONF) + install debian/freeside.apache-alias.conf $(APACHE_CONF)/freeside-alias.conf + FREESIDE_DOCUMENT_ROOT=/usr/share/freeside/www MASON_HANDLER=/usr/share/freeside/handler.pl FREESIDE_CONF=/etc/freeside $(MAKE) -e install-apache + + $(MAKE) -e install-init + + #RT + #(configure-rt) + + # XXX need to adjust db-type, db-database, db-rt-user, db-rt-pass + # based on info from dbc + ( cd rt; \ + cp config.layout.in config.layout; \ + perl -p -i -e "\ + s'%%%FREESIDE_DOCUMENT_ROOT%%%'${FREESIDE_DOCUMENT_ROOT}'g;\ + s'%%%MASONDATA%%%'${FREESIDE_CACHE}/masondata'g;\ + " config.layout; \ + ./configure --prefix=${RT_PATH} \ + --enable-layout=Freeside \ + --with-db-type=Pg \ + --with-db-dba=freeside \ + --with-db-database=_DBC_DBNAME_ \ + --with-db-rt-user=_DBC_DBUSER_ \ + --with-db-rt-pass=_DBC_DBPASS_ \ + --with-web-user=freeside \ + --with-web-group=freeside \ + --with-rt-group=freeside \ + ) + + #(create-rt) + install -d $(RT_PATH) + ( cd rt; make install ) + #hack the build dir out of RT. yeah, sucky. + perl -p -i -e "\ + s'${TMP}''g;\ + " ${RT_PATH}/etc/RT_Config.pm \ + ${RT_PATH}/lib/RT.pm \ + ${RT_PATH}/bin/mason_handler.fcgi \ + ${RT_PATH}/bin/mason_handler.scgi \ + ${RT_PATH}/bin/standalone_httpd \ + ${RT_PATH}/bin/webmux.pl \ + ${RT_PATH}/bin/rt-crontool \ + ${RT_PATH}/sbin/rt-dump-database \ + ${RT_PATH}/sbin/rt-setup-database + + #hack @INC dir out of RT (well, handler.pl) too. + perl -p -i -e "\ + s'/opt/rt3/'/var/opt/freeside/rt/'g;\ + " ${TMP}-webui/usr/share/freeside/handler.pl + + mv ${RT_PATH}/etc/RT_Config.pm ${RT_PATH}/etc/RT_Config.pm.dbc - dh_movefiles + perl -p -i -e "\ + s'%%%RT_DOMAIN%%%'${RT_DOMAIN}'g;\ + s'%%%RT_TIMEZONE%%%'${RT_TIMEZONE}'g;\ + s'%%%FREESIDE_URL%%%'${FREESIDE_URL}'g;\ + " ${RT_PATH}/etc/RT_SiteConfig.pm + + install -D debian/dbconfig-common.install $(DBC_SCRIPTS)/install/pgsql + install -D debian/dbconfig-common.install $(DBC_SCRIPTS)/install/mysql + + install -D debian/dbconfig-common.upgrade $(DBC_SCRIPTS)/upgrade/pgsql/$(DEBVERSION) + install -D debian/dbconfig-common.upgrade $(DBC_SCRIPTS)/upgrade/mysql/$(DEBVERSION) + + dh_install + + touch $@ + +binary-arch: +# We have nothing to do here for an architecture-independent package -# Build architecture-independent files here. -# Pass -i to all debhelper commands in this target to reduce clutter. binary-indep: build install - dh_testdir -i - dh_testroot -i -# dh_installdebconf -i - dh_installdocs -i - dh_installexamples -i - dh_installmenu -i -# dh_installlogrotate -i -# dh_installemacsen -i -# dh_installpam -i -# dh_installmime -i -# dh_installinit -i - dh_installcron -i -# dh_installman -i - dh_installinfo -i -# dh_undocumented -i - dh_installchangelogs -i - dh_link -i - dh_compress -i - dh_fixperms -i - dh_installdeb -i -# dh_perl -i - dh_gencontrol -i - dh_md5sums -i - dh_builddeb -i - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir -a - dh_testroot -a -# dh_installdebconf -a - dh_installdocs -a - dh_installexamples -a - dh_installmenu -a -# dh_installlogrotate -a -# dh_installemacsen -a -# dh_installpam -a -# dh_installmime -a -# dh_installinit -a - dh_installcron -a -# dh_installman -a - dh_installinfo -a -# dh_undocumented -a - dh_installchangelogs -a - dh_strip -a - dh_link -a - dh_compress -a - dh_fixperms -a -# dh_makeshlibs -a - dh_installdeb -a -# dh_perl -a - dh_shlibdeps -a - dh_gencontrol -a - dh_md5sums -a - dh_builddeb -a + dh_testdir + dh_testroot + dh_installchangelogs ChangeLog + dh_installdocs #freeside.docs README AGPL + dh_installexamples eg/* +# dh_installmenu + dh_installdebconf +# dh_installlogrotate + dh_installinit + dh_installcron +# dh_installinfo + dh_installman + dh_perl + dh_link + dh_compress + dh_fixperms + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install configure +.PHONY: build clean binary-indep binary-arch binary install diff --git a/debian/templates b/debian/templates new file mode 100644 index 000000000..e69de29bb diff --git a/debian/watch.ex b/debian/watch.ex deleted file mode 100644 index 3f57ae020..000000000 --- a/debian/watch.ex +++ /dev/null @@ -1,5 +0,0 @@ -# Example watch control file for uscan -# Rename this file to "watch" and then you can run the "uscan" command -# to check for upstream updates and more. -# Site Directory Pattern Version Script -sunsite.unc.edu /pub/Linux/Incoming freeside-(.*)\.tar\.gz debian uupdate