Simulating package installs with Alpine's `apk`

Posted on June 13, 2017

Today I discovered the -s flag in apk:

localhost:~# apk add -h | grep simulate
           [--print-arch] [-s|--simulate]
  -s, --simulate          Show what would be done

--simulate does as you would expect:

localhost:~# apk -s add zfs-vanilla
(1/4) Installing linux-firmware (20170330-r0)
(2/4) Installing linux-vanilla (4.9.30-r0)
(3/4) Installing spl-vanilla (4.9.30-r0)
(4/4) Installing zfs-vanilla (4.9.30-r0)
OK: 246 MiB in 87 packages
localhost:~# apk -s add zfs-hardened
(1/4) Installing linux-firmware (20170330-r0)
(2/4) Installing linux-hardened (4.9.30-r0)
(3/4) Installing spl-hardened (4.9.30-r0)
(4/4) Installing zfs-hardened (4.9.30-r0)
OK: 246 MiB in 87 packages

apk is a simple but powerful tool. It is very well engineered, and feels refreshing to use (after years of apt-get).