forked from laravel/valet
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from cpriego/dnsmasq
Fix various errors, fixes #55
- Loading branch information
Showing
14 changed files
with
145 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,51 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Determine if the port config key exists, if not, create it | ||
CONFIG="$HOME/.valet/config.json" | ||
PORT=$(jq -r ".port" "$CONFIG") | ||
function fix-config() { | ||
local CONFIG="$HOME/.valet/config.json" | ||
|
||
if [[ "$PORT" = "null" ]] | ||
if [[ -f $CONFIG ]] | ||
then | ||
local PORT=$(jq -r ".port" "$CONFIG") | ||
|
||
if [[ "$PORT" = "null" ]] | ||
then | ||
echo "Fixing valet config file..." | ||
CONTENTS=$(jq '. + {port: "80"}' "$CONFIG") | ||
echo -n $CONTENTS >| "$CONFIG" | ||
fi | ||
fi | ||
} | ||
|
||
function cleanup { | ||
local NM="/etc/NetworkManager" | ||
local TMP="/tmp/nm.conf" | ||
|
||
if [[ -f "$NM"/dnsmasq.d/valet ]] | ||
then | ||
echo "Removing old dnsmasq config file..." | ||
sudo rm "$NM"/dnsmasq.d/valet | ||
fi | ||
|
||
if [[ -f "$NM"/conf.d/valet.conf ]] | ||
then | ||
echo "Removing old NetworkManager config file..." | ||
sudo rm "$NM"/conf.d/valet.conf | ||
fi | ||
|
||
if grep -xq "dns=dnsmasq" "$NM/NetworkManager.conf" | ||
then | ||
echo "Removing dnsmasq control from NetworkManager..." | ||
sudo grep -v "dns=dnsmasq" "$NM/NetworkManager.conf" > "$TMP" && sudo mv "$TMP" "$NM/NetworkManager.conf" | ||
fi | ||
|
||
echo "Cleanup done." | ||
} | ||
|
||
if [[ "$1" = "update" ]] | ||
then | ||
CONTENTS=$(jq '. + {port: "80"}' "$CONFIG") | ||
echo -n $CONTENTS >| "$CONFIG" | ||
exit | ||
composer global update "cpriego/valet-linux" | ||
fi | ||
|
||
fix-config | ||
# cleanup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters