X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=src%2Fidentify-distros;h=88b31fc738405afd73138ca6f09041cb6d089ad1;hb=831dbe4e6c5929435d42ee6aed11f410e40c4fc0;hp=fa661721cfa3882dd9cd006e95688e334e7d1896;hpb=e94e0a22876c3f7327ecd7e5bfd89f63e3b7b39c;p=distro-functions diff --git a/src/identify-distros b/src/identify-distros index fa66172..88b31fc 100644 --- a/src/identify-distros +++ b/src/identify-distros @@ -53,15 +53,15 @@ distro-name-ver() { } distro-num() { - # Subshell keeps environment clean. - ( . /etc/os-release - # in ubuntu the .x matters, trisquel it doesnt - if [[ $ID == ubuntu ]]; then - echo $VERSION_ID - else - echo ${VERSION_ID%%.*} - fi - ) + local os_id ver_id + os_id=$(awk -F = '$1 == "ID" { print $2 }' /etc/os-release) + ver_id=$(awk -F = '$1 == "VERSION_ID" { print $2 }' /etc/os-release | sed 's/"//g') + # of VERSION_ID.x, the x matters in ubuntu but not trisquel + if [[ $os_id == ubuntu ]]; then + printf "%s\n" "$ver_id" + else + printf "%s\n" "$ver_id" | sed 's/\..*//' + fi } debian-archive() {