commit
16680e4261
@ -31,6 +31,7 @@ echo '| | | | __/ (_| |\ V /| |_| /\__/ / (__| | | | |_) | |_ '
|
||||
echo '\_| |_/\___|\__,_| \_/ \__, \____/ \___|_| |_| .__/ \__|'
|
||||
echo ' __/ | | | '
|
||||
echo ' |___/ |_| '
|
||||
echo "$hs_version"
|
||||
echo
|
||||
}
|
||||
export -f title
|
||||
|
@ -2,20 +2,25 @@
|
||||
|
||||
args=("$@")
|
||||
self_update() {
|
||||
branch="main"
|
||||
git fetch &> /dev/null
|
||||
|
||||
git fetch --tags &>/dev/null
|
||||
latest_ver=$(git describe --tags "$(git rev-list --tags --max-count=1)")
|
||||
echo "🅂 🄴 🄻 🄵"
|
||||
echo "🅄 🄿 🄳 🄰 🅃 🄴"
|
||||
if git diff --name-only origin/$branch | grep -qs ".sh" ; then
|
||||
if [[ "$hs_version" != "$latest_ver" ]] ; then
|
||||
echo "Found a new version of HeavyScript, updating myself..."
|
||||
git reset --hard -q
|
||||
git pull --force -q
|
||||
git checkout "$latest_ver" &>/dev/null
|
||||
count=0
|
||||
for i in "${args[@]}"
|
||||
do
|
||||
[[ "$i" == "--self-update" ]] && unset "args[$count]" && break
|
||||
((count++))
|
||||
done
|
||||
echo "Updating from: $hs_version"
|
||||
echo "Updating To: $latest_ver"
|
||||
echo "Changelog:"
|
||||
curl --silent "https://api.github.com/repos/HeavyBullets8/heavy_script/releases/latest" | jq -r .body
|
||||
echo
|
||||
[[ -z ${args[*]} ]] && echo -e "No more arguments, exiting..\n\n" && exit
|
||||
echo -e "Running the new version...\n\n"
|
||||
sleep 5
|
||||
@ -23,7 +28,8 @@ if git diff --name-only origin/$branch | grep -qs ".sh" ; then
|
||||
# Now exit this old instance
|
||||
exit
|
||||
else
|
||||
echo -e "HeavyScript is already the latest version\n\n"
|
||||
echo "HeavyScript is already the latest version:"
|
||||
echo -e "$hs_version\n\n"
|
||||
fi
|
||||
}
|
||||
export -f self_update
|
@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
#Version
|
||||
hs_version=$(git describe --tags)
|
||||
|
||||
# cd to script, this ensures the script can find the source scripts below, even when ran from a seperate directory
|
||||
script=$(readlink -f "$0")
|
||||
|
Loading…
Reference in New Issue
Block a user