Files
DRB-CnC/Client/update.sh

34 lines
690 B
Bash

#!/bin/bash
# Check if the user is root
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
# Sleeping to give the client time to respond to the requester
sleep 5
# Stating Message
echo "<!-- UPDATING ---!>"
# TODO - Add an updater for Stable Diffusion API
# Stop any running service
systemctl stop RadioNode
# Get the owner of the current working directory
cwd_owner=$(stat -c '%U' .)
# Update the git Repo as the owner of the current working directory
sudo su -l $cwd_owner -c 'git fetch'
sudo su -l $cwd_owner -c 'git pull'
# Install any new libraries
npm i
# Start the service
systemctl start RadioNode
# Update complete message
echo "<!--- UPDATE COMPLETE! ---!>"