Debian Codegraph @

debian/postinst

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 set -e
4
5 configurescip-shell shell shell-project 0.0.0 configure().() {
6 LOGDIR="/var/log/atopscip-shell filesystem . . `/var/log/atop`."
7 # this has been in place since at least buster. remove post-trixie
8 rmscip-shell system . . rm. -f "${LOGDIR}/dummy_after" "${LOGDIR}/dummy_before"
9 # check whether atop will read its own latest file
10 # point atop to the latest file and check for output on stdout
11 # the pipe will prevent atop from going interactive, and if it
12 # won't read the file, stdout will be empty.
13 LATESTFILE="$(findscip-shell system . . find. "${LOGDIR}" -maxdepth 1 -type f \
14 -regextype posix-egrep -regex '.*/atop_[0-9]+$' \
15 -printf '%p\n' | sort | tail -n 1)"
16 if [scip-shell system . . `[`. -n "${LATESTFILE}" ]; then
17 if ! atop -r "${LATESTFILE}" 2>/dev/nullscip-shell filesystem . . `/dev/null`. | headscip-shell system . . head. -n 5 | grepscip-shell system . . grep. -q '.'; then
18 # updating from an older version which won't read
19 # the old log file format
20 # take a backup of the old file and convert it
21 BACKUPFILE="${LATESTFILE}_oldformat"
22 if [scip-shell system . . `[`. -e "${BACKUPFILE}" ]; then
23 TIMESTAMP=$(datescip-shell system . . date. +%Y%m%dT%H%M%S)
24 BACKUPFILE="${LATESTFILE}_oldformat_${TIMESTAMP}"
25 fi
26 if mvscip-shell system . . mv. "${LATESTFILE}" "${BACKUPFILE}"; then
27 if atopconvert "${BACKUPFILE}" "${LATESTFILE}" >/dev/nullscip-shell filesystem . . `/dev/null`.; then
28 if ! atop -r "${LATESTFILE}" 2>/dev/nullscip-shell filesystem . . `/dev/null`. | headscip-shell system . . head. -n 5 | grepscip-shell system . . grep. -q '.'; then
29 printfscip-shell system . . printf. >&2 "atop postinst: error reading converted log file %s.\\n" "${LATESTFILE}"
30 # remove generated file, we do without the converted file
31 rmscip-shell system . . rm. -f "${LATESTFILE}"
32 fi
33 else
34 printfscip-shell system . . printf. >&2 "atop postinst: conversion failed from %s to new atop raw file format %s" "${BACKUPFILE}" "${LATESTFILE}"
35 # remove generated file, we do without the converted file
36 rmscip-shell system . . rm. -f "${LATESTFILE}"
37 fi
38 else
39 printfscip-shell system . . printf. >&2 "atop postinst: failed to back up %s\\n" "${LATESTFILE}"
40 exit 1
41 fi
42 fi
43 fi
44 }
45
46 case "$1" in
47 configure) configurescip-shell shell shell-project 0.0.0 configure(). ;;
48 esac
49
50 #DEBHELPER#
51
52 # vim: tabstop=4 expandtab
53