liferaft/rustdesk.sh

51 lines
1.3 KiB
Bash
Raw Normal View History

2024-02-04 21:42:40 +00:00
#!/bin/bash
2024-02-05 09:43:27 +00:00
# Variables
2024-02-04 21:42:40 +00:00
RUSTDESK_URL="https://github.com/rustdesk/rustdesk/releases/download/1.2.3/rustdesk-1.2.3-x86_64.deb"
RUSTDESK_DEB="rustdesk-1.2.3-x86_64.deb"
2024-02-05 10:56:08 +00:00
ID_SERVER="172.232.132.62"
2024-02-04 21:42:40 +00:00
2024-02-05 10:48:48 +00:00
# Check for RustDesk installation and remove it if present
if dpkg -l | grep -qw rustdesk; then
echo "RustDesk is already installed. Uninstalling..."
sudo dpkg --purge rustdesk
else
echo "RustDesk is not installed. Proceeding with installation."
2024-02-05 10:13:53 +00:00
fi
2024-02-04 21:42:40 +00:00
echo "Downloading RustDesk..."
2024-02-05 10:05:55 +00:00
# Download the RustDesk .deb package
2024-02-05 09:43:27 +00:00
if curl -L "$RUSTDESK_URL" -o "$RUSTDESK_DEB"; then
2024-02-04 21:42:40 +00:00
echo "Download successful."
2024-02-05 09:43:27 +00:00
else
echo "Download failed. Please check the URL and try again."
exit 1
fi
2024-02-04 21:42:40 +00:00
echo "Installing RustDesk..."
2024-02-05 10:05:55 +00:00
# Attempt to install the RustDesk package
2024-02-05 09:43:27 +00:00
if sudo dpkg -i "$RUSTDESK_DEB"; then
echo "RustDesk installed successfully."
else
2024-02-04 21:42:40 +00:00
echo "Error: dpkg encountered an issue installing RustDesk. Attempting to fix..."
2024-02-05 09:43:27 +00:00
if ! sudo apt-get install -f; then
echo "Error: Failed to resolve dependencies. Exiting."
exit 1
2024-02-04 21:42:40 +00:00
else
2024-02-05 09:43:27 +00:00
echo "Dependencies resolved. Please try installing RustDesk again."
2024-02-04 21:42:40 +00:00
fi
fi
2024-02-05 10:05:55 +00:00
echo "Starting RustDesk..."
2024-02-05 10:48:48 +00:00
# Start RustDesk and attempt to bring its window to the foreground
2024-02-05 10:56:08 +00:00
rustdesk
echo "$ID_SERVER" | xclip -selection clipboard
2024-02-05 10:05:55 +00:00
2024-02-04 21:42:40 +00:00
echo "Cleaning up..."
2024-02-05 09:43:27 +00:00
rm -f "$RUSTDESK_DEB"
2024-02-04 21:42:40 +00:00
echo "Installation complete."