provisioning tool for building opinionated architecture
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.

22 lines
523 B

2 months ago
2 months ago
  1. #!/bin/bash
  2. function check_db_maria_exists() {
  3. db-maria list | grep -q "^$1$"
  4. }
  5. function check_db_postgres_exists() {
  6. db-psql list | grep -q "^$1$"
  7. }
  8. function extract_domain_from_fqdn() {
  9. fqdn=$1
  10. part1=$(builtin echo "$fqdn" | rev | cut -d'.' -f1 | rev)
  11. part2=$(builtin echo "${fqdn%."$part1"}" | rev | cut -d'.' -f1 | rev)
  12. builtin echo "$part2.$part1"
  13. }
  14. function extract_subdomain_from_fqdn() {
  15. fqdn=$1
  16. domain=$(extract_domain_from_fqdn "$fqdn")
  17. builtin echo "${fqdn%."$domain"}"
  18. }