diff --git a/quickstart/Makefile b/quickstart/Makefile new file mode 100644 index 00000000..e40fae98 --- /dev/null +++ b/quickstart/Makefile @@ -0,0 +1,74 @@ +# +# Copyright (C) 2015-2016 OpenWrt.org +# Copyright (C) 2020 jjm2473@gmail.com +# +# This is free software, licensed under the GNU General Public License v3. +# + +include $(TOPDIR)/rules.mk + +PKG_ARCH_quickstart:=$(ARCH) + +PKG_NAME:=quickstart +PKG_VERSION:=0.9.7 +PKG_RELEASE:=1 +PKG_SOURCE:=$(PKG_NAME)-binary-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/linkease/istore-packages/releases/download/prebuilt/ +PKG_HASH:=6c1d0b0fb13ad75ce2dad2d86b4a51ce925aa4c14551e95eecc4c65a08d57dbf + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-binary-$(PKG_VERSION) + +PKG_BUILD_PARALLEL:=1 +PKG_USE_MIPS16:=0 + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME) + SECTION:=net + CATEGORY:=Network + SUBMENU:=Web Servers/Proxies + TITLE:=Quickstart, the quick start. + DEPENDS:=@(x86_64||aarch64||arm) +shadow-utils +shadow-useradd +mount-utils +block-mount +lsblk +e2fsprogs +parted +smartmontools +smartd +mdadm +ip-full +ubus +uci +bash + URL:=https://easepi.linkease.com/ +endef + +define Package/$(PKG_NAME)/description + Quickstart is a dashboard & user guide +endef + +define Package/$(PKG_NAME)/conffiles +/etc/config/quickstart +endef + +define Package/$(PKG_NAME)/postinst +#!/bin/sh +if [ -z "$${IPKG_INSTROOT}" ]; then + if [ -f /etc/uci-defaults/09-quickstart ]; then + chmod 755 /etc/uci-defaults/09-quickstart + /etc/uci-defaults/09-quickstart && rm -f /etc/uci-defaults/09-quickstart + fi + exit 0 +fi +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/uci-defaults $(1)/etc/hotplug.d/block $(1)/etc/config $(1)/usr/libexec/quickstart + $(INSTALL_BIN) $(PKG_BUILD_DIR)/quickstart.$(PKG_ARCH_quickstart) $(1)/usr/sbin/quickstart + $(INSTALL_BIN) ./files/quickstart.init $(1)/etc/init.d/quickstart + $(INSTALL_BIN) ./files/quickstart.uci-default $(1)/etc/uci-defaults/09-quickstart + $(INSTALL_BIN) ./files/quickstart.hotplug $(1)/etc/hotplug.d/block/09-quickstart + $(INSTALL_CONF) ./files/quickstart.config $(1)/etc/config/quickstart + $(INSTALL_BIN) ./files/dhcpvalid.sh $(1)/usr/libexec/quickstart/dhcpvalid.sh + $(INSTALL_BIN) ./files/startdhns.init $(1)/etc/init.d/startdhns + $(LN) /usr/sbin/quickstart $(1)/usr/sbin/startdhns + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_BIN) ./files/startdhns.hotplug $(1)/etc/hotplug.d/iface/21-startdhns +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/quickstart/files/dhcpvalid.sh b/quickstart/files/dhcpvalid.sh new file mode 100755 index 00000000..d262aab7 --- /dev/null +++ b/quickstart/files/dhcpvalid.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +/usr/sbin/quickstart dhcpValid + diff --git a/quickstart/files/quickstart.config b/quickstart/files/quickstart.config new file mode 100644 index 00000000..0156c3c0 --- /dev/null +++ b/quickstart/files/quickstart.config @@ -0,0 +1 @@ +config quickstart 'main' diff --git a/quickstart/files/quickstart.hotplug b/quickstart/files/quickstart.hotplug new file mode 100644 index 00000000..c10363a8 --- /dev/null +++ b/quickstart/files/quickstart.hotplug @@ -0,0 +1,3 @@ +if [ "$ACTION" = "add" -o "$ACTION" = "remove" ]; then + quickstart blockChange +fi \ No newline at end of file diff --git a/quickstart/files/quickstart.init b/quickstart/files/quickstart.init new file mode 100755 index 00000000..e13c3a96 --- /dev/null +++ b/quickstart/files/quickstart.init @@ -0,0 +1,13 @@ +#!/bin/sh /etc/rc.common + +START=92 +USE_PROCD=1 + + +start_service() { + procd_open_instance + procd_set_param command /usr/sbin/quickstart serve --unix /var/run/quickstart/local.sock + procd_set_param stderr 1 + procd_set_param respawn + procd_close_instance +} diff --git a/quickstart/files/quickstart.uci-default b/quickstart/files/quickstart.uci-default new file mode 100644 index 00000000..7f5e2aeb --- /dev/null +++ b/quickstart/files/quickstart.uci-default @@ -0,0 +1,10 @@ +#!/bin/sh + +if [ "$PKG_UPGRADE" = 1 ]; then + /etc/init.d/quickstart enable + /etc/init.d/quickstart start + /etc/init.d/startdhns enable + /etc/init.d/startdhns boot +fi + +exit 0 diff --git a/quickstart/files/startdhns.hotplug b/quickstart/files/startdhns.hotplug new file mode 100644 index 00000000..bee2fb84 --- /dev/null +++ b/quickstart/files/startdhns.hotplug @@ -0,0 +1,9 @@ +[ "$INTERFACE" = "planb" -o "$INTERFACE" = "wan" ] || exit 0 + +if [ "$ACTION" = "ifup" -o "$ACTION" = "ifupdate" ]; then + /usr/sbin/quickstart ifaceEvent up "$INTERFACE" +fi + +if [ "$ACTION" = "ifdown" ]; then + /usr/sbin/quickstart ifaceEvent down "$INTERFACE" +fi diff --git a/quickstart/files/startdhns.init b/quickstart/files/startdhns.init new file mode 100755 index 00000000..8ba5dd60 --- /dev/null +++ b/quickstart/files/startdhns.init @@ -0,0 +1,13 @@ +#!/bin/sh /etc/rc.common + +START=93 +USE_PROCD=1 + +start_service() { + /usr/sbin/quickstart uciChange +} + +service_triggers() +{ + procd_add_reload_trigger network +}