setup/config updates. getting easier...
authorivan <ivan>
Tue, 30 Oct 2001 10:20:32 +0000 (10:20 +0000)
committerivan <ivan>
Tue, 30 Oct 2001 10:20:32 +0000 (10:20 +0000)
FS/FS/Conf.pm
FS/MANIFEST
FS/bin/freeside-adduser [new file with mode: 0644]
Makefile
httemplate/docs/install.html

index fb8d13b..1c75954 100644 (file)
@@ -8,7 +8,7 @@ $DEBUG = 0;
 
 =head1 NAME
 
-FS::Conf - Read access to Freeside configuration values
+FS::Conf - Freeside configuration values
 
 =head1 SYNOPSIS
 
@@ -29,7 +29,7 @@ FS::Conf - Read access to Freeside configuration values
 
 =head1 DESCRIPTION
 
-Read access to Freeside configuration values.  Keys currently map to filenames,
+Read and write Freeside configuration values.  Keys currently map to filenames,
 but this may change in the future.
 
 =head1 METHODS
index 5de6977..4254514 100644 (file)
@@ -7,7 +7,8 @@ bin/freeside-bill
 bin/freeside-email
 bin/freeside-print-batch
 bin/freeside-queued
-fin/freeside-apply-credits
+bin/freeside-apply-credits
+bin/freeside-adduser
 FS.pm
 FS/CGI.pm
 FS/Conf.pm
diff --git a/FS/bin/freeside-adduser b/FS/bin/freeside-adduser
new file mode 100644 (file)
index 0000000..4517a83
--- /dev/null
@@ -0,0 +1,52 @@
+#!/usr/bin/perl -w
+#
+# $Id: freeside-adduser,v 1.1 2001-10-30 10:20:32 ivan Exp $
+
+use strict;
+use vars qw($opt_h $opt_c);
+use Getopt::Std;
+
+my $FREESIDE_CONF = "/usr/local/etc/freeside";
+
+getopts("ch:");
+die &usage if $opt_c && ! $opt_h;
+my $secretfile = shift or die &usage;
+my $user = shift or die &usage;
+
+my @args = ( 'htpasswd' );
+push @args, '-c' if $opt_c;
+push @args, $opt_h, $user;
+system(@args) == 0 or die "htpasswd failed: $?";
+
+open(MAPSECRETS,">>$FREESIDE_CONF/mapsecrets")
+  or die "can't open $FREESIDE_CONF/mapsecrets: $!";
+print MAPSECRETS "$user $secretfile\n";
+close MAPSECRETS or die "can't close $FREESIDE_CONF/mapsecrets: $!";
+
+sub usage {
+  die "Usage:\n\n  freeside-adduser [ -h htpasswd_file [ -c ] ] secretfile username"
+}
+
+=head1 NAME
+
+freeside-adduser - Command line interface to add (freeside) users.
+
+=head1 SYNOPSIS
+
+  freeside-adduser [ -h htpasswd_file [ -c ] ] username
+
+=head DESCRIPTION
+
+Adds a user to the Freeside billing system.  This is for adding users (internal
+sales/tech folks) to the web interface, not for adding customer accounts.
+
+  -h: Also call htpasswd for this user with the given filename
+
+  -c: Passed to htpasswd
+
+=head1 SEE ALSO
+
+L<htpasswd>, base Freeside documentation
+
+=cut
+
index 7edc5aa..90b6bf4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,33 @@
 #!/usr/bin/make
 
+#Pg
+DATASOURCE = DBI:Pg:host=localhost;dbname=freeside
+#pgsql on some systems; check /etc/passwd
+DB_ADMIN_USER = postgres
+DB_ADMIN_PASSWORD=
+
+#mysql
+#DATASOURCE=DBI:mysql:freeside
+#DB_ADMIN_USER=mysql
+#DB_ADMIN_PASSWORD=
+
+TEMPLATE = asp
+#mason's a bit dodgy stil
+#TEMPLATE = mason
+
+FREESIDE_DOCUMENT_ROOT = /var/www/freeside
+
+#---
+
+#not changable yet
+FREESIDE_CONF = /usr/local/etc/freeside
+
 help:
-       @echo "supported targets: aspdocs masondocs alldocs perl-modules"
-       @echo "                   install-perl-modules install clean"
+       @echo "supported targets: aspdocs masondocs alldocs docs install-docs"
+       @echo "                   perl-modules install-perl-modules"
+       @echo "                   install deploy"
+       @echo "                   create-database"
+       @echo "                   clean"
 
 aspdocs: httemplate/* httemplate/*/* httemplate/*/*/* httemplate/*/*/*/* httemplate/*/*/*/*/*
        rm -rf aspdocs
@@ -19,9 +44,11 @@ masondocs: httemplate/* httemplate/*/* httemplate/*/*/* httemplate/*/*/*/* httem
 
 alldocs: aspdocs masondocs
 
-FS/Makefile:
-       cd FS
-       perl Makefile.PL
+docs:
+       make ${TEMPLATE}docs
+
+install-docs: docs
+       cp -r ${TEMPLATE}docs ${FREESIDE_DOCUMENT_ROOT}
 
 perl-modules:
        cd FS; \
@@ -32,11 +59,34 @@ install-perl-modules: perl-modules
        cd FS; \
        make install
 
-install: install-perl-modules
+install: install-perl-modules install-docs
 
 deploy: install
        /etc/init.d/apache restart
 
+create-database:
+       perl -e 'use DBIx::DataSource qw( create_database ); create_database( \'${DATASOURCE}\', \'${DB_ADMIN_USER}\', \'${DB_ADMIN_PASSWORD}\' ) or die $DBIx::DataSource::errstr;'
+
+create-config: install-perl-modules
+       [ -d ${FREESIDE_CONF} ] || mkdir ${FREESIDE_CONF}
+       chown freeside ${FREESIDE_CONF}
+
+       [ -d "${FREESIDE_CONF}/conf.${DATASOURCE}" ] \
+         || mkdir "${FREESIDE_CONF}/conf.${DATASOURCE}"
+       chown freeside "${FREESIDE_CONF/conf.${DATASOURCE}"
+
+       [ -d "${FREESIDE_CONF}/counters.${DATASOURCE}" ] \
+         || mkdir "${FREESIDE_CONF}/counters.${DATASOURCE}"
+       chown freeside "${FREESIDE_CONF/counters.${DATASOURCE}"
+
+       [ -d "${FREESIDE_CONF}/cache.${DATASOURCE}" ] \
+         || mkdir "${FREESIDE_CONF}/cache.${DATASOURCE}"
+       chown freeside "${FREESIDE_CONF/cache.${DATASOURCE}"
+
+       [ -d "${FREESIDE_CONF}/export.${DATASOURCE}" ] \
+         || mkdir "${FREESIDE_CONF}/export.${DATASOURCE}"
+       chown freeside "${FREESIDE_CONF/export.${DATASOURCE}"
+
 clean:
        rm -rf aspdocs masondocs
        cd FS; \
index 63c39d6..3a14fa7 100644 (file)
@@ -38,6 +38,7 @@ Before installing, you need:
       <li><a href="http://search.cpan.org/search?dist=Text-Template">Text-Template</a>
       <li><a href="http://search.cpan.org/search?dist=DBI">DBI</a>
       <li><a href="http://search.cpan.org/search?mode=module&query=DBD">DBD for your database engine</a>
+      <li><a href="http://search.cpan.org/search?dist=DBIx-DataSource">DBIx-DataSource</a>
       <li><a href="http://search.cpan.org/search?dist=DBIx-DBSchema">DBIx-DBSchema</a>
       <li><a href="http://search.cpan.org/search?dist=Net-SSH">Net-SSH</a>
       <li><a href="http://search.cpan.org/search?dist=String-ShellQuote">String-ShellQuote</a>
@@ -112,7 +113,16 @@ require "/usr/local/apache/conf/handler.pl";
   </tr>
 </table>
 <ul>
-<li>Restrict access to this web interface.  (with <a href="http://httpd.apache.org/docs/misc/FAQ.html#user-authentication">Apache</a>)
+<li>Restrict access to this web interface.  (with <a href="http://httpd.apache.org/docs/misc/FAQ.html#user-authentication">Apache</a>).    For example, to configure user authentication with flat files:
+<font size="-1"><pre>
+&lt;Directory /usr/local/apache/htdocs/freeside-asp&gt;
+PerlSetVar Global /usr/local/etc/freeside/asp-global/
+AuthName Freeside
+AuthType Basic
+AuthUserFile /usr/local/etc/apache/htpasswd
+require valid-user
+&lt;/Directory&gt;
+</pre>
 <li>Create the necessary <a href="config.html">configuration files</a>.
 <li>Create the `/usr/local/etc/freeside/counters.<i>datasrc</i>', 
   `/usr/local/etc/freeside/cache.<i>datasrc</i>', and