From 8afde976993c632d77ea60806be883a612320f88 Mon Sep 17 00:00:00 2001 From: SirPdboy <63764630+sirpdboy@users.noreply.github.com> Date: Mon, 28 Mar 2022 11:39:36 +0800 Subject: [PATCH] up ad --- adguardhome/Makefile | 75 ++++++++++++++++++++++++++++ adguardhome/files/adguardhome.config | 3 ++ adguardhome/files/adguardhome.init | 23 +++++++++ 3 files changed, 101 insertions(+) create mode 100644 adguardhome/Makefile create mode 100644 adguardhome/files/adguardhome.config create mode 100644 adguardhome/files/adguardhome.init diff --git a/adguardhome/Makefile b/adguardhome/Makefile new file mode 100644 index 0000000..9da39a4 --- /dev/null +++ b/adguardhome/Makefile @@ -0,0 +1,75 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=adguardhome +PKG_VERSION:=0.107.5 +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=v$(PKG_VERSION) +PKG_SOURCE_URL:=https://github.com/AdguardTeam/AdGuardHome +PKG_MIRROR_HASH:=5282d58b1a8d52f02af4ab7a5d6089aba6f7d20929bd49fd844c930110262dcb + +PKG_LICENSE:=GPL-3.0-only +PKG_LICENSE_FILES:=LICENSE.txt +PKG_MAINTAINER:=Dobroslaw Kijowski + +PKG_BUILD_DEPENDS:=golang/host node/host node-yarn/host +PKG_BUILD_PARALLEL:=1 +PKG_USE_MIPS16:=0 + +GO_PKG:=github.com/AdguardTeam/AdGuardHome +GO_PKG_BUILD_PKG:=github.com/AdguardTeam/AdGuardHome + +AGH_BUILD_TIME:=$(shell date -d @$(SOURCE_DATE_EPOCH) +%FT%TZ%z) +AGH_VERSION_PKG:=github.com/AdguardTeam/AdGuardHome/internal/version +GO_PKG_LDFLAGS_X:=$(AGH_VERSION_PKG).channel=release \ + $(AGH_VERSION_PKG).version=$(PKG_SOURCE_VERSION) \ + $(AGH_VERSION_PKG).buildtime=$(AGH_BUILD_TIME) \ + $(AGH_VERSION_PKG).goarm=$(GO_ARM) \ + $(AGH_VERSION_PKG).gomips=$(GO_MIPS) + +include $(INCLUDE_DIR)/package.mk +include ../../lang/golang/golang-package.mk + +define Package/adguardhome + SECTION:=net + CATEGORY:=Network + TITLE:=Network-wide ads and trackers blocking DNS server + URL:=https://github.com/AdguardTeam/AdGuardHome + DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle +endef + +define Package/adguardhome/conffiles +/etc/adguardhome.yaml +/etc/config/adguardhome +endef + +define Package/adguardhome/description +Free and open source, powerful network-wide ads and trackers blocking DNS server. +endef + +define Build/Compile + ( \ + pushd $(PKG_BUILD_DIR) ; \ + make js-deps js-build ; \ + popd ; \ + $(call GoPackage/Build/Compile) ; \ + ) +endef + +define Package/adguardhome/install + $(call GoPackage/Package/Install/Bin,$(1)) + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/adguardhome.init $(1)/etc/init.d/adguardhome + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/adguardhome.config $(1)/etc/config/adguardhome +endef + +$(eval $(call GoBinPackage,adguardhome)) +$(eval $(call BuildPackage,adguardhome)) diff --git a/adguardhome/files/adguardhome.config b/adguardhome/files/adguardhome.config new file mode 100644 index 0000000..9f49348 --- /dev/null +++ b/adguardhome/files/adguardhome.config @@ -0,0 +1,3 @@ +config adguardhome config + # Where to store persistent data by AdGuard Home + option workdir /var/adguardhome diff --git a/adguardhome/files/adguardhome.init b/adguardhome/files/adguardhome.init new file mode 100644 index 0000000..fbb45c5 --- /dev/null +++ b/adguardhome/files/adguardhome.init @@ -0,0 +1,23 @@ +#!/bin/sh /etc/rc.common + +PROG=/usr/bin/AdGuardHome + +USE_PROCD=1 + +# starts after network starts +START=21 +# stops before networking stops +STOP=89 + +start_service() { + config_load adguardhome + config_get WORK_DIR config workdir + + [ -d "$WORK_DIR" ] || mkdir -m 0755 -p "$WORK_DIR" + + procd_open_instance + procd_set_param command "$PROG" -c /etc/config/adguardhome.yaml -w "$WORK_DIR" --no-check-update + procd_set_param stdout 1 + procd_set_param stderr 1 + procd_close_instance +}