diff --git a/.gitignore b/.gitignore index bc6ebed73..cef4d7aab 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ __pycache__/ *.py[cod] dots/.config/quickshell/ii/.qmlls.ini .update-lock +/os-release diff --git a/sdata/subcmd-install/1.deps-selector.sh b/sdata/subcmd-install/1.deps-selector.sh index 27661925e..dec23c463 100644 --- a/sdata/subcmd-install/1.deps-selector.sh +++ b/sdata/subcmd-install/1.deps-selector.sh @@ -65,9 +65,15 @@ esac # Helpful link(s): # http://stackoverflow.com/questions/29581754 # https://github.com/which-distro/os-release -export OS_RELEASE_FILE=${OS_RELEASE_FILE:-/etc/os-release} -test -f ${OS_RELEASE_FILE} || \ - ( echo "${OS_RELEASE_FILE} does not exist. Aborting..." ; exit 1 ; ) +OS_RELEASE_FILE_CUSTOM="${REPO_ROOT}/os-release" +if test -f "${OS_RELEASE_FILE_CUSTOM}"; then + printf "${STY_YELLOW}Warning: using custom os-release file \"${OS_RELEASE_FILE_CUSTOM}\".${STY_RST}\n" + OS_RELEASE_FILE="${OS_RELEASE_FILE_CUSTOM}" +elif test -f /etc/os-release; then + OS_RELEASE_FILE=/etc/os-release +else + printf "${STY_RED}/etc/os-release does not exist, aborting...${STY_RST}\n" ; exit 1 +fi export OS_DISTRO_ID=$(awk -F'=' '/^ID=/ { gsub("\"","",$2); print tolower($2) }' ${OS_RELEASE_FILE} 2> /dev/null) export OS_DISTRO_ID_LIKE=$(awk -F'=' '/^ID_LIKE=/ { gsub("\"","",$2); print tolower($2) }' ${OS_RELEASE_FILE} 2> /dev/null)