-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·117 lines (100 loc) · 3.64 KB
/
install.sh
File metadata and controls
executable file
·117 lines (100 loc) · 3.64 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/bash
# dupl - Secure Duplicate Hunter Installation Script
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
echo -e "${BLUE}dupl - Secure Duplicate Hunter Installer${NC}"
echo "========================================================="
# Check Python version
echo -e "${YELLOW}Checking Python installation...${NC}"
if command -v python3 &> /dev/null; then
python_version=$(python3 --version 2>&1 | awk '{print $2}')
echo -e "${GREEN}Python 3 found: $python_version${NC}"
elif command -v python &> /dev/null; then
python_version=$(python --version 2>&1 | awk '{print $2}')
if [[ $python_version == 3.* ]]; then
echo -e "${GREEN}Python 3 found: $python_version${NC}"
else
echo -e "${YELLOW}Python 3 required. Found: $python_version${NC}"
echo "Please install Python 3.7 or higher"
exit 1
fi
else
echo -e "${YELLOW}Python not found${NC}"
echo "Please install Python 3.7 or higher"
exit 1
fi
# Verify files exist
echo -e "${YELLOW}Verifying installation files...${NC}"
if [[ ! -f "dupl.py" ]]; then
echo -e "${YELLOW}dupl.py not found${NC}"
echo "Please run this script from the dupl directory"
exit 1
fi
if [[ ! -d "src" ]]; then
echo -e "${YELLOW}src directory not found${NC}"
echo "Please run this script from the dupl directory"
exit 1
fi
echo -e "${GREEN}All files found${NC}"
# Make script executable
echo -e "${YELLOW}Setting up dupl...${NC}"
chmod +x dupl.py
# Create directories for organized output
mkdir -p reports backups
# Create global command (optional)
read -p "Create global 'dupl' command? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
# Create symlink or alias
SCRIPT_PATH="$(pwd)/dupl.py"
# Try to add to PATH
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
LOCAL_BIN="$HOME/.local/bin"
mkdir -p "$LOCAL_BIN"
ln -sf "$SCRIPT_PATH" "$LOCAL_BIN/dupl"
# Add to PATH if not already there
if [[ ":$PATH:" != *":$LOCAL_BIN:"* ]]; then
echo "export PATH=\"\$HOME/.local/bin:\$PATH\"" >> ~/.zshrc
echo "export PATH=\"\$HOME/.local/bin:\$PATH\"" >> ~/.bashrc
echo -e "${GREEN}Added to PATH. Restart terminal or run: source ~/.zshrc${NC}"
fi
else
# Linux
LOCAL_BIN="$HOME/.local/bin"
mkdir -p "$LOCAL_BIN"
ln -sf "$SCRIPT_PATH" "$LOCAL_BIN/dupl"
if [[ ":$PATH:" != *":$LOCAL_BIN:"* ]]; then
echo "export PATH=\"\$HOME/.local/bin:\$PATH\"" >> ~/.bashrc
echo -e "${GREEN}Added to PATH. Restart terminal or run: source ~/.bashrc${NC}"
fi
fi
echo -e "${GREEN}Global command 'dupl' created${NC}"
echo "You can now run: dupl /path/to/scan"
fi
echo
echo -e "${GREEN}Installation complete!${NC}"
echo
echo "Features:"
echo " Advanced security (never touches system files)"
echo " Focus on large files for maximum impact"
echo " High-performance parallel processing"
echo " Automatic backups before deletion"
echo " Comprehensive reporting"
echo
echo "Usage examples:"
echo " python dupl.py ~/Downloads --min-size 50MB --dry-run"
echo " python dupl.py ~/Pictures --file-types jpg,png --interactive"
echo " python dupl.py ~/Documents --auto-delete"
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo
echo "Or use the global command:"
echo " dupl ~/Downloads --min-size 50MB --dry-run"
echo " dupl ~/Pictures --file-types jpg,png --interactive"
fi
echo
echo -e "${BLUE} Pro tip: Always test with --dry-run first!${NC}"
echo -e "${BLUE} Reports saved to: reports/dupl_report_*.txt${NC}"
echo -e "${BLUE} Backups saved to: backups/dupl_backup_*/${NC}