install_easy: support dnf packager

This commit is contained in:
bol-van 2025-01-23 14:34:54 +03:00
parent e0e935c2ae
commit 80a0b38295

View File

@ -617,11 +617,17 @@ write_config_var()
replace_var_def $1 "$M" "$ZAPRET_CONFIG" replace_var_def $1 "$M" "$ZAPRET_CONFIG"
} }
no_prereq_exit()
{
echo could not install prerequisites
exitp 6
}
check_prerequisites_linux() check_prerequisites_linux()
{ {
echo \* checking prerequisites echo \* checking prerequisites
local s cmd PKGS UTILS req="curl curl" local s cmd PKGS UTILS req="curl curl"
local APTGET DNF YUM PACMAN ZYPPER EOPKG APK
case "$FWTYPE" in case "$FWTYPE" in
iptables) iptables)
req="$req iptables iptables ip6tables iptables ipset ipset" req="$req iptables iptables ip6tables iptables ipset ipset"
@ -650,6 +656,7 @@ check_prerequisites_linux()
echo packages required : $PKGS echo packages required : $PKGS
APTGET=$(whichq apt-get) APTGET=$(whichq apt-get)
DNF=$(whichq dnf)
YUM=$(whichq yum) YUM=$(whichq yum)
PACMAN=$(whichq pacman) PACMAN=$(whichq pacman)
ZYPPER=$(whichq zypper) ZYPPER=$(whichq zypper)
@ -657,39 +664,23 @@ check_prerequisites_linux()
APK=$(whichq apk) APK=$(whichq apk)
if [ -x "$APTGET" ] ; then if [ -x "$APTGET" ] ; then
"$APTGET" update "$APTGET" update
"$APTGET" install -y --no-install-recommends $PKGS dnsutils || { "$APTGET" install -y --no-install-recommends $PKGS dnsutils || no_prereq_exit
echo could not install prerequisites elif [ -x "$DNF" ] ; then
exitp 6 "$DNF" -y install $PKGS || no_prereq_exit
}
elif [ -x "$YUM" ] ; then elif [ -x "$YUM" ] ; then
"$YUM" -y install $PKGS || { "$YUM" -y install $PKGS || no_prereq_exit
echo could not install prerequisites
exitp 6
}
elif [ -x "$PACMAN" ] ; then elif [ -x "$PACMAN" ] ; then
"$PACMAN" -Syy "$PACMAN" -Syy
"$PACMAN" --noconfirm -S $PKGS || { "$PACMAN" --noconfirm -S $PKGS || no_prereq_exit
echo could not install prerequisites
exitp 6
}
elif [ -x "$ZYPPER" ] ; then elif [ -x "$ZYPPER" ] ; then
"$ZYPPER" --non-interactive install $PKGS || { "$ZYPPER" --non-interactive install $PKGS || no_prereq_exit
echo could not install prerequisites
exitp 6
}
elif [ -x "$EOPKG" ] ; then elif [ -x "$EOPKG" ] ; then
"$EOPKG" -y install $PKGS || { "$EOPKG" -y install $PKGS || no_prereq_exit
echo could not install prerequisites
exitp 6
}
elif [ -x "$APK" ] ; then elif [ -x "$APK" ] ; then
"$APK" update "$APK" update
# for alpine # for alpine
[ "$FWTYPE" = iptables ] && [ -n "$($APK list ip6tables)" ] && PKGS="$PKGS ip6tables" [ "$FWTYPE" = iptables ] && [ -n "$($APK list ip6tables)" ] && PKGS="$PKGS ip6tables"
"$APK" add $PKGS || { "$APK" add $PKGS || no_prereq_exit
echo could not install prerequisites
exitp 6
}
else else
echo supported package manager not found echo supported package manager not found
echo you must manually install : $UTILS echo you must manually install : $UTILS