General refactoring

This commit is contained in:
2020-05-30 16:00:49 +02:00
parent 1e3f6f05ec
commit 07cf718ad9
17 changed files with 162 additions and 145 deletions
+5 -5
View File
@@ -1,13 +1,14 @@
#!/usr/bin/env bash
########################################################################
# 2014-09-07 Lukas Bestle mail@lukasbestle.com
# Copyright 2014 Lukas Bestle <project-projectr@lukasbestle.com>
# License MIT
########################################################################
# Creates a link for the webserver pointing a domain to a site.
#
# Usage: site_link <site> <domain>
#
# <site> Name of the site (directory in ~/web/sites/)
# <domain> FQDN of the domain (like "example.com")
# <site> Name of the site (directory in ~/web/sites/)
# <domain> FQDN of the domain (like "example.com")
########################################################################
site="$1"
@@ -40,7 +41,7 @@ fi
# Create link
echo -e "\033[1mCreating link from site \033[34m$site\033[0;1m to domain \033[34m$domain\033[0;1m...\033[0m"
if ! ln -s "sites/$site/current" "$HOME/web/$domain"; then
echo -e "\033[31mCould not create link at \033[34m$HOME/web/$domain\033[31m.\033[0m" >&2
echo -e " => \033[31mCould not create link at \033[34m$HOME/web/$domain\033[31m.\033[0m" >&2
exit 1
fi
echo -e " => \033[32mSuccess.\033[0m"
@@ -50,7 +51,6 @@ echo -e "\033[1mAdding domain to site's domains (\033[34m.domains\033[0;1m file)
echo "$domain" >> "$HOME/web/sites/$site/.domains"
if [[ $? == 0 ]]; then
echo -e " => \033[32mSuccess.\033[0m"
exit 0
else
echo -e " => \033[31mSomething went wrong.\033[0m" >&2
exit 1