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.

create_multisite.sh 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/bash
  2. usage() {
  3. cat <<HELP_USAGE
  4. Usage: $(basename $0) [options...] lodelsites_name [instance_dir] [install_path] [install_tpl]
  5. lodelsites_name: name of the lodelsites instance, only lower case alphas, numerics, -, _, are allowed
  6. instance_dir: path where the data and context folders will be set (defaults to /var/lodel2)
  7. Options:
  8. -h, --help give this help list
  9. HELP_USAGE
  10. exit 1
  11. }
  12. [[ `grep -w "\-\-help\|\-.*h.*" <<< $@` ]] && usage
  13. [[ -z $1 ]] && echo "Not enough arguments" && usage
  14. name="$1"
  15. install_dir=${2:=[@]LODEL2_VARDIR[@]}
  16. install_tpl="$3"
  17. context_dir_name="[@]LODELSITES_CTX_DIRNAME[@]"
  18. datas_dir_name="[@]LODELSITES_DATA_DIRNAME[@]"
  19. [[ -d "$install_dir/$name" ]] && echo "A multisite install $name already exists!" && usage
  20. echo "$MULTISITE_DATADIR"
  21. lodelsites_ctx_dir="$install_dir/$name/$context_dir_name"
  22. lodelsites_data_dir="$install_dir/$name/$datas_dir_name"
  23. [[ ! "$name" =~ ^[abcdefghijklmnopqrstuvwxyz0-9_-]+$ ]] &&
  24. echo "Only lowercase alpha, numerics, '-', '_', are allowed in name" >&2 &&
  25. usage
  26. echo "Creating directories"
  27. mkdir -pv "$lodelsites_ctx_dir"
  28. mkdir -pv "$lodelsites_data_dir"
  29. echo "Modularization of the lodelsites context dir"
  30. > "$lodelsites_ctx_dir/__init__.py"
  31. echo "created '$lodelsites_ctx_dir/__init__.py' file"
  32. #echo cp -R $install_tpl "${install_dir}/$name"