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

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