Files
tetanus/tetanus_update.sh
T

22 lines
833 B
Bash

#!/bin/bash
config_path="|||CONFIG|||"
current_version=$(cat $config_path/version | grep version | cut -d " " -f 2)
path=$(cat $config_path/version | grep path | cut -d " " -f 2)
version=$(curl https://git.pyro.monster/pyro/tetanus/releases/tag/latest | grep "<title>" | cut -d ">" -f 2 | cut -d " " -f 1)
if [[ "$version" == "$current_version" ]]; then
echo "up to date"
else
echo "update needed"
curl https://git.pyro.monster/pyro/tetanus/releases/download/latest/tetanus -o $config_path/new_tetanus
chmod +x $config_path/new_tetanus
if [ "$(stat -c '%u' $path)" -eq 0 ]; then
sudo cp $config_path/new_tetanus $path
else
cp $config_path/new_tetanus $path
fi
echo "version: $version" > $config_path/version
echo "path: $path" >> $config_path/version
echo update complete!
fi