Hi,
I think this should work for you.
#!/bin/sh
pkg="openvpn"
deps=""
for dep in $(apk info -R $pkg | grep -v depends\ on); do
if [ "${dep#*/}" != "$dep" ]; then
dep_full="$(apk info -W "$dep" | awk '{print $5}')"
deps="${dep_full%%-*} $deps"
elif [ "${dep#*so:}" != "$dep" ]; then
dep_full="$(apk info -W $(find / -name "${dep#*so:}") | awk '{print $5}')"
deps="${dep_full%%-*} $deps"
else
deps="$dep $deps"
fi
done
echo $deps
Cheers,
On 3/2/19 6:34 PM, John Miner wrote:
> Is there a way to use "apk info" to retrieve a listing of the package
> names on which a specific package depends, (i.e., the package names that
> can be used in an "apk add" rather than just the module names)?
>
> For example, when I use --depends, it provides a list of some packages
> and some modules, not all of which can be used in "apk add":
>
> apk info --repository /tmp/alpine/apks/ --arch armhf --depends openvpn
> openvpn-2.4.6-r4 depends on:
> iproute2
> /bin/sh
> so:libc.musl-x86_64.so.1
> so:libcrypto.so.1.1
> so:liblzo2.so.2
> so:libssl.so.1.1
>
> Is there a way to use apk to get the actual package names of the
> dependencies (similar to the list that appears under "Depends"
> on pkgs.alpinelinux.org)? For example, for the above, I would want:
>
> https://pkgs.alpinelinux.org/package/edge/main/armhf/openvpn
> Depends:
> busybox
> iproute2
> libcrypto1.1
> libssl1.1
> lzo
> musl
> --- Unsubscribe: alpine-user+unsubscribe@lists.alpinelinux.org Help:
> alpine-user+help@lists.alpinelinux.org ---
---
Unsubscribe: alpine-user+unsubscribe@lists.alpinelinux.org
Help: alpine-user+help@lists.alpinelinux.org
---