/usr/sbin/aptitude-robot-session is in aptitude-robot 1.5.2-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | #!/bin/sh
[ -f /etc/default/aptitude-robot ] && . /etc/default/aptitude-robot
if [ ! -x /usr/sbin/aptitude-robot ]; then
exit # aptitude-robot has been deinstalled but not purged
fi
if fuser -s /var/lib/dpkg/lock ; then
echo 'another package manager is running. Exiting.' 1>&2
exit 1
fi
if [ -n "$LOG_SESSION" ] ; then
# the session log is made unique with a PID ending
# so as to not overwrite an old log of a crashed aptitude-robot process
LOG_SESSION="$LOG_SESSION".$$
touch "$LOG_SESSION"
# only redirect STDOUT+STDERR if session log is available
if [ -f "$LOG_SESSION" ]; then
exec 1>"$LOG_SESSION" 2>&1
fi
fi
cleanup () {
# finish session log
echo "aptitude-robot ended at" $(date --rfc-3339=seconds)
echo ""
if [ -n "$LOG_SESSION" -a -f "$LOG_SESSION" ]; then
# append session log to permanent log file
if [ -n "$LOGFILE" ]; then
touch "$LOGFILE" # create the log file if necessary
if [ -f "$LOGFILE" ]; then
cat "$LOG_SESSION" >> "$LOGFILE"
fi
fi
# optionally process session log for reporting
if [ -x "$SESSION_REPORT_COMMAND" ]; then
"$SESSION_REPORT_COMMAND" "$LOG_SESSION"
fi
rm "$LOG_SESSION"
fi
}
trap cleanup INT TERM QUIT HUP EXIT
set -e
echo "aptitude-robot started at" $(date --rfc-3339=seconds)
# prevent infinite loops by limiting log file sizes
MAX_LOGFILES_SIZE_BLOCKS=$(($MAX_LOGFILES_SIZE_BLOCKS + 0)) # force number
[ $MAX_LOGFILES_SIZE_BLOCKS -gt 0 ] && ulimit -f $MAX_LOGFILES_SIZE_BLOCKS
# called from a script aptitude should ask as few questions as possible
# and just take the defaults. We expect the configuration management
# to have provided the necessary config options beforehand
DEBIAN_FRONTEND=noninteractive
export DEBIAN_FRONTEND
DEBIAN_PRIORITY=critical
export DEBIAN_PRIORITY
# -q (for --quiet) suppresses percentage reporting for downloads
# but leaves most regular output to be collected in the log file
/usr/bin/aptitude -q update
if egrep -q '[EW]: Failed to fetch ' "$LOG_SESSION"; then
echo "E: aptitude-robot failed to fetch some APT repositories. Aborting."
exit 2
fi
touch /var/lib/apt/update_success
/usr/sbin/aptitude-robot -y -q "$@" \
-o DPkg::Options::=--force-confdef \
-o DPkg::Options::=--force-confold \
< /dev/null
if [ -n "$POST_SESSION_HOOK" ]; then
$POST_SESSION_HOOK
fi
|