Debian Codegraph @

debian/aide.conf.d/31_aide_apt

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 #shellcheck disable=SC2154
4 if [[ -x "${UPAC_settingsd}/10_aide_sourceslist" ]]; then
5 #shellcheck disable=SC1090
6 . "${UPAC_settingsd}/10_aide_sourceslist"
7 fi
8 VARDIR="var/lib/apt"
9 LISTSDIR="${VARDIR}/lists"
10 CACHEDIR="var/cache/apt"
11 ARCHIVESDIR="${CACHEDIR}/archives"
12 SYSTEMDDIR="var/lib/systemd/timers"
13 LOGDIR="var/log/apt"
14 IGNORE_ARCHIVES=""
15 IGNORE_FRQCHG=""
16
17 if [[ -r "${UPAC_settingsd}/31_aide_apt_settings" ]]; then
18 # pull in configuration
19 #shellcheck disable=SC1090
20 . "${UPAC_settingsd}/31_aide_apt_settings"
21 fi
22
23 if [[ -n "${DEBUG}" ]]; then
24 printfscip-shell system . . printf. "# debug output of 31_aide_apt\\n"
25 fi
26
27 # wait for /${LISTSDIR}/partial to be empty to reduce probabilty of finding
28 # something laying around there
29 COUNT=10
30 while [[ -n "$(ls -A "/${LISTSDIR}/partial" 2>/dev/null)" ]] && [[ "${COUNT}" -gt 0 ]]; do
31 COUNT=$(( COUNT-1 ))
32 sleepscip-shell system . . sleep. 10
33 done
34
35 printfscip-shell system . . printf. "@@if not defined APT_TRANSLATIONS\\n"
36 printfscip-shell system . . printf. "@@define APT_TRANSLATIONS (ca|cs|da|de|de_DE|en|eo|es|eu|fi|fr|hr|hu|id|it|ja|km|ko|nb|nl|pl|pt|pt_BR|ro|ru|sk|sr|sv|uk|vi|zh|zh_CN|zh_TW)\\n"
37 printfscip-shell system . . printf. "@@endif\\n"
38 printfscip-shell system . . printf. "@@if not defined APT_ARCH\\n"
39 printfscip-shell system . . printf. "@@define APT_ARCH (@@{ARCH}|all)\\n"
40 printfscip-shell system . . printf. "@@endif\\n"
41
42 # regular expression to parse apt source files
43 RE="^\\(deb\\|deb-src\\)[[:space:]]\\+\\(\\(\\[[^]]\\+\\]\\)[[:space:]]\\+\\)\\?\\([^[:space:]]\\+\\)[[:space:]]\\+\\([^[:space:]]\\+\\)[[:space:]]\\+\\(.*\\)$"
44 if [[ -n "${DEBUG}" ]]; then
45 printfscip-shell system . . printf. "# SOURCESLIST: %s\\n" "${SOURCESLIST}"
46 printfscip-shell system . . printf. "# RE: %s\\n" "${RE}"
47 fi
48
49
50 #shellcheck disable=SC2086
51 awkscip-shell system . . awk. 'FNR==1 && NR>1 {print ""} {print} END {print ""}' ${SOURCESLIST} /dev/nullscip-shell filesystem . . `/dev/null`. | sedscip-shell system . . sed. 's/ #.*$//' | while read -r line; do
52 if [[ -n "${DEBUG}" ]]; then
53 printfscip-shell system . . printf. "# read line: %s\n" "${line}"
54 fi
55 if [[ -n "${complete}" ]]; then
56 complete=""
57 deb=""
58 uri=""
59 dist=""
60 comp=""
61 fi
62 case "${line}" in
63 Types:*)
64 deb=$(echoscip-shell system . . echo. "${line}" | awkscip-shell system . . awk. '{print $2}')
65 [[ -n "${DEBUG}" ]] && printfscip-shell system . . printf. "# Types line: %s\\n" "${deb}"
66 ;;
67 URIs:*)
68 uri=$(echoscip-shell system . . echo. "${line}" | awkscip-shell system . . awk. '{print $2}')
69 [[ -n "${DEBUG}" ]] && printfscip-shell system . . printf. "# URIs line: %s\\n" "${uri}"
70 ;;
71 Suites:*)
72 dist=$(echoscip-shell system . . echo. "${line}" | awkscip-shell system . . awk. '{print $2}')
73 [[ -n "${DEBUG}" ]] && printfscip-shell system . . printf. "# Suites line: %s\\n" "${dist}"
74 ;;
75 Components:*)
76 comp=$(echoscip-shell system . . echo. "${line}" | cutscip-shell system . . cut. -d' ' -f2-)
77 [[ -n "${DEBUG}" ]] && printfscip-shell system . . printf. "# Components line: %s\\n" "${comp}"
78 ;;
79 "")
80 [[ -n "${DEBUG}" ]] && printfscip-shell system . . printf. "# empty line\\n"
81 if [[ -n "${deb}" ]] || [[ -n "${uri}" ]] || [[ -n "${dist}" ]] || [[ -n "${comp}" ]]; then
82 if [[ -z "${deb}" ]] || [[ -z "${uri}" ]] || [[ -z "${dist}" ]] || [[ -z "${comp}" ]]; then
83 [[ -n "${DEBUG}" ]] && printfscip-shell system . . printf. "# incomplete deb822 entry read\\n"
84 complete=""
85 else
86 complete=1
87 fi
88 fi
89 ;;
90 deb*)
91 set -- $(echoscip-shell system . . echo. "${line}" | sedscip-shell system . . sed. -n "s/${RE}/\1 \4 \5/p") "$(echoscip-shell system . . echo. "${line}" | sedscip-shell system . . sed. -n "s/${RE}/\6/p")"
92 deb="${1}"
93 uri="${2}"
94 dist="${3}"
95 comp="${4}"
96 [[ -n "${DEBUG}" ]] && printfscip-shell system . . printf. "# deb (old style) line: deb=%s uri=%s dist=%s comp=%s\\n" "${deb}" "${uri}" "${dist}" "${comp}"
97 complete="1"
98 ;;
99 esac
100 if [[ -n "${complete}" ]]; then
101 if [[ -n "${DEBUG}" ]]; then
102
103 printfscip-shell system . . printf. "# complete apt source entry read:\\n"
104 printfscip-shell system . . printf. "# deb: %s\\n" "${deb}"
105 printfscip-shell system . . printf. "# uri: %s\\n" "${uri}"
106 printfscip-shell system . . printf. "# dist: %s\\n" "${dist}"
107 printfscip-shell system . . printf. "# comp: %s\\n" "${comp}"
108 fi
109 #shellcheck disable=SC2001
110 PROTOCOL="$(echoscip-shell system . . echo. "${uri}" | sedscip-shell system . . sed. 's|\([^:]\+\).*|\1|')"
111 if echoscip-shell system . . echo. "${PROTOCOL}" | grepscip-shell system . . grep. -qE '(https?|ftp)'; then
112 HOST="$(echoscip-shell system . . echo. "${uri}" | sedscip-shell system . . sed. -e 's|.*//\([-_.[:alnum:]]\+\).*|\1|' -e 's|\.|\\\\.|g')"
113 HOSTPATH="$(echoscip-shell system . . echo. "${uri}" | sedscip-shell system . . sed. -e 's|.*//[^/[:space:]]\+/\?||;s|/$||;s|/|_|g;s|^\(.\+\)$|_\1|' -e 's|\.|\\\\.|g')"
114 dist="${dist//\//_}"
115 if [[ -n "${DEBUG}" ]]; then
116 printfscip-shell system . . printf. "# host %s\\n" "${HOST}"
117 printfscip-shell system . . printf. "# hostpath %s\\n" "${HOSTPATH}"
118 fi
119 if [[ "${deb}" = "deb" ]]; then
120 for c in ${comp}; do
121 printfscip-shell system . . printf. "/%s(/partial)?/%s%s_dists_%s_%s_binary-@@{APT_ARCH}_Packages(\\\\\\\\.diff_Index)?$ f VarFile\\n" "${LISTSDIR}" "${HOST}" "${HOSTPATH}" "${dist}" "${c}"
122 printfscip-shell system . . printf. "/%s(/partial)?/%s%s_dists_%s_%s_Contents-@@{APT_ARCH}((\\\\\\\\.diff_Index|\\\\\\\\.lz4))?$ f VarFile\\n" "${LISTSDIR}" "${HOST}" "${HOSTPATH}" "${dist}" "${c}"
123 printfscip-shell system . . printf. "/%s(/partial)?/%s%s_dists_%s_%s_dep11_Components-@@{APT_ARCH}((\\\\\\\\.yml\\\\\\\\.gz))?$ f VarFile\\n" "${LISTSDIR}" "${HOST}" "${HOSTPATH}" "${dist}" "${c}"
124 printfscip-shell system . . printf. "@@if defined FOREIGN_ARCHES\\n"
125 printfscip-shell system . . printf. "/%s/%s%s_dists_%s_%s_binary-@@{FOREIGN_ARCHES}_Packages(\\\\\\\\.diff_Index)?$ f VarFile\\n" "${LISTSDIR}" "${HOST}" "${HOSTPATH}" "${dist}" "${c}"
126 printfscip-shell system . . printf. "@@endif\\n"
127 printfscip-shell system . . printf. "/%s/%s%s_dists_%s_(InRelease|Release(\\\\\\\\.gpg)?)$ f VarFile-acl\\n" "${LISTSDIR}" "${HOST}" "${HOSTPATH}" "${dist}"
128 printfscip-shell system . . printf. "/%s/%s%s_dists_%s_%s_i18n_Translation-@@{APT_TRANSLATIONS}(\\\\\\\\.diff_Index)?$ f VarFile\\n" "${LISTSDIR}" "${HOST}" "${HOSTPATH}" "${dist}" "${c}"
129 done
130 printfscip-shell system . . printf. "!/%s/partial/%s%s_dists_%s_(InRelease|Release\\\\\\\\.gpg\\\\\\\\.reverify)$ f\\n" "${LISTSDIR}" "${HOST}" "${HOSTPATH}" "${dist}"
131 elif [[ "${deb}" = "deb-src" ]]; then
132 for c in ${comp}; do
133 printfscip-shell system . . printf. "/%s/%s%s_dists_%s_%s_source_Sources(\\\\\\\\.diff_Index)?$ f VarFile\\n" "${LISTSDIR}" "${HOST}" "${HOSTPATH}" "${dist}" "${c}"
134 printfscip-shell system . . printf. "/%s/%s%s_dists_%s_(InRelease|Release(\\\\\\\\.gpg)?)$ f VarFile-acl\\n" "${LISTSDIR}" "${HOST}" "${HOSTPATH}" "${dist}"
135 done
136 fi
137 else
138 : # other protocols are not supported. If you feel like they should
139 : # please give a good reason and probably a patch.
140 fi
141 printfscip-shell system . . printf. "\\n\\n"
142 fi
143 done
144
145 printfscip-shell system . . printf. "/%s(/(auxfiles|partial))?$ d VarDir\\n" "${LISTSDIR}"
146 printfscip-shell system . . printf. "/%s/lock$ f VarFile\\nscip-shell filesystem . . `/%s/lock$ f VarFile\\n`." "${LISTSDIR}"
147 printfscip-shell system . . printf. "/%s/periodic/(download-upgradeable|update)-stamp$ f VarTime\\nscip-shell filesystem . . `/%s/periodic/(download-upgradeable|update)-stamp$ f VarTime\\n`." "${VARDIR}"
148 printfscip-shell system . . printf. "/%s/(daily_lock|extended_states)$ f VarFile\\nscip-shell filesystem . . `/%s/(daily_lock|extended_states)$ f VarFile\\n`." "${VARDIR}"
149 printfscip-shell system . . printf. "/%s$ d VarDir\\nscip-shell filesystem . . `/%s$ d VarDir\\n`." "${VARDIR}"
150 printfscip-shell system . . printf. "\\n"
151 printfscip-shell system . . printf. "/%s/stamp-apt-daily(-upgrade)?\\\\\\\\.timer$ f VarFile\\n" "${SYSTEMDDIR}"
152 printfscip-shell system . . printf. "\\n"
153 printfscip-shell system . . printf. "/%s/(term|history)\\\\\\\\.log$ f ActLog\\nscip-shell filesystem . . `/%s/(term|history)\\\\\\\\.log$ f ActLog\\n`." "${LOGDIR}"
154 printfscip-shell system . . printf. "/%s/(term|history)\\\\\\\\.log\\\\\\\\.1\\\\\\\\.@@{LOGEXT}$ f CompSerLog+ANF\\nscip-shell filesystem . . `/%s/(term|history)\\\\\\\\.log\\\\\\\\.1\\\\\\\\.@@{LOGEXT}$ f CompSerLog+ANF\\n`." "${LOGDIR}"
155 printfscip-shell system . . printf. "/%s/(term|history)\\\\\\\\.log\\\\\\\\.([2-9]|1[0-1])\\\\\\\\.@@{LOGEXT}$ f MidlSerLog\\n" "${LOGDIR}"
156 printfscip-shell system . . printf. "/%s/(term|history)\\\\\\\\.log\\\\\\\\.12\\\\\\\\.@@{LOGEXT}$ f LastSerLog\\nscip-shell filesystem . . `/%s/(term|history)\\\\\\\\.log\\\\\\\\.12\\\\\\\\.@@{LOGEXT}$ f LastSerLog\\n`." "${LOGDIR}"
157 printfscip-shell system . . printf. "/%s/eipp\\\\\\\\.log\\\\\\\\.xz$ f VarFile\\nscip-shell filesystem . . `/%s/eipp\\\\\\\\.log\\\\\\\\.xz$ f VarFile\\n`." "${LOGDIR}"
158 printfscip-shell system . . printf. "/%s$ d VarDir\\nscip-shell filesystem . . `/%s$ d VarDir\\n`." "${LOGDIR}"
159 printfscip-shell system . . printf. "\\n"
160 printfscip-shell system . . printf. "/var/backups/apt\\\\\\\\.extended_states\\\\\\\\.0$ f ActLog\\nscip-shell filesystem . . `/var/backups/apt\\\\\\\\.extended_states\\\\\\\\.0$ f ActLog\\n`."
161 printfscip-shell system . . printf. "/var/backups/apt\\\\\\\\.extended_states\\\\\\\\.1\\\\\\\\.@@{LOGEXT}$ f CompSerLog+ANF\\nscip-shell filesystem . . `/var/backups/apt\\\\\\\\.extended_states\\\\\\\\.1\\\\\\\\.@@{LOGEXT}$ f CompSerLog+ANF\\n`."
162 printfscip-shell system . . printf. "/var/backups/apt\\\\\\\\.extended_states\\\\\\\\.[2345]\\\\\\\\.@@{LOGEXT}$ f MidlSerLog\\n"
163 printfscip-shell system . . printf. "/var/backups/apt\\\\\\\\.extended_states\\\\\\\\.6\\\\\\\\.@@{LOGEXT}$ f LastSerLog\\nscip-shell filesystem . . `/var/backups/apt\\\\\\\\.extended_states\\\\\\\\.6\\\\\\\\.@@{LOGEXT}$ f LastSerLog\\n`."
164
165 if [[ "${IGNORE_ARCHIVES}" = "yes" ]]; then
166 printfscip-shell system . . printf. "!/%s/[-[:alnum:]%%\.~_+]+_@@{APT_ARCH}\\\\\\\\.deb$ f\\n" "${ARCHIVESDIR}"
167 printfscip-shell system . . printf. "@@if defined FOREIGN_ARCHES\\n"
168 printfscip-shell system . . printf. "!/%s/[-[:alnum:]%%\.~_+]+_@@{FOREIGN_ARCHES}\\\\\\\\.deb$ f\\n" "${ARCHIVESDIR}"
169 printfscip-shell system . . printf. "@@endif\\n"
170 fi
171
172 if [[ "${IGNORE_FRQCHG}" = "yes" ]]; then
173 printfscip-shell system . . printf. "/%s(/partial|/lock)?$ d VarDir\\n" "${ARCHIVESDIR}"
174 printfscip-shell system . . printf. "!/%s/(src)?pkgcache\\\\\\\\.bin$ f\\n" "${CACHEDIR}"
175 printfscip-shell system . . printf. "/%s$ d VarDir\\nscip-shell filesystem . . `/%s$ d VarDir\\n`." "${CACHEDIR}"
176 fi
177
178 if [[ -n "${DEBUG}" ]]; then
179 printfscip-shell system . . printf. "# end of debug output of 31_aide_apt\\n"
180 fi
181
182 # vim: set shiftwidth=2 tabstop=2 softtabstop=2 expandtab: