[freeside-commits] freeside/FS/bin freeside-addoutsource, 1.4,
1.5 freeside-addoutsourceuser, 1.9, 1.10 freeside-adduser,
1.16, 1.17 freeside-deloutsource, 1.1,
1.2 freeside-deloutsourceuser, 1.1, 1.2 freeside-deluser, 1.1,
1.2 freeside-queued, 1.33, 1.34 freeside-selfservice-server,
1.18, 1.19 freeside-setup, 1.58,
1.59 freeside-sqlradius-radacctd, 1.7, 1.8 freeside-upgrade,
1.4, 1.5
Ivan,,,
ivan at wavetail.420.am
Thu Dec 14 01:27:28 PST 2006
Update of /home/cvs/cvsroot/freeside/FS/bin
In directory wavetail:/tmp/cvs-serv19347/FS/bin
Modified Files:
freeside-addoutsource freeside-addoutsourceuser
freeside-adduser freeside-deloutsource
freeside-deloutsourceuser freeside-deluser freeside-queued
freeside-selfservice-server freeside-setup
freeside-sqlradius-radacctd freeside-upgrade
Log Message:
make the config directory configurable
Index: freeside-addoutsourceuser
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-addoutsourceuser,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- freeside-addoutsourceuser 9 Oct 2006 01:05:27 -0000 1.9
+++ freeside-addoutsourceuser 14 Dec 2006 09:27:26 -0000 1.10
@@ -4,16 +4,15 @@
domain=$2
password=$3
realdomain=$4
-
+FREESIDE_CONF=%%%FREESIDE_CONF%%%
freeside-adduser -s conf.DBI:Pg:dbname=$domain/secrets \
-n \
$username #2>/dev/null
-[ -e /usr/local/etc/freeside/dbdef.DBI:Pg:dbname=$domain ] \
+[ -e $FREESIDE_CONF/dbdef.DBI:Pg:dbname=$domain ] \
|| ( freeside-setup -d $realdomain -u $username )
-# 2>/dev/null
freeside-adduser -g 1 $username
-htpasswd -b /usr/local/etc/freeside/htpasswd $username $password
+htpasswd -b $FREESIDE_CONF/htpasswd $username $password
Index: freeside-setup
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-setup,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- freeside-setup 6 Sep 2006 01:08:20 -0000 1.58
+++ freeside-setup 14 Dec 2006 09:27:26 -0000 1.59
@@ -24,7 +24,7 @@
getsecrets($opt_u); #$user);
#needs to match FS::Record
-my($dbdef_file) = "/usr/local/etc/freeside/dbdef.". datasrc;
+my($dbdef_file) = "%%%FREESIDE_CONF%%%/dbdef.". datasrc;
###
@@ -127,3 +127,4 @@
1;
+
Index: freeside-selfservice-server
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-selfservice-server,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- freeside-selfservice-server 5 Nov 2006 16:58:19 -0000 1.18
+++ freeside-selfservice-server 14 Dec 2006 09:27:26 -0000 1.19
@@ -18,6 +18,8 @@
use FS::cust_bill;
use FS::cust_pkg;
+$FREESIDE_CONF = "%%%FREESIDE_CONF%%%";
+
$Debug = 1; # 2 will turn on more logging
# 3 will log packet contents, including passwords
@@ -50,11 +52,10 @@
adminsuidsetup $user;
#logfile("/usr/local/etc/freeside/selfservice.". $FS::UID::datasrc); #MACHINE
-logfile("/usr/local/etc/freeside/selfservice.$machine.log");
+logfile("$FREESIDE_SERVER/selfservice.$machine.log");
daemonize2();
-
my $conf = new FS::Conf;
my $clientd = "/usr/local/sbin/freeside-selfservice-clientd"; #better name?
Index: freeside-deluser
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-deluser,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- freeside-deluser 20 Sep 2002 15:47:58 -0000 1.1
+++ freeside-deluser 14 Dec 2006 09:27:26 -0000 1.2
@@ -5,7 +5,7 @@
use Fcntl qw(:flock);
use Getopt::Std;
-my $FREESIDE_CONF = "/usr/local/etc/freeside";
+my $FREESIDE_CONF = "%%%FREESIDE_CONF%%%";
getopts("h:");
my $user = shift or die &usage;
Index: freeside-sqlradius-radacctd
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-sqlradius-radacctd,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- freeside-sqlradius-radacctd 28 Nov 2005 17:13:30 -0000 1.7
+++ freeside-sqlradius-radacctd 14 Dec 2006 09:27:26 -0000 1.8
@@ -23,7 +23,7 @@
adminsuidsetup $user;
-logfile( "/usr/local/etc/freeside/sqlradius-radacctd-log.". $FS::UID::datasrc );
+logfile( "%%%FREESIDE_CONF%%%/sqlradius-radacctd-log.". $FS::UID::datasrc );
daemonize2();
Index: freeside-deloutsource
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-deloutsource,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- freeside-deloutsource 20 Sep 2002 15:47:58 -0000 1.1
+++ freeside-deloutsource 14 Dec 2006 09:27:26 -0000 1.2
@@ -1,11 +1,12 @@
#!/bin/sh
domain=$1
+FREESIDE_CONF=%%%FREESIDE_CONF%%%
dropdb $domain && \
-rm -rf /usr/local/etc/freeside/conf.DBI:Pg:host=localhost\;dbname=$domain && \
-rm -rf /usr/local/etc/freeside/counters.DBI:Pg:host=localhost\;dbname=$domain && \
-rm -rf /usr/local/etc/freeside/cache.DBI:Pg:host=localhost\;dbname=$domain && \
-rm -rf /usr/local/etc/freeside/export.DBI:Pg:host=localhost\;dbname=$domain && \
-rm /usr/local/etc/freeside/dbdef.DBI:Pg:host=localhost\;dbname=$domain
+rm -rf $FREESIDE_CONF/conf.DBI:Pg:host=localhost\;dbname=$domain && \
+rm -rf $FREESIDE_CONF/counters.DBI:Pg:host=localhost\;dbname=$domain && \
+rm -rf $FREESIDE_CONF/cache.DBI:Pg:host=localhost\;dbname=$domain && \
+rm -rf $FREESIDE_CONF/export.DBI:Pg:host=localhost\;dbname=$domain && \
+rm $FREESIDE_CONF/dbdef.DBI:Pg:host=localhost\;dbname=$domain
Index: freeside-adduser
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-adduser,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- freeside-adduser 9 Oct 2006 01:05:27 -0000 1.16
+++ freeside-adduser 14 Dec 2006 09:27:26 -0000 1.17
@@ -5,7 +5,7 @@
use Fcntl qw(:flock);
use Getopt::Std;
-my $FREESIDE_CONF = "/usr/local/etc/freeside";
+my $FREESIDE_CONF = "%%%FREESIDE_CONF%%%";
getopts("s:g:n");
my $user = shift or die &usage;
Index: freeside-queued
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-queued,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- freeside-queued 1 Dec 2006 01:41:39 -0000 1.33
+++ freeside-queued 14 Dec 2006 09:27:26 -0000 1.34
@@ -41,7 +41,7 @@
}
}
-logfile( "/usr/local/etc/freeside/queuelog.". $FS::UID::datasrc );
+logfile( "%%%FREESIDE_CONF%%%/queuelog.". $FS::UID::datasrc );
warn "completing daemonization (detaching))\n" if $DEBUG;
daemonize2();
Index: freeside-deloutsourceuser
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-deloutsourceuser,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- freeside-deloutsourceuser 20 Sep 2002 15:47:58 -0000 1.1
+++ freeside-deloutsourceuser 14 Dec 2006 09:27:26 -0000 1.2
@@ -2,5 +2,5 @@
username=$1
-freeside-deluser -h /usr/local/etc/freeside/htpasswd $username 2>/dev/null
+freeside-deluser -h %%%FREESIDE_CONF%%%/htpasswd $username 2>/dev/null
Index: freeside-upgrade
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-upgrade,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- freeside-upgrade 19 Jun 2006 12:15:32 -0000 1.4
+++ freeside-upgrade 14 Dec 2006 09:27:26 -0000 1.5
@@ -1,23 +1,29 @@
#!/usr/bin/perl -w
use strict;
+use vars qw($opt_d $opt_q $opt_v);
use vars qw($DEBUG $DRY_RUN);
-use Term::ReadKey;
+use Getopt::Std;
use DBIx::DBSchema 0.31;
use FS::UID qw(adminsuidsetup checkeuid datasrc ); #getsecrets);
use FS::CurrentUser;
use FS::Schema qw( dbdef dbdef_dist reload_dbdef );
-$DEBUG = 1;
-
die "Not running uid freeside!" unless checkeuid();
+getopts("dq");
+
+$DEBUG = !$opt_q;
+#$DEBUG = $opt_v;
+
+$DRY_RUN = $opt_d;
+
my $user = shift or die &usage;
$FS::CurrentUser::upgrade_hack = 1;
my $dbh = adminsuidsetup($user);
#needs to match FS::Schema...
-my $dbdef_file = "/usr/local/etc/freeside/dbdef.". datasrc;
+my $dbdef_file = "%%%FREESIDE_CONF%%%/dbdef.". datasrc;
dbdef_create($dbh, $dbdef_file);
@@ -26,7 +32,13 @@
$DBIx::DBSchema::DEBUG = $DEBUG;
$DBIx::DBSchema::Table::DEBUG = $DEBUG;
-dbdef->update_schema( dbdef_dist, $dbh );
+
+if ( $DRY_RUN ) {
+ print join(";\n", dbdef->sql_update_schema( dbdef_dist, $dbh ) ). ";\n";
+ exit;
+} else {
+ dbdef->update_schema( dbdef_dist, $dbh );
+}
$dbh->commit or die $dbh->errstr;
@@ -43,7 +55,31 @@
}
sub usage {
- die "Usage:\n freeside-upgrade user\n";
+ die "Usage:\n freeside-upgrade [ -d ] [ -q | -v ] user\n";
}
-1;
+=head1 NAME
+
+freeside-upgrade - Upgrades database schema for new freeside verisons.
+
+=head1 SYNOPSIS
+
+ freeside-adduser [ -d ] [ -q | -v ]
+
+=head1 DESCRIPTION
+
+Reads your existing database schema and updates it to match the current schema,
+adding any columns or tables necessary.
+
+ [ -d ]: Dry run; output SQL statements (to STDOUT) only, but do not execute
+ them.
+
+ [ -q ]: Run quietly. This may become the default at some point.
+
+ [ -v ]: Run verbosely, sending debugging information to STDERR. This is the
+ current default.
+
+=head1 SEE ALSO
+
+=cut
+
Index: freeside-addoutsource
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-addoutsource,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- freeside-addoutsource 9 Oct 2006 01:05:27 -0000 1.4
+++ freeside-addoutsource 14 Dec 2006 09:27:26 -0000 1.5
@@ -2,24 +2,29 @@
domain=$1
+FREESIDE_CONF=%%%FREESIDE_CONF%%%
+
+#without this, [a-z]* matches CVS/, the copy doesn't return a sucessful error
+# status, and the rest of the commands aren't run
+export LANG=C
+
createdb $domain && \
\
-mkdir /usr/local/etc/freeside/conf.DBI:Pg:dbname=$domain && \
+mkdir $FREESIDE_CONF/conf.DBI:Pg:dbname=$domain && \
\
-chown freeside /usr/local/etc/freeside/conf.DBI:Pg:dbname=$domain && \
+chown freeside $FREESIDE_CONF/conf.DBI:Pg:dbname=$domain && \
\
-cp /home/ivan/freeside/conf/[a-z]* /usr/local/etc/freeside/conf.DBI:Pg:dbname=$domain
-
-
-touch /usr/local/etc/freeside/conf.DBI:Pg:dbname=$domain/secrets && \
+cp /home/ivan/freeside/conf/[a-z]* $FREESIDE_CONF/conf.DBI:Pg:dbname=$domain && \
\
-chown freeside /usr/local/etc/freeside/conf.DBI:Pg:dbname=$domain/secrets && \
+touch $FREESIDE_CONF/conf.DBI:Pg:dbname=$domain/secrets && \
\
-chmod 600 /usr/local/etc/freeside/conf.DBI:Pg:dbname=$domain/secrets && \
+chown freeside $FREESIDE_CONF/conf.DBI:Pg:dbname=$domain/secrets && \
\
-echo -e "DBI:Pg:dbname=$domain\nfreeside\n" >/usr/local/etc/freeside/conf.DBI:Pg:dbname=$domain/secrets && \
+chmod 600 $FREESIDE_CONF/conf.DBI:Pg:dbname=$domain/secrets && \
\
-mkdir /usr/local/etc/freeside/counters.DBI:Pg:dbname=$domain && \
-mkdir /usr/local/etc/freeside/cache.DBI:Pg:dbname=$domain && \
-mkdir /usr/local/etc/freeside/export.DBI:Pg:dbname=$domain
+echo -e "DBI:Pg:dbname=$domain\nfreeside\n" >$FREESIDE_CONF/conf.DBI:Pg:dbname=$domain/secrets && \
+\
+mkdir $FREESIDE_CONF/counters.DBI:Pg:dbname=$domain && \
+mkdir $FREESIDE_CONF/cache.DBI:Pg:dbname=$domain && \
+mkdir $FREESIDE_CONF/export.DBI:Pg:dbname=$domain
More information about the freeside-commits
mailing list