diff --git a/zapret/Makefile b/zapret/Makefile index 584ff4f..e4012bf 100644 --- a/zapret/Makefile +++ b/zapret/Makefile @@ -37,7 +37,7 @@ define Package/$(PKG_NAME) DEPENDS:= +nftables +curl +gzip DEPENDS+= +coreutils +coreutils-sort +coreutils-sleep DEPENDS+= +kmod-nft-nat +kmod-nft-offload +kmod-nft-queue - DEPENDS+= +libnetfilter-queue +libcap +zlib + DEPENDS+= +libnetfilter-queue +libmnl +libcap +zlib endef define Build/Prepare @@ -180,7 +180,7 @@ if [ -z "$${IPKG_INSTROOT}" ]; then $${ZAPRET_INITD} running && $${ZAPRET_INITD} stop >/dev/null 2>&1 fi fi - if $${PKG_CHECK} zapret >/dev/null 2>&1; then + if $${PKG_CHECK} zapret 2>/dev/null | grep -q . ; then if [ ! -f "/opt/zapret/sync_config.sh" ]; then echo "Please uninstall incompatible \"zapret\" package!" exit 47 @@ -190,7 +190,7 @@ if [ -z "$${IPKG_INSTROOT}" ]; then exit 48 fi fi - if $${PKG_CHECK} luci-app-zapret >/dev/null 2>&1; then + if $${PKG_CHECK} luci-app-zapret 2>/dev/null | grep -q . ; then SVC_FILE=/www/luci-static/resources/view/zapret/service.js if [ ! -f "$${SVC_FILE}" ] || ! grep -Fq "/remittor/zapret-openwrt" "$${SVC_FILE}"; then echo "Please uninstall incompatible \"luci-app-zapret\" package!" @@ -206,10 +206,10 @@ if [ -z "$${IPKG_INSTROOT}" ]; then [ -d "$${ZAPRET_DIR}" ] && rm -rf $${ZAPRET_DIR} echo "All files of the previously installed package have been removed!" fi - if $${PKG_CHECK} zapret-mdig >/dev/null 2>&1; then + if $${PKG_CHECK} zapret-mdig 2>/dev/null | grep -q . ; then $${PKG_REMOVE} zapret-mdig fi - if $${PKG_CHECK} zapret-ip2net >/dev/null 2>&1; then + if $${PKG_CHECK} zapret-ip2net 2>/dev/null | grep -q . ; then $${PKG_REMOVE} zapret-ip2net fi if [ ! -d "$${ZAPRET_DIR}" ]; then diff --git a/zapret/update-pkg.sh b/zapret/update-pkg.sh index 45e107b..f45e207 100755 --- a/zapret/update-pkg.sh +++ b/zapret/update-pkg.sh @@ -89,6 +89,16 @@ fi # ------------------------------------------------------------------------------------------------------- +function check_pkg_installed +{ + local pkg_name="$1" + if [ "$PKG_MGR" = apk ]; then + apk info -e "$pkg_name" >/dev/null 2>&1; + else + opkg status "$pkg_name" 2>/dev/null | grep -q . + fi +} + function get_distrib_param { local parname=$1 @@ -475,7 +485,7 @@ if [ "$opt_update" != "" ]; then mkdir $ZAP_PKG_DIR ZAP_PKG_FN="$ZAP_PKG_DIR/${ZAP_PKG_URL##*/}" echo "Download ZIP-file..." - curl -s -L --max-time 15 -H "$CURL_HEADER2" "$ZAP_PKG_URL" -o "$ZAP_PKG_FN" + curl -s -L --max-time 35 -H "$CURL_HEADER2" "$ZAP_PKG_URL" -o "$ZAP_PKG_FN" if [ $? -ne 0 ]; then echo "ERROR: cannot download package!" return 215 @@ -529,11 +539,11 @@ if [ "$opt_update" != "" ]; then if [ "$opt_forced" = true ]; then pkg_mgr_update fi - if ${PKG_CHECK} ${ZAPRET_CFG_NAME}-mdig >/dev/null 2>&1; then + if check_pkg_installed ${ZAPRET_CFG_NAME}-mdig; then echo "Uninstall mdig..." ${PKG_REMOVE} ${ZAPRET_CFG_NAME}-mdig fi - if ${PKG_CHECK} ${ZAPRET_CFG_NAME}-ip2net >/dev/null 2>&1; then + if check_pkg_installed ${ZAPRET_CFG_NAME}-ip2net; then echo "Uninstall ip2net..." ${PKG_REMOVE} ${ZAPRET_CFG_NAME}-ip2net fi