Files
NeoTachyon/tachyon/Makefile
T
Dushnilin 22a236e5d1 feat: commit-level version tracking for same-release updates
Backend:
- constants.uc: add TACHYON_COMMIT_SHA constant (placeholder __COMPILED_COMMIT_SHA__)
- build.sh: capture git rev-parse HEAD and sed-replace commit SHA placeholder
- Makefile: same commit SHA sed replacement for OpenWrt builds
- action.uc: modify check_tachyon() to compare installed commit SHA with
  target_commitish from GitHub release, new status 'outdated_same_release'
- action.uc: reuse release_json for both version and commit SHA extraction
- updater.uc: add release_commit_sha helper to extract target_commitish
- updates.uc: extend cacheable status to include outdated_same_release

Frontend:
- main.js: handle outdated_same_release status in renderComponentCard
- main.js: include outdated_same_release in shouldShowInstallAfterCheck
- main.js: include outdated_same_release in applyCachedCheckResults

i18n:
- Add 'Update is available for current release' and 'Update is available
  for current release:' to .pot and .ru.po files

78 tests pass.
2026-08-03 21:35:06 +03:00

113 lines
3.6 KiB
Makefile

include $(TOPDIR)/rules.mk
PKG_NAME:=tachyon
TACHYON_SOURCE_VERSION:=$(or $(TACHYON_PACKAGE_VERSION),$(TACHYON_VERSION))
TACHYON_HAS_RELEASE_VERSION:=$(if $(filter dev,$(TACHYON_SOURCE_VERSION)),,$(TACHYON_SOURCE_VERSION))
TACHYON_COMPILED_VERSION:=$(if $(TACHYON_HAS_RELEASE_VERSION),$(TACHYON_SOURCE_VERSION),$(or $(TACHYON_SOURCE_VERSION),dev))
TACHYON_RELEASE_VERSION_VALID:=$(if $(TACHYON_HAS_RELEASE_VERSION),$(shell printf '%s\n' '$(TACHYON_SOURCE_VERSION)' | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$$' && printf '1'),1)
ifeq ($(TACHYON_RELEASE_VERSION_VALID),)
$(error TACHYON_PACKAGE_VERSION and TACHYON_VERSION must use x.y.z format)
endif
PKG_VERSION:=$(or $(TACHYON_HAS_RELEASE_VERSION),0.0.0)
PKG_RELEASE:=
PKG_MAINTAINER:=Dushnilin <dushnilin@gmail.com>
PKG_LICENSE:=GPL-2.0-or-later
include $(INCLUDE_DIR)/package.mk
define Package/tachyon
SECTION:=net
CATEGORY:=Network
DEPENDS:=+ca-bundle +curl +ucode +ucode-mod-fs +ucode-mod-uci +coreutils-base64 +bind-dig +nftables +ip-full
CONFLICTS:=https-dns-proxy nextdns luci-app-passwall luci-app-passwall2
PROVIDES:=forkop
REPLACES:=forkop
TITLE:=Tachyon backend service
URL:=https://github.com/Dushnilin/tachyon
PKGARCH:=all
endef
define Package/tachyon/description
Rule-based Tachyon backend with hybrid sing-box + zapret orchestration
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/tachyon/prerm
#!/usr/bin/ucode
if (getenv("IPKG_INSTROOT") == null || getenv("IPKG_INSTROOT") == "")
system("/usr/bin/tachyon package_prerm >/dev/null 2>&1");
exit(0);
endef
define Package/tachyon/postinst
#!/bin/sh
[ -n "$${IPKG_INSTROOT}" ] && exit 0
# Clean up legacy forkop package files
rm -rf /usr/lib/lua/luci/i18n/forkop.* /www/luci-static/resources/i18n/forkop.* \
/usr/share/luci/menu.d/luci-app-forkop.json /usr/share/rpcd/acl.d/luci-app-forkop.json \
/etc/uci-defaults/50_luci-forkop 2>/dev/null || true
# Migration from Forkop
if [ -f /etc/config/forkop ]; then
mv /etc/config/forkop /etc/config/tachyon
elif [ -f /etc/config/forkop_plus ]; then
mv /etc/config/forkop_plus /etc/config/tachyon
# Migration from Podkop
elif [ -f /etc/config/podkop ]; then
mv /etc/config/podkop /etc/config/tachyon
TACHYON_LIB=/usr/lib/tachyon ucode -L /usr/lib/tachyon /usr/lib/tachyon/config/migration.uc migrate-podkop
exit 0
elif [ -f /etc/config/podkop_plus ]; then
mv /etc/config/podkop_plus /etc/config/tachyon
TACHYON_LIB=/usr/lib/tachyon ucode -L /usr/lib/tachyon /usr/lib/tachyon/config/migration.uc migrate-podkop
exit 0
fi
TACHYON_LIB=/usr/lib/tachyon ucode -L /usr/lib/tachyon /usr/lib/tachyon/config/migration.uc migrate
/usr/bin/tachyon package_postinst
# Harden config: telegram bot_token must not be world-readable
chmod 600 /etc/config/tachyon
chown root:root /etc/config/tachyon
endef
define Package/tachyon/conffiles
/etc/config/tachyon
endef
define Package/tachyon/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/etc/init.d/tachyon $(1)/etc/init.d/tachyon
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/etc/config/tachyon $(1)/etc/config/tachyon
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) ./files/usr/bin/tachyon $(1)/usr/bin/tachyon
$(INSTALL_DIR) $(1)/usr/lib/tachyon
$(CP) ./files/usr/lib/. $(1)/usr/lib/tachyon/
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
$(INSTALL_BIN) ./files/etc/hotplug.d/iface/99-tachyon-wan-monitor $(1)/etc/hotplug.d/iface/99-tachyon-wan-monitor
sed -i -e 's/__COMPILED_VERSION_VARIABLE__/$(TACHYON_COMPILED_VERSION)/g' \
-e 's/__COMPILED_COMMIT_SHA__/$(shell git -C $(TOPDIR)/../ rev-parse --short HEAD 2>/dev/null || echo unknown)/g' \
$(1)/usr/lib/tachyon/core/constants.uc
endef
$(eval $(call BuildPackage,tachyon))