upgrade.sh (1432B)
1 #!/bin/bash 2 # This file is in the public domain. 3 set -eu 4 5 notify_err() { 6 echo "errexit on line $(caller)" >&2 7 } 8 9 trap notify_err ERR 10 11 echo "Fetching package list..." 12 apt-get update -y 13 14 echo -n "Stopping Taler services..." 15 systemctl disable --now taler-exchange.target &>> upgrade.log 16 systemctl disable --now taler-merchant.target &>> upgrade.log 17 systemctl disable --now libeufin-bank.target &>> upgrade.log 18 systemctl disable --now libeufin-nexus.target &>> upgrade.log 19 echo " OK" 20 21 echo "Upgrading packages..." 22 apt-get upgrade -y 23 apt-get dist-upgrade -y 24 25 if test -x /etc/taler/taler.conf 26 then 27 echo "Manual upgrade required, please split your /etc/taler/taler.conf" 28 echo "into separate versions for exchange and merchant." 29 echo "Once done, continue the upgrade by exiting this sub-shell by" 30 echo "entering 'exit'." 31 export PS1="SUBSHELL-$PS1" 32 bash 33 fi 34 35 echo "Upgrading databases..." 36 libeufin-dbconfig &>> upgrade.log 37 taler-exchange-dbconfig &>> upgrade.log 38 taler-merchant-dbconfig &>> upgrade.log 39 40 echo -n "Run migrations" 41 for migration in migration/*; 42 do ./"$migration" &>> upgrade.log; 43 done 44 echo " OK" 45 46 echo -n "Restarting Taler services..." 47 systemctl enable --now taler-exchange.target &>> upgrade.log 48 systemctl enable --now taler-merchant.target &>> upgrade.log 49 systemctl enable --now libeufin-bank.target &>> upgrade.log 50 systemctl enable --now libeufin-nexus.target &>> upgrade.log 51 echo " OK" 52 53 exit 0