mirror of
https://github.com/routerich/RouterichAX3000_configs.git
synced 2025-12-06 11:36:43 +03:00
Add check if alt firmware
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user