Skip to content

Instantly share code, notes, and snippets.

@geirawsm
Created July 7, 2025 18:49
Show Gist options
  • Save geirawsm/c5e83a8feec7e6dd9f3e89c80521dba0 to your computer and use it in GitHub Desktop.
Save geirawsm/c5e83a8feec7e6dd9f3e89c80521dba0 to your computer and use it in GitHub Desktop.
Simple bash script for upgrading pullio from github
pullio_up () {
_promptyn () {
if [[ -z $1 ]]; then
echo "_promptyn misses text"
else
while true; do
read -rp "$1 " yn
case "${yn:-$2}" in
[Yy]* ) return 0;;
[Nn]* ) return 1;;
* ) echo "Please answer yes or no.";;
esac
done
fi
}
if [[ ! $(type -P pullio) ]]; then
if _promptyn "pullio is not installed. Do you want to install? [Yn] " y; then
sudo curl -fsSL "https://raw.githubusercontent.com/hotio/pullio/master/pullio.sh" -o /usr/local/bin/pullio
sudo chmod +x /usr/local/bin/pullio
fi
exit 0
fi
sudo curl -fsSL "https://raw.githubusercontent.com/hotio/pullio/master/pullio.sh" -o /tmp/pullio_tmp
CUR_VER=$(grep -i current_version= /usr/local/bin/pullio | awk -F "=" '{ print $2 }')
NEW_VER=$(grep -i current_version= /tmp/pullio_tmp | awk -F "=" '{ print $2 }')
if [ "$CUR_VER" != "$NEW_VER" ]; then
echo Found new version of pullio: $NEW_VER vs $CUR_VER
if _promptyn "Do you want to upgrade? [Yn] " y; then
sudo curl -fsSL "https://raw.githubusercontent.com/hotio/pullio/master/pullio.sh" -o /usr/local/bin/pullio
sudo chmod +x /usr/local/bin/pullio
else
echo Not upgrading
fi
else
echo You are running the newest version of pullio \("$CUR_VER"\)
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment