Skip to content

Commit b7b6e2f

Browse files
committed
Hide the IPV6 & WAN IP in the new version of Armbian
1 parent 92f29de commit b7b6e2f

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

build-armbian/armbian-files/common-files/usr/sbin/armbian-fix

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ echo "" >${fix_log} && tolog "Start fixing..."
4646

4747
# Fix common releases permissions
4848
[[ -d "/var/tmp" ]] && sudo chmod 777 /var/tmp && tolog "01. Fix tmp permissions"
49-
[[ -d "/etc/update-motd.d" ]] && sudo chmod -x /etc/update-motd.d/* && sudo chmod +x /etc/update-motd.d/{10-*,30-*} 2>/dev/null && tolog "02. Fix update-motd.d permissions"
49+
[[ -d "/etc/update-motd.d" ]] && sudo chmod -x /etc/update-motd.d/* && sudo chmod +x /etc/update-motd.d/{10-*,20-*,30-*} 2>/dev/null && tolog "02. Fix update-motd.d permissions"
5050
[[ -d "/var/cache/man" ]] && sudo chown man:root /var/cache/man -R && tolog "03. Fix man permissions"
5151
[[ -d "/var/cache/man" ]] && sudo chmod g+s /var/cache/man -R && tolog "04. Fix man permissions"
5252
[[ -f "/etc/sudoers" ]] && sudo chown root:root /etc/sudoers && tolog "05. Fix man permissions"
@@ -100,7 +100,7 @@ motd_tips="/etc/default/armbian-motd"
100100
sed -i 's|^MOTD_DISABLE=""|MOTD_DISABLE="tips"|g' ${motd_tips}
101101
tolog "54. Disable tips of the day"
102102
}
103-
quotes_cron="/etc/cron.weekly/armbian-quotes"
103+
quotes_cron="/etc/cron.daily/armbian-quotes"
104104
[[ -f "${quotes_cron}" ]] && {
105105
sed -i "s|^curl |#curl |g" ${quotes_cron}
106106
tolog "55. Disable quotes cron plan"
@@ -124,7 +124,6 @@ motd_service="/usr/lib/systemd/system/motd-news.service"
124124
sudo rm -f /var/lib/systemd/deb-systemd-helper-enabled/timers.target.wants/motd-news.timer
125125
sudo rm -f /var/lib/systemd/deb-systemd-helper-enabled/motd-news.timer.dsh-also
126126
sudo rm -f /etc/systemd/system/timers.target.wants/motd-news.timer
127-
sudo rm -f /etc/update-motd.d/50-motd-news
128127

129128
# Disable the system's partition adjustment service
130129
sudo systemctl stop armbian-resize-filesystem.service 2>/dev/null
@@ -207,13 +206,15 @@ tolog "59. Disable the ssh.socket and enable ssh.service"
207206
sed -i "s|^REVISION=.*|REVISION=\"${short_version}\"|g" ${armbian_release_file}
208207
}
209208

209+
sed -i "s|^BOOT_SOC=.*|BOOT_SOC=\"${soc_name}\"|g" ${armbian_release_file}
210210
sed -i "s|^BOARDFAMILY=.*|BOARDFAMILY=\"${family_name}\"|g" ${armbian_release_file}
211211
sed -i "s|^LINUXFAMILY=.*|LINUXFAMILY=\"${platform_name}\"|g" ${armbian_release_file}
212212
sed -i "s|^VENDOR=.*|VENDOR=\"Armbian OS\"|g" ${armbian_release_file}
213213
sed -i "s|^IMAGE_TYPE=.*|IMAGE_TYPE=rebuild|g" ${armbian_release_file}
214214
sed -i "s|^BOARD_TYPE=.*|BOARD_TYPE=diy|g" ${armbian_release_file}
215215
sed -i "s|^FORCE_BOOTSCRIPT_UPDATE=.*|FORCE_BOOTSCRIPT_UPDATE=\"no\"|g" ${armbian_release_file}
216216
sed -i "s|^BOOTSCRIPT_FORCE_UPDATE=.*|BOOTSCRIPT_FORCE_UPDATE=\"no\"|g" ${armbian_release_file}
217+
sed -i "s|^FORCE_UBOOT_UPDATE=.*|FORCE_UBOOT_UPDATE=\"no\"|g" ${armbian_release_file}
217218
tolog "85. Adjust custom board name: ${armbian_release_file}"
218219
}
219220

@@ -282,12 +283,10 @@ todo_rootfs_resize="/root/.no_rootfs_resize"
282283
}
283284

284285
# Hidd the IP address of WAN & IPv6
285-
[[ -f "/etc/update-motd.d/10-armbian-header" ]] && {
286-
# Hide the IP address of WAN
287-
sed -i 's|curl.*akamai.*|curl --connect-timeout 2 -s http://whatismyip.akamai.com/ \| sed -E '\''s/(\.[0-9]+){2}$/.\*\*\*\.\*\*\*/'\''|' \
288-
/etc/update-motd.d/10-armbian-header 2>/dev/null
289-
# Hide the IPv6 address
290-
sed -i '/echo -e "${all_ip6_address}"/s/^/#/' /etc/update-motd.d/10-armbian-header 2>/dev/null
286+
ip_info_file="/etc/update-motd.d/20-ip-info"
287+
[[ -f "${ip_info_file}" ]] && {
288+
sed -i '/^get_wan.*_address/s/{.*/{ true; }/' ${ip_info_file}
289+
sed -i '/if.*ipv6s.*||.*wan6/,/fi/s/^/#/' ${ip_info_file}
291290
tolog "93. Hide the IP address of WAN & IPv6"
292291
}
293292

rebuild

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,13 +1022,17 @@ refactor_rootfs() {
10221022
# Custom banner name
10231023
sed -i "s|^BOARD=.*|BOARD=\"${board}\"|g" ${armbian_release_file}
10241024
sed -i "s|^BOARD_NAME=.*|BOARD_NAME=\"${board}\"|g" ${armbian_release_file}
1025+
sed -i "s|^BOARDFAMILY=.*|BOARDFAMILY=\"${FAMILY}\"|g" ${armbian_release_file}
10251026
# Use custom type to remove [ No end-user support ] prompt in [ /etc/update-motd.d/10-armbian-header ]
1027+
sed -i "s|^BOOT_SOC=.*|BOOT_SOC=\"${SOC}\"|g" ${armbian_release_file}
10261028
sed -i "s|^IMAGE_TYPE=.*|IMAGE_TYPE=rebuild|g" ${armbian_release_file}
10271029
sed -i "s|^BOARD_TYPE=.*|BOARD_TYPE=diy|g" ${armbian_release_file}
10281030
sed -i "s|^VENDOR=.*|VENDOR=\"Armbian OS\"|g" ${armbian_release_file}
10291031
# Disable the update of the boot script
10301032
sed -i "s|^FORCE_BOOTSCRIPT_UPDATE=.*|FORCE_BOOTSCRIPT_UPDATE=\"no\"|g" ${armbian_release_file}
10311033
sed -i "s|^BOOTSCRIPT_FORCE_UPDATE=.*|FORCE_BOOTSCRIPT_UPDATE=\"no\"|g" ${armbian_release_file}
1034+
# Disable the update of the u-boot
1035+
sed -i "s|^FORCE_UBOOT_UPDATE=.*|FORCE_UBOOT_UPDATE=\"no\"|g" ${armbian_release_file}
10321036
}
10331037

10341038
# Add custom startup script
@@ -1055,7 +1059,7 @@ refactor_rootfs() {
10551059
# Disable tips of the day for [ /etc/update-motd.d/35-armbian-tips ]
10561060
motd_tips="etc/default/armbian-motd"
10571061
[[ -f "${motd_tips}" ]] && sed -i 's|^MOTD_DISABLE=.*|MOTD_DISABLE="tips"|g' ${motd_tips}
1058-
quotes_cron="etc/cron.weekly/armbian-quotes"
1062+
quotes_cron="etc/cron.daily/armbian-quotes"
10591063
[[ -f "${quotes_cron}" ]] && sed -i "s|^curl |#curl |g" ${quotes_cron}
10601064

10611065
# Add custom disabled alias extension load modules
@@ -1072,6 +1076,19 @@ refactor_rootfs() {
10721076
# Renaming/disabling related files
10731077
mv -f etc/udev/rules.d/hdmi.rules etc/udev/rules.d/hdmi.rules.bak 2>/dev/null
10741078

1079+
# Disable motd scripts
1080+
[[ -d "etc/update-motd.d" ]] && {
1081+
chmod -x etc/update-motd.d/*
1082+
chmod +x etc/update-motd.d/{10-*,20-*,30-*}
1083+
}
1084+
1085+
# Disable IP information display
1086+
ip_info_file="etc/update-motd.d/20-ip-info"
1087+
[[ -f "${ip_info_file}" ]] && {
1088+
sed -i '/^get_wan.*_address/s/{.*/{ true; }/' ${ip_info_file}
1089+
sed -i '/if.*ipv6s.*||.*wan6/,/fi/s/^/#/' ${ip_info_file}
1090+
}
1091+
10751092
# Explicitly disable resizing for Amlogic device [ /usr/lib/armbian/armbian-resize-filesystem ], use armbian-tf settings
10761093
echo "yes" >root/.no_rootfs_resize
10771094

0 commit comments

Comments
 (0)