router: others: one version for ARM and MIPS branch; clean-up

arm-sdk7
pedro 4 years ago
parent d8a1a93ed5
commit a5d2f0e132

@ -12,27 +12,32 @@ ifeq ($(TCONFIG_USB),y)
install -d $(INSTALLDIR)/usr/bin
ln -sf /opt/bin/perl $(INSTALLDIR)/usr/bin/perl
#3G modem switch script
# 3G modem switch script
install -m 0700 switch3g $(INSTALLDIR)/usr/sbin
#4G modem switch script
# 4G modem switch script
install -m 0700 switch4g $(INSTALLDIR)/usr/sbin
#modem status script
install -m 0700 wwansignal $(INSTALLDIR)/usr/sbin
ifneq ($(TCONFIG_BCMARM),y)
sed -i $(INSTALLDIR)/usr/sbin/switch4g -e "/BCMARM-BEGIN/,/BCMARM-END/d"
else
sed -i $(INSTALLDIR)/usr/sbin/switch4g -e "/BCMARMNO-BEGIN/,/BCMARMNO-END/d"
endif
# modem status script
install -m 0700 wwansignal $(INSTALLDIR)/usr/sbin
endif # TCONFIG_USB
ifeq ($(TCONFIG_NGINX),y)
#MySQL
# MySQL
install -D -m 755 mycheck $(INSTALLDIR)/usr/bin
endif
#MultiWAN watchdog script
# MultiWAN watchdog script
install -m 0700 watchdog $(INSTALLDIR)/usr/sbin
ifeq ($(TCONFIG_DNSCRYPT),y)
install -m 0700 ntp2ip $(INSTALLDIR)/usr/sbin
endif
#TomatoAnon project
# TomatoAnon project
install -m 0700 tomatoanon $(INSTALLDIR)/usr/sbin
ifneq ($(TCONFIG_STUBBY),y)
sed -i $(INSTALLDIR)/usr/sbin/tomatoanon -e "/STUBBY-BEGIN/,/STUBBY-END/d"
@ -40,7 +45,7 @@ else
sed -i $(INSTALLDIR)/usr/sbin/tomatoanon -e "/STUBBYNO-BEGIN/,/STUBBYNO-END/d"
endif
#Adblock
# Adblock
install -m 0700 adblock $(INSTALLDIR)/usr/sbin
ifneq ($(TCONFIG_STUBBY),y)
sed -i $(INSTALLDIR)/usr/sbin/adblock -e "/STUBBY-BEGIN/,/STUBBY-END/d"
@ -48,47 +53,80 @@ else
sed -i $(INSTALLDIR)/usr/sbin/adblock -e "/STUBBYNO-BEGIN/,/STUBBYNO-END/d"
endif
#TTB project
install -m 0700 ttb $(INSTALLDIR)/usr/sbin
# TTB project
ifeq ($(TCONFIG_USB),y)
install -m 0700 ttb $(INSTALLDIR)/usr/sbin/ttb
else
install -m 0700 ttb-simple $(INSTALLDIR)/usr/sbin/ttb
endif
ifneq ($(TCONFIG_STUBBY),y)
sed -i $(INSTALLDIR)/usr/sbin/ttb -e "/STUBBY-BEGIN/,/STUBBY-END/d"
else
sed -i $(INSTALLDIR)/usr/sbin/ttb -e "/STUBBYNO-BEGIN/,/STUBBYNO-END/d"
endif
#Ethernet state report
# Ethernet state report
install -m 0700 ethstate $(INSTALLDIR)/usr/sbin
ifneq ($(TCONFIG_BCMARM),y)
sed -i $(INSTALLDIR)/usr/sbin/ethstate -e "/BCMARM-BEGIN/,/BCMARM-END/d"
endif
# stealthMode
ifneq ($(TCONFIG_BCMARM),y)
ifneq ($(TCONFIG_OPTIMIZE_SIZE_MORE),y)
install -m 0700 stealthMode $(INSTALLDIR)/usr/sbin
endif
endif
#MOTD
# MOTD
install -m 0700 mymotd $(INSTALLDIR)/usr/sbin
ifneq ($(TCONFIG_BCMARM),y)
sed -i $(INSTALLDIR)/usr/sbin/mymotd -e "/BCMARM-BEGIN/,/BCMARM-END/d"
else
sed -i $(INSTALLDIR)/usr/sbin/mymotd -e "/BCMARMNO-BEGIN/,/BCMARMNO-END/d"
endif
#sysinfo-helper
# sysinfo-helper
ifeq ($(TCONFIG_BCMARM),y)
install -m 0700 sysinfo-helper $(INSTALLDIR)/usr/sbin
endif
#Link Aggregation
# Link Aggregation
ifeq ($(TCONFIG_BONDING),y)
install -m 0700 linkagg $(INSTALLDIR)/usr/sbin
endif
#Web Monitor Backup Script
# Web Monitor Backup Script
install -m 0700 webmon_bkp $(INSTALLDIR)/usr/sbin
#optware/entware install script
# optware/entware install script
ifeq ($(TCONFIG_USB),y)
ifneq ($(TCONFIG_BCMARM),y)
install -m 0700 optware-install.sh $(INSTALLDIR)/usr/sbin
ifneq ($(TCONFIG_BCMARM),y)
sed -i $(INSTALLDIR)/usr/sbin/optware-install.sh -e "/BCMARM-BEGIN/,/BCMARM-END/d"
else
sed -i $(INSTALLDIR)/usr/sbin/optware-install.sh -e "/BCMARMNO-BEGIN/,/BCMARMNO-END/d"
endif
ifneq ($(TCONFIG_STUBBY),y)
sed -i $(INSTALLDIR)/usr/sbin/optware-install.sh -e "/STUBBY-BEGIN/,/STUBBY-END/d"
else
sed -i $(INSTALLDIR)/usr/sbin/optware-install.sh -e "/STUBBYNO-BEGIN/,/STUBBYNO-END/d"
endif
endif
install -m 0700 entware-install.sh $(INSTALLDIR)/usr/sbin
ifeq ($(TCONFIG_BCMARM),y)
install -m 0700 entware-install-ARM.sh $(INSTALLDIR)/usr/sbin/entware-install.sh
else
install -m 0700 entware-install-MIPS.sh $(INSTALLDIR)/usr/sbin/entware-install.sh
endif
ifneq ($(TCONFIG_STUBBY),y)
sed -i $(INSTALLDIR)/usr/sbin/entware-install.sh -e "/STUBBY-BEGIN/,/STUBBY-END/d"
else
sed -i $(INSTALLDIR)/usr/sbin/entware-install.sh -e "/STUBBYNO-BEGIN/,/STUBBYNO-END/d"
endif
endif
endif # TCONFIG_USB
# ovpn up/down/etc scripts
ifeq ($(TCONFIG_OPENVPN),y)
install -m 0700 updown-client.sh $(INSTALLDIR)/usr/sbin
install -m 0700 vpnrouting.sh $(INSTALLDIR)/usr/sbin
@ -126,7 +164,7 @@ endif
# clean up
cd $(INSTALLDIR)/usr/sbin && \
for F in tomatoanon adblock ttb optware-install.sh entware-install.sh vpnrouting.sh; do \
for F in tomatoanon adblock ttb optware-install.sh entware-install.sh vpnrouting.sh ethstate mymotd switch4g; do \
[ -f $(INSTALLDIR)/usr/sbin/$$F ] && sed -i $$F \
-e "/STUBBY-BEGIN/d" -e "/STUBBY-END/d" \
-e "/STUBBYNO-BEGIN/d" -e "/STUBBYNO-END/d" \
@ -152,6 +190,6 @@ ifeq ($(or $(TCONFIG_BT),$(TCONFIG_NGINX)),y)
} || true; \
done
endif
endif
endif # TCONFIG_BCMARM
clean:

@ -11,22 +11,19 @@ WGET="/usr/bin/wget"
echo "Info: Checking for prerequisites and creating folders..."
if [ -d /opt ]
then
echo "Warning: Folder /opt exists!"
else
mkdir /opt
fi
[ -d /opt ] && {
echo "Warning: Folder /opt exists!"
} || {
mkdir /opt
}
# no need to create many folders. entware-opt package creates most
for folder in bin etc lib/opkg tmp var/lock
do
if [ -d "/opt/$folder" ]
then
echo "Warning: Folder /opt/$folder exists!"
echo "Warning: If something goes wrong please clean /opt folder and try again."
else
mkdir -p /opt/$folder
fi
for folder in bin etc lib/opkg tmp var/lock; do
[ -d "/opt/$folder" ] && {
echo "Warning: Folder /opt/$folder exists!"
echo "Warning: If something goes wrong please clean /opt folder and try again."
} || {
mkdir -p /opt/$folder
}
done
echo "Info: Opkg package manager deployment..."
@ -53,41 +50,27 @@ echo "Info: Basic packages installation..."
chmod 777 /opt/tmp
# now try create symlinks - it is a std installation
if [ -f /etc/passwd ]
then
ln -sf /etc/passwd /opt/etc/passwd
else
cp /opt/etc/passwd.1 /opt/etc/passwd
fi
[ -f /etc/passwd ] && {
ln -sf /etc/passwd /opt/etc/passwd
} || {
cp /opt/etc/passwd.1 /opt/etc/passwd
}
if [ -f /etc/group ]
then
ln -sf /etc/group /opt/etc/group
else
cp /opt/etc/group.1 /opt/etc/group
fi
[ -f /etc/group ] && {
ln -sf /etc/group /opt/etc/group
} || {
cp /opt/etc/group.1 /opt/etc/group
}
if [ -f /etc/shells ]
then
ln -sf /etc/shells /opt/etc/shells
else
cp /opt/etc/shells.1 /opt/etc/shells
fi
[ -f /etc/shells ] && {
ln -sf /etc/shells /opt/etc/shells
} || {
cp /opt/etc/shells.1 /opt/etc/shells
}
if [ -f /etc/shadow ]
then
ln -sf /etc/shadow /opt/etc/shadow
fi
if [ -f /etc/gshadow ]
then
ln -sf /etc/gshadow /opt/etc/gshadow
fi
if [ -f /etc/localtime ]
then
ln -sf /etc/localtime /opt/etc/localtime
fi
[ -f /etc/shadow ] && ln -sf /etc/shadow /opt/etc/shadow
[ -f /etc/gshadow ] && ln -sf /etc/gshadow /opt/etc/gshadow
[ -f /etc/localtime ] && ln -sf /etc/localtime /opt/etc/localtime
echo "Info: Congratulations!"
echo "Info: If there are no errors above then Entware was successfully initialized."

@ -0,0 +1,60 @@
#!/bin/sh
export PATH=/opt/sbin:/opt/bin:$PATH
unset LD_LIBRARY_PATH
unset LD_PRELOAD
# STUBBYNO-BEGIN
WGET="/usr/bin/wget --no-check-certificate"
# STUBBYNO-END
# STUBBY-BEGIN
WGET="/usr/bin/wget"
# STUBBY-END
URL=http://pkg.entware.net/binaries/mipsel/installer
echo "Info: Creating folders..."
for folder in bin etc/init.d lib/opkg sbin share tmp usr var/log var/lock var/run; do
[ -d "/opt/$folder" ] && {
echo "Warning: Folder /opt/$folder exists! If something goes wrong please clean /opt folder and try again."
} || {
mkdir -p /opt/$folder
}
done
dl () {
# $1 - URL to download
# $2 - place to store
# $3 - 'x' if should be executable
echo -n "Downloading $2... "
$WGET -q $1 -O $2
[ $? -eq 0 ] && {
echo "success!"
} || {
echo "failed!"
exit 1
}
[ -z "$3" ] || chmod +x $2
}
echo "Info: Deploying opkg package manager..."
dl $URL/opkg /opt/bin/opkg x
dl $URL/opkg.conf /opt/etc/opkg.conf
dl $URL/profile /opt/etc/profile x
dl $URL/rc.func /opt/etc/init.d/rc.func
dl $URL/rc.unslung /opt/etc/init.d/rc.unslung x
echo "Info: Basic packages installation..."
opkg update
opkg install ldconfig findutils
ldconfig > /dev/null 2>&1
[ -f /etc/TZ ] && ln -sf /etc/TZ /opt/etc/TZ
cat << EOF
Congratulations! If there are no errors above then Entware-ng is successfully initialized.
Found a Bug? Please report at https://github.com/Entware-ng/Entware-ng/issues
Type 'opkg install <pkg_name>' to install necessary package.
EOF

@ -20,6 +20,7 @@ SWAN=$(cat /tmp/ethernet.state.tmp | grep "Port $VPORT" | awk '{print $3}')
echo "Port 0: $SWAN" > /tmp/ethernet.state
sed -n -e "/Port $VPORT:/!p" /tmp/ethernet.state.tmp > /tmp/ethernet.state1
# BCMARM-BEGIN
ROUTERNAME=$(nvram get t_fix1)
#Xiaomi MiWiFi X-R1D (only 3 Ports; Port 0,2 for LAN and Port 4 for WAN)
[ "$ROUTERNAME" == "MiWiFi" ] && {
@ -30,6 +31,7 @@ ROUTERNAME=$(nvram get t_fix1)
[ "$ROUTERNAME" == "AC15" ] && {
sed -i '/Port 1/d' /tmp/ethernet.state1
}
# BCMARM-END
sed -i '/Port 5/d' /tmp/ethernet.state1
sed -i '/Port 7/d' /tmp/ethernet.state1

@ -3,44 +3,40 @@
# Script for checking/adding to cron MySQL
case "$1" in
addcru)
ISCRU=`cru l | grep mysql_inside | wc -l`
addcru)
ISCRU=$(cru l | grep mysql_inside | wc -l)
INTERVAL=`nvram get mysql_check_time`
INTERVAL=$(nvram get mysql_check_time)
BTON=`nvram get mysql_enable`
if [ "$BTON" == "1" ]; then
BTCH=`nvram get mysql_check`
if [ "$BTCH" == "1" ]; then
if [ "$ISCRU" == "0" ]; then
cru a mysql_inside "*/$INTERVAL * * * * /usr/bin/mycheck check"
else
cru d mysql_inside
cru a mysql_inside "*/$INTERVAL * * * * /usr/bin/mycheck check"
fi
else
if [ "$ISCRU" == "1" ]; then
cru d mysql_inside
fi
fi
else
if [ "$ISCRU" == "1" ]; then
cru d mysql_inside
fi
fi
;;
check)
BTON=`nvram get mysql_enable`
if [ "$BTON" == "1" ]; then
BTCH=`nvram get mysql_check`
if [ "$BTCH" == "1" ]; then
ON=`ps w | grep mysqld | grep -v grep | wc -l`
if [ "$ON" == "0" ]; then
logger MySQL stopped? Starting...
service mysql restart
fi
fi
fi
;;
BTON=$(nvram get mysql_enable)
[ "$BTON" == "1" ] && {
BTCH=$(nvram get mysql_check)
[ "$BTCH" == "1" ] && {
[ "$ISCRU" == "0" ] && {
cru a mysql_inside "*/$INTERVAL * * * * /usr/bin/mycheck check"
} || {
cru d mysql_inside
cru a mysql_inside "*/$INTERVAL * * * * /usr/bin/mycheck check"
}
} || {
[ "$ISCRU" == "1" ] && cru d mysql_inside
}
} || {
[ "$ISCRU" == "1" ] && cru d mysql_inside
}
;;
check)
BTON=$(nvram get mysql_enable)
[ "$BTON" == "1" ] && {
BTCH=$(nvram get mysql_check)
[ "$BTCH" == "1" ] && {
ON=$(ps w | grep mysqld | grep -v grep | wc -l)
[ "$ON" == "0" ] && {
logger MySQL stopped? Starting...
service mysql restart
}
}
}
;;
esac
exit 0

@ -46,7 +46,7 @@
[ ! "$WANPROTO" == "disabled" ] && WAN1=$(NV wan_$WANIP | /bin/grep -v "0.0.0.0" | /usr/bin/wc -w)
[ ! "$WAN2PROTO" == "disabled" ] && WAN2=$(NV wan2_$WAN2IP | /bin/grep -v "0.0.0.0" | /usr/bin/wc -w)
[ "$(/bin/nvram dump | /bin/grep 'wan3_' | /usr/bin/wc -l)" -gt 0 ] && {
[ "$(/bin/nvram show | /bin/grep 'wan3_' | /usr/bin/wc -l)" -gt 0 ] && {
MULTIWAN=1
WAN3PROTO=$(NV wan3_proto)
WAN3PDHCP=$(NV wan3_pptp_dhcp)
@ -138,6 +138,18 @@
[ "$(NV wl2_nband)" == 2 ] && BAND="2.4GHz" || BAND="5GHz"
[ "$(NV wl2_radio)" == 1 ] && /bin/echo " WL2 : $BAND @ $(NV wl2_ssid) @ channel: $(NV wl2_country)$CH @ $(NV wl2_hwaddr)"
}
# BCMARMNO-BEGIN
STHMD_ISENABLED=$(/usr/sbin/cru l | /bin/grep "perm_on" | /usr/bin/wc -l)
STHMD_SCHON=$(/usr/sbin/cru l | /bin/grep "stealthsheduleon" | /usr/bin/awk '{ print $2" "$1 }')
STHMD_SCHOFF=$(/usr/sbin/cru l | /bin/grep "stealthsheduleoff" | /usr/bin/awk '{ print $2" "$1 }')
STHMD_SCHONC=$(/bin/echo $STHMD_SCHON | /usr/bin/wc -c)
STHMD_SCHOFFC=$(/bin/echo $STHMD_SCHOFF | /usr/bin/wc -c)
[ $STHMD_ISENABLED -gt 0 -o $STHMD_SCHONC -gt 1 -o $STHMD_SCHOFFC -gt 1 ] && {
/bin/echo " -------------------------------------------------------- "
[ $STHMD_ISENABLED -gt 0 ] && /bin/echo " Detected the presence of stealthMode which is now active"
[ $STHMD_SCHONC -gt 1 -a $STHMD_SCHOFFC -gt 1 ] && /bin/echo -e " stealthMode Scheduled mode is currently active and is\n set for sunset at $( /bin/echo $STHMD_SCHON | /usr/bin/awk '{$1=sprintf("%02d", $1);$2=sprintf("%02d", $2); print $1":"$2 }' ) and sunrise at $( /bin/echo $STHMD_SCHOFF | /usr/bin/awk '{$1=sprintf("%02d", $1);$2=sprintf("%02d", $2); print $1":"$2 }' )"
}
# BCMARMNO-END
/bin/echo -e "\033[1;34m ======================================================== \033[0m"
/bin/echo ""
}

@ -3,8 +3,7 @@
#cleaning
sed -i /tmp/etc/hosts -e "/ntp2ip/d"
for server in $(nvram get ntp_server)
do
for server in $(nvram get ntp_server); do
addresses=$(hostip $server)
for address in $addresses; do
echo "$address $server #ntp2ip" >> /tmp/etc/hosts

@ -2,7 +2,13 @@
# Optware pre-installation script, Leon Kos 2006-2008
# Broadcom ARM support - Shibby 2014
# BCMARM-BEGIN
REPOSITORY=http://ipkg.nslu2-linux.org/feeds/optware/mbwe-bluering/cross/stable
# BCMARM-END
# BCMARMNO-BEGIN
REPOSITORY=http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable
# BCMARMNO-END
TMP=/tmp
# STUBBYNO-BEGIN
WGET="/usr/bin/wget --no-check-certificate"
@ -15,92 +21,100 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/bin:/opt/sbin
unset LD_PRELOAD
unset LD_LIBRARY_PATH
_check_config()
{
echo "Checking system config ..."
GATEWAY=$(netstat -rn |
sed -n 's/^0.0.0.0[ \t]\{1,\}\([0-9.]\{8,\}\).*/\1/p' )
if [ -n "${GATEWAY}" ]; then
echo "Using ${GATEWAY} as default gateway."
else
echo "Error: No default gateway set!"
exit 2
fi
if [ -s /etc/resolv.conf ]; then
echo "Using the following nameserver(s):"
if grep nameserver /etc/resolv.conf ; then
GATEWAY_SUBNET=$(echo "${GATEWAY}" |
sed 's/\.[0-9]\{1,3\}\.[0-9]\{1,3\}$//')
if [ "${GATEWAY_SUBNET}" = "192.168" ]; then
if grep -q ${GATEWAY} /etc/resolv.conf ; then
echo "Gateway ${GATEWAY} is also nameserver."
_check_config() {
echo "Checking system config ..."
GATEWAY=$(netstat -rn | sed -n 's/^0.0.0.0[ \t]\{1,\}\([0-9.]\{8,\}\).*/\1/p')
[ -n "${GATEWAY}" ] && {
echo "Using ${GATEWAY} as default gateway."
} || {
echo "Error: No default gateway set!"
exit 2
}
[ -s /etc/resolv.conf ] && {
echo "Using the following nameserver(s):"
if grep nameserver /etc/resolv.conf ; then
GATEWAY_SUBNET=$(echo "${GATEWAY}" |
sed 's/\.[0-9]\{1,3\}\.[0-9]\{1,3\}$//')
[ "${GATEWAY_SUBNET}" = "192.168" ] && {
if grep -q ${GATEWAY} /etc/resolv.conf ; then
echo "Gateway ${GATEWAY} is also nameserver."
else
echo "Warning: local nameserver is different than gateway!"
echo "Check config or enter:"
if test -L /etc/resolv.conf ; then
echo " sed -i s/192.168.*/${GATEWAY}/ /tmp/resolv.conf"
else
echo " sed -i s/192.168.*/${GATEWAY}/ /etc/resolv.conf"
fi
echo "to correct this."
fi
}
else
echo "Warning: local nameserver is different than gateway!"
echo "Check config or enter:"
if test -L /etc/resolv.conf ; then
echo " sed -i s/192.168.*/${GATEWAY}/ /tmp/resolv.conf"
else
echo " sed -i s/192.168.*/${GATEWAY}/ /etc/resolv.conf"
fi
echo "to correct this."
echo "Error: No nameserver specified in /etc/resolv.conf"
exit 5
fi
fi
} || {
echo "Error: Empty or nonexistent /etc/resolv.conf"
exit 3
}
if mount | grep -q /opt ; then
[ -d /opt/etc ] && echo "Warning: /opt partition not empty!"
else
echo "Error: No nameserver specified in /etc/resolv.conf"
exit 5
echo "Error: /opt partition not mounted."
echo "Enter"
echo " mkdir /jffs/opt"
echo " mount -o bind /jffs/opt /opt"
echo "to correct this."
exit 4
fi
else
echo "Error: Empty or nonexistent /etc/resolv.conf"
exit 3
fi
if mount | grep -q /opt ; then
[ -d /opt/etc ] && echo "Warning: /opt partition not empty!"
else
echo "Error: /opt partition not mounted."
echo "Enter"
echo " mkdir /jffs/opt"
echo " mount -o bind /jffs/opt /opt"
echo "to correct this."
exit 4
fi
}
_install_package()
{
PACKAGE=$1
echo "Installing package ${PACKAGE} ..."
$WGET -O ${TMP}/${PACKAGE} ${REPOSITORY}/${PACKAGE}
cd ${TMP}
tar xzf ${TMP}/${PACKAGE}
tar xzf ${TMP}/control.tar.gz
cd /
if [ -f ${TMP}/preinst ] ; then
sh ${TMP}/preinst
rm -f ${TMP}/preints
fi
tar xzf ${TMP}/data.tar.gz
if [ -f ${TMP}/postinst ] ; then
sh ${TMP}/postinst
rm -f ${TMP}/postinst
fi
rm -f ${TMP}/data.tar.gz
rm -f ${TMP}/control.tar.gz
rm -f ${TMP}/control
rm -f ${TMP}/${PACKAGE}
_install_package() {
PACKAGE=$1
echo "Installing package ${PACKAGE} ..."
$WGET -O ${TMP}/${PACKAGE} ${REPOSITORY}/${PACKAGE}
cd ${TMP}
tar xzf ${TMP}/${PACKAGE}
tar xzf ${TMP}/control.tar.gz
cd /
[ -f ${TMP}/preinst ] && {
sh ${TMP}/preinst
rm -f ${TMP}/preints
}
tar xzf ${TMP}/data.tar.gz
[ -f ${TMP}/postinst ] && {
sh ${TMP}/postinst
rm -f ${TMP}/postinst
}
rm -f ${TMP}/data.tar.gz
rm -f ${TMP}/control.tar.gz
rm -f ${TMP}/control
rm -f ${TMP}/${PACKAGE}
}
_check_config
# BCMARM-BEGIN
_install_package uclibc-opt_0.9.28-1_arm.ipk
_install_package ipkg-opt_0.99.163-10_arm.ipk
# BCMARM-END
# BCMARMNO-BEGIN
_install_package uclibc-opt_0.9.28-13_mipsel.ipk
_install_package ipkg-opt_0.99.163-10_mipsel.ipk
/opt/sbin/ldconfig
# BCMARMNO-END
/opt/bin/ipkg update
/opt/bin/ipkg install -force-reinstall uclibc-opt
/opt/bin/ipkg install -force-reinstall ipkg-opt
##ipkg.conf
# BCMARM-BEGIN
## ipkg.conf
echo "src/gz nslu2 http://ipkg.nslu2-linux.org/feeds/optware/mbwe-bluering/cross/stable" > /opt/etc/ipkg.conf
echo "src shibby http://tomato.groov.pl/repo-arm" >> /opt/etc/ipkg.conf
echo "dest /opt/ /" >> /opt/etc/ipkg.conf
# BCMARM-END
# BCMARMNO-BEGIN
## shibby`s repository ##
echo "src shibby http://tomato.groov.pl/repo" >> /opt/etc/ipkg.conf
# BCMARMNO-END
/opt/bin/ipkg update

@ -11,13 +11,12 @@ mkdir -p -m 0755 cifs1
mkdir -p -m 0755 cifs2
mkdir -p -m 0755 opt
# !!TB
mkdir -p -m 0755 mmc
mkdir -p -m 0755 usr/local
case "$1" in
ln_usr_share)
ln -sf /tmp/share usr/share
;;
ln_usr_share)
ln -sf /tmp/share usr/share
;;
esac
ln -sf /tmp/share usr/local/share
@ -28,20 +27,18 @@ ln -sf tmp/home home
ln -sf tmp/home/root root
(cd usr && ln -sf ../tmp)
# !!TB
ln -sf /tmp/var/wwwext www/ext
ln -sf /tmp/var/wwwext www/user
ln -sf /www/ext/proxy.pac www/proxy.pac
ln -sf /www/ext/proxy.pac www/wpad.dat
# shibby
mkdir -p -m 0755 nas
mkdir -p -m 0755 bkp
mkdir -p -m 0777 tftpboot
# Tor GeoIP DB in /tmp
case "$1" in
ln_tor_geoip)
ln -sf /tmp/tor usr/share/tor
;;
ln_tor_geoip)
ln -sf /tmp/tor usr/share/tor
;;
esac

@ -0,0 +1,195 @@
#!/bin/sh
#
# Turn off/on all led for Asus routers RT-N16, RT-N66U, RT-AC66U, RT-AC68U
#
# Version: 0.11
# Authors: Monter, Shibby, hasIPv6
#
# configuration
VERSION="v0.11"
# /configuration
# Send your bug report to monter[at]techlog.pl
dir=$(/bin/echo $( cd "$(/usr/bin/dirname "$0")" ; /bin/pwd -P ))
stms=$(/usr/bin/basename ${0})
MAKE=$(/bin/nvram get t_model_name | /usr/bin/awk '{print $1}')
MODEL=$(/bin/nvram get t_model_name | /usr/bin/awk '{print $2}')
USB3=$(/usr/bin/lsusb | /bin/grep -v "Device 001" | /bin/grep "Bus 001")
USB2=$(/usr/bin/lsusb | /bin/grep -v "Device 001" | /bin/grep "Bus 002")
LOGS="/usr/bin/logger -s -t stealthMode"
case "$MAKE" in
"Asus")
;;
*)
$LOGS "Router Brand does not support this feature"
exit 1
esac
case "$MODEL" in
"RT-N16"|"RT-N66U"|"RT-AC66U"|"RT-AC68R/U")
;;
*)
$LOGS "Router Model does not support this feature"
exit 1
esac
case "$1" in
on)
case "$MODEL" in
"RT-N16"|"RT-N66U"|"RT-AC66U"|"RT-AC68R/U")
/usr/sbin/et robowr 0x00 0x18 0x1e0
;;
*)
exit 99
esac
# strobo effect
/bin/sleep 1
$dir/$stms perm_on
$LOGS "Activated"
/usr/sbin/cru a stealthmode "*/5 * * * * $dir/$stms perm_on"
;;
perm_on)
case "$MODEL" in
"RT-N16")
# power led
/sbin/gpio enable 1
# unlock lan ports
/usr/sbin/et robord 0x1 0x4 > /dev/null 2>&1
/usr/sbin/wl -i eth1 leddc 1
;;
"RT-N66U"|"RT-AC66U")
# power led
/sbin/gpio enable 12
# usb led
/sbin/gpio enable 15
/usr/sbin/wl -i eth1 leddc 1
/usr/sbin/wl -i eth2 leddc 1
;;
"RT-AC68R/U")
# white led at the back
/sbin/gpio enable 4
# power led
/sbin/gpio enable 3
# usb2 led
/sbin/gpio enable 0
# usb3 led
/sbin/gpio enable 14
/usr/sbin/wl -i eth1 ledbh 10 0
/usr/sbin/wl -i eth2 ledbh 10 0
;;
*)
exit 99
esac
case "$MODEL" in
"RT-N16"|"RT-N66U"|"RT-AC66U"|"RT-AC68R/U")
/usr/sbin/et robowr 0x00 0x18 0x1e0
/usr/sbin/et robowr 0x00 0x1a 0x1e0
;;
*)
exit 99
esac
;;
sch_on)
[ "${2}" != "" -a "${2}" -le 23 -a "0$(/bin/echo $2 | /usr/bin/tr -d ' ')" -ge 0 ] 2>/dev/null && {
[ "${3}" != "" -a "${3}" -le 59 -a "${3}" -eq "${3}" ] 2>/dev/null && SCHMIN=${3} || SCHMIN="0"
/usr/sbin/cru a stealthsheduleon $SCHMIN $2 "* * * $dir/$stms on"
$LOGS "Scheduled On set to $2:$(/usr/bin/printf "%02d" $SCHMIN)"
} || {
$LOGS "Scheduled On error - Hour/Minutes not specified!"
$dir/$stms
exit 1
}
;;
sch_off)
[ "${2}" != "" -a "${2}" -le 23 -a "0$(/bin/echo $2 | /usr/bin/tr -d ' ')" -ge 0 ] 2>/dev/null && {
[ "${3}" != "" -a "${3}" -le 59 -a "${3}" -eq "${3}" ] 2>/dev/null && SCHMIN=${3} || SCHMIN="0"
/usr/sbin/cru a stealthsheduleoff $SCHMIN $2 "* * * $dir/$stms off"
$LOGS "Scheduled Off set to $2:$(/usr/bin/printf "%02d" $SCHMIN)"
} || {
$LOGS "Scheduled Off error - Hour/Minutes not specified!"
$dir/$stms
exit 1
}
;;
sch_clear)
/usr/sbin/cru d stealthsheduleon
/usr/sbin/cru d stealthsheduleoff
$LOGS "Scheduler Tasks Deleted"
;;
clear_all)
$dir/$stms sch_clear
$LOGS "Complete shutdown and delete all jobs from Crontab - done"
;;
off)
/usr/sbin/cru d stealthmode
case "$MODEL" in
"RT-N16")
#power led
/sbin/gpio disable 1
# unlock lan ports
/usr/sbin/et robord 0x1 0x4 > /dev/null 2>&1
/usr/sbin/wl -i eth1 leddc 0
;;
"RT-N66U"|"RT-AC66U")
# power led
/sbin/gpio disable 12
# usb led
/sbin/gpio disable 15
/usr/sbin/wl -i eth1 leddc 0
/usr/sbin/wl -i eth2 leddc 0
;;
"RT-AC68R/U")
# white led at the back
/sbin/gpio disable 4
# power led
/sbin/gpio disable 3
[ "$USB2" != "" ] && /sbin/gpio disable 0
[ "$USB3" != "" ] && /sbin/gpio disable 14
/usr/sbin/wl -i eth1 ledbh 10 7
/usr/sbin/wl -i eth2 ledbh 10 7
;;
*)
exit 99
esac
case "$MODEL" in
"RT-N16"|"RT-N66U"|"RT-AC66U"|"RT-AC68R/U")
/usr/sbin/et robowr 0x00 0x18 0x1ff
/usr/sbin/et robowr 0x00 0x1a 0x1ff
# delay before repeat off commands - strobo error fix
/bin/sleep 1
/usr/sbin/et robowr 0x00 0x18 0x1ff
/usr/sbin/et robowr 0x00 0x1a 0x1ff
;;
*)
exit 99
esac
$LOGS "Deactivated"
;;
*)
/bin/echo "$stms ${VERSION} by Monter"
/bin/echo "Usage: $stms {on|off|sch_on <H> <M>|sch_off <H> <M>|sch_clear|clear_all}"
/bin/echo
/bin/echo " [Standard mode]"
/bin/echo " on | off - enable or disable steathMode in real time"
/bin/echo
/bin/echo " [Scheduled mode]"
/bin/echo " sch_on <H> <M> - set the hour and minutes of the scheduled enable/disable"
/bin/echo " sch_off <H> <M> stealthMode in Standard mode and adding jobs to the Crontab"
/bin/echo " Hour and minute time must be a numbers without any additional"
/bin/echo " characters, where hour is a mandatory parameter, while not"
/bin/echo " specifying an minute will assign a default 00 value"
/bin/echo " These options add just the right job for Crontab, nothing more"
/bin/echo " sch_clear - removes tasks from Crontab for scheduled enable/disable"
/bin/echo " stealthMode function set by sch_on and sch_off switches"
/bin/echo
/bin/echo " [Repair / debug]"
/bin/echo " clear_all - removes all jobs from Crontab and completely disables all"
/bin/echo " available stealthMode modes"
/bin/echo
exit 1
esac

@ -5,7 +5,7 @@
#
# - changes/fixes
# - add support for rndis protocol
# Copyright (C) 2018 - 2019 by pedro
# Copyright (C) 2018 - 2021 by pedro
#
@ -46,14 +46,14 @@ connect() {
local TTY DEVALL SYSCFGEX CGPADDR TXTLOG MODESPEED MODEROAM MODEBAND CONNECTED=0 COUNT=1 DONE=0 i
local SPEEDTXT ROAMTXT BANDTXT RESSPEED RSPEEDTXT RESROAM RROAMTXT RESBAND RBANDTXT
[ "$MTYPE" == "non-hilink" -o "$MTYPE" == "qmi_wwan" -o "$MTYPE" == "huawei-non-hilink" ] && {
[ "$MTYPE" == "non-hilink" -o "$MTYPE" == "huawei-non-hilink" -o "$MTYPE" == "hw-ether" -o "$MTYPE" == "qmi_wwan" ] && {
[ -e "$DEVNR" ] || wayOut "4G MODEM - DIAG interface not found - connection terminated!"
}
$LOGS "4G MODEM - connecting ..."
# non-hilink/1st type
if [ "$MTYPE" == "non-hilink" -o "$MTYPE" == "huawei-non-hilink" ]; then
if [ "$MTYPE" == "non-hilink" -o "$MTYPE" == "huawei-non-hilink" -o "$MTYPE" == "hw-ether" ]; then
case "$SPEED" in
"00") SPEEDTXT="Auto" ;;
"03") SPEEDTXT="4G only" ;;
@ -362,7 +362,7 @@ disconnect() {
watchdog del
dhcpc-release $PREFIX
if [ "$MTYPE" == "non-hilink" -o "$MTYPE" == "huawei-non-hilink" ]; then
if [ "$MTYPE" == "non-hilink" -o "$MTYPE" == "huawei-non-hilink" -o "$MTYPE" == "hw-ether" ]; then
DEVALL="$DEVNR $(cat "$DIAGSFILE" | sed "s~"$DEVNR"~~")"
for j in $DEVALL; do # on every interface
@ -387,7 +387,12 @@ disconnect() {
switchMode() {
VENDOR="" PRODUCT="" MTYPE="" MODULE="" DEVICENAME="" # global
# BCMARM-BEGIN
MODULES="qmi_wwan cdc_ether huawei_cdc_ncm cdc_ncm rndis_host"
# BCMARM-END
# BCMARMNO-BEGIN
MODULES="qmi_wwan cdc_ether huawei_ether cdc_ncm rndis_host"
# BCMARMNO-END
local COUNT=1 SWITCHED=0 DVDP=0 PATHDEV SWITCH DEVICES IFN_BEFORE DV DP DB DG
for MODULE in $MODULES; do # remove modules
@ -521,7 +526,7 @@ searchDiag() {
[ -z "$VENDOR" ] && VENDOR=$(cat "$PATHDIAG"/"$DEVICENAME"/idVendor)
[ -z "$PRODUCT" ] && PRODUCT=$(cat "$PATHDIAG"/"$DEVICENAME"/idProduct)
if [ "$MTYPE" == "non-hilink" -o "$MTYPE" == "huawei-non-hilink" ]; then
if [ "$MTYPE" == "non-hilink" -o "$MTYPE" == "huawei-non-hilink" -o "$MTYPE" == "hw-ether" ]; then
isDiag # --> TTYS
[ -z "$TTYS" ] && {
@ -601,6 +606,8 @@ findType() {
MTYPE="non-hilink"
elif [ "$MODULE" == "huawei_cdc_ncm" ]; then
MTYPE="huawei-non-hilink"
elif [ "$MODULE" == "huawei_ether" ]; then
MTYPE="hw-ether"
elif [ "$MODULE" == "qmi_wwan" ]; then
MTYPE="qmi_wwan"
elif [ "$MODULE" == "rndis_host" ]; then
@ -628,7 +635,7 @@ setPIN() {
local IS_PIN=$(NV "$PREFIX"_modem_pin | wc -w)
local IS_DONE=0 COUNT=1 TIMEOUT=30 PINVAL DEVALL i
[ "$MTYPE" == "non-hilink" -o "$MTYPE" == "huawei-non-hilink" ] && {
[ "$MTYPE" == "non-hilink" -o "$MTYPE" == "huawei-non-hilink" -o "$MTYPE" == "hw-ether" ] && {
[ "$IS_PIN" -eq 1 ] && {
DEVALL="$DEVNR $(cat "$DIAGSFILE" | sed "s~"$DEVNR"~~")"
@ -772,7 +779,7 @@ else
searchWAN
# only for non-hilink
[ "$MTYPE" == "non-hilink" -o "$MTYPE" == "qmi_wwan" -o "$MTYPE" == "huawei-non-hilink" ] && {
[ "$MTYPE" == "non-hilink" -o "$MTYPE" == "huawei-non-hilink" -o "$MTYPE" == "hw-ether" -o "$MTYPE" == "qmi_wwan" ] && {
searchDiag
setPIN
}

@ -1,17 +1,17 @@
#!/bin/sh
a=`cat /proc/cpuinfo | grep BogoMIPS | head -1 | awk {' print $3'} | awk '{printf "%0.1f %s\n", $1/100}' | awk '{printf "%s\n", $1*50}'`
a=$(cat /proc/cpuinfo | grep BogoMIPS | head -1 | awk {' print $3'} | awk '{printf "%0.1f %s\n", $1/100}' | awk '{printf "%s\n", $1*50}')
b=`cat /proc/cpuinfo | grep processor | wc -l`
b=$(cat /proc/cpuinfo | grep processor | wc -l)
if [ $b -le "1" ]; then
c="single"
else
c="dual"
fi
[ $b -le "1" ] && {
c="single"
} || {
c="dual"
}
d=`cat /proc/dmu/temperature | head -1 | awk '{ print substr($4,1,length($4)-2)}'`
if [ ! $d ]; then d="--"; fi
d=$(cat /proc/dmu/temperature | head -1 | awk '{ print substr($4,1,length($4)-2)}')
[ ! $d ] && d="--"
echo "cpu MHz : $a MHz ($c" > /tmp/sysinfo-helper
echo "cpu Temp : $d" >> /tmp/sysinfo-helper

@ -0,0 +1,65 @@
#!/bin/sh
#
# v1.00 Shibby 2013
# v1.01 Fix memory leak + cosmetics - pedro 2019
# v1.02 rs232 06/2021
#
[ ! "$(nvram get web_css)" == "online" ] && exit 0
PID=$$
LOCK="/tmp/ttb.lock"
DIR="/www/ext"
LOGS="logger -t TTB[$PID]"
URL_ORIG="http://ttb.mooo.com http://ttb.ath.cx http://ttb.ddnsfree.com"
# STUBBYNO-BEGIN
WGET="/usr/bin/wget --no-check-certificate"
# STUBBYNO-END
# STUBBY-BEGIN
WGET="/usr/bin/wget"
# STUBBY-END
ttbshuf() {
awk 'BEGIN {srand(); OFMT="%.17f"} {print rand(), $0}' "$@" | sort -k1,3n | cut -d ' ' -f2-;
}
# script in action
[ -f $LOCK ] && {
$LOGS "Another process in action - exiting"
exit 0
} || {
touch $LOCK
TTB=$(nvram get ttb_css)
# no skin
[ ! -f $DIR/$TTB.css ] && {
# no skin but zip with skin is available
[ -f $DIR/$TTB.zip ] && {
unzip -o $DIR/$TTB.zip -d $DIR/
$LOGS "Online theme [ $TTB ] has been applied"
cru d ttbDL
# no skin either zip
} || {
rm $DIR/*.css $DIR/*.zip $DIR/*.png $DIR/*.gif $DIR/*.jpg >/dev/null 2>&1
echo $URL_ORIG | tr ' ' '\n' | ttbshuf | tr ' ' '\n' | sed 's/\/$//' |
while read l; do
$WGET -U "Mozilla/5.0 (X11; Linux x86_64; rv:30.0) Gecko/20100101 Firefox/88.0" -T 10 -t 1 $l/$TTB.zip -O $DIR/$TTB.zip >/dev/null 2>&1 && echo $l && break
done
sleep 1
# zip downloaded
[ -f $DIR/$TTB.zip ] && {
unzip -o $DIR/$TTB.zip -d $DIR/
$LOGS "Online theme [ $TTB ] has been downloaded and applied"
cru d ttbDL
# can't download zip!!
} || {
$LOGS "Cannot download Online theme. Will try again soon ..."
cru a ttbDL "*/5 * * * * /usr/sbin/ttb"
}
}
}
rm $LOCK
}
Loading…
Cancel
Save