Нема описа
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.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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/examples/em_test.pickle $instdir/editorial_model.pickle
  30. ln -sv $libdir/install/Makefile $instdir/Makefile
  31. ln -sv $libdir/install/lodel_admin.py $instdir/lodel_admin.py
  32. ln -sv $libdir/plugins $instdir/plugins
  33. # Adding lib path to loader
  34. sed -i -E "s#^(LODEL2_LIB_ABS_PATH = )None#\1'$libdir'#" "$loader"
  35. # Adding instance name to conf
  36. sed -i -E "s#^sitename = noname#sitename = $name#" "$conf"
  37. echo -e "\nInstance successfully created in $instdir"
  38. echo -e "============================\n"
  39. echo "Now you should edit files in '${instdir}/conf.d/' and then run : cd $instdir && make dyncode"