Update rustdesk.sh

This commit is contained in:
Spencer Flagg 2024-02-05 09:43:27 +00:00
parent 886c74f1f5
commit 55738df2cd

View file

@ -1,42 +1,46 @@
#!/bin/bash #!/bin/bash
# Define the RustDesk deb package URL # Variables
RUSTDESK_URL="https://github.com/rustdesk/rustdesk/releases/download/1.2.3/rustdesk-1.2.3-x86_64.deb" 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" RUSTDESK_DEB="rustdesk-1.2.3-x86_64.deb"
# Download RustDesk deb package # Check for curl
echo "Downloading RustDesk..." if ! command -v curl &> /dev/null; then
curl -L "$RUSTDESK_URL" -o "$RUSTDESK_DEB" 2>/dev/null echo "Error: curl is not installed. Please install curl and try again."
# Verify that the download was successful
if [ $? -ne 0 ]; then
echo "Error: Failed to download RustDesk."
exit 1 exit 1
else fi
echo "Downloading RustDesk..."
# Downloading the RustDesk .deb package
if curl -L "$RUSTDESK_URL" -o "$RUSTDESK_DEB"; then
echo "Download successful." echo "Download successful."
fi
# Install RustDesk
echo "Installing RustDesk..."
sudo dpkg -i "$RUSTDEK_DEB"
# Check if dpkg encountered any errors
if [ $? -ne 0 ]; then
echo "Error: dpkg encountered an issue installing RustDesk. Attempting to fix..."
sudo apt-get install -f
# Check if apt-get fixed the issue
if [ $? -ne 0 ]; then
echo "Error: Failed to resolve dependencies automatically."
exit 2
else
echo "Dependencies resolved and RustDesk installed successfully."
fi
else else
echo "RustDesk installed successfully." echo "Download failed. Please check the URL and try again."
exit 1
fi fi
# Cleanup downloaded package # Check if the file was actually downloaded
echo "Cleaning up..." if [ ! -f "$RUSTDESK_DEB" ]; then
rm "$RUSTDESK_DEB" echo "Error: The RustDesk .deb file was not downloaded. Exiting."
exit 1
fi
echo "Installing RustDesk..."
# Attempting to install the RustDesk package
if sudo dpkg -i "$RUSTDESK_DEB"; then
echo "RustDesk installed successfully."
else
echo "Error: dpkg encountered an issue installing RustDesk. Attempting to fix..."
if ! sudo apt-get install -f; then
echo "Error: Failed to resolve dependencies. Exiting."
exit 1
else
echo "Dependencies resolved. Please try installing RustDesk again."
fi
fi
echo "Cleaning up..."
rm -f "$RUSTDESK_DEB"
echo "Installation complete." echo "Installation complete."