add initial netcentrex CDR format
[freeside.git] / Makefile
index c813168..0bd4704 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,11 @@ FREESIDE_EXPORT = /usr/local/etc/freeside
 MASON_HANDLER = ${FREESIDE_CONF}/handler.pl
 MASONDATA = ${FREESIDE_CACHE}/masondata
 
+#where to put the default configuraiton used by freeside-setup to initialize
+#a new database (not used after that).  primarily of interest to distro
+#package maintainers
+DIST_CONF = ${FREESIDE_CONF}/default_conf
+
 #mod_perl v1
 #APACHE_VERSION = 1
 #mod_perl v2 prereleases up to and including 1.999_21
@@ -103,11 +108,14 @@ FREESIDE_URL = "http://localhost/freeside/"
 #for now, same db as specified in DATASOURCE... eventually, otherwise?
 RT_DB_DATABASE = freeside
 
+# for cvs-upgrade-deploy target, the username who checked out the CVS copy.
+CVS_USER = ivan
+
+# for auto-version updates, so we can "make release" more things automatically
 RPM_SPECFILE = rpm/freeside.spec
 
 #---
 
-
 #rt/config.layout.in
 RT_PATH = /opt/rt3
 
@@ -124,6 +132,7 @@ help:
        @echo "supported targets:"
        @echo "                   create-database create-config"
        @echo "                   install deploy"
+       @echo "                   cvs-upgrade-deploy"
        @echo "                   configure-rt create-rt"
        @echo "                   clean help"
        @echo
@@ -160,11 +169,6 @@ install-docs: docs
        cp -r masondocs ${FREESIDE_DOCUMENT_ROOT}
        chown -R freeside:freeside ${FREESIDE_DOCUMENT_ROOT}
        cp htetc/handler.pl ${MASON_HANDLER}
-         perl -p -i -e "\
-           s'%%%FREESIDE_DOCUMENT_ROOT%%%'${FREESIDE_DOCUMENT_ROOT}'g; \
-           s'%%%RT_ENABLED%%%'${RT_ENABLED}'g; \
-           s'%%%MASONDATA%%%'${MASONDATA}'g;\
-         " ${MASON_HANDLER}
        [ ! -e ${MASONDATA} ] && mkdir ${MASONDATA} || true
        chown -R freeside ${MASONDATA}
 
@@ -173,14 +177,10 @@ dev-docs:
        ln -s ${FREESIDE_PATH}/httemplate ${FREESIDE_DOCUMENT_ROOT}
        cp htetc/handler.pl ${MASON_HANDLER}
        perl -p -i -e "\
-         s'%%%FREESIDE_DOCUMENT_ROOT%%%'${FREESIDE_DOCUMENT_ROOT}'g; \
-         s'%%%RT_ENABLED%%%'${RT_ENABLED}'g; \
-         s'%%%MASONDATA%%%'${MASONDATA}'g;\
          s'###use Module::Refresh;###'use Module::Refresh;'; \
          s'###Module::Refresh->refresh;###'Module::Refresh->refresh;'; \
        " ${MASON_HANDLER} || true
 
-
 perl-modules:
        cd FS; \
        [ -e Makefile ] || perl Makefile.PL; \
@@ -191,6 +191,9 @@ perl-modules:
        perl -p -i -e "\
          s|%%%FREESIDE_CONF%%%|${FREESIDE_CONF}|g;\
          s|%%%FREESIDE_CACHE%%%|${FREESIDE_CACHE}|g;\
+         s'%%%FREESIDE_DOCUMENT_ROOT%%%'${FREESIDE_DOCUMENT_ROOT}'g; \
+         s'%%%RT_ENABLED%%%'${RT_ENABLED}'g; \
+         s'%%%MASONDATA%%%'${MASONDATA}'g;\
        " blib/lib/FS/*.pm;\
        perl -p -i -e "\
          s|%%%FREESIDE_EXPORT%%%|${FREESIDE_EXPORT}|g;\
@@ -201,6 +204,7 @@ perl-modules:
          s|%%%FREESIDE_LOCK%%%|${FREESIDE_LOCK}|g;\
          s|%%%FREESIDE_CACHE%%%|${FREESIDE_CACHE}|g;\
          s|%%%FREESIDE_EXPORT%%%|${FREESIDE_EXPORT}|g;\
+         s|%%%DIST_CONF%%%|${DIST_CONF}|g;\
        " blib/script/*
 
 install-perl-modules: perl-modules
@@ -210,6 +214,11 @@ install-perl-modules: perl-modules
          || true
        cd FS; \
        make install UNINST=1
+       #install this for freeside-setup
+       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)
 
 dev-perl-modules: perl-modules
        [ -d ${PERL_INC_DEV_KLUDGE}/FS -a ! -L ${PERL_INC_DEV_KLUDGE}/FS ] \
@@ -243,7 +252,7 @@ install-apache:
 
 install-selfservice:
        [ -e ~freeside ] || cp -pr /etc/skel ~freeside && chown -R freeside ~freeside
-       [ -e ~freeside/.ssh/id_dsa.pub ] || su - freeside -c 'ssh-keygen -t dsa'
+       [ -e ~freeside/.ssh/id_dsa.pub ] || [ -e ~freeside/.ssh/id_rsa.pub ] || su - freeside -c 'ssh-keygen -t dsa'
        for MACHINE in ${SELFSERVICE_MACHINES}; do \
          scp -r fs_selfservice/FS-SelfService ${SELFSERVICE_INSTALL_USER}@$$MACHINE:. ;\
          ssh ${SELFSERVICE_INSTALL_USER}@$$MACHINE "cd FS-SelfService; perl Makefile.PL && make" ;\
@@ -256,7 +265,7 @@ install-selfservice:
 update-selfservice:
        for MACHINE in ${SELFSERVICE_MACHINES}; do \
          RSYNC_RSH=ssh rsync -rlptz fs_selfservice/FS-SelfService/ ${SELFSERVICE_INSTALL_USER}@$$MACHINE:FS-SelfService ;\
-         ssh ${SELFSERVICE_INSTALL_USER}@$$MACHINE "cd FS-SelfService; perl Makefile.PL && make" ;\
+         ssh ${SELFSERVICE_INSTALL_USER}@$$MACHINE "cd FS-SelfService; make clean; perl Makefile.PL && make" ;\
          ssh ${SELFSERVICE_INSTALL_USER}@$$MACHINE "cd FS-SelfService; sudo make install" ;\
        done
 
@@ -266,6 +275,12 @@ deploy: install
        ${HTTPD_RESTART}
        ${FREESIDE_RESTART}
 
+cvs-upgrade-deploy:
+       su ${CVS_USER} -c 'cvs update -d -P'
+       make install-perl-modules
+       su freeside -c "freeside-upgrade ${CVS_USER}" #not really the same user
+       make deploy
+
 dev: dev-perl-modules dev-docs
 
 create-database:
@@ -298,6 +313,12 @@ create-config: install-perl-modules
        mkdir "${FREESIDE_EXPORT}/export.${DATASOURCE}"
        chown freeside "${FREESIDE_EXPORT}/export.${DATASOURCE}"
 
+       #install this for freeside-setup
+       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)
+
 configure-rt:
        cd rt; \
        cp config.layout.in config.layout; \
@@ -356,10 +377,12 @@ release:
        cvs commit -m "Updated for ${VERSION}" ChangeLog
 
        # Update the RPM specfile
+       cvs edit ${RPM_SPECFILE}
        perl -p -i -e "s/\d+[^\}]+/${VERSION}/ if /%define\s+version\s+(\d+[^\}]+)\}/;" ${RPM_SPECFILE}
        cvs commit -m "Updated for ${VERSION}" ${RPM_SPECFILE}
 
        # Update the Debian changelog
+       cvs edit debian/changelog
        dch -v ${DEBVERSION} -p "New upstream release"
        cvs commit -m "Updated for ${VERSION}" debian/changelog