Samba shares, host file updates
This commit is contained in:
31
helpers/update-dev-hosts.sh
Normal file
31
helpers/update-dev-hosts.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
HOSTS_FILE="/etc/hosts"
|
||||
SITES_DIR="/var/www"
|
||||
DEV_DOMAIN="vincentdevelopment.ca"
|
||||
|
||||
TMP=$(mktemp)
|
||||
|
||||
echo "# BEGIN DEV-SITES" >> "$TMP"
|
||||
|
||||
for dir in "$SITES_DIR"/*; do
|
||||
site=$(basename "$dir")
|
||||
|
||||
# Skip system dirs
|
||||
[[ "$site" == "html" ]] && continue
|
||||
|
||||
echo "127.0.0.1 $site" >> "$TMP"
|
||||
|
||||
# Uncomment when system goes live
|
||||
# echo "127.0.0.1 $site $site.$DEV_DOMAIN"
|
||||
done
|
||||
|
||||
echo "# END DEV-SITES" >> "$TMP"
|
||||
|
||||
# Remove existing block
|
||||
sed -i '/# BEGIN DEV-SITES/,/# END DEV-SITES/d' "$HOSTS_FILE"
|
||||
|
||||
# Append fresh block
|
||||
cat "$TMP" >> "$HOSTS_FILE"
|
||||
|
||||
rm "$TMP"
|
||||
Reference in New Issue
Block a user