added rolling release support (or any distribution not providing a version)
This commit is contained in:
@@ -25,14 +25,20 @@ read_os_release()
|
|||||||
# Import the file in the environment
|
# Import the file in the environment
|
||||||
source /etc/os-release
|
source /etc/os-release
|
||||||
|
|
||||||
if [[ -z $ID || -z $VERSION_ID ]]; then
|
if [[ -z $ID ]]; then
|
||||||
prnt E "Your /etc/os-release file mises some vital information."
|
prnt E "Your /etc/os-release file mises some vital information."
|
||||||
die --force 8
|
die --force 8
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -z $VERSION_ID ]]; then
|
||||||
|
local maj=$(uname -r | cut -d'.' -f1)
|
||||||
|
local min=$(uname -r | cut -d'.' -f2)
|
||||||
|
VERSION_ID="$maj.$min"
|
||||||
|
unset maj min
|
||||||
|
fi
|
||||||
|
|
||||||
# Return values on standard stdout
|
# Return values on standard stdout
|
||||||
echo ${ID,,} ${VERSION_ID} ${VERSION_CODENAME,,}
|
echo ${ID,,} ${VERSION_ID} ${VERSION_CODENAME,,}
|
||||||
#prnt I "OS is: ${ID,,} ${VERSION_ID} ${VERSION_CODENAME,,}"
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export read_os_release
|
export read_os_release
|
||||||
@@ -54,3 +60,4 @@ get_os_version()
|
|||||||
export SYS_CODE=$3
|
export SYS_CODE=$3
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
export -f get_os_version
|
||||||
|
|||||||
Reference in New Issue
Block a user