-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_mac.sh
executable file
·48 lines (40 loc) · 1.68 KB
/
setup_mac.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
#!/bin/bash
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
echo -e "${GREEN}Setting up Faroxy Proxy Server...${NC}"
# Get the current directory
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Make start and stop scripts executable
chmod +x "$SCRIPT_DIR/start.sh"
chmod +x "$SCRIPT_DIR/stop.sh"
# Determine which shell configuration file to use
SHELL_CONFIG=""
if [ -f "$HOME/.zshrc" ]; then
SHELL_CONFIG="$HOME/.zshrc"
elif [ -f "$HOME/.bashrc" ]; then
SHELL_CONFIG="$HOME/.bashrc"
elif [ -f "$HOME/.bash_profile" ]; then
SHELL_CONFIG="$HOME/.bash_profile"
else
echo -e "${YELLOW}No shell configuration file found. Creating .zshrc${NC}"
SHELL_CONFIG="$HOME/.zshrc"
touch "$SHELL_CONFIG"
fi
# Check if aliases already exist
if ! grep -q "alias proxystart=" "$SHELL_CONFIG" && ! grep -q "alias proxystop=" "$SHELL_CONFIG"; then
echo -e "\n# Faroxy Proxy Server aliases" >> "$SHELL_CONFIG"
echo "alias proxystart=\"cd $SCRIPT_DIR && ./start.sh\"" >> "$SHELL_CONFIG"
echo "alias proxystop=\"cd $SCRIPT_DIR && ./stop.sh\"" >> "$SHELL_CONFIG"
echo -e "${GREEN}Aliases added successfully!${NC}"
else
echo -e "${YELLOW}Aliases already exist in $SHELL_CONFIG${NC}"
fi
# Source the configuration file
echo -e "${GREEN}Reloading shell configuration...${NC}"
source "$SHELL_CONFIG"
echo -e "${GREEN}Setup complete! You can now use the following commands:${NC}"
echo -e " ${YELLOW}proxystart${NC} - Start the Faroxy Proxy Server"
echo -e " ${YELLOW}proxystop${NC} - Stop the Faroxy Proxy Server"
echo -e "\n${GREEN}Note: You may need to restart your terminal or run 'source $SHELL_CONFIG' for the changes to take effect.${NC}"