Update rustdesk.sh

This commit is contained in:
Spencer Flagg 2024-02-05 10:13:53 +00:00
parent a0904b6fb7
commit 403b3bd0bd

View file

@ -4,6 +4,7 @@
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"
ID_SERVER="192.168.1.242"
PACKAGE_NAME="rustdesk"
# Check for curl
if ! command -v curl &> /dev/null; then
@ -11,6 +12,17 @@ if ! command -v curl &> /dev/null; then
exit 1
fi
# 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
echo "Downloading RustDesk..."
# Download the RustDesk .deb package
@ -44,31 +56,20 @@ fi
echo "Configuring RustDesk..."
# Assuming RustDesk configuration file path; adjust as necessary
# Configure RustDesk
CONFIG_PATH="$HOME/.config/rustdesk/hbb.conf"
# Create config directory if it doesn't exist
mkdir -p "$(dirname "$CONFIG_PATH")"
# Set the ID server address
echo "id_server = \"$ID_SERVER\"" > "$CONFIG_PATH"
echo "Configuration updated."
echo "Starting RustDesk..."
# Assuming the RustDesk binary name; adjust path as necessary
# Note: The exact path may vary depending on the installation method and version
if pgrep rustdesk; then
echo "RustDesk is already running."
# Start RustDesk
if ! pgrep -x "rustdesk" > /dev/null; then
rustdesk &> /dev/null &
echo "RustDesk client started."
else
if command -v rustdesk &> /dev/null; then
rustdesk &
echo "RustDesk client started."
else
echo "Error: RustDesk client could not be found. Please check the installation."
exit 1
fi
echo "RustDesk is already running."
fi
echo "Cleaning up..."