Skip to content

Commit

Permalink
Merge branch 'master' into mainline
Browse files Browse the repository at this point in the history
  • Loading branch information
RMerl committed Jan 31, 2020
2 parents ccb2410 + 9c5c158 commit db26f1d
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 197 deletions.
42 changes: 35 additions & 7 deletions Changelog-NG.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
Asuswrt-Merlin 384/NG Changelog
===============================

384.15 (xx-xxx-xxxx)
384.15 (xx-xxx-2020)
The RT-AC87U and RT-AC3200 are not supported by this release, see
the 384.13_3 release released separately for these two models.

- NEW: wan-event script. The first parameter will be the WAN unit
(0 for first WAN, 1 for secondary). The second parameter
will be a string describing the type of event (init,
Expand All @@ -14,29 +17,37 @@ Asuswrt-Merlin 384/NG Changelog
to ten different pages that can be added anywhere within
the webui, and a dedicated storage repository for your
settings, which can be interacted with through your
custom web page. See the Wiki for more information:
custom web page or through a shell script.
See the Wiki for more information:

https://github.com/RMerl/asuswrt-merlin/wiki/Addons-API

- NEW: amtm (Asuswrt-Merlin Terminal Menu) by thelonelycoder has
been added to the firmware. Running "amtm" over SSH will
give you a menu allowing you to select and install various
addons, such as Diversion (ad blocker) or SKynet (an
advanced firewall extension).
advanced firewall extension). The plugins for amtm are
still maintained by its original author (thelonelycoder).

- UPDATED: Backported some fixes from 384_81981, mostly related
to WAN, port bonding and mdns.
- UPDATED: Merged with GPL 385_10002 (from RT-AC68U)
- UPDATED: Merged GPK 384_7756 for RT-AX88U, which adds OFDMA and
WPA3 support to that model.
- UPDATED: Merged with GPL 385_10002 for other models (from RT-AC68U)
- UPDATED: odhcp6c to 1.1-97-ge199804 (themiron)
- UPDATED: curl to 7.67.0.
- UPDATED: openssl-1.0 to 1.0.2u
- UPDATED: dnsmasq to 2.80-114-ge40d8be (themiron)
- CHANGED: Replaced entware-setup.sh script with link to amtm, as
using the amtm Entware installer is now the supported
method.
- FIXED: Some of the newest DNSFilter servers weren't properly set
up with IPv6 (dave14305)


384.13_3 (xx-xxx-2020)
This release is only available for the RT-AC87U and RT-AC3200.

384.14_3 (xx-xx-xxxx) (RT-AC87U and RT-AC3200)
- NEW: wan-event script. The first parameter will be the WAN unit
(0 for first WAN, 1 for secondary). The second parameter
will be a string describing the type of event (init,
Expand All @@ -49,11 +60,28 @@ Asuswrt-Merlin 384/NG Changelog
to ten different pages that can be added anywhere within
the webui, and a dedicated storage repository for your
settings, which can be interacted with through your
custom web page. See the Wiki for more information:
custom web page or through a shell script.
See the Wiki for more information:

(first draft of the documentation, need to be reorganized)
https://github.com/RMerl/asuswrt-merlin/wiki/Addons-API

- NEW: amtm (Asuswrt-Merlin Terminal Menu) by thelonelycoder has
been added to the firmware. Running "amtm" over SSH will
give you a menu allowing you to select and install various
addons, such as Diversion (ad blocker) or SKynet (an
advanced firewall extension). The plugins for amtm are
still maintained by its original author (thelonelycoder).

- UPDATED: odhcp6c to 1.1-97-ge199804 (themiron)
- UPDATED: openssl-1.0 to 1.0.2u
- UPDATED: curl to 7.67.0.
- UPDATED: OpenVPN to 2.4.8.
- UPDATED: dnsmasq to 2.80-114-ge40d8be (themiron)
- CHANGED: Replaced entware-setup.sh script with link to amtm, as
using the amtm Entware installer is now the supported
method.
- FIXED: Some of the newest DNSFilter servers weren't properly set
up with IPv6 (dave14305)


384.14_2 (1-1-2020)
Expand Down
2 changes: 1 addition & 1 deletion release/src-rt/version.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
KERNEL_VER=3.0
FS_VER=0.4
SERIALNO=384.15
EXTENDNO=alpha2
EXTENDNO=beta1
RCNO=0
209 changes: 37 additions & 172 deletions release/src/router/others/amtm
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/sh
#bof

# amtm is free to use under the GNU General Public License version 3 (GPL-3.0)
# https://opensource.org/licenses/GPL-3.0
Expand All @@ -11,62 +10,15 @@

add=/jffs/addons/amtm
amtmURL=https://fwupdate.asuswrt-merlin.net/amtm_fw

ascii_logo(){
echo " _"
echo " ____ ____ | |_ ____"
echo " / _ | \| _)| \ "
echo " ( ( | | | | | |__| | | |"
echo " \_||_|_|_|_|\___)_|_|_|"
echo
echo " $1"
}

about_amtm(){
p_e_l
echo " amtm, the $title
Version $version FW, released on $release
(Built-in firmware version)
amtm is a front end that manages popular scripts
for wireless routers running Asuswrt-Merlin firmware.
For updates and discussion visit this thread:
https://www.snbforums.com/threads/amtm-the-snbforums-asuswrt-merlin-terminal-menu.42415
Proudly coded by thelonelycoder:
Copyright (c) 2016-2066 thelonelycoder - All Rights Reserved
https://www.snbforums.com/members/thelonelycoder.25480
https://diversion.ch/amtm.html
$contributors
amtm License:
amtm is free to use under the GNU General
Public License, version 3 (GPL-3.0).
https://opensource.org/licenses/GPL-3.0
Follow amtm on Twitter or Reddit:
https://twitter.com/DiversionBlock
https://www.reddit.com/r/diversion"
p_r_l
p_e_t "return to menu"
show_amtm menu
}
amtmRev=0

a_m(){ [ -z "$am" ] && am=$1 || am="$am\\n$1";}
c_e(){ [ ! -f /opt/bin/opkg ] && show_amtm " $1 requires the Entware repository\\n installed. Enter ${GN_BG}ep${NC} to install Entware now.";}
c_nl(){ [ -n "$(tail -c2 "$1")" ] && echo >> "$1";}
c_j_s(){ if [ ! -f "$1" ]; then echo "#!/bin/sh" >"$1"; echo >>"$1"; elif [ -f "$1" ] && ! head -1 "$1" | grep -qE "^#!/bin/sh"; then c_nl "$1"; echo >>"$1"; sed -i '1s~^~#!/bin/sh\n~' "$1";fi; d_t_u "$1"; c_nl "$1"; [ ! -x "$1" ] && chmod 0755 "$1";}
c_d(){ p_e_l;while true;do printf " Continue? [1=Yes e=Exit] ";read -r continue;case "$continue" in 1)echo;break;;[Ee])am=;show_amtm menu;break;;*)printf "\\n input is not an option\\n\\n";;esac done;}
c_url(){ /usr/sbin/curl -fsNL --retry 2 --connect-timeout 3 -m 8 "$@";}
d_t_u(){ dos2unix < $1 | cmp -s - $1;[ "$?" = 1 ] && dos2unix $1;}
p_e_t(){ printf "\\n Press Enter to $1 ";read -r;echo;}
p_r_l(){ echo "${R}_____________________________________________${NC}";}
p_e_l(){ p_r_l;echo;}
r_w_e(){ [ "$(sed '/^[[:space:]]*$/d; /#!\/bin\/sh/d' "$1" | wc -c)" = 0 ] && rm "$1";}
r_m(){ [ -f "${add}/$1" ] && rm -f "${add}/$1";}
s_p(){ for i in "$1"/*; do if [ -d "$i" ]; then s_p "$i";elif [ -f "$i" ]; then [ ! -w "$i" ] && chmod 666 "$i";d_t_u "$i";fi;done;}
theme_standard(){ R='';R_BG='';E_BG='';GN='';GN_BG='';B='';GY='';NC='';COR=20;}
theme_green(){ R='';R_BG='';E_BG='';GN='';GN_BG='';B='';GY='';NC='';COR=20;}
theme_blue(){ R='';R_BG='';E_BG='';GN='';GN_BG='';B='';GY='';NC='';COR=21;}
Expand All @@ -81,13 +33,13 @@ theme_basic(){ R='';R_BG=;E_BG=;GN=;GN_BG=;B=;GY='';NC='';COR=15;}
f_b_url(){ a_m " ! using ${R}fallback server${NC} diversion.ch\\n";amtmURL=https://diversion.ch/amtm_fw;}

c_t(){
[ -f "${add}"/.amtm_theme ] && . "${add}"/.amtm_theme
divconf=/opt/share/diversion/.conf/diversion.conf
if [ -s "$divconf" ]; then
[ ! -f "${add}"/.amtm_theme ] && theme="$(grep "THEME=" "$divconf" | sed -e 's/THEME=//')"
if [ -f "${add}"/.amtm_theme ]; then
. "${add}"/.amtm_theme
else
[ -s "$divconf" ] && theme="$(grep "THEME=" "$divconf" | sed -e 's/THEME=//')"
fi
[ "$theme" ] || theme_amtm new
theme_$theme
[ "$theme" ] && theme_$theme || theme_amtm new
}

g_m(){
Expand Down Expand Up @@ -128,41 +80,10 @@ g_m(){
fi
}

reset_amtm(){
p_e_l
echo " Do you want to reset amtm settings now?"
echo
echo " Note that resetting amtm will not remove or"
echo " uninstall any installed SNBForum scripts."
echo
echo " However, it will remove the Disk check"
echo " script and log, the Format disk log and the"
echo " reboot scheduler when found."
c_d
if [ -f /jffs/scripts/disk-check ]; then
sed -i '\~/jffs/scripts/disk-check ~d' /jffs/scripts/pre-mount
r_w_e /jffs/scripts/pre-mount
rm -f /jffs/scripts/disk-check
fi
if [ -f /jffs/scripts/init-start ] && grep -qE "amtm_RebootScheduler" /jffs/scripts/init-start; then
sed -i '\~amtm_RebootScheduler~d' /jffs/scripts/init-start
r_w_e /jffs/scripts/init-start
cru d amtm_RebootScheduler
fi
rm -rf "${add}"
clear
ascii_logo " amtm settings reset"
echo
echo " Goodbye!"
echo
exit 0
}

theme_amtm(){
p_e_l
if [ -z "$1" ]; then
printf " This changes the amtm theme. All used colors\\n are shown in the themes below.\\n"
printf "\\n Your current theme is: ${R_BG} $theme ${NC}\\n\\n"
printf " All colors in use are shown.\\n Your current theme is: ${R_BG} $theme ${NC}\\n\\n"
else
printf " Select a theme that works best in your\\n SSH client. All colors in use are shown.\\n\\n"
fi
Expand Down Expand Up @@ -195,8 +116,7 @@ theme_amtm(){
p_r_l
ton=12;noad=12
fi
printf "\\n The basic and reduced themes use no or fewer\\n"
printf " colors, service states may not be visible.\\n"
printf "\\n The basic and reduced themes use no or fewer\\n colors, service states may not be visible.\\n"
theme_standard
while true; do
if [ -z "$1" ]; then
Expand Down Expand Up @@ -228,98 +148,44 @@ theme_amtm(){
[ "$1" ] || show_amtm " changed theme to $theme"
}

update_amtm(){
urlNOK=
if ! c_url "$amtmURL/amtm.mod" | grep -q "^version="; then
urlNOK=1
f_b_url
init_amtm(){
[ -d "${add}" ] && fmd= || fmd=1
mkdir -p "${add}/a_fw"
if [ ! -d "${add}" ]; then
printf "\\n amtm failed to create the directory\\n ${add}\\n Please investigate. Aborting amtm now.\\n\\n";exit 1
fi
if [ "$urlNOK" ] && ! c_url "$amtmURL/amtm.mod" | grep -q "^version="; then
if [ "$su" = 1 ]; then
updErr=1
thisrem=" ${E_BG}upd err${NC}"
amtmUpd=0
else
a_m " Update aborted, could not retrieve version"
show_amtm menu
mv /jffs/amtm-* "${add}" 2> /dev/null;mv /jffs/.amtm_* "${add}" 2> /dev/null
c_t
if [ -f /jffs/scripts/amtm ] || [ -f /opt/bin/amtm ]; then
rm -f /jffs/scripts/amtm;rm -f /opt/bin/amtm
if [ -f "/jffs/configs/profile.add" ]; then
sed -i '/alias amtm=/d' /jffs/configs/profile.add >/dev/null
r_w_e /jffs/configs/profile.add
unalias amtm 2> /dev/null
fi
a_m " amtm migrated to integrated firmware version"
else
urlNOK=
a_m " Initializing amtm for first run"
fi
if [ -z "$urlNOK" ]; then
amtmRemotever="$(c_url "$amtmURL/amtm.mod" | grep "^version=" | sed -e 's/version=//')"
localmd5="$(md5sum "${add}"/a_fw/amtm.mod | awk '{print $1}')"
remotemd5="$(c_url "$amtmURL/amtm.mod" | md5sum | awk '{print $1}')"

if [ "$su" = 1 ]; then
if [ "$version" != "$amtmRemotever" ]; then
thisrem="${E_BG}-> v$amtmRemotever${NC}"
amtmUpd=1
elif [ "$localmd5" != "$remotemd5" ]; then
thisrem="${E_BG}-> min upd${NC}"
amtmUpd=2
else
thisrem="${GN_BG}v$version${NC}"
amtmUpd=0
fi
else
if [ "$version" != "$amtmRemotever" ]; then
a_m " amtm updated from v$version to v$amtmRemotever"
elif [ "$localmd5" != "$remotemd5" ]; then
a_m " amtm minor version update applied"
else
a_m " amtm force updated to v$amtmRemotever"
fi
get_i_modules "${add}"
exec "$0" "$am"
fi
[ "$fmd" ] && a_m " - Created ${GN}${add}${NC} directory"
if [ "$(nvram get jffs2_scripts)" != 1 ]; then
a_m " - JFFS custom scripts and configs enabled"
nvram set jffs2_scripts=1
nvram commit
fi
g_m amtm.mod new
if [ ! -f "${add}"/a_fw/amtm.mod ]; then
p_e_l
printf "$am\\n\\n Exiting amtm now\\n"
p_e_l
exit 1
fi
exec "$0" "$am"
}

run_amtm(){
if [ ! -f "${add}"/a_fw/amtm.mod ] || [ -f /jffs/scripts/amtm ]; then
mkdir -p /jffs/scripts
[ -d "${add}" ] && fmd= || fmd=1
mkdir -p "${add}/a_fw"

if [ ! -d "${add}" ]; then
printf "\\n amtm failed to create the directory\\n ${add}\\n Please investigate. Aborting amtm now.\\n\\n"
exit 1
fi

[ -f /jffs/.amtm_theme ] && mv /jffs/.amtm_theme "${add}"
[ -f /jffs/amtm-format-disk.log ] && mv /jffs/amtm-format-disk.log "${add}"
[ -f /jffs/amtm-disk-check.log ] && mv /jffs/amtm-disk-check.log "${add}"

c_t

if [ -f /jffs/scripts/amtm ] || [ -f /opt/bin/amtm ]; then
rm -f /jffs/scripts/amtm
rm -f /opt/bin/amtm
if [ -f "/jffs/configs/profile.add" ]; then
sed -i '/alias amtm=/d' /jffs/configs/profile.add >/dev/null
r_w_e /jffs/configs/profile.add
fi
a_m " amtm migrated to integrated firmware version"
else
a_m " Initializing amtm for first run"
fi

[ "$fmd" ] && a_m " - Created ${GN}${add}${NC} directory"

if [ "$(nvram get jffs2_scripts)" != 1 ]; then
a_m " - JFFS custom scripts and configs enabled"
nvram set jffs2_scripts=1
nvram commit
fi
g_m amtm.mod new
if [ ! -f "${add}"/a_fw/amtm.mod ]; then
p_e_l
printf "$am\\n\\n Exiting amtm now\\n"
p_e_l
exit 1
fi
exec "$0" "$am"
init_amtm
elif [ -z "$1" ]; then
[ "$am" ] && show_amtm "$am" || show_amtm menu
elif [ "$1" = tpu ]; then
Expand All @@ -332,4 +198,3 @@ run_amtm(){
}
[ -f "${add}"/a_fw/amtm.mod ] && . "${add}"/a_fw/amtm.mod
run_amtm "$@"
#eof
Loading

0 comments on commit db26f1d

Please sign in to comment.