Nessuna descrizione
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

create_instance.sh 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/bash
  2. usage() {
  3. echo "Usage : $0 instance_name instance_dir [lodel_libdir]" 1>&2
  4. exit 1
  5. }
  6. if [ $# -lt 2 ]
  7. then
  8. echo "Not enough arguments" 1>&2
  9. usage
  10. fi
  11. name="$1"
  12. instdir="$2"
  13. libdir="$3"
  14. libdir="${libdir:=$(realpath $(dirname $0)/..)}/"
  15. loader="$instdir/loader.py"
  16. conf="$instdir/conf.d/lodel2.ini"
  17. if [ -e "$instdir" ]
  18. then
  19. echo "Abording... "$instdir" exists" 1>&2
  20. exit 1
  21. fi
  22. echo "Creating lodel instance directory '$instdir'"
  23. mkdir -pv "$instdir"
  24. mkdir -pv "$instdir/sessions"
  25. chmod 700 "$instdir/sessions"
  26. #cp -Rv $libdir/install/* $instdir
  27. cp -Rv $libdir/install/conf.d $instdir/
  28. cp -Rv $libdir/install/loader.py $instdir/
  29. cp -Rv $libdir/install/editorial_model.pickle $instdir/
  30. ln -s $libdir/install/Makefile $instdir/Makefile
  31. ln -s $libdir/install/run.py $instdir/run.py
  32. ln -s $libdir/install/lodel_admin.py $instdir/lodel_admin.py
  33. ln -s $libdir/plugins $instdir/plugins
  34. # Adding lib path to loader
  35. sed -i -E "s#^(LODEL2_LIB_ABS_PATH = )None#\1'$libdir'#" "$loader"
  36. # Adding instance name to conf
  37. sed -i -E "s#^sitename = noname#sitename = $name#" "$conf"
  38. echo -e "\nInstance successfully created in $instdir"
  39. echo -e "============================\n"
  40. echo "Now you should edit files in '${instdir}/conf.d/' and then run : cd $instdir && make dyncode"