Update rustdesk.sh
This commit is contained in:
parent
403b3bd0bd
commit
5a6955c4b7
1 changed files with 16 additions and 34 deletions
50
rustdesk.sh
50
rustdesk.sh
|
|
@ -3,24 +3,13 @@
|
||||||
# Variables
|
# 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"
|
||||||
ID_SERVER="192.168.1.242"
|
|
||||||
PACKAGE_NAME="rustdesk"
|
|
||||||
|
|
||||||
# Check for curl
|
# Check for RustDesk installation and remove it if present
|
||||||
if ! command -v curl &> /dev/null; then
|
if dpkg -l | grep -qw rustdesk; then
|
||||||
echo "Error: curl is not installed. Please install curl and try again."
|
echo "RustDesk is already installed. Uninstalling..."
|
||||||
exit 1
|
sudo dpkg --purge rustdesk
|
||||||
fi
|
else
|
||||||
|
echo "RustDesk is not installed. Proceeding with installation."
|
||||||
# Check if RustDesk is already installed and remove it
|
|
||||||
if dpkg -l | grep -qw "$PACKAGE_NAME"; then
|
|
||||||
echo "RustDesk is already installed. Removing..."
|
|
||||||
if sudo dpkg --purge "$PACKAGE_NAME"; then
|
|
||||||
echo "Successfully removed existing RustDesk installation."
|
|
||||||
else
|
|
||||||
echo "Failed to remove existing RustDesk. Exiting."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Downloading RustDesk..."
|
echo "Downloading RustDesk..."
|
||||||
|
|
@ -33,12 +22,6 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if the file was actually downloaded
|
|
||||||
if [ ! -f "$RUSTDESK_DEB" ]; then
|
|
||||||
echo "Error: The RustDesk .deb file was not downloaded. Exiting."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Installing RustDesk..."
|
echo "Installing RustDesk..."
|
||||||
|
|
||||||
# Attempt to install the RustDesk package
|
# Attempt to install the RustDesk package
|
||||||
|
|
@ -54,20 +37,19 @@ else
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Configuring RustDesk..."
|
|
||||||
|
|
||||||
# Configure RustDesk
|
|
||||||
CONFIG_PATH="$HOME/.config/rustdesk/hbb.conf"
|
|
||||||
mkdir -p "$(dirname "$CONFIG_PATH")"
|
|
||||||
echo "id_server = \"$ID_SERVER\"" > "$CONFIG_PATH"
|
|
||||||
echo "Configuration updated."
|
|
||||||
|
|
||||||
echo "Starting RustDesk..."
|
echo "Starting RustDesk..."
|
||||||
|
|
||||||
# Start RustDesk
|
# Start RustDesk and attempt to bring its window to the foreground
|
||||||
if ! pgrep -x "rustdesk" > /dev/null; then
|
if ! pgrep -x "rustdesk" > /dev/null; then
|
||||||
rustdesk &> /dev/null &
|
rustdesk &
|
||||||
echo "RustDesk client started."
|
sleep 2 # Give RustDesk a moment to start
|
||||||
|
# Attempt to focus the RustDesk window. This method may need adjustment based on the desktop environment.
|
||||||
|
WINDOW_ID=$(xdotool search --onlyvisible --class rustdesk | head -1)
|
||||||
|
if [ ! -z "$WINDOW_ID" ]; then
|
||||||
|
xdotool windowactivate "$WINDOW_ID"
|
||||||
|
else
|
||||||
|
echo "RustDesk started but could not focus the window automatically."
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "RustDesk is already running."
|
echo "RustDesk is already running."
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue