forked from mathiasbynens/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
switch_valet_user.sh
73 lines (56 loc) · 1.65 KB
/
switch_valet_user.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash
# Based on: https://gist.github.com/trevorgreenleaf/2f4092b721471307e7bb9c680559c04b
# Remove valet
valet uninstall --force
rm -rf ~/.config/valet
rm -rf /usr/local/etc/nginx/valet
rm -rf /usr/local/bin/valet
composer global remove laravel/valet
# Change the permisions on all brew files
sudo chown -R $(whoami) $(brew --prefix)/*
# Clean up - removes logs and cache
brew cleanup
# Reinstall Process
brew tap
brew update
brew install homebrew/core/php
brew install [email protected]
brew install [email protected]
pecl install xdebug
echo 'Removing any duplicate entries for Xdebug in php.ini'
for V in 1 2 3 4 ; do
INI=$(php -i | grep /.+/php.ini -oE | sed "s/7\.[1-4]/7.$V/g")
if [ -f $INI ]; then
if grep -q "xdebug.so" $INI; then
echo $INI
sudo sed -i '' 's/zend_extension=xdebug\.so//g' $INI
fi
fi
done
brew services restart [email protected]
brew services restart postgresql@10
brew services restart redis
composer global require laravel/valet
valet install
echo 'Parking and securing all servable Laravel sites';
cd ~/Sites
valet park
for SITES in $(find ~/Sites -maxdepth 1 -type d) ; do
if [ -r "$SITES/public/index.php" ] && [ -w "$SITES/storage" ]; then
cd $SITES
valet secure
fi
done
# Check each user for shared sites that should be parked and secured
# for USERS in $(find /Users -maxdepth 1 -type d) ; do
# if [ $USERS != '/Users' ] && [ -d "$USERS/Sites" ] && [ -r "$USERS/Sites" ]; then
# valet park
#
# for SITES in $(find $USERS/Sites -maxdepth 1 -type d) ; do
# if [ -r "$SITES/public/index.php" ] && [ -w "$SITES/storage" ]; then
# cd $SITES
# valet secure
# fi
# done
# fi
# done