From 6b64fb50fecf45cee2c3fa89d4bcfc0815ba58d4 Mon Sep 17 00:00:00 2001 From: rsiddall Date: Sun, 8 Jul 2007 03:37:03 +0000 Subject: [PATCH] Modified for Freeside 1.7.2 --- install/rpm/freeside-install | 227 +++++++++++++++++++++++++++++++++++ 1 file changed, 227 insertions(+) create mode 100755 install/rpm/freeside-install diff --git a/install/rpm/freeside-install b/install/rpm/freeside-install new file mode 100755 index 000000000..f6f11db8f --- /dev/null +++ b/install/rpm/freeside-install @@ -0,0 +1,227 @@ +#!/bin/sh +# This is based on the Fedora Core 3 INSTALL file, modified using the information in the Freeside Wiki +# It's intended to be a universal Freeside installation script, but it's nowhere near that yet. +# + +# Primary domain - see the Wiki +DOMAIN= +# Package manager to use +PACKAGER= +# Main freeside user +USER= +# Name for database for this instance of freeside +DBNAME=freeside + +# Parse the command line arguments +#parse_cli_arguments() +#{ + while getopts "hd:n:p:u:" flag + do + case $flag in + d) + NEWVAL=`echo $OPTARG | tr '[A-Z]' '[a-z]'` + if [ "x$DOMAIN" -ne "x" ] ; then + echo STDERR "Domain already set to $DOMAIN. Changing to $NEWVAL" + fi + DOMAIN=$NEWVAL;; + h) + usage;; + n) + # We don't lowercase the database name + if [ "x$DBNAME" -ne "x" ] ; then + echo STDERR "Database name already set to $DBNAME. Changing to $OPTARG" + fi + DBNAME=$OPTARG;; + p) + NEWVAL=`echo $OPTARG | tr '[A-Z]' '[a-z]'` + if [ "x$PACKAGER" -ne "x" ] ; then + echo STDERR "Packager already set to $PACKAGER. Changing to $NEWVAL" + fi + PACKAGER=$NEWVAL;; + u) + # We don't lowercase the user name + if [ "x$USER" -ne "x" ] ; then + echo STDERR "Main freeside web user already set to $USER. Changing to $OPTARG" + fi + USER=$OPTARG;; + esac + done +#} + +usage() +{ + echo "freeside-install is a utility to install the Freeside ISP billing system." + echo "Usage: freeside-install -d -n -p -u " + echo "where:" + echo " domain is the required first domain, usually the ISP's main customer domain" + echo " database name is the name of the database for this instance of Freeside - defaults to freeside" + echo " packager is the package management tool you want to use: RPM, CPAN, etc." + exit 1 +} + +apologize() +{ + echo "Sorry, this version of freeside-install is non-functional. Feel free to contribute fixes" + echo "See http://www.sisd.com/mediawiki/index.php/Freeside:1.7:Documentation:Installation for information on how to install Freeside" + exit 1 +} + +install_perl_module() +{ + # We should do something smarter than this, checking to see if the module was installed + # and falling back to another package manager (or two) if not + echo "$MODULE: $CPAN" + case $PACKAGER in + apt) + # apt-get install $CPAN; + ;; + cpan) + # cpan install $CPAN; + ;; + cpan2rpm) + # cpan2rpm $CPAN; + # rpm -Uvh /usr/src/redhat/RPMS/*/perl-$CPAN*.rpm + ;; + rpm) + # Nothing to do; RPM should already be installed? + ;; + yum) + # yum install perl-$CPAN; + ;; + esac +} + +install_all_perl_modules() +{ + while read MODULE CPAN + do + install_perl_module $MODULE $CPAN; + done <