-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
58 lines (49 loc) · 1.45 KB
/
Copy pathinstall.sh
File metadata and controls
58 lines (49 loc) · 1.45 KB
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
#!/bin/bash
# Define colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
DRY_RUN=false
if [ "$1" == "--dry-run" ]; then
DRY_RUN=true
echo -e "${CYAN}=== DRY RUN MODE: No files will be modified ===${NC}"
fi
echo -e "${GREEN}Starting Custom Scripts Installation...${NC}"
# Detect OS
OS="Unknown"
if [[ "$OSTYPE" == "darwin"* ]]; then
OS="macOS"
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
OS="Ubuntu"
else
echo -e "Unsupported OS: $OSTYPE. Please install manually."
exit 1
fi
echo -e "${YELLOW}Detected OS: $OS${NC}"
# Set source path based on OS
if [ "$OS" == "macOS" ]; then
SRC_FILE="macos/.zshrc"
else
SRC_FILE="ubuntu/.zshrc"
fi
DEST_FILE="$HOME/.zshrc"
# Backup existing .zshrc
if [ -f "$DEST_FILE" ]; then
BACKUP_FILE="$DEST_FILE.backup.$(date +%Y%m%d_%H%M%S)"
echo -e "${YELLOW}Backing up existing .zshrc to $BACKUP_FILE...${NC}"
if [ "$DRY_RUN" = false ]; then
mv "$DEST_FILE" "$BACKUP_FILE"
else
echo -e "${CYAN}[Dry Run] Would move $DEST_FILE to $BACKUP_FILE${NC}"
fi
fi
# Copy the new config
echo -e "${YELLOW}Installing new .zshrc from $SRC_FILE...${NC}"
if [ "$DRY_RUN" = false ]; then
cp "$(dirname "$0")/$SRC_FILE" "$DEST_FILE"
echo -e "${GREEN}Installation complete! Please restart your terminal or run: source ~/.zshrc${NC}"
else
echo -e "${CYAN}[Dry Run] Would copy $SRC_FILE to $DEST_FILE${NC}"
echo -e "${GREEN}Dry-run complete!${NC}"
fi