Skip to content
Snippets Groups Projects
Commit af4cf20b authored by Filippo Giunchedi's avatar Filippo Giunchedi Committed by Ben Kochie
Browse files

apt.sh: handle multiple origins in apt-get output (#757)

It might happen that a given upgrade comes from multiple origins, in
which case the origins are separated by ", " and thus breaking
whitespace-based split. For example:

Inst package [1.2.3] (1.2.4 Debian:8.10/oldstable, Debian-Security:8/oldstable [amd64])

To workaround this case, mangle the apt-get output to remove whitespaces from
the origins list.
parent 1e9bb4ec
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -5,7 +5,9 @@
# Author: Ben Kochie <superq@gmail.com>
 
upgrades="$(/usr/bin/apt-get --just-print upgrade \
| /usr/bin/awk '/^Inst/ {print $5, $6}' \
| /usr/bin/awk -F'[()]' \
'/^Inst/ { sub("^[^ ]+ ", "", $2); sub("\\[", " ", $2);
sub(" ", "", $2); sub("\\]", "", $2); print $2 }'
| /usr/bin/sort \
| /usr/bin/uniq -c \
| awk '{ gsub(/\\\\/, "\\\\", $2); gsub(/\"/, "\\\"", $2);
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment