From 50631579696f541e6818112095151b917f5f1441 Mon Sep 17 00:00:00 2001 From: Galen Guyer Date: Fri, 5 Aug 2022 09:26:24 -0400 Subject: Print intro and detect OS --- lib/os.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 lib/os.sh (limited to 'lib/os.sh') diff --git a/lib/os.sh b/lib/os.sh new file mode 100644 index 0000000..eff8e9c --- /dev/null +++ b/lib/os.sh @@ -0,0 +1,12 @@ +function os::kernel() { + uname -s | tr '[:upper:]' '[:lower:]' +} + +function os::distro() { + if [[ "$(os::kernel)" = "linux" ]] && [[ -f /etc/os-release ]]; then + source /etc/os-release + echo "$ID" | tr '[:upper:]' '[:lower:]' | sed 's/^arch$/archlinux/' + return + fi + echo "unknown" +} -- cgit v1.2.3