Add check if alt firmware

This commit is contained in:
CodeRoK7
2025-07-14 22:48:47 +05:00
committed by GitHub
parent bc396bebab
commit 85663170f8

View File

@@ -120,24 +120,38 @@ manage_package() {
fi
}
checkPackageAndInstall()
{
checkPackageAndInstall() {
local name="$1"
local isRequried="$2"
#проверяем установлени ли библиотека $name
if opkg list-installed | grep -q $name; then
echo "$name already installed..."
else
echo "$name not installed. Installed $name..."
opkg install $name
res=$?
if [ "$isRequried" = "1" ]; then
if [ $res -eq 0 ]; then
echo "$name insalled successfully"
else
echo "Error installing $name. Please, install $name manually and run the script again"
exit 1
local isRequired="$2"
local alt=""
if [ "$name" = "https-dns-proxy" ]; then
alt="luci-app-doh-proxy"
fi
if [ -n "$alt" ]; then
if opkg list-installed | grep -qE "^($name|$alt) "; then
echo "$name or $alt already installed..."
return 0
fi
else
if opkg list-installed | grep -q "^$name "; then
echo "$name already installed..."
return 0
fi
fi
echo "$name not installed. Installing $name..."
opkg install "$name"
res=$?
if [ "$isRequired" = "1" ]; then
if [ $res -eq 0 ]; then
echo "$name installed successfully"
else
echo "Error installing $name. Please, install $name manually$( [ -n "$alt" ] && echo " or $alt") and run the script again."
exit 1
fi
fi
}