From fce1d0b1a75bb9ac7f4477c1f3bf278a5a24c577 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 25 Aug 2024 19:32:00 +0200 Subject: [PATCH] spcd_os_grep --- spcd/main.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/spcd/main.sh b/spcd/main.sh index 2834635..394b14c 100644 --- a/spcd/main.sh +++ b/spcd/main.sh @@ -161,7 +161,7 @@ ${SPCD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")" SPCD_PATH="$(realpath "${0}")" spcd_echo "SPCD_PATH" # set operating system id - SPCD_OS_ID="$(spcd_grep_os ID)" + SPCD_OS_ID="$(spcd_os_grep ID)" case "${SPCD_OS_ID}" in "almalinux") SPCD_OS_ID="${SPCD_OS_ALMA}" ;; "alpine") SPCD_OS_ID="${SPCD_OS_ALPINE}" ;; @@ -177,15 +177,15 @@ ${SPCD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")" case "${SPCD_OS_ID}" in "${SPCD_OS_ALMA}" | "${SPCD_OS_FEDORA}" | "${SPCD_OS_ROCKY}" | \ "${SPCD_OS_ARCH}") - SPCD_OS_VERSION=$(spcd_grep_os VERSION_ID | + SPCD_OS_VERSION=$(spcd_os_grep VERSION_ID | sed "s|^\([0-9]\+\)\..*|\1|") ;; "${SPCD_OS_ALPINE}" | "${SPCD_OS_OPENSUSE}") - SPCD_OS_VERSION=$(spcd_grep_os VERSION_ID | + SPCD_OS_VERSION=$(spcd_os_grep VERSION_ID | sed "s|^\([0-9]\+\.[0-9]\+\)\..*|\1|") ;; "${SPCD_OS_DEBIAN}" | "${SPCD_OS_UBUNTU}") - SPCD_OS_VERSION="$(spcd_grep_os VERSION_CODENAME)" + SPCD_OS_VERSION="$(spcd_os_grep VERSION_CODENAME)" ;; *) ;; esac @@ -914,11 +914,11 @@ spcd_git_url() { # │ functions │ os │ # ╰───────────┴────╯ -spcd_grep_os() { - spcd_grep_os__variable="${1}" - [ -n "${spcd_grep_os__variable}" ] && - grep "^${spcd_grep_os__variable}=" "/etc/os-release" | - sed "s|^${spcd_grep_os__variable}=||" | +spcd_os_grep() { + spcd_os_grep__variable="${1}" + [ -n "${spcd_os_grep__variable}" ] && + grep "^${spcd_os_grep__variable}=" "/etc/os-release" | + sed "s|^${spcd_os_grep__variable}=||" | sed "s|^\"\(.*\)\"$|\1|" }