Move the upgrade script out of the main command
This allows the upgrade script itself to potentially be upgradable
This commit is contained in:
parent
54602b4b2e
commit
83d4d6a871
|
@ -11141,32 +11141,18 @@ function install_mediagoblin {
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_upgrade_script {
|
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
|
if grep -Fxq "create_upgrade_script" $COMPLETION_FILE; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
apt-get -y install unattended-upgrades
|
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
|
echo 'create_upgrade_script' >> $COMPLETION_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue