Apply first and third benpro review of web-add fix command

Simplify sed(1) command by getting rid of echo(1)

Use a2ensite(1) instead of ln(1) to link vhosts.
This commit is contained in:
Patrick Marchand 2018-11-29 18:42:20 +01:00
parent b693075f39
commit 53335ee4ef
1 changed files with 2 additions and 2 deletions

View File

@ -997,7 +997,7 @@ op_add() {
# 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')"
ln_vhosts_dir="$(sed 's/available/enabled/' <<< "$VHOST_PATH")"
non_ln_vhosts="$(find "$ln_vhosts_dir"/* ! -type l)"
for ln_path in $non_ln_vhosts
@ -1005,7 +1005,7 @@ op_fixvhosts() {
vhost_name=$(basename "$ln_path")
mv "$ln_path" "$VHOST_PATH/$vhost_name"
ln -s "$VHOST_PATH/$vhost_name" "$ln_path"
a2ensite "$vhostname"
done
}