At the time when we can fix this up the new (and possibly an old) server daemon process is running, so use the flock CLI tool from util-linux to ensure we do the same locking as the server and thus we avoid a race condition. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
		
			
				
	
	
		
			36 lines
		
	
	
		
			804 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			804 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
#!/bin/sh
 | 
						|
 | 
						|
set -e
 | 
						|
 | 
						|
#DEBHELPER#
 | 
						|
 | 
						|
case "$1" in
 | 
						|
    configure)
 | 
						|
	# modeled after dh_systemd_start output
 | 
						|
	systemctl --system daemon-reload >/dev/null || true
 | 
						|
	if [ -n "$2" ]; then
 | 
						|
		_dh_action=try-reload-or-restart
 | 
						|
	else
 | 
						|
		_dh_action=start
 | 
						|
	fi
 | 
						|
	deb-systemd-invoke $_dh_action proxmox-backup.service proxmox-backup-proxy.service >/dev/null || true
 | 
						|
 | 
						|
	if test -n "$2"; then
 | 
						|
		if dpkg --compare-versions "$2" 'le' '0.8.10-1'; then
 | 
						|
			echo "Fixing up termproxy user id in task log..."
 | 
						|
			flock -w 30 /var/log/proxmox-backup/tasks/active.lock sed -i 's/:termproxy::root: /:termproxy::root@pam: /' /var/log/proxmox-backup/tasks/active
 | 
						|
		fi
 | 
						|
	fi
 | 
						|
    ;;
 | 
						|
 | 
						|
    abort-upgrade|abort-remove|abort-deconfigure)
 | 
						|
    ;;
 | 
						|
 | 
						|
    *)
 | 
						|
        echo "postinst called with unknown argument \`$1'" >&2
 | 
						|
        exit 1
 | 
						|
    ;;
 | 
						|
esac
 | 
						|
 | 
						|
exit 0
 |