Adds command to fix vhost linking problems in web-add.sh
Some people forget to use the --follow-symlinks flag with sed(1), thus not carrying changes over to /etc/apache2/sites-available. This new command makes sure all vhosts in /etc/apache2/sites-enabled are symlinks. It assumes that we always want to overwrite the file in /etc/apache2/sites-available with the file in /etc/apache2/sites-enabled.
This commit is contained in:
parent
d64cfa4e8b
commit
b693075f39
|
@ -110,6 +110,9 @@ list-vhost LOGIN
|
|||
|
||||
List Apache vhost for user LOGIN
|
||||
|
||||
fix-vhosts
|
||||
Fixes non-symlinked vhosts
|
||||
|
||||
add-alias VHOST ALIAS
|
||||
|
||||
Add a ServerAlias to an Apache vhost
|
||||
|
@ -710,6 +713,9 @@ arg_processing() {
|
|||
list-vhost)
|
||||
op_listvhost "$@"
|
||||
;;
|
||||
fix-vhosts)
|
||||
op_fixvhosts "$@"
|
||||
;;
|
||||
add-alias)
|
||||
op_aliasadd "$@"
|
||||
;;
|
||||
|
@ -988,5 +994,20 @@ op_add() {
|
|||
echo
|
||||
}
|
||||
|
||||
# Some people forget to use the --follow-symlinks flag with sed(1),
|
||||
# thus not carrying changes over to /etc/sites-available.
|
||||
op_fixvhosts() {
|
||||
ln_vhosts_dir="$(echo "$VHOST_PATH" | sed 's/available/enabled')"
|
||||
non_ln_vhosts="$(find "$ln_vhosts_dir"/* ! -type l)"
|
||||
|
||||
for ln_path in $non_ln_vhosts
|
||||
do
|
||||
vhost_name=$(basename "$ln_path")
|
||||
|
||||
mv "$ln_path" "$VHOST_PATH/$vhost_name"
|
||||
ln -s "$VHOST_PATH/$vhost_name" "$ln_path"
|
||||
done
|
||||
}
|
||||
|
||||
# Point d'entrée
|
||||
arg_processing "$@"
|
||||
|
|
Loading…
Reference in a new issue