do a safer migration

This commit is contained in:
Daniel Hansson 2023-10-06 08:07:30 +02:00 committed by GitHub
parent 5e45d44635
commit 81f97d46e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,27 +87,33 @@ sudo rm -f /etc/systemd/system/gohttpserver.service
sudo rm -f /etc/systemd/system/rustdesksignal.service
sudo rm -f /etc/systemd/system/rustdeskrelay.service
# We need to create the new install dir before the migration task, otherwise mv will fail
mkdir -p "$RUSTDESK_INSTALL_DIR"
# Migration tasks
if [ -d /opt/rustdesk ]
then
mv /opt/rustdesk/id_* "$RUSTDESK_INSTALL_DIR/"
rm -rf /opt/rustdesk
fi
# Install Rustdesk again
# It won't install RustDesk again since there's a check in the install script which checks for the installation folder, but services and everything else will be created
# Would it be possible to move L93-98 after the installation?
if ! curl -fSLO --retry 3 https://raw.githubusercontent.com/rustdesk/rustdesk-server-pro/main/install.sh
msg_box "Sorry, we couldn't fetch the install script, please try again.
Your old installation now lives in $RUSTDESK_INSTALL_DIR"
Your old installation still lives in /opt/rustdesk"
exit
else
if sudo bash install.sh
if sudo bash -x install.sh
then
rm -f install.sh
# Migration tasks
if [ -d /opt/rustdesk ]
then
# First remove the keys generated by the installation script
rm -f "$RUSTDESK_INSTALL_DIR"/id_*
# Then copy over the old keys to the new install dir
# Only remove the old dir if the copy was succesful
if cp -f /opt/rustdesk/id_* "$RUSTDESK_INSTALL_DIR/"
then
rm -rf /opt/rustdesk
else
msg_box "Sorry, but it seems that something went wrong with copying your old keys to the new install dir. Please try again"
exit 1
fi
fi
fi
msg_box "Conversion from OS seems to have been OK!"
else
msg_box "Sorry, but something seems to have gone wrong, please report this to: