spcd_os_grep
This commit is contained in:
parent
721ee6f6f2
commit
fce1d0b1a7
1 changed files with 9 additions and 9 deletions
18
spcd/main.sh
18
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|"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue