fix: harden postrm guards to prevent fallthrough on empty arg and fix lock path

This commit is contained in:
Dushnilin
2026-09-09 07:40:59 +03:00
parent 8a56361bfd
commit 01dad3bab0
3 changed files with 17 additions and 9 deletions
+9 -5
View File
@@ -460,8 +460,10 @@ EOF
#!/bin/sh #!/bin/sh
[ -n "${IPKG_INSTROOT}" ] && exit 0 [ -n "${IPKG_INSTROOT}" ] && exit 0
[ "$1" = "upgrade" ] && exit 0 [ "$1" = "upgrade" ] && exit 0
[ "$1" != "remove" ] && [ "$1" != "purge" ] && [ -n "$1" ] && exit 0 if [ "$1" != "remove" ] && [ "$1" != "purge" ]; then
if [ -f /var/run/tachyon/component-actions/action.lock ] || [ -f /tmp/run/tachyon/component-actions/action.lock ]; then exit 0
fi
if [ -e /var/run/tachyon/component-action.lock ] || [ -e /tmp/run/tachyon/component-action.lock ] || [ -e /var/run/tachyon/component-actions/action.lock ] || [ -e /tmp/run/tachyon/component-actions/action.lock ]; then
exit 0 exit 0
fi fi
rm -f /www/cgi-bin/tachyon-agent /etc/hotplug.d/iface/99-tachyon-wan-monitor 2>/dev/null || true rm -f /www/cgi-bin/tachyon-agent /etc/hotplug.d/iface/99-tachyon-wan-monitor 2>/dev/null || true
@@ -522,8 +524,10 @@ EOF
#!/bin/sh #!/bin/sh
[ -n "${IPKG_INSTROOT}" ] && exit 0 [ -n "${IPKG_INSTROOT}" ] && exit 0
[ "$1" = "upgrade" ] && exit 0 [ "$1" = "upgrade" ] && exit 0
[ "$1" != "remove" ] && [ "$1" != "purge" ] && [ -n "$1" ] && exit 0 if [ "$1" != "remove" ] && [ "$1" != "purge" ]; then
if [ -f /var/run/tachyon/component-actions/action.lock ] || [ -f /tmp/run/tachyon/component-actions/action.lock ]; then exit 0
fi
if [ -e /var/run/tachyon/component-action.lock ] || [ -e /tmp/run/tachyon/component-action.lock ] || [ -e /var/run/tachyon/component-actions/action.lock ] || [ -e /tmp/run/tachyon/component-actions/action.lock ]; then
exit 0 exit 0
fi fi
rm -f /var/luci-indexcache* /tmp/luci-indexcache* /tmp/luci-modulecache/* 2>/dev/null || true rm -f /var/luci-indexcache* /tmp/luci-indexcache* /tmp/luci-modulecache/* 2>/dev/null || true
@@ -804,7 +808,7 @@ EOF
#!/bin/sh #!/bin/sh
[ -n "${IPKG_INSTROOT}" ] && exit 0 [ -n "${IPKG_INSTROOT}" ] && exit 0
[ -f /usr/bin/tachyon ] && exit 0 [ -f /usr/bin/tachyon ] && exit 0
if [ -f /var/run/tachyon/component-actions/action.lock ] || [ -f /tmp/run/tachyon/component-actions/action.lock ]; then if [ -e /var/run/tachyon/component-action.lock ] || [ -e /tmp/run/tachyon/component-action.lock ] || [ -e /var/run/tachyon/component-actions/action.lock ] || [ -e /tmp/run/tachyon/component-actions/action.lock ]; then
exit 0 exit 0
fi fi
rm -f /www/cgi-bin/tachyon-agent /etc/hotplug.d/iface/99-tachyon-wan-monitor 2>/dev/null || true rm -f /www/cgi-bin/tachyon-agent /etc/hotplug.d/iface/99-tachyon-wan-monitor 2>/dev/null || true
+4 -2
View File
@@ -38,9 +38,11 @@ define Package/$(PKG_NAME)/postrm
[ -n "$${IPKG_INSTROOT}" ] && exit 0 [ -n "$${IPKG_INSTROOT}" ] && exit 0
[ "$$1" = "upgrade" ] && exit 0 [ "$$1" = "upgrade" ] && exit 0
[ "$$1" != "remove" ] && [ "$$1" != "purge" ] && [ -n "$$1" ] && exit 0 if [ "$$1" != "remove" ] && [ "$$1" != "purge" ]; then
exit 0
fi
if [ -f /var/run/tachyon/component-actions/action.lock ] || [ -f /tmp/run/tachyon/component-actions/action.lock ]; then if [ -e /var/run/tachyon/component-action.lock ] || [ -e /tmp/run/tachyon/component-action.lock ] || [ -e /var/run/tachyon/component-actions/action.lock ] || [ -e /tmp/run/tachyon/component-actions/action.lock ]; then
exit 0 exit 0
fi fi
+4 -2
View File
@@ -157,9 +157,11 @@ define Package/tachyon/postrm
[ -n "$${IPKG_INSTROOT}" ] && exit 0 [ -n "$${IPKG_INSTROOT}" ] && exit 0
[ "$$1" = "upgrade" ] && exit 0 [ "$$1" = "upgrade" ] && exit 0
[ "$$1" != "remove" ] && [ "$$1" != "purge" ] && [ -n "$$1" ] && exit 0 if [ "$$1" != "remove" ] && [ "$$1" != "purge" ]; then
exit 0
fi
if [ -f /var/run/tachyon/component-actions/action.lock ] || [ -f /tmp/run/tachyon/component-actions/action.lock ]; then if [ -e /var/run/tachyon/component-action.lock ] || [ -e /tmp/run/tachyon/component-action.lock ] || [ -e /var/run/tachyon/component-actions/action.lock ] || [ -e /tmp/run/tachyon/component-actions/action.lock ]; then
exit 0 exit 0
fi fi