-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·85 lines (63 loc) · 1.81 KB
/
install.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
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
# Check if Python is installed
if ! command -v python3 &>/dev/null; then
echo "This program needs Python to run. Install Python first and then re-run this utility."
exit 1
fi # Added missing 'fi' here
echo "Creating and activating virtual environment.
"
python3 -m venv venv
source venv/bin/activate
echo "Upgrading pip and installing dependencies
"
pip install --upgrade pip
pip install -r requirements.txt
# Check if an create desktop entry argument is provided
createDesktopEntry=true
if [ -n "$1" ]; then
case "$1" in
--createDesktopEntry=false)
createDesktopEntry=false
echo "No desktop entry will be created"
;;
--createDesktopEntry=true|--createDesktopEntry)
createDesktopEntry=true
echo "Creating desktop entry"
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
fi
if [ "$createDesktopEntry" = true ]; then
# Get the current working directory
cwd=$(pwd)
echo "
Creating .Desktop entry
"
# Create the content for the .desktop entry
desktop_entry="[Desktop Entry]
Version=1.0
Name=LogiOpsGUI
Comment=Configuration tool for Logitech mouse drivers
Exec=${cwd}/run.sh
Icon=${cwd}/images/icon.png
Terminal=false
Type=Application
StartupWMClass=Tk
Categories=Utility;
"
# Define the path to the applications directory
desktop_path="${HOME}/.local/share/applications"
# Create the directory if it doesn't exist
mkdir -p "$desktop_path"
# Define the full path to the .desktop file
desktop_file_path="${desktop_path}/LogiOpsGUI.desktop"
# Write the .desktop entry to the file
echo "$desktop_entry" > "$desktop_file_path"
# Set the correct permissions for the .desktop file
chmod 755 "$desktop_file_path"
echo "Desktop entry created at $desktop_file_path"
fi
echo "Installation complete."