mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-06-19 01:35:30 +08:00

* Revert "busybox: update to 1.33.2 bugfix release (#8386)" This reverts commit a6f79ace50b31f5970987043aad4583e5236d676. * busybox: fix compilation with GCC 10 When compiling busybox with GCC 10 and CONFIG_PKG_ASLR_PIE_ALL=y, there are hundreds of errors like: relocation R_MIPS16_26 against `xzalloc' cannot be used when making a shared object; recompile with -fPIC Simply solve this by no longer disabling PKG_ASLR_PIE, so that $(FPIC) is properly added to the CFLAGS and LDFLAGS. Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be> Acked-by: Hauke Mehrtens <hauke@hauke-m.de> * busybox: update to version 1.34.0 Update busybox to version 1.34.0 * Remove upstreamed patches (205, 530, 540) * Remove one old patch that does not apply any more. (203) That was originally introduced in 2008 with 563d23459, but does not apply after busybox restructuring with https://git.busybox.net/busybox/commit/networking/udhcp/dhcpc.c?h=1_34_stable&id=e6007c4911c3ea26925f9473b9f156a692585f30 and https://git.busybox.net/busybox/commit/networking/udhcp/dhcpc.c?h=1_34_stable&id=1c7253726fcbab09917f143f0b703efbd2df55c3 * Refresh config and patches. * Backport upstream fixes for - MIPS compilation breakage and - process substitution regression Config refresh: Refresh commands, run after busybox is first built once: cd utils/busybox/ cd config/ ../convert_menuconfig.pl ../../../../build_dir/target-aarch64_cortex-a53_musl/busybox-default/busybox-1.34.0 cd .. ./convert_defaults.pl < ../../../build_dir/target-aarch64_cortex-a53_musl/busybox-default/busybox-1.34.0/.config > Config-defaults.in Manual edits needed afterward: * Config-defaults.in: OpenWrt config symbol IPV6 logic applied to BUSYBOX_DEFAULT_FEATURE_IPV6 * Config-defaults.in: OpenWrt configTARGET_bcm53xx logic applied to BUSYBOX_DEFAULT_TRUNCATE (commit 547f1ec) * Config-defaults.in: OpenWrt logic applied to BUSYBOX_DEFAULT_LOGIN_SESSION_AS_CHILD (commit dc92917) BUSYBOX_DEFAULT_UDHCPC_DEFAULT_INTERFACE (just "") * config/editors/Config.in: Add USE_GLIBC dependency to BUSYBOX_CONFIG_FEATURE_VI_REGEX_SEARCH (commit f141090) * config/shell/Config.in : change at "Options common to all shells" the symbol SHELL_ASH --> BUSYBOX_CONFIG_SHELL_ASH (discussion in http://lists.openwrt.org/pipermail/openwrt-devel/2021-January/033140.html Apparently our script does not see the hidden option while prepending config options with "BUSYBOX_CONFIG_" which leads to a missed dependency when the options are later evaluated.) * Edit Config.in files by adding quotes to sourced items in config/Config.in, config/networking/Config.in and config/util-linux/Config.in (commit 1da014f) Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi> * busybox: update to 1.34.1 Update busybox to version 1.34.1, which is a minor maintenance release. It contains just the two post-1.34.0 upstream patches that we earlier backported plus a few fixes to awk. * Remove the two backported upstream patches that are now unnecessary. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi> * busybox: fix compatibility with BUSYBOX_CONFIG_INSTALL_NO_USR Signed-off-by: aakkll <94471752+aakkll@users.noreply.github.com> * busybox: update to 1.35.0 Update busybox to 1.35.0 * refresh patches Config refresh: Refresh commands, run after busybox is first built once: cd package/utils/busybox/config/ ../convert_menuconfig.pl ../../../../build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/busybox-default/busybox-1.35.0 cd .. ./convert_defaults.pl ../../../build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/busybox-default/busybox-1.35.0/.config > Config-defaults.in Manual edits needed after config refresh: * Config-defaults.in: OpenWrt config symbol IPV6 logic applied to BUSYBOX_DEFAULT_FEATURE_IPV6 * Config-defaults.in: OpenWrt configTARGET_bcm53xx logic applied to BUSYBOX_DEFAULT_TRUNCATE (commit 547f1ec) * Config-defaults.in: OpenWrt logic applied to BUSYBOX_DEFAULT_LOGIN_SESSION_AS_CHILD (commit dc92917) * config/editors/Config.in: Add USE_GLIBC dependency to BUSYBOX_CONFIG_FEATURE_VI_REGEX_SEARCH (commit f141090) * config/shell/Config.in : change at "Options common to all shells" the symbol SHELL_ASH --> BUSYBOX_CONFIG_SHELL_ASH (discussion in http://lists.openwrt.org/pipermail/openwrt-devel/2021-January/033140.html Apparently our script does not see the hidden option while prepending config options with "BUSYBOX_CONFIG_" which leads to a missed dependency when the options are later evaluated.) * Edit Config.in files by adding quotes to sourced items in config/Config.in, config/networking/Config.in and config/util-linux/Config.in (commit 1da014f) Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi> Co-authored-by: Stijn Tintel <stijn@linux-ipv6.be> Co-authored-by: Hannu Nyman <hannu.nyman@iki.fi> Co-authored-by: Marius Dinu <m95d+git@psihoexpert.ro>
131 lines
3.1 KiB
Bash
Executable File
131 lines
3.1 KiB
Bash
Executable File
#!/bin/sh /etc/rc.common
|
|
# Copyright (C) 2011 OpenWrt.org
|
|
|
|
START=98
|
|
|
|
USE_PROCD=1
|
|
PROG=ntpd
|
|
HOTPLUG_SCRIPT=/usr/sbin/ntpd-hotplug
|
|
|
|
get_dhcp_ntp_servers() {
|
|
local interfaces="$1"
|
|
local filter="*"
|
|
local interface ntpservers ntpserver
|
|
|
|
for interface in $interfaces; do
|
|
[ "$filter" = "*" ] && filter="@.interface='$interface'" || filter="$filter,@.interface='$interface'"
|
|
done
|
|
|
|
ntpservers=$(ubus call network.interface dump | jsonfilter -e "@.interface[$filter]['data']['ntpserver']")
|
|
|
|
for ntpserver in $ntpservers; do
|
|
local duplicate=0
|
|
local entry
|
|
for entry in $server; do
|
|
[ "$ntpserver" = "$entry" ] && duplicate=1
|
|
done
|
|
[ "$duplicate" = 0 ] && server="$server $ntpserver"
|
|
done
|
|
}
|
|
|
|
validate_ntp_section() {
|
|
uci_load_validate system timeserver "$1" "$2" \
|
|
'dhcp_interface:list(string)' \
|
|
'enable_server:bool:0' \
|
|
'enabled:bool:1' \
|
|
'interface:string' \
|
|
'server:list(host)' \
|
|
'use_dhcp:bool:1'
|
|
}
|
|
|
|
start_ntpd_instance() {
|
|
local peer
|
|
|
|
[ "$2" = 0 ] || {
|
|
echo "validation failed"
|
|
return 1
|
|
}
|
|
|
|
[ $enabled = 0 ] && return
|
|
|
|
[ $use_dhcp = 1 ] && get_dhcp_ntp_servers "$dhcp_interface"
|
|
|
|
[ -z "$server" -a "$enable_server" = "0" ] && return
|
|
|
|
procd_open_instance
|
|
procd_set_param command "$PROG" -n -N
|
|
if [ "$enable_server" = "1" ]; then
|
|
procd_append_param command -l
|
|
[ -n "$interface" ] && {
|
|
local ifname
|
|
|
|
network_get_device ifname "$interface" || \
|
|
ifname="$interface"
|
|
procd_append_param command -I "$ifname"
|
|
procd_append_param netdev "$ifname"
|
|
}
|
|
fi
|
|
[ -x "$HOTPLUG_SCRIPT" ] && procd_append_param command -S "$HOTPLUG_SCRIPT"
|
|
for peer in $server; do
|
|
procd_append_param command -p $peer
|
|
done
|
|
procd_set_param respawn
|
|
[ -x /sbin/ujail -a -e /etc/capabilities/ntpd.json ] && {
|
|
procd_add_jail ntpd ubus
|
|
procd_add_jail_mount "$HOTPLUG_SCRIPT"
|
|
procd_add_jail_mount "/usr/share/libubox/jshn.sh"
|
|
procd_add_jail_mount "/usr/bin/env"
|
|
procd_add_jail_mount "/usr/bin/jshn"
|
|
procd_add_jail_mount "/bin/ubus"
|
|
procd_set_param capabilities /etc/capabilities/ntpd.json
|
|
procd_set_param user ntp
|
|
procd_set_param group ntp
|
|
procd_set_param no_new_privs 1
|
|
}
|
|
procd_close_instance
|
|
}
|
|
|
|
start_service() {
|
|
. /lib/functions/network.sh
|
|
validate_ntp_section ntp start_ntpd_instance
|
|
}
|
|
|
|
service_triggers() {
|
|
local script name use_dhcp enable_server interface
|
|
|
|
script=$(readlink -f "$initscript")
|
|
name=$(basename ${script:-$initscript})
|
|
|
|
procd_add_config_trigger "config.change" "system" /etc/init.d/$name reload
|
|
|
|
config_load system
|
|
config_get use_dhcp ntp use_dhcp 1
|
|
|
|
[ $use_dhcp = 1 ] && {
|
|
local dhcp_interface
|
|
config_get dhcp_interface ntp dhcp_interface
|
|
|
|
if [ -n "$dhcp_interface" ]; then
|
|
for n in $dhcp_interface; do
|
|
procd_add_interface_trigger "interface.*" $n /etc/init.d/$name reload
|
|
done
|
|
else
|
|
procd_add_raw_trigger "interface.*" 1000 /etc/init.d/$name reload
|
|
fi
|
|
}
|
|
|
|
config_get_bool enable_server ntp enable_server 0
|
|
config_get interface ntp interface
|
|
|
|
[ $enable_server -eq 1 ] && [ -n "$interface" ] && {
|
|
local ifname
|
|
|
|
network_get_device ifname "$interface" || \
|
|
ifname="$interface"
|
|
procd_add_interface_trigger "interface.*" "$ifname" \
|
|
/etc/init.d/"$name" reload
|
|
}
|
|
|
|
procd_add_validation validate_ntp_section
|
|
}
|