dermotbradley/create-alpine-disk-image

OS detection fails on Ubuntu 20.04 server

Closed this issue · 1 comments

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=//')

Thanks, I've added that fix.