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

OS detection fails on Ubuntu 20.04 server #14

Closed tomastzn closed 2 years ago

tomastzn commented 2 years ago

The function detect_host_os is not working because it returns multiple lines from file /etc/os-release. Below are first couple of lines from the file on Ubuntu 20.04 server:

NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.4 LTS"

With this content, the function will return two lines, ID= and ID_LIKE. However, by making the grep command look for ID= the function will return only one line:

  _os=$(grep "^ID=" /etc/os-release | sed -e 's/^ID=//')
dermotbradley commented 2 years ago

Thanks, I've added that fix.