Download patterns with zypper
1 min readFeb 5, 2021
This days I had to play with SuSe Linux a while. Zypper is very cool package manager but of course it can’t do everything you want from it. So I hit the issue with downloading the whole software pattern. Following the logic of install and info options i tried
zypper download -t pattern Minimal
The idea was too good to be true. Let’s play with some bash scripting.
zypper info -t pattern
returns the list of packages and we need only required ones. So the first guess is
zypper info -t pattern Minimal | grep Required | awk -F '|' '{print $2}' | sed 's/ //g' | xargs zypper --pkg-cache-dir /tmp download
Unfortunately you can;t run more than one instance of zypper so the single line command turned into shell script:
for PKG in $(zypper info -t pattern $1 | grep Required | awk -F '|' '{print $2}' | sed 's/ //g'); do
zypper --pkg-cache-dir /tmp download $PKG
done