forked from ArduPilot/MethodicConfigurator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_linux.sh
executable file
·53 lines (44 loc) · 2.2 KB
/
install_linux.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
#!/bin/bash
# Update package lists
echo "Updating package lists..."
sudo apt-get update
# Install Python3 PIL.ImageTk for GUI support
echo "Installing Python3 PIL.ImageTk..."
sudo apt-get install -y python3-pil.imagetk
# Uninstall serial and pyserial to avoid conflicts
echo "Uninstalling serial and pyserial..."
python3 -m pip uninstall -y serial pyserial
# Install the project dependencies
echo "Installing project dependencies..."
python3 -m pip install .
# Get the directory of the script
prog_dir=$(realpath "$(dirname "$0")")/MethodicConfigurator
# Check if the system is Debian-based
if [ -f /etc/debian_version ] || [ -f /etc/os-release ] && grep -q 'ID_LIKE=.*debian.*' /etc/os-release; then
echo "Creating MethodicConfigurator.desktop for Debian-based systems..."
# Define the desktop entry content
desktop_entry="[Desktop Entry]\nName=ArduPilot Methodic Configurator\nComment=A clear ArduPilot configuration sequence\nExec=bash -c 'cd $prog_dir && python3 ardupilot_methodic_configurator.py'\nIcon=$prog_dir/ArduPilot_icon.png\nTerminal=true\nType=Application\nCategories=Development;\nKeywords=ardupilot;arducopter;drone;copter;scm"
# Create the .desktop file in the appropriate directory
echo -e $desktop_entry > /home/$USER/.local/share/applications/MethodicConfigurator.desktop
echo "MethodicConfigurator.desktop created successfully."
else
echo "This system is not Debian-based. Skipping .desktop file creation."
fi
# Check if the ~/Desktop directory exists
if [ -d "$HOME/Desktop" ]; then
# Copy the .desktop file to the ~/Desktop directory
cp /home/$USER/.local/share/applications/MethodicConfigurator.desktop $HOME/Desktop/
# Mark it as thrusted
chmod 755 $HOME/Desktop/MethodicConfigurator.desktop
echo "MethodicConfigurator.desktop copied to ~/Desktop."
else
echo "~/Desktop directory does not exist. Skipping copy to Desktop."
fi
update-desktop-database ~/.local/share/applications/
echo "Installation complete."
echo ""
echo "You can run the ArduPilot methodic configurator GUI by executing:"
echo "cd MethodicConfigurator"
echo "python3 ardupilot_methodic_configurator.py"
echo ""
echo "For more detailed usage instructions, please refer to the USERMANUAL.md file."