mirror of
				https://github.com/Kicksecure/security-misc.git
				synced 2025-10-31 03:28:54 -04:00 
			
		
		
		
	 daf0a0900b
			
		
	
	
		daf0a0900b
		
			
		
	
	
	
	
		
			
			https://forums.kicksecure.com/t/systemcheck-reports-warning-debian-package-update-check-result-apt-get-reports-that-packages-can-be-updated-but-system-is-already-fully-upgraded/785
		
			
				
	
	
		
			48 lines
		
	
	
	
		
			979 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
	
		
			979 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
| #!/bin/bash
 | |
| 
 | |
| ## Copyright (C) 2012 - 2024 ENCRYPTED SUPPORT LP <adrelanos@whonix.org>
 | |
| ## See the file COPYING for copying conditions.
 | |
| 
 | |
| set -o errexit
 | |
| set -o nounset
 | |
| set -o errtrace
 | |
| set -o pipefail
 | |
| 
 | |
| export LANG=C
 | |
| 
 | |
| write_pid_file() {
 | |
|   [[ -z "${TMP:-}" ]] && error "TMP is unset"
 | |
|   safe-rm -rf "$TMP/security-misc-apt-get-update-pid";
 | |
|   install -m644 /dev/null "$TMP/security-misc-apt-get-update-pid"
 | |
|   echo "$$" | sponge -- "$TMP/security-misc-apt-get-update-pid"
 | |
| }
 | |
| 
 | |
| sigterm_trap() {
 | |
|    if [ "$lastpid" = "" ]; then
 | |
|       exit 143
 | |
|    fi
 | |
|    ps -p "$lastpid" >/dev/null 2>&1
 | |
|    if [ ! "$?" = "0" ]; then
 | |
|       ## Already terminated.
 | |
|       exit 143
 | |
|    fi
 | |
|    kill -s sigterm "$lastpid"
 | |
|    exit 143
 | |
| }
 | |
| 
 | |
| trap "sigterm_trap" SIGTERM SIGINT
 | |
| 
 | |
| [[ -v timeout_after ]] || timeout_after="600"
 | |
| [[ -v kill_after ]] || kill_after="10"
 | |
| 
 | |
| write_pid_file
 | |
| 
 | |
| timeout \
 | |
|    --kill-after="$kill_after" \
 | |
|    "$timeout_after" \
 | |
|    apt-get update --error-on=any "$@" &
 | |
| 
 | |
| lastpid="$!"
 | |
| wait "$lastpid"
 | |
| 
 | |
| exit "$?"
 |