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:
parent
b693075f39
commit
53335ee4ef
|
@ -997,7 +997,7 @@ op_add() {
|
||||||
# Some people forget to use the --follow-symlinks flag with sed(1),
|
# Some people forget to use the --follow-symlinks flag with sed(1),
|
||||||
# thus not carrying changes over to /etc/sites-available.
|
# thus not carrying changes over to /etc/sites-available.
|
||||||
op_fixvhosts() {
|
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)"
|
non_ln_vhosts="$(find "$ln_vhosts_dir"/* ! -type l)"
|
||||||
|
|
||||||
for ln_path in $non_ln_vhosts
|
for ln_path in $non_ln_vhosts
|
||||||
|
@ -1005,7 +1005,7 @@ op_fixvhosts() {
|
||||||
vhost_name=$(basename "$ln_path")
|
vhost_name=$(basename "$ln_path")
|
||||||
|
|
||||||
mv "$ln_path" "$VHOST_PATH/$vhost_name"
|
mv "$ln_path" "$VHOST_PATH/$vhost_name"
|
||||||
ln -s "$VHOST_PATH/$vhost_name" "$ln_path"
|
a2ensite "$vhostname"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue