3 # Configuration first : set the local repository
4 # where the code can be found
5 # Test number of arguments
8 echo " Usage : bash_nukem repository_directory vm (should be senslab or senslab2)"
13 # Check if directory exists
17 echo "RESPOSITORY: " $git_local_repo
21 # Set which vm we are working on (sfa-vm or sfa-vm2)
22 if [[ $2 = "senslab" || $2 = "senslab2" ]]
27 echo "Vm options should be senslab or senslab2, not " $2
32 sudo sfaadmin.py registry nuke
34 # Drop table in slab_sfa
35 # to avoid duplicates.
36 psql -d slab_sfa -U sfa -W -q -c "drop table slice_senslab;"
38 # ATTENTION :Save the config file /etc/sfa/sfa_config
41 # Remove all the remaining gid, creds files
43 sudo rm -rf /var/lib/sfa
46 sudo service sfa restart
48 # Put back the config file that you saved before
52 sudo python setup.py install
53 # sudo service sfa restart
55 # Wrote /etc/sfa/configs/site.xml
57 # /etc/sfa/default_config.xml
58 # and /etc/sfa/configs/site.xml
59 # into /etc/sfa/sfa_config.xml
61 sudo cp $git_local_repo/sfa/senslab/config/$vm/sfa_config /etc/sfa/sfa_config
62 sudo cp $git_local_repo/sfa/senslab/config/$vm/sfa_config.xml /etc/sfa/sfa_config.xml
63 sudo cp $git_local_repo/sfa/senslab/config/$vm/site.xml /etc/sfa/site.xml
64 # sudo ln -s ldap_config.py /etc/sfa/ldap_config.py
65 sudo cp $git_local_repo/sfa/senslab/config/ldap_config.py /etc/sfa/ldap_config.py
66 sudo service sfa restart
68 # User stuff : clean your folder
70 rm *.sscert *.cred *.gid sfi_cache.dat
73 # Import the datbase form ldap
74 sudo sfaadmin.py registry import_registry
75 sudo service sfa restart
77 sudo rm -rf /var/lib/sfa/authorities/plc