Skip to content

Commit

Permalink
add adbyby ram for 4M tiny rom
Browse files Browse the repository at this point in the history
  • Loading branch information
coolsnowwolf committed Jan 15, 2018
1 parent 09e34de commit 91217e1
Show file tree
Hide file tree
Showing 11 changed files with 5,763 additions and 6 deletions.
5,378 changes: 5,378 additions & 0 deletions 4m.config

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion config/Config-images.in
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ menu "Target Images"
int "Block size (in KiB)"
depends on TARGET_ROOTFS_SQUASHFS
default 64 if LOW_MEMORY_FOOTPRINT
default 256
default 1024

menuconfig TARGET_ROOTFS_UBIFS
bool "ubifs"
Expand Down
6 changes: 1 addition & 5 deletions include/target.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ __target_inc=1
DEVICE_TYPE?=router

# Default packages - the really basic set
DEFAULT_PACKAGES:=base-files libc libgcc busybox dropbear mtd uci opkg netifd fstools uclient-fetch logd ip-full \
iptables-mod-nat-extra kmod-nf-nathelper kmod-nf-nathelper-extra kmod-macvlan block-mount automount \
default-settings ipset-lists luci luci-app-ddns luci-app-sqm luci-app-upnp luci-app-adbyby-plus luci-app-autoreboot \
luci-app-filetransfer luci-app-shadowsocksr-pro luci-app-usb-printer luci-app-vsftpd ddns-scripts_aliyun luci-app-xlnetacc \
luci-app-pptp-server luci-app-ipsec-vpnd luci-app-vlmcsd luci-app-wifischedule luci-app-wol luci-app-sfe luci-app-nlbwmon
DEFAULT_PACKAGES:=base-files libc libgcc busybox dropbear mtd uci opkg netifd fstools uclient-fetch logd
# For nas targets
DEFAULT_PACKAGES.nas:=block-mount fdisk lsblk mdadm
# For router targets
Expand Down
105 changes: 105 additions & 0 deletions package/lean/adbyby-ram/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#
# Copyright (C) 2017 adbyby-ram
# Copyright (C) 2017 yushi studio <[email protected]>
#
# This is free software, licensed under the GNU General Public License v3.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=adbyby-ram
PKG_VERSION:=1.0


PKG_LICENSE:=GPLv3
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=yushi studio <[email protected]>



include $(INCLUDE_DIR)/package.mk

define Package/luci-app-adbyby-ram
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=3. Applications
TITLE:=adbyby-ram LuCI interface
URL:=https://github.com/ywb94/adbyby-ram
PKGARCH:=all
endef

define Package/luci-app-adbyby-ram/description
LuCI Support for adbyby-ram.
endef

define Build/Prepare
$(foreach po,$(wildcard ${CURDIR}/files/luci/i18n/*.po), \
po2lmo $(po) $(PKG_BUILD_DIR)/$(patsubst %.po,%.lmo,$(notdir $(po)));)
endef

define Build/Configure
endef

define Build/Compile
endef

define Package/luci-app-adbyby-ram/prerm
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
/etc/init.d/adbyby_ram disable
/etc/init.d/adbyby_ram stop
fi
exit 0
endef






define Package/luci-app-adbyby-ram/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
chmod 755 /etc/init.d/adbyby_ram >/dev/null 2>&1
/etc/init.d/adbyby_ram enable >/dev/null 2>&1
fi
exit 0
endef

ifeq ($(ARCH),mips)
define Package/luci-app-adbyby-ram/install
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller
$(INSTALL_DATA) ./files/luci/controller/adbyby.lua $(1)/usr/lib/lua/luci/controller/adbyby.lua
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
$(INSTALL_DATA) $(PKG_BUILD_DIR)/adbyby.*.lmo $(1)/usr/lib/lua/luci/i18n
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi
$(INSTALL_DATA) ./files/luci/model/cbi/*.lua $(1)/usr/lib/lua/luci/model/cbi/
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) ./files/adbyby_ar71xx.sh $(1)/usr/bin/adbyby.sh
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DATA) ./files/adbyby.config $(1)/etc/config/adbyby
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/adbyby.init $(1)/etc/init.d/adbyby_ram
endef
endif

ifeq ($(ARCH),mipsel)
define Package/luci-app-adbyby-ram/install
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller
$(INSTALL_DATA) ./files/luci/controller/adbyby.lua $(1)/usr/lib/lua/luci/controller/adbyby.lua
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
$(INSTALL_DATA) $(PKG_BUILD_DIR)/adbyby.*.lmo $(1)/usr/lib/lua/luci/i18n
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi
$(INSTALL_DATA) ./files/luci/model/cbi/*.lua $(1)/usr/lib/lua/luci/model/cbi/
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) ./files/adbyby_ramips.sh $(1)/usr/bin/adbyby.sh
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DATA) ./files/adbyby.config $(1)/etc/config/adbyby
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/adbyby.init $(1)/etc/init.d/adbyby_ram
endef
endif

$(eval $(call BuildPackage,luci-app-adbyby-ram))
3 changes: 3 additions & 0 deletions package/lean/adbyby-ram/files/adbyby.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

config adbyby 'adbyby'
option enable '0'
58 changes: 58 additions & 0 deletions package/lean/adbyby-ram/files/adbyby.init
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/sh /etc/rc.common

######################################################################
#
# Function : Run adbyby in RAM
#
# Creater : [email protected], 2017-02-16
#
# Copyright : yushi studio
#
######################################################################

START=80


start() {
/etc/init.d/adbyby_ram enabled
if [ $? == 1 ]; then
return
fi
#不重复启动
icount=`ps -w|grep adbyby.sh|grep -v grep|wc -l`
icount2=`netstat -nautp|grep adbyby|grep -v grep|wc -l`

if [ $icount = 0 -a $icount2 = 0 ] ;then
/usr/bin/adbyby.sh &
fi

}

stop() {
#确保清除防火墙规则
i=0
icount=`iptables -t nat -L|grep "ports 8118"|wc -l`
while [ $i -le 10 -a $icount -gt 1 ]
do
let i=i+1
iptables -t nat -D PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8118
icount=`iptables -t nat -L|grep "ports 8118"|wc -l`
done


if [ -f /tmp/adbyby/bin/stopadbb ] ;then
cd /tmp/adbyby/bin
./stopadbb 2>/dev/null
fi

icount=`ps -w|grep adbyby.sh|grep -v grep|wc -l`
if [ $icount -gt 0 ] ;then
mid=`ps -w|grep adbyby.sh|grep -v grep|awk '{print $1}'`
kill -9 $mid
fi
}

restart() {
stop
start
}
49 changes: 49 additions & 0 deletions package/lean/adbyby-ram/files/adbyby_ar71xx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/sh
cd /tmp
#等待网络连接成功
wget_ok="0"
#rm -f 7620n.tar.gz
rm -f ar71xx.tar.gz

while [ "$wget_ok" = "0" ]
do
#wget http://update.adbyby.com/download/7620n.tar.gz
wget http://update.adbyby.com/download/ar71xx.tar.gz
if [ "$?" == "0" ]; then
wget_ok="1"
else
sleep 30
fi
done
#解压、启动adbyby
mkdir -p adbyby
#tar -zvxf 7620n.tar.gz -C ./adbyby
tar -zvxf ar71xx.tar.gz -C ./adbyby

#更新一次规则
murl=`cat /tmp/adbyby/bin/update.info|grep lazy.txt|awk '{print $1}'`

if [ ${#murl} -gt 5 ] ;then
murl2=`cat /tmp/adbyby/bin/update.info|grep lazy.txt|awk '{print $2}'`
mfile="/tmp/adbyby/bin"${murl2//\\//}
wget $murl -O $mfile
fi

murl=`cat /tmp/adbyby/bin/update.info|grep video.txt|awk '{print $1}'`
if [ ${#murl} -gt 5 ] ;then
murl2=`cat /tmp/adbyby/bin/update.info|grep video.txt|awk '{print $2}'`
mfile="/tmp/adbyby/bin"${murl2//\\//}
wget $murl -O $mfile
fi

murl=`cat /tmp/adbyby/bin/update.info|grep user.action|awk '{print $1}'`
if [ ${#murl} -gt 5 ] ;then
murl2=`cat /tmp/adbyby/bin/update.info|grep user.action|awk '{print $2}'`
mfile="/tmp/adbyby/bin"${murl2//\\//}
wget $murl -O $mfile
fi


cd ./adbyby/bin
./startadbb

48 changes: 48 additions & 0 deletions package/lean/adbyby-ram/files/adbyby_ramips.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/sh
cd /tmp
#等待网络连接成功
wget_ok="0"
rm -f 7620n.tar.gz
#rm -f ar71xx.tar.gz

while [ "$wget_ok" = "0" ]
do
wget http://update.adbyby.com/download/7620n.tar.gz
#wget http://update.adbyby.com/download/ar71xx.tar.gz
if [ "$?" == "0" ]; then
wget_ok="1"
else
sleep 30
fi
done
#解压、启动adbyby
mkdir -p adbyby
tar -zvxf 7620n.tar.gz -C ./adbyby
#tar -zvxf ar71xx.tar.gz -C ./adbyby

#更新一次规则
murl=`cat /tmp/adbyby/bin/update.info|grep lazy.txt|awk '{print $1}'`

if [ ${#murl} -gt 5 ] ;then
murl2=`cat /tmp/adbyby/bin/update.info|grep lazy.txt|awk '{print $2}'`
mfile="/tmp/adbyby/bin"${murl2//\\//}
wget $murl -O $mfile
fi

murl=`cat /tmp/adbyby/bin/update.info|grep video.txt|awk '{print $1}'`
if [ ${#murl} -gt 5 ] ;then
murl2=`cat /tmp/adbyby/bin/update.info|grep video.txt|awk '{print $2}'`
mfile="/tmp/adbyby/bin"${murl2//\\//}
wget $murl -O $mfile
fi

murl=`cat /tmp/adbyby/bin/update.info|grep user.action|awk '{print $1}'`
if [ ${#murl} -gt 5 ] ;then
murl2=`cat /tmp/adbyby/bin/update.info|grep user.action|awk '{print $2}'`
mfile="/tmp/adbyby/bin"${murl2//\\//}
wget $murl -O $mfile
fi

cd ./adbyby/bin
./startadbb

10 changes: 10 additions & 0 deletions package/lean/adbyby-ram/files/luci/controller/adbyby.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

module("luci.controller.adbyby", package.seeall)

function index()
if not nixio.fs.access("/etc/config/adbyby") then
return
end

entry({"admin","services", "adbyby"}, cbi("adbyby"), _("Adbyby"), 20)
end
38 changes: 38 additions & 0 deletions package/lean/adbyby-ram/files/luci/i18n/adbyby.zh-cn.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8\n"

msgid "Not exist"
msgstr "不存在"

msgid "AD Block"
msgstr "广告屏蔽"

msgid "Disable"
msgstr "停用"

msgid "Enable"
msgstr "启用"

msgid "Running Status"
msgstr "运行状态"

msgid "Lazy rules time"
msgstr "Lazy规则日期"

msgid "Video rules time"
msgstr "Video规则日期"

msgid "Running"
msgstr "运行中"

msgid "Not Running"
msgstr "未运行"

msgid "Wait Connect.."
msgstr "等待联网"

msgid "Enable Adbyby"
msgstr "是否启用Adbyby"

msgid "Adbyby"
msgstr "广告屏蔽"
Loading

0 comments on commit 91217e1

Please sign in to comment.