3 #solaris and perhaps other very weirdass /bin/sh
12 DATASOURCE = DBI:${DB_TYPE}:dbname=freeside
14 #changable now (some things which should go to the others still go to CONF)
15 FREESIDE_CONF = /usr/local/etc/freeside
16 FREESIDE_LOG = /usr/local/etc/freeside
17 FREESIDE_LOCK = /usr/local/etc/freeside
18 FREESIDE_CACHE = /usr/local/etc/freeside
19 FREESIDE_EXPORT = /usr/local/etc/freeside
21 MASON_HANDLER = ${FREESIDE_CONF}/handler.pl
22 MASONDATA = ${FREESIDE_CACHE}/masondata
24 #where to put the default configuraiton used by freeside-setup to initialize
25 #a new database (not used after that). primarily of interest to distro
27 DIST_CONF = ${FREESIDE_CONF}/default_conf
31 #mod_perl v2 prereleases up to and including 1.999_21
33 #mod_perl v2 proper and prereleases 1.999_22 and after
37 FREESIDE_DOCUMENT_ROOT = /var/www/freeside
38 #redhat, fedora, mandrake
39 #FREESIDE_DOCUMENT_ROOT = /var/www/html/freeside
41 #FREESIDE_DOCUMENT_ROOT = /usr/local/www/data/freeside
43 #FREESIDE_DOCUMENT_ROOT = /var/www/htdocs/freeside
45 #FREESIDE_DOCUMENT_ROOT = /srv/www/htdocs/freeside
47 #FREESIDE_DOCUMENT_ROOT = /usr/local/apache/htdocs/freeside
49 #deb, redhat, fedora, mandrake, suse, others?
50 INIT_FILE = /etc/init.d/freeside
52 #INIT_FILE = /usr/local/etc/rc.d/011.freeside.sh
55 INIT_INSTALL = /usr/sbin/update-rc.d freeside defaults 23 01
57 #INIT_INSTALL = /sbin/chkconfig freeside on
58 #not necessary (freebsd)
59 #INIT_INSTALL = /usr/bin/true
62 #HTTPD_RESTART = /etc/init.d/apache restart
64 HTTPD_RESTART = /etc/init.d/apache2 restart
65 #redhat, fedora, mandrake
66 #HTTPD_RESTART = /etc/init.d/httpd restart
68 #HTTPD_RESTART = /usr/local/etc/rc.d/apache.sh stop || true; sleep 10; /usr/local/etc/rc.d/apache.sh start
70 #HTTPD_RESTART = kill -TERM `cat /var/www/logs/httpd.pid`; sleep 10; /usr/sbin/httpd -u -DSSL
72 #HTTPD_RESTART = /usr/local/apache/bin/apachectl stop; sleep 10; /usr/local/apache/bin/apachectl startssl
74 #(an include directory, not a file, "Include /etc/apache/conf.d" in httpd.conf)
76 APACHE_CONF = /etc/apache2/conf.d
78 FREESIDE_RESTART = ${INIT_FILE} restart
80 #deb, redhat, fedora, mandrake, suse, others?
85 #edit the stuff below to have the daemons start
89 SELFSERVICE_USER = fs_selfservice
90 #never run on the same machine in production!!!
91 SELFSERVICE_MACHINES =
92 # SELFSERVICE_MACHINES = www.example.com
93 # SELFSERVICE_MACHINES = web1.example.com web2.example.com
95 #user with sudo access on SELFSERVICE_MACHINES for automated self-service
97 SELFSERVICE_INSTALL_USER = ivan
98 SELFSERVICE_INSTALL_USERADD = /usr/sbin/useradd
99 #SELFSERVICE_INSTALL_USERADD = "/usr/sbin/pw useradd"
103 RT_DOMAIN = example.com
104 RT_TIMEZONE = US/Pacific
105 #RT_TIMEZONE = US/Eastern
106 FREESIDE_URL = "http://localhost/freeside/"
108 #for now, same db as specified in DATASOURCE... eventually, otherwise?
109 RT_DB_DATABASE = freeside
111 # for auto-version updates, so we can "make release" more things automatically
112 RPM_SPECFILE = rpm/freeside.spec
119 #only used for dev kludge now, not a big deal
120 FREESIDE_PATH = `pwd`
121 PERL_INC_DEV_KLUDGE = /usr/local/share/perl/5.10.1/
126 DEBVERSION = `echo ${VERSION} | perl -pe 's/(\d)([a-z])/\1~\2/'`-1
128 TEXMFHOME := "\$$TEXMFHOME"
131 @echo "supported targets:"
132 @echo " create-database create-config"
133 @echo " install deploy"
134 @echo " configure-rt create-rt"
137 @echo " install-docs install-perl-modules"
138 @echo " install-init install-apache"
139 @echo " install-rt install-texmf"
140 @echo " install-selfservice update-selfservice"
142 @echo " dev dev-docs dev-perl-modules"
144 @echo " masondocs alldocs docs"
146 @echo " perl-modules"
148 #@echo " upload-docs release"
151 masondocs: httemplate/* httemplate/*/* httemplate/*/*/* httemplate/*/*/*/*
153 cp -pr httemplate masondocs
162 chmod a+rx ./bin/pod2x
165 install-docs: check-conflicts docs
166 [ -e ${FREESIDE_DOCUMENT_ROOT} ] && mv ${FREESIDE_DOCUMENT_ROOT} ${FREESIDE_DOCUMENT_ROOT}.`date +%Y%m%d%H%M%S` || true
167 cp -r masondocs ${FREESIDE_DOCUMENT_ROOT}
168 chown -R freeside:freeside ${FREESIDE_DOCUMENT_ROOT}
169 cp htetc/handler.pl ${MASON_HANDLER}
170 cp htetc/htpasswd.logout ${FREESIDE_CONF}
171 [ ! -e ${MASONDATA} ] && mkdir ${MASONDATA} || true
172 chown -R freeside ${MASONDATA}
175 [ -e ${FREESIDE_DOCUMENT_ROOT} ] && mv ${FREESIDE_DOCUMENT_ROOT} ${FREESIDE_DOCUMENT_ROOT}.`date +%Y%m%d%H%M%S` || true
176 ln -s ${FREESIDE_PATH}/httemplate ${FREESIDE_DOCUMENT_ROOT}
177 cp htetc/handler.pl ${MASON_HANDLER}
179 s'###use Module::Refresh;###'use Module::Refresh;'; \
180 s'###Module::Refresh->refresh;###'Module::Refresh->refresh;'; \
181 " ${MASON_HANDLER} || true
185 [ -e Makefile ] || perl Makefile.PL; \
188 s/%%%VERSION%%%/${VERSION}/g;\
191 s|%%%FREESIDE_CONF%%%|${FREESIDE_CONF}|g;\
192 s|%%%FREESIDE_CACHE%%%|${FREESIDE_CACHE}|g;\
193 s'%%%FREESIDE_DOCUMENT_ROOT%%%'${FREESIDE_DOCUMENT_ROOT}'g; \
194 s'%%%RT_ENABLED%%%'${RT_ENABLED}'g; \
195 s'%%%RT_PATH%%%'${RT_PATH}'g; \
196 s'%%%MASONDATA%%%'${MASONDATA}'g;\
199 s/%%%SELFSERVICE_USER%%%/${SELFSERVICE_USER}/g;\
200 s/%%%SELFSERVICE_MACHINES%%%/${SELFSERVICE_MACHINES}/g;\
201 s|%%%FREESIDE_EXPORT%%%|${FREESIDE_EXPORT}|g;\
202 " blib/lib/FS/Cron/*.pm;\
204 s|%%%FREESIDE_CONF%%%|${FREESIDE_CONF}|g;\
205 s|%%%FREESIDE_EXPORT%%%|${FREESIDE_EXPORT}|g;\
206 s|%%%FREESIDE_LOG%%%|${FREESIDE_LOG}|g;\
207 " blib/lib/FS/part_export/*.pm;\
209 s|%%%FREESIDE_CACHE%%%|${FREESIDE_CACHE}|g;\
210 " blib/lib/FS/cust_main/*.pm blib/lib/FS/cust_pkg/*.pm;\
212 s|%%%FREESIDE_CONF%%%|${FREESIDE_CONF}|g;\
213 s|%%%FREESIDE_LOG%%%|${FREESIDE_LOG}|g;\
214 s|%%%FREESIDE_LOCK%%%|${FREESIDE_LOCK}|g;\
215 s|%%%FREESIDE_CACHE%%%|${FREESIDE_CACHE}|g;\
216 s|%%%FREESIDE_EXPORT%%%|${FREESIDE_EXPORT}|g;\
217 s|%%%DIST_CONF%%%|${DIST_CONF}|g;\
220 install-perl-modules: check-conflicts perl-modules install-rt-initialdata
221 [ -L ${PERL_INC_DEV_KLUDGE}/FS ] \
222 && rm ${PERL_INC_DEV_KLUDGE}/FS \
223 && mv ${PERL_INC_DEV_KLUDGE}/FS.old ${PERL_INC_DEV_KLUDGE}/FS \
226 make install UNINST=1
227 #install this for freeside-setup
228 install -d $(DIST_CONF)
229 #install conf/[a-z]* $(DEFAULT_CONF)
231 install `ls -d conf/[a-z]* | grep -v CVS | grep -v '^conf/registries'` $(DIST_CONF)
233 dev-perl-modules: perl-modules
234 [ -d ${PERL_INC_DEV_KLUDGE}/FS -a ! -L ${PERL_INC_DEV_KLUDGE}/FS ] \
235 && mv ${PERL_INC_DEV_KLUDGE}/FS ${PERL_INC_DEV_KLUDGE}/FS.old \
238 rm -rf ${PERL_INC_DEV_KLUDGE}/FS
239 ln -sf ${FREESIDE_PATH}/FS/blib/lib/FS ${PERL_INC_DEV_KLUDGE}/FS
242 install -D -o freeside -m 444 etc/fslongtable.sty \
243 `kpsewhich -expand-var \\\$$TEXMFLOCAL`/tex/generic/fslongtable.sty
244 texhash `kpsewhich -expand-var \\\$$TEXMFLOCAL`
247 #[ -e ${INIT_FILE} ] || install -o root -g ${INSTALLGROUP} -m 711 init.d/freeside-init ${INIT_FILE}
248 install -o root -g ${INSTALLGROUP} -m 711 init.d/freeside-init ${INIT_FILE}
250 s/%%%QUEUED_USER%%%/${QUEUED_USER}/g;\
251 s/%%%SELFSERVICE_USER%%%/${SELFSERVICE_USER}/g;\
252 s/%%%SELFSERVICE_MACHINES%%%/${SELFSERVICE_MACHINES}/g;\
257 [ -e ${APACHE_CONF}/freeside-base.conf ] && rm ${APACHE_CONF}/freeside-base.conf || true
258 [ -d ${APACHE_CONF} ] && \
259 ( install -o root -m 755 htetc/freeside-base${APACHE_VERSION}.conf ${APACHE_CONF} && \
260 ( [ ${RT_ENABLED} -eq 1 ] && install -o root -m 755 htetc/freeside-rt.conf ${APACHE_CONF} || true ) && \
262 s'%%%FREESIDE_DOCUMENT_ROOT%%%'${FREESIDE_DOCUMENT_ROOT}'g; \
263 s'%%%FREESIDE_CONF%%%'${FREESIDE_CONF}'g; \
264 s'%%%MASON_HANDLER%%%'${MASON_HANDLER}'g; \
265 " ${APACHE_CONF}/freeside-*.conf \
269 [ -e ~freeside ] || cp -pr /etc/skel ~freeside && chown -R freeside ~freeside
270 [ -e ~freeside/.ssh/id_dsa.pub ] || [ -e ~freeside/.ssh/id_rsa.pub ] || su - freeside -c 'ssh-keygen -t dsa'
271 for MACHINE in ${SELFSERVICE_MACHINES}; do \
272 scp -r fs_selfservice/FS-SelfService ${SELFSERVICE_INSTALL_USER}@$$MACHINE:. ;\
273 ssh ${SELFSERVICE_INSTALL_USER}@$$MACHINE "cd FS-SelfService; perl Makefile.PL && make" ;\
274 ssh ${SELFSERVICE_INSTALL_USER}@$$MACHINE "cd FS-SelfService; sudo make install" ;\
275 scp ~freeside/.ssh/id_dsa.pub ${SELFSERVICE_INSTALL_USER}@$$MACHINE:. ;\
276 ssh ${SELFSERVICE_INSTALL_USER}@$$MACHINE "sudo ${SELFSERVICE_INSTALL_USERADD} freeside; sudo install -d -o freeside -m 600 ~freeside/.ssh/; sudo install -o freeside -m 600 ./id_dsa.pub ~freeside/.ssh/authorized_keys" ;\
277 ssh ${SELFSERVICE_INSTALL_USER}@$$MACHINE "sudo install -o freeside -d /usr/local/freeside" ;\
281 for MACHINE in ${SELFSERVICE_MACHINES}; do \
282 RSYNC_RSH=ssh rsync -rlptz fs_selfservice/FS-SelfService/ ${SELFSERVICE_INSTALL_USER}@$$MACHINE:FS-SelfService ;\
283 ssh ${SELFSERVICE_INSTALL_USER}@$$MACHINE "cd FS-SelfService; make clean; perl Makefile.PL && make" ;\
284 ssh ${SELFSERVICE_INSTALL_USER}@$$MACHINE "cd FS-SelfService; sudo make install" ;\
287 install: install-perl-modules install-docs install-init install-apache install-rt install-texmf
293 dev: dev-perl-modules dev-docs
296 perl -e 'use DBIx::DataSource qw( create_database ); create_database( "${DATASOURCE}", "${DB_USER}", "${DB_PASSWORD}" ) or die $$DBIx::DataSource::errstr;'
298 create-config: install-perl-modules
299 [ -e ${FREESIDE_CONF} ] && mv ${FREESIDE_CONF} ${FREESIDE_CONF}.`date +%Y%m%d%H%M%S` || true
300 install -d -o freeside ${FREESIDE_CONF}
302 touch ${FREESIDE_CONF}/secrets
303 chown freeside ${FREESIDE_CONF}/secrets
304 chmod 600 ${FREESIDE_CONF}/secrets
306 /bin/echo -e "${DATASOURCE}\n${DB_USER}\n${DB_PASSWORD}" >${FREESIDE_CONF}/secrets
307 chmod 600 ${FREESIDE_CONF}/secrets
308 chown freeside ${FREESIDE_CONF}/secrets
310 mkdir "${FREESIDE_CACHE}/counters.${DATASOURCE}"
311 chown freeside "${FREESIDE_CACHE}/counters.${DATASOURCE}"
313 mkdir "${FREESIDE_CACHE}/cache.${DATASOURCE}"
314 chown freeside "${FREESIDE_CACHE}/cache.${DATASOURCE}"
316 mkdir "${FREESIDE_EXPORT}/export.${DATASOURCE}"
317 chown freeside "${FREESIDE_EXPORT}/export.${DATASOURCE}"
319 #install this for freeside-setup
320 install -d $(DIST_CONF)
321 #install conf/[a-z]* $(DEFAULT_CONF)
323 install `ls -d conf/[a-z]* | grep -v CVS | grep -v '^conf/registries'` $(DIST_CONF)
328 cp config.layout.in config.layout; \
330 s'%%%FREESIDE_DOCUMENT_ROOT%%%'${FREESIDE_DOCUMENT_ROOT}'g;\
331 s'%%%MASONDATA%%%'${MASONDATA}'g;\
333 ./configure --enable-layout=Freeside\
334 --with-db-type=${DB_TYPE} \
335 --with-db-dba=${DB_USER} \
336 --with-db-database=${RT_DB_DATABASE} \
337 --with-db-rt-user=${DB_USER} \
338 --with-db-rt-pass=${DB_PASSWORD} \
339 --with-web-user=freeside \
340 --with-web-group=freeside \
341 --with-rt-group=freeside \
342 --with-web-handler=modperl2
344 create-rt: configure-rt
345 [ -d /opt ] || mkdir /opt #doh
346 [ -d /opt/rt3 ] || mkdir /opt/rt3 #
347 [ -d /opt/rt3/share ] || mkdir /opt/rt3/share #
349 rt/sbin/rt-setup-database --dba '${DB_USER}' \
350 --dba-password '${DB_PASSWORD}' \
353 rt/sbin/rt-setup-database --dba-password '${DB_PASSWORD}' \
355 && rt/sbin/rt-setup-database --dba-password '${DB_PASSWORD}' \
357 --datafile ${RT_PATH}/etc/initialdata \
360 install-rt: check-conflicts
361 if [ ${RT_ENABLED} -eq 1 ]; then ( cd rt; make install ); fi
362 if [ ${RT_ENABLED} -eq 1 ]; then perl -p -i -e "\
363 s'%%%RT_DOMAIN%%%'${RT_DOMAIN}'g;\
364 s'%%%RT_TIMEZONE%%%'${RT_TIMEZONE}'g;\
365 s'%%%FREESIDE_URL%%%'${FREESIDE_URL}'g;\
366 " ${RT_PATH}/etc/RT_SiteConfig.pm; fi
367 if [ ${RT_ENABLED} -eq 1 ]; then \
368 chown -R freeside:freeside ${RT_PATH}/etc; fi
370 install-rt-initialdata:
371 if [ ${RT_ENABLED} -eq 1 ] && [ -d ${RT_PATH} ]; then \
372 chown -R freeside:freeside ${RT_PATH}/etc; \
373 install -D -o freeside -g freeside -m 0440 rt/etc/initialdata \
374 ${RT_PATH}/etc/initialdata; fi
378 rm -rf httemplate/docs/man
383 -cd fs_selfservice/FS-SelfService; \
387 ! grep -r --exclude='*config.log*' '--exclude=*config.status*' --exclude=gnupg_details_on_output_formats '--exclude=*mason_handler*' '^=======$$' .
389 #these are probably only useful if you're me...
391 #release: upload-docs
394 # Update the changelog
396 #cvs commit -m "Updated for ${VERSION}" ChangeLog
398 # Update the RPM specfile
399 #cvs edit ${RPM_SPECFILE}
400 #perl -p -i -e "s/\d+[^\}]+/${VERSION}/ if /%define\s+version\s+(\d+[^\}]+)\}/;" ${RPM_SPECFILE}
401 #perl -p -i -e "s/\d+[^\}]+/1/ if /%define\s+release\s+(\d+[^\}]+)\}/;" ${RPM_SPECFILE}
402 #cvs commit -m "Updated for ${VERSION}" ${RPM_SPECFILE}
404 # Update the Debian changelog
405 #cvs edit debian/changelog
406 #dch -v ${DEBVERSION} -p "New upstream release"
407 #cvs commit -m "Updated for ${VERSION}" debian/changelog
409 # Make sure other people's changes are pulled in!
416 git archive ${TAG} | gzip -9 >freeside-${VERSION}.tar.gz
418 scp freeside-${VERSION}.tar.gz ivan@420.am:/var/www/www.sisd.com/freeside/
419 mv freeside-${VERSION} freeside-${VERSION}.tar.gz ..
421 #these things failing should not make release target fail, so: "|| true"
423 #kick off vmware update
424 #./BUILD_VMWARE_APPLIANCE ${$TAG} || true
426 #kick off deb package update
428 #kick off rpm package update too?
432 #update web demo self-service?