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 975B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. sed -i -e "s#LODEL2_LIB_ABS_PATH#$libdir#" "$settings"
  29. sed -i -e "s#LODEL2_INSTANCE_NAME#$name#" "$settings"
  30. echo "Generating dynamic code"
  31. cd "$instdir"
  32. make refreshdyn
  33. echo "Cleaning instance directory"
  34. make clean
  35. echo -e "\nInstance successfully created in $instdir"
  36. echo -e "============================\n"
  37. echo "Now you should edit '$settings' and then run : cd $instdir && make dbinit"