diff options
Diffstat (limited to 'debian')
-rw-r--r-- | debian/README.Debian | 25 | ||||
-rw-r--r-- | debian/TODO | 38 | ||||
-rw-r--r-- | debian/changelog | 26 | ||||
-rw-r--r-- | debian/compat | 1 | ||||
-rw-r--r-- | debian/config | 19 | ||||
-rw-r--r-- | debian/control | 59 | ||||
-rw-r--r-- | debian/copyright | 45 | ||||
-rw-r--r-- | debian/cron.d | 4 | ||||
-rw-r--r-- | debian/dbconfig-common.install | 90 | ||||
-rw-r--r-- | debian/dbconfig-common.upgrade | 3 | ||||
-rw-r--r-- | debian/freeside-webui.links | 4 | ||||
-rw-r--r-- | debian/freeside.apache-alias.conf | 1 | ||||
-rw-r--r-- | debian/freeside.default | 12 | ||||
-rw-r--r-- | debian/freeside.docs | 1 | ||||
-rw-r--r-- | debian/init.d.ex | 157 | ||||
-rw-r--r-- | debian/init.d.lsb.ex | 281 | ||||
-rw-r--r-- | debian/postinst | 54 | ||||
-rw-r--r-- | debian/postrm | 48 | ||||
-rw-r--r-- | debian/preinst | 100 | ||||
-rw-r--r-- | debian/prerm | 46 | ||||
-rwxr-xr-x | debian/rules | 230 | ||||
-rw-r--r-- | debian/templates | 0 |
22 files changed, 1244 insertions, 0 deletions
diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 000000000..829b543e4 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,25 @@ +Freeside for Debian +------------------- + +1. +Edit /etc/apache2/envvars or /etc/apache2/apache2.conf and set User and Group +to freeside + +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 <ivan-debian@420.am> 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.<datasrc is missing> + +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 new file mode 100644 index 000000000..b7087407e --- /dev/null +++ b/debian/changelog @@ -0,0 +1,26 @@ +freeside (2.1.0-1) UNRELEASED; urgency=low + + * New upstream release + * New upstream release + * New upstream release + + -- Ivan Kohler <ivan-debian@420.am> Tue, 25 May 2010 05:43:49 -0700 + +freeside (1.9.1-1) unstable; urgency=low + + * New upstream release + + -- Ivan Kohler <ivan-debian@420.am> Sat, 10 Oct 2009 19:41:01 -0700 + +freeside (1.9.1-1) unstable; urgency=low + + * New upstream release + + -- Ivan Kohler <ivan-debian@420.am> Sat, 10 Oct 2009 18:57:01 -0700 + +freeside (1.9.0~cvs0-1) unstable; urgency=low + + * Initial release + + -- Ivan Kohler <ivan-debian@420.am> Wed, 02 Apr 2008 01:46:20 -0700 + 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/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 new file mode 100644 index 000000000..4ea4815d2 --- /dev/null +++ b/debian/control @@ -0,0 +1,59 @@ +Source: freeside +Section: misc +Priority: extra +Maintainer: Ivan Kohler <ivan-debian@420.am> +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: all +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: ghostscript | gs-gpl, gsfonts, tetex-base, tetex-bin, libauthen-passphrase-perl, 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-domain-tld-perl, 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, libemail-sender-perl, libemail-sender-transport-smtp-tls-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-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-webui +Architecture: all +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 new file mode 100644 index 000000000..c409cb99e --- /dev/null +++ b/debian/copyright @@ -0,0 +1,45 @@ +This package was debianized by Ivan Kohler <ivan-debian@420.am> on +Wed, 02 Apr 2008 01:46:20 -0700. + +It was downloaded from <http://www.freeside.biz/freeside> + +Upstream Author(s): + + 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: <likewise for all other copyrights from httemplate/docs/license.html> + +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 <ivan-debian@420.am> 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/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/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 new file mode 100644 index 000000000..2480f515d --- /dev/null +++ b/debian/init.d.ex @@ -0,0 +1,157 @@ +#! /bin/sh +# +# skeleton example file to build /etc/init.d/ scripts. +# This file should be used to construct scripts for /etc/init.d. +# +# Written by Miquel van Smoorenburg <miquels@cistron.nl>. +# Modified for Debian +# by Ian Murdock <imurdock@gnu.ai.mit.edu>. +# Further changes by Javier Fernandez-Sanguino <jfs@debian.org> +# +# Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl +# + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/sbin/freeside +NAME=freeside +DESC=freeside + +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 $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 $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 + # 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. + # + # echo "Reloading $DESC configuration files." + # start-stop-daemon --stop --signal 1 --quiet --pidfile \ + # /var/run/$NAME.pid --exec $DAEMON + #;; + 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" 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 + [ -n "$DODTIME" ] && sleep $DODTIME + start-stop-daemon --start --quiet --pidfile \ + /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|status|force-stop}" >&2 + exit 1 + ;; +esac + +exit 0 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 <jfs@debian.org> +# +# 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: <Enter a short description of the sortware> +# Description: <Enter a long description of the software> +# <...> +# <...> +### 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/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: +# * <postinst> `configure' <most-recently-configured-version> +# * <old-postinst> `abort-upgrade' <new version> +# * <conflictor's-postinst> `abort-remove' `in-favour' <package> +# <new-version> +# * <postinst> `abort-remove' +# * <deconfigured's-postinst> `abort-deconfigure' `in-favour' +# <failed-install-package> <version> `removing' +# <conflicting-package> <version> +# 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/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: +# * <postrm> `remove' +# * <postrm> `purge' +# * <old-postrm> `upgrade' <new-version> +# * <new-postrm> `failed-upgrade' <old-version> +# * <new-postrm> `abort-install' +# * <new-postrm> `abort-install' <old-version> +# * <new-postrm> `abort-upgrade' <old-version> +# * <disappearer's-postrm> `disappear' <overwriter> +# <overwriter-version> +# 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/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: +# * <new-preinst> `install' +# * <new-preinst> `install' <old-version> +# * <new-preinst> `upgrade' <old-version> +# * <old-preinst> `abort-upgrade' <new-version> +# 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/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: +# * <prerm> `remove' +# * <old-prerm> `upgrade' <new-version> +# * <new-prerm> `failed-upgrade' <old-version> +# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version> +# * <deconfigured's-prerm> `deconfigure' `in-favour' +# <package-being-installed> <version> `removing' +# <conflicting-package> <version> +# 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/rules b/debian/rules new file mode 100755 index 000000000..d37dfd1c5 --- /dev/null +++ b/debian/rules @@ -0,0 +1,230 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# 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 DIST_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: build-stamp +build-stamp: + dh_testdir + # Add commands to compile the package here + + ( cd FS/ && $(PERL) Makefile.PL INSTALLDIRS=vendor ) + + $(MAKE) -e perl-modules + + #TEST# + + touch $@ + +clean: + dh_testdir + dh_testroot + dh_clean build-stamp install-stamp + + # Add here commands to clean up after the build process. + $(MAKE) -e clean + #|| true #XXX freeside clean target fucked + + dh_clean + +install: install-stamp +install-stamp: build-stamp + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install package into + # debian/<package>-whatever. + ( cd FS/ && $(MAKE) -e DESTDIR=$(TMP)-lib install ) + + #false laziness w/install-perl-modules now + #install this for postinst later (no create-config) + install -d $(DIST_CONF) + #install conf/[a-z]* $(DEFAULT_CONF) + #CVS is not [a-z] + install `ls -d conf/[a-z]* | grep -v CVS` $(DIST_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 + + 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 + +binary-indep: build install + 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 diff --git a/debian/templates b/debian/templates new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/debian/templates |