diff --git a/install/install_quilibrium_service.sh b/install/install_quilibrium_service.sh index fdec658..e1a5103 100644 --- a/install/install_quilibrium_service.sh +++ b/install/install_quilibrium_service.sh @@ -31,8 +31,30 @@ else fi sudo sysctl -p +# Step 3: Check if directory ~/ceremonyclient exists and remove it +if [ -d ~/ceremonyclient ]; then + # Check if backup directory ~/backup/qnode_keys exists, if not create it + if [ ! -d ~/backup/qnode_keys ]; then + mkdir -p ~/backup/qnode_keys + fi + + # Check if files exist, then backup + if [ -f ~/ceremonyclient/node/.config/keys.yml ]; then + cp ~/ceremonyclient/node/.config/keys.yml ~/backup/qnode_keys/ + echo "✅ Backup of keys.yml created in ~/backup/qnode_keys folder" + fi + + if [ -f ~/ceremonyclient/node/.config/config.yml ]; then + cp ~/ceremonyclient/node/.config/config.yml ~/backup/qnode_keys/ + echo "✅ Backup of config.yml created in ~/backup/qnode_keys folder" + fi + + # Remove existing directory ~/ceremonyclient + echo "🗑️ Removing existing directory ~/ceremonyclient..." + rm -rf ~/ceremonyclient +fi -# Step 8:Download Ceremonyclient +# Step 4:Download Ceremonyclient echo "⏳Downloading Ceremonyclient" sleep 1 # Add a 1-second delay cd ~ @@ -43,7 +65,7 @@ git checkout release # Get the system architecture ARCH=$(uname -m) -# Step10.1:Determine the ExecStart line based on the architecture +# Step 5:Determine the ExecStart line based on the architecture if [ "$ARCH" = "x86_64" ]; then EXEC_START="/root/ceremonyclient/node/node-1.4.18-linux-amd64" elif [ "$ARCH" = "aarch64" ]; then @@ -55,10 +77,20 @@ else exit 1 fi -# Step10.2:Create Ceremonyclient Service +# Step 6:Create Ceremonyclient Service echo "⏳ Re-Creating Ceremonyclient Service" sleep 2 # Add a 2-second delay -rm /lib/systemd/system/ceremonyclient.service + +# Check if the file exists before attempting to remove it +if [ -f "/lib/systemd/system/ceremonyclient.service" ]; then + # If the file exists, remove it + rm /lib/systemd/system/ceremonyclient.service + echo "ceremonyclient.service file removed." +else + # If the file does not exist, inform the user + echo "ceremonyclient.service file does not exist. No action taken." +fi + sudo tee /lib/systemd/system/ceremonyclient.service > /dev/null <