-
Notifications
You must be signed in to change notification settings - Fork 14
/
install_linux.sh
executable file
·69 lines (57 loc) · 2.75 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
#
# SPDX-FileCopyrightText: 2024 Amilcar do Carmo Lucas <[email protected]>
#
#SPDX-License-Identifier: GPL-3.0-or-later
# 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..."
sudo python3 -m pip uninstall -y serial pyserial
# Install the project dependencies
echo "Installing project dependencies..."
python3 -m pip install -e .[dev]
# 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/
# configure git local repository settings
git config --local pull.rebase true
git config --local push.autoSetupRemote
git config --local init.defaultbranch master
git config --local sequence.editor "code --wait"
# install pre-commit git hooks
pre-commit install
# setuptools has a bug and refuses to install these files, so do it manually
cp vehicle_templates ~/.local/lib/python3.12/site-packages/MethodicConfigurator/
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."