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
|
@ -109,6 +109,9 @@ del LOGIN [DBNAME]
|
||||||
list-vhost LOGIN
|
list-vhost LOGIN
|
||||||
|
|
||||||
List Apache vhost for user LOGIN
|
List Apache vhost for user LOGIN
|
||||||
|
|
||||||
|
fix-vhosts
|
||||||
|
Fixes non-symlinked vhosts
|
||||||
|
|
||||||
add-alias VHOST ALIAS
|
add-alias VHOST ALIAS
|
||||||
|
|
||||||
|
@ -709,6 +712,9 @@ arg_processing() {
|
||||||
;;
|
;;
|
||||||
list-vhost)
|
list-vhost)
|
||||||
op_listvhost "$@"
|
op_listvhost "$@"
|
||||||
|
;;
|
||||||
|
fix-vhosts)
|
||||||
|
op_fixvhosts "$@"
|
||||||
;;
|
;;
|
||||||
add-alias)
|
add-alias)
|
||||||
op_aliasadd "$@"
|
op_aliasadd "$@"
|
||||||
|
@ -988,5 +994,20 @@ op_add() {
|
||||||
echo
|
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
|
# Point d'entrée
|
||||||
arg_processing "$@"
|
arg_processing "$@"
|
||||||
|
|
Loading…
Reference in a new issue