now available as methods
[freeside.git] / Makefile
index f469d5f..3500888 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -57,12 +57,16 @@ QUEUED_USER=fs_queue
 FREESIDE_PATH = `pwd`
 
 SELFSERVICE_USER = fs_selfservice
+#never run on the same machine in production!!!
+SELFSERVICE_MACHINES = localhost
 # SELFSERVICE_MACHINES = www.example.com
 # SELFSERVICE_MACHINES = web1.example.com web2.example.com
 
 #user with sudo access on SELFSERVICE_MACHINES for automated self-service
 #installation.
 SELFSERVICE_INSTALL_USER = ivan
+SELFSERVICE_INSTALL_USERADD = /usr/sbin/useradd
+#SELFSERVICE_INSTALL_USERADD = "/usr/sbin/pw useradd"
 
 RT_ENABLED = 0
 #RT_ENABLED = 1
@@ -170,10 +174,15 @@ install-init:
        " ${INIT_FILE}
 
 install-selfservice:
+       [ -e ~freeside/.ssh/id_dsa.pub ] || su -c 'ssh-keygen -t dsa' - freeside
        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"
-         ssh ${SELFSERVICE_INSTALL_USER}@\$MACHINE "cd FS-SelfService; sudo make install"
+         scp -r fs_selfservice/FS-SelfService ${SELFSERVICE_INSTALL_USER}@$$MACHINE:. ;\
+         ssh ${SELFSERVICE_INSTALL_USER}@$$MACHINE "cd FS-SelfService; perl Makefile.PL && make" ;\
+         ssh ${SELFSERVICE_INSTALL_USER}@$$MACHINE "cd FS-SelfService; sudo make install" ;\
+         scp ~freeside/.ssh/id_dsa.pub ${SELFSERVICE_INSTALL_USER}@$$MACHINE:. ;\
+         ssh ${SELFSERVICE_INSTALL_USER}@$$MACHINE "sudo ${SELFSERVICE_INSTALL_USERADD} freeside; sudo install -D -o freeside -m 600 ./id_dsa.pub ~freeside/.ssh/authorized_keys" ;\
+          ssh ${SELFSERVICE_INSTALL_USER}@$$MACHINE "sudo install -o freeside -d /usr/local/freeside" ;\
+       done
 
 install: install-perl-modules install-docs install-init install-rt