diff --git a/rustdesk.sh b/rustdesk.sh index be5adf9..aec236d 100644 --- a/rustdesk.sh +++ b/rustdesk.sh @@ -1,21 +1,23 @@ #!/bin/bash # Variables -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_VERSION="1.2.3" +RUSTDESK_DEB="rustdesk-${RUSTDESK_VERSION}-x86_64.deb" +RUSTDESK_URL="https://github.com/rustdesk/rustdesk/releases/download/${RUSTDESK_VERSION}/${RUSTDESK_DEB}" ID_SERVER="172.232.132.62" -# Check for RustDesk installation and remove it if present +# Ensure system is updated and curl, xclip are installed +sudo apt update && sudo apt install -y curl xclip + +echo "Checking for RustDesk installation..." if dpkg -l | grep -qw rustdesk; then echo "RustDesk is already installed. Uninstalling..." - sudo dpkg --purge rustdesk + sudo apt remove --purge -y rustdesk else echo "RustDesk is not installed. Proceeding with installation." fi -echo "Downloading RustDesk..." - -# Download the RustDesk .deb package +echo "Downloading RustDesk from ${RUSTDESK_URL}..." if curl -L "$RUSTDESK_URL" -o "$RUSTDESK_DEB"; then echo "Download successful." else @@ -24,25 +26,25 @@ else fi echo "Installing RustDesk..." - -# Attempt 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 + # Attempt to fix broken installations + sudo apt --fix-broken install -y + # Try the installation again + if sudo dpkg -i "$RUSTDESK_DEB"; then + echo "RustDesk installed successfully after fixing dependencies." else - echo "Dependencies resolved. Please try installing RustDesk again." + echo "Error: Failed to install RustDesk even after attempting to fix dependencies." + exit 1 fi fi echo "Starting RustDesk..." +rustdesk & -# Start RustDesk and attempt to bring its window to the foreground -rustdesk - +echo "Copying server ID to clipboard..." echo "$ID_SERVER" | xclip -selection clipboard echo "Cleaning up..."