No Description
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.

lodel_init.sh 1014B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. emfilename="em.json"
  16. settings="$instdir/instance_settings.py"
  17. em="$instdir/em.json"
  18. dyncode="$instdir/${name}.py"
  19. if [ -e "$instdir" ]
  20. then
  21. echo "Abording... "$instdir" exists" 1>&2
  22. exit 1
  23. fi
  24. echo "Creating lodel instance directory '$instdir'"
  25. mkdir -pv "$instdir"
  26. cp -v $libdir/install/* $instdir
  27. rm -fv $instdir/__init__.py
  28. cp -v $libdir/manage_lodel.py $instdir
  29. sed -i -e "s#LODEL2_LIB_ABS_PATH#$libdir#" "$settings"
  30. sed -i -e "s#LODEL2_INSTANCE_NAME#$name#" "$settings"
  31. echo "Generating dynamic code"
  32. cd "$instdir"
  33. make refreshdyn
  34. echo "Cleaning instance directory"
  35. make clean
  36. echo -e "\nInstance successfully created in $instdir"
  37. echo -e "============================\n"
  38. echo "Now you should edit '$settings' and then run : cd $instdir && make dbinit"