diff --git a/src/freedombone b/src/freedombone index 4b3e5d8b..259c1fcb 100755 --- a/src/freedombone +++ b/src/freedombone @@ -11141,32 +11141,18 @@ function install_mediagoblin { } function create_upgrade_script { + if [ -f /usr/local/bin/${PROJECT_NAME}-upgrade ]; then + cp /usr/local/bin/${PROJECT_NAME}-upgrade /etc/cron.weekly/$UPGRADE_SCRIPT_NAME + else + cp /usr/bin/${PROJECT_NAME}-upgrade /etc/cron.weekly/$UPGRADE_SCRIPT_NAME + fi + if grep -Fxq "create_upgrade_script" $COMPLETION_FILE; then return fi apt-get -y install unattended-upgrades - echo '#!/bin/bash' > /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo '' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo 'update-ca-certificates' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo '' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo 'if [ ! -d /root/freedombone ]; then' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo " git clone $FREEDOMBONE_REPO /root/freedombone" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo 'fi' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo '' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo 'if [ -f /root/freedombone.cfg ]; then' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo ' cd /root/freedombone' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo ' git stash' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo ' git pull' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo ' make install' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo ' freedombone -c /root/freedombone.cfg' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo 'fi' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo '' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - echo "echo ' - -' | reset-tripwire" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - chmod +x /etc/cron.weekly/$UPGRADE_SCRIPT_NAME echo 'create_upgrade_script' >> $COMPLETION_FILE } diff --git a/src/freedombone-upgrade b/src/freedombone-upgrade new file mode 100755 index 00000000..6b2a6c2d --- /dev/null +++ b/src/freedombone-upgrade @@ -0,0 +1,23 @@ +#!/bin/bash + +FREEDOMBONE_REPO="https://github.com/bashrc/freedombone" + +update-ca-certificates + +if [ ! -d /root/freedombone ]; then + echo " git clone $FREEDOMBONE_REPO /root/freedombone" +fi + +if [ -f /root/freedombone.cfg ]; then + cd /root/freedombone + git stash + git pull + make install + freedombone -c /root/freedombone.cfg +fi + +echo ' + +' | reset-tripwire + +# deliberately there is no 'exit 0' here