Commit ce099c17 authored by Paolo Dongilli's avatar Paolo Dongilli
Browse files

Merge branch 'auto-fuss-client-upgrade' into 'master'

First implementation of auto (fuss-client) upgrade

See merge request !1
parents 460a1a00 156a9a6a
Pipeline #200 passed with stage
in 44 seconds
......@@ -48,3 +48,7 @@
"timestamp": "{{ ansible_date_time.epoch }}",
"version": "{{ fuss_client_version }}"
}
- name: Remove the update trigger
file:
path: /var/lib/fuss-client/upgrade-trigger
state: absent
......@@ -34,6 +34,10 @@
file:
dest: /usr/local/share/applications/chromium.desktop
state: absent
- name: Remove server.conf
file:
dest: /etc/fuss-client/server.conf
state: absent
- name: Remove the existing kerberos keys
file:
dest: /etc/krb5.keytab
......
......@@ -54,3 +54,7 @@
"timestamp": "{{ ansible_date_time.epoch }}",
"version": "{{ fuss_client_version }}"
}
- name: Remove the update trigger
file:
path: /var/lib/fuss-client/upgrade-trigger
state: absent
#!/bin/bash
# This file is part of the FUSS project.
# Copyright (C) 2022 The FUSS Project <info@fuss.bz.it>
# Author: Marco Marinello <contact-nohuman@marinello.bz.it>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# Run fuss-client -U if an update was installed by unattended upgrades
# and the client is already joined to the domain
LOCKFILE="/var/lock/fuss-client-unattended.lock"
# Exit if the client is not joined to the domain or
# the update was already executed
test -e /var/lib/fuss-client/upgrade-trigger -a -e /etc/fuss-client/server.conf -a ! -e $LOCKFILE || exit 0
# Lock the upgrade process: if apt takes more
# than an hour, no other execution will start.
echo $$ > $LOCKFILE
LOGFILE="/var/log/fuss-client-unattended-$(date +%Y-%m-%d-%H-%M).log"
echo "Unattended execution of fuss-client -U started on $(date)" > $LOGFILE
# Wait for any packaging-related process to finish
echo "$(date) - start loop to wait apt to be finished" >> $LOGFILE
while ps -C apt-get,apt,dpkg,unattended-upgrade,unattended-upgrades > /dev/null ; do
sleep 5
done
echo "$(date) - apt finished, run fuss-client -U" >> $LOGFILE
# Run fuss-client -U
fuss-client -U >> $LOGFILE 2>&1
# No need to remove the trigger file as it will be removed by fuss-client itself
rm $LOCKFILE
#!/bin/bash
# This file is part of the FUSS project.
# Copyright (C) 2022 The FUSS Project <info@fuss.bz.it>
# Author: Marco Marinello <contact-nohuman@marinello.bz.it>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# Install the trigger so that anacron will silently run
# fuss-client -U
set -e
case "$1" in
configure)
test ! -d /var/lib/fuss-client && mkdir -p /var/lib/fuss-client
chown root:root /var/lib/fuss-client
chmod 0700 /var/lib/fuss-client
touch /var/lib/fuss-client/upgrade-trigger
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment