addet correct way to check for every case? hopefully..
This commit is contained in:
parent
4645dcf0a1
commit
2699bc533d
1 changed files with 18 additions and 4 deletions
|
@ -8,7 +8,9 @@ __getOS-Release__() {
|
||||||
# Load OS release information
|
# Load OS release information
|
||||||
[ -f /etc/os-release ] && . /etc/os-release || return 1
|
[ -f /etc/os-release ] && . /etc/os-release || return 1
|
||||||
|
|
||||||
case "$ID_LIKE" in
|
DISTRO="${ID}:${ID_LIKE}"
|
||||||
|
|
||||||
|
case "$DISTRO" in
|
||||||
*debian*)
|
*debian*)
|
||||||
if command_exists nala; then
|
if command_exists nala; then
|
||||||
alias search="nala search"
|
alias search="nala search"
|
||||||
|
@ -64,6 +66,18 @@ __getOS-Release__() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
case "$ID_LIKE" in
|
||||||
|
*)
|
||||||
|
echo 1
|
||||||
|
;;
|
||||||
|
2 | 3)
|
||||||
|
echo 2 or 3
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo default
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
echo "Unsupported distro: $ID"
|
echo "Unsupported distro: $ID"
|
||||||
return 1
|
return 1
|
||||||
;;
|
;;
|
||||||
|
@ -74,7 +88,7 @@ __getPackager__() {
|
||||||
local packager="apt pacman dnf zypper apk"
|
local packager="apt pacman dnf zypper apk"
|
||||||
for pkg in $packager; do
|
for pkg in $packager; do
|
||||||
if command_exists "$pkg"; then
|
if command_exists "$pkg"; then
|
||||||
export PACKAGER="$pkg"
|
export PACKAGER=$pkg
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -474,8 +488,8 @@ _coding_() {
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
# __getOS-Release__
|
__getOS-Release__
|
||||||
__getPackager__
|
# __getPackager__
|
||||||
_alias
|
_alias
|
||||||
_coding_
|
_coding_
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue