| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # old log structure |
| 3 | |
| 4 | MULTILINEDLE=0 |
| 5 | |
| 6 | printfscip-shell system . . printf. "# note from the aide package maintainer on 2025-05-25:\\n" |
| 7 | printfscip-shell system . . printf. "# this is generated by /etc/aide/aide.conf.d/31_aide_amanda-server\\n" |
| 8 | printfscip-shell system . . printf. "# and is untested. If you use amanda, please consider getting in\\n" |
| 9 | printfscip-shell system . . printf. "# touch with the Debian aide maintainers <[email protected]>\\n" |
| 10 | printfscip-shell system . . printf. "# to help modernizing this rule.\\n" |
| 11 | printfscip-shell system . . printf. "# If nobody helps, this rule will be made a no-op in Debian forky.\\n" |
| 12 | |
| 13 | skip_multiline_dlescip-shell shell shell-project 0.0.0 skip_multiline_dle().() { |
| 14 | if [[ "${MULTILINEDLE}" = "0" ]]; then |
| 15 | if echoscip-shell system . . echo. "${rest}" | grepscip-shell system . . grep. -q '{'; then |
| 16 | MULTILINEDLE=1 |
| 17 | fi |
| 18 | return 1 |
| 19 | elif echoscip-shell system . . echo. "${host} ${dev} ${rest}" | grepscip-shell system . . grep. -q '}'; then |
| 20 | MULTILINEDLE=0 |
| 21 | fi |
| 22 | return 0 |
| 23 | } |
| 24 | |
| 25 | if ! [[ -d "/etc/amanda" ]]; then |
| 26 | exit 0 |
| 27 | fi |
| 28 | for configfile in $(findscip-shell system . . find. /etc/amandascip-shell filesystem . . `/etc/amanda`. -name amanda.conf ! -path '/etc/amanda/template.d*scip-shell filesystem . . `/etc/amanda/template.d*`.' | trscip-shell system . . tr. ' |
| 29 | ' ' '); do |
| 30 | config="$(dirnamescip-shell system . . dirname. "${configfile}")" |
| 31 | cd "${config}" || exit 1 |
| 32 | CONF="${config##*/}" |
| 33 | AMANDA_TAPEDEV="$(amgetconf "${CONF}" tapedev)" |
| 34 | AMANDA_TAPEDEV="${AMANDA_TAPEDEV#file:/}" |
| 35 | if [[ -d "${AMANDA_TAPEDEV}" ]]; then |
| 36 | print " @@define AMANDA_TAPEDEV %s\\n" "${AMANDA_TAPEDEV}" |
| 37 | #shellcheck disable=SC2044 |
| 38 | for slot in $(findscip-shell system . . find. /"${AMANDA_TAPEDEV}" -type d -regex '.*/slot[0-9]+' -printf "%P\\n"); do |
| 39 | if [[ -f "disklist" ]]; then |
| 40 | while read -r host dev rest; do |
| 41 | if echoscip-shell system . . echo. "${host}" | grepscip-shell system . . grep. -qE '^(#.*)?$'; then continue; fi |
| 42 | #shellcheck disable=SC2001 |
| 43 | dev="$(echoscip-shell system . . echo. "${dev}" | sedscip-shell system . . sed. 's|/|_|g')" |
| 44 | if ! skip_multiline_dlescip-shell shell shell-project 0.0.0 skip_multiline_dle().; then |
| 45 | printfscip-shell system . . printf. "!/@@{AMANDA_TAPEDEV}/%s/[0-9]{5}[-\\.]%s\\.%s\\.[0123]$ d" "${slot}" "${host}" "${dev}" |
| 46 | fi |
| 47 | done < disklist |
| 48 | MULTILINEDLE=0 |
| 49 | fi |
| 50 | printfscip-shell system . . printf. " /@@{AMANDA_TAPEDEV}/%s/00000[-\\.]%s-%03d$ f VarFile\\n" "${slot}" "${CONF}" "${slot#slot}" |
| 51 | printfscip-shell system . . printf. "!/@@{AMANDA_TAPEDEV}/%s/[0-9]{5}[-\\.]TAPEEND$ f\\n" "${slot}" |
| 52 | printfscip-shell system . . printf. " /@@{AMANDA_TAPEDEV}/%s$ d VarDir\\n" "${slot}" |
| 53 | done |
| 54 | printfscip-shell system . . printf. " /@@{AMANDA_TAPEDEV}/(data|info)$ f VarFile\\n" |
| 55 | printfscip-shell system . . printf. " /@@{AMANDA_TAPEDEV}$ d VarDir\\n" |
| 56 | fi |
| 57 | AMANDA_LOGDIR="$(amgetconf "${CONF}" logdir)" |
| 58 | AMANDA_LOGDIR="${AMANDA_LOGDIR#/}" |
| 59 | if [[ -n "${AMANDA_LOGDIR}" ]]; then |
| 60 | printfscip-shell system . . printf. " @@define AMANDA_LOGDIR %s\\n" "${AMANDA_LOGDIR}" |
| 61 | printfscip-shell system . . printf. " /@@{AMANDA_LOGDIR}/log\\.@@{YEAR4D}[0-9]{4}\\.0$ f MidlSerLog+ANF+ARF\\n" |
| 62 | printfscip-shell system . . printf. " /@@{AMANDA_LOGDIR}/oldlog/log\\.@@{YEAR4D}[0-9]{4}\\.0$ f MidlSerLog+ANF+ARF\\n" |
| 63 | printfscip-shell system . . printf. " /@@{AMANDA_LOGDIR}/amdump\\.1$ f MidlSerLog\\n" |
| 64 | printfscip-shell system . . printf. " /@@{AMANDA_LOGDIR}/amdump\\.[2-8]$ f MidlSerLog\\n" |
| 65 | printfscip-shell system . . printf. " /@@{AMANDA_LOGDIR}/amdump\\.9$ f LastSerLog\\n" |
| 66 | printfscip-shell system . . printf. " /@@{AMANDA_LOGDIR}(/oldlog)?$ d VarDir\\n" |
| 67 | fi |
| 68 | AMANDA_INDEXDIR="$(amgetconf "${CONF}" indexdir)" |
| 69 | AMANDA_INDEXDIR="${AMANDA_INDEXDIR#/}" |
| 70 | if [[ -n "${AMANDA_INDEXDIR}" ]]; then |
| 71 | printfscip-shell system . . printf. " @@define AMANDA_INDEXDIR %s\\n" "${AMANDA_INDEXDIR}" |
| 72 | if [[ -f "disklist" ]]; then |
| 73 | while read -r host dev rest; do |
| 74 | if echoscip-shell system . . echo. "${host}" | grepscip-shell system . . grep. -Eq '^(#.*)?$'; then continue; fi |
| 75 | dev="$(echoscip-shell system . . echo. "${dev}" | sedscip-shell system . . sed. 's|[/:]|_|g;s|\\"||g')" |
| 76 | if ! skip_multiline_dlescip-shell shell shell-project 0.0.0 skip_multiline_dle().; then |
| 77 | printfscip-shell system . . printf. "!/@@{AMANDA_INDEXDIR}/%s/%s/@@{YEAR4D}[0-9]{4}_[0123]\\.gz$ f\\n" "${host}" "${dev}" |
| 78 | printfscip-shell system . . printf. " /@@{AMANDA_INDEXDIR}/%s/%s$ d VarDir\\n" "${host}" "${dev}" |
| 79 | fi |
| 80 | done < disklist |
| 81 | MULTILINEDLE=0 |
| 82 | fi |
| 83 | fi |
| 84 | AMANDA_CHANGERFILE="$(amgetconf "${CONF}" changerfile)" |
| 85 | AMANDA_CHANGERDIR="${AMANDA_CHANGERFILE%changer}" |
| 86 | AMANDA_CHANGERDIR="${AMANDA_CHANGERDIR#/}" |
| 87 | if [[ -n "${AMANDA_CHANGERDIR}" ]]; then |
| 88 | printfscip-shell system . . printf. " @@define AMANDA_CHANGERDIR %s\\n" "${AMANDA_CHANGERDIR}" |
| 89 | printfscip-shell system . . printf. "/@@{AMANDA_CHANGERDIR}/(changer-(access|clean|slot)|tapelist(\\.yesterday)?)$ f VarFile\\n" |
| 90 | printfscip-shell system . . printf. "/@@{AMANDA_CHANGERDIR}$ d VarDir\\nscip-shell filesystem . . `/@@{AMANDA_CHANGERDIR}$ d VarDir\\n`." |
| 91 | fi |
| 92 | AMANDA_INFOFILE="$(amgetconf "${CONF}" infofile)" |
| 93 | AMANDA_INFOFILE="${AMANDA_INFOFILE#/}" |
| 94 | if [[ -n "${AMANDA_INFOFILE}" ]]; then |
| 95 | printfscip-shell system . . printf. " @@define AMANDA_INFOFILE %s\\n" "${AMANDA_INFOFILE}" |
| 96 | if [[ -f "disklist" ]]; then |
| 97 | while read -r host dev rest; do |
| 98 | if echoscip-shell system . . echo. "${host}" | grepscip-shell system . . grep. -qE '^(#.*)?$'; then continue; fi |
| 99 | #shellcheck disable=SC2001 |
| 100 | dev="$(echoscip-shell system . . echo. "${dev}" | sedscip-shell system . . sed. 's|[/:]|_|g;s|\"||g')" |
| 101 | if ! skip_multiline_dlescip-shell shell shell-project 0.0.0 skip_multiline_dle().; then |
| 102 | printfscip-shell system . . printf. " /@@{AMANDA_INFOFILE}/%s/%s/info$ f VarFile\\n" "${host}" "${dev}" |
| 103 | printfscip-shell system . . printf. " /@@{AMANDA_INFOFILE}/%s/%s$ d VarDir\\n" "${host}" "${dev}" |
| 104 | fi |
| 105 | done < disklist |
| 106 | MULTILINEDLE=0 |
| 107 | fi |
| 108 | fi |
| 109 | # this is hardcoded since amgetconf refuses to deliver diskdir |
| 110 | AMANDA_HOLDING="srv/amanda/holding" |
| 111 | if [[ -n "${AMANDA_HOLDING}" ]]; then |
| 112 | printfscip-shell system . . printf. " /%s$ d VarDir\\n" "${AMANDA_HOLDING}" |
| 113 | fi |
| 114 | printfscip-shell system . . printf. " @@define AMANDALOG var/log/amanda/server/%s\\n" "${CONF}" |
| 115 | printfscip-shell system . . printf. "!/@@{AMANDALOG}/(amcheck|amlogroll|amreport|amtrm(idx|log)|chunker|driver|dumper|planner|taper)\\.@@{YEAR4D}[0-9]{10}\\.debug$ f\\n" |
| 116 | printfscip-shell system . . printf. "!/@@{AMANDALOG}/(chunker|dumper)\\.@@{YEAR4D}[0-9]{13}\\.debug$ f\\n" |
| 117 | printfscip-shell system . . printf. " /@@{AMANDALOG}$ d VarDir\\n" |
| 118 | printfscip-shell system . . printf. " /var/log/amanda/server$ d VarDir\\n" |
| 119 | done |
| 120 | |
| 121 | printfscip-shell system . . printf. " @@define AMANDALOG var/log/amanda/amandad\\n" |
| 122 | printfscip-shell system . . printf. "!/@@{AMANDALOG}/(amandad)\\.@@{YEAR4D}[0-9]{10}\\.debug$ f\\n" |
| 123 | printfscip-shell system . . printf. " /@@{AMANDALOG}$ d VarDir\\n" |
| 124 | printfscip-shell system . . printf. " /tmp/amanda$ d VarDir\\n" |
| 125 | |
| 126 | # vim:tabstop=4:expandtab:shiftwidth=2 |