Skip to content

Instantly share code, notes, and snippets.

@CactiChameleon9
Created February 14, 2022 20:59
Show Gist options
  • Save CactiChameleon9/143a04235fc0a85151bf692611c387ea to your computer and use it in GitHub Desktop.
Save CactiChameleon9/143a04235fc0a85151bf692611c387ea to your computer and use it in GitHub Desktop.
A script to update pleroma if it isn't the latest version (linux, bash)
#!/bin/bash
#replace current with your instance
latest=$(curl -s https://pleroma.social/announcements/feed.xml | grep "Pleroma patch release" | head -n 1 | sed 's/<title>Pleroma patch release: //g' | sed 's/ //g' | sed 's/<\/title>//g')
current=$(curl https://pleroma.my.instance/api/v1/instance -s | sed -e 's/[{}]/''/g' | awk -v RS=',"' -F: '/^version/ {print $2}' | awk '{print $4}' | sed 's/..$//')
echo $latest
echo $current
if [ "$latest" != "$current" ];
then
su pleroma -s $SHELL -lc "./bin/pleroma_ctl update --no-rm"
systemctl stop pleroma
su pleroma -s $SHELL -lc "./bin/pleroma_ctl migrate"
systemctl start pleroma
else
echo "Pleroma is already latest version"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment