Ei kuvausta
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 888B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. cp -Rv $libdir/install/* $instdir
  25. # Adding lib path to loader
  26. sed -i -E "s#^(LODEL2_LIB_ABS_PATH = )None#\1'$libdir'#" "$loader"
  27. # Adding instance name to conf
  28. sed -i -E "s#^sitename = noname#sitename = $name#" "$conf"
  29. echo -e "\nInstance successfully created in $instdir"
  30. echo -e "============================\n"
  31. echo "Now you should edit files in '${instdir}/conf.d/' and then run : cd $instdir && make dyncode"