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