-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquick_install.sh
More file actions
executable file
·139 lines (117 loc) · 3.48 KB
/
Copy pathquick_install.sh
File metadata and controls
executable file
·139 lines (117 loc) · 3.48 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/bash
echo "SysPilot - Quick Installation Fix"
echo "==================================="
echo
# Get the current directory
CURRENT_DIR="$(pwd)"
APP_DIR="$HOME/.local/share/syspilot"
echo "Current directory: $CURRENT_DIR"
echo "Target app directory: $APP_DIR"
echo
# Create necessary directories
echo "Creating directories..."
mkdir -p "$HOME/.local/bin"
mkdir -p "$HOME/.local/share/syspilot"
mkdir -p "$HOME/.config/syspilot"
# Copy application files
echo "Copying application files..."
cp -r "$CURRENT_DIR"/* "$APP_DIR/"
# Create virtual environment
echo "Creating virtual environment..."
cd "$APP_DIR"
python3 -m venv venv
# Install requirements if pip is available
if command -v pip &> /dev/null || python3 -m pip --version &> /dev/null; then
echo "Installing Python dependencies..."
source venv/bin/activate
# Try to install requirements
if [ -f requirements.txt ]; then
python -m pip install --upgrade pip
python -m pip install -r requirements.txt || echo "Warning: Some dependencies failed to install"
fi
deactivate
else
echo "Warning: pip not available, skipping Python dependencies"
fi
# Create wrapper script
echo "Creating command wrapper..."
WRAPPER_SCRIPT="$HOME/.local/bin/syspilot"
cat > "$WRAPPER_SCRIPT" << EOF
#!/bin/bash
# SysPilot wrapper script
APP_DIR="$HOME/.local/share/syspilot"
cd "\$APP_DIR"
# Check if virtual environment exists
if [ -d "venv" ]; then
source venv/bin/activate
python main.py "\$@"
else
# Fallback to system Python
echo "Warning: Virtual environment not found, using system Python"
python3 main.py "\$@"
fi
EOF
chmod +x "$WRAPPER_SCRIPT"
# Add to PATH
echo "Updating PATH..."
if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
# Add to multiple shell configs
for config_file in ~/.bashrc ~/.zshrc ~/.profile; do
if [ -f "$config_file" ]; then
echo "export PATH=\"\$HOME/.local/bin:\$PATH\"" >> "$config_file"
echo "Updated $config_file"
fi
done
# Update current session
export PATH="$HOME/.local/bin:$PATH"
echo "PATH updated for current session"
fi
# Create desktop entry
echo "Creating desktop entry..."
DESKTOP_FILE="$HOME/.local/share/applications/syspilot.desktop"
cat > "$DESKTOP_FILE" << EOF
[Desktop Entry]
Version=1.0
Type=Application
Name=SysPilot
GenericName=System Cleanup Tool
Comment=Clean temporary files and monitor system performance
Exec=$WRAPPER_SCRIPT
Icon=$APP_DIR/assets/syspilot.png
Terminal=false
StartupNotify=true
Categories=System;Utility;
Keywords=clean;cleanup;system;performance;monitor;
EOF
# Make main.py executable
chmod +x "$APP_DIR/main.py"
echo
echo "================================="
echo "Installation Complete!"
echo "================================="
echo
echo "Testing installation..."
# Test the command
if command -v syspilot &> /dev/null; then
echo "✓ syspilot command is available"
echo "Testing: syspilot --help"
if syspilot --help 2>/dev/null | head -3; then
echo "✓ SysPilot is working!"
else
echo "! Command runs but may have dependency issues"
fi
else
echo "! syspilot command not found in PATH"
echo " You can run directly: $WRAPPER_SCRIPT"
echo " Or restart your terminal"
fi
echo
echo "Usage:"
echo " syspilot # GUI mode"
echo " syspilot --cli # CLI mode"
echo " syspilot --help # Show help"
echo
echo "If command not found, try:"
echo " source ~/.bashrc # Reload bash config"
echo " $WRAPPER_SCRIPT # Run directly"
echo