dermotbradley / create-alpine-disk-image

Create cloud-init enabled Alpine disk images for physical machines (PCs & RPIs), VMs, and Cloud servers
GNU General Public License v2.0
93 stars 11 forks source link

Checking for required packages fails on Ubuntu 20.04 server #15

Closed tomastzn closed 2 years ago

tomastzn commented 2 years ago

Checking for required packages is returning text instead of a number and that fails the if command. Following change to grep and count number of "ok"s in the output makes the check working:

     _required_packages="coreutils dosfstools mount parted wget util-linux e2fsprogs"
      if [ "$(dpkg-query -W -f='${Status}\n' $_required_packages | grep -c 'ok' )" -ne 7 ]; then

Downside of this approach is that it hard-codes number of packages in the if condition. This issue exists in the generated script in two places, on line 73 and 131.