Add --mirror option and curl timeout support
This commit is contained in:
@@ -35,6 +35,10 @@ usage() {
|
|||||||
Enabled by default for --ssh-upgrade
|
Enabled by default for --ssh-upgrade
|
||||||
--flash,-f DEVICE
|
--flash,-f DEVICE
|
||||||
Example: /dev/sdX
|
Example: /dev/sdX
|
||||||
|
--mirror PREFIX
|
||||||
|
Mirror prefix for feeds (default: github.com/openwrt)
|
||||||
|
--dl-timeout SECONDS
|
||||||
|
Per-file max download time for source builds (default: 300)
|
||||||
--depends
|
--depends
|
||||||
Force dependency installation
|
Force dependency installation
|
||||||
--yes,-y
|
--yes,-y
|
||||||
@@ -128,8 +132,8 @@ parse_input() {
|
|||||||
debug "${FUNCNAME[0]}" "$*"
|
debug "${FUNCNAME[0]}" "$*"
|
||||||
declare -ga PROFILES
|
declare -ga PROFILES
|
||||||
declare -gi RESET=0 YES=0 DEBUG=0 FORCE_DEPENDS=0 CPUS=0
|
declare -gi RESET=0 YES=0 DEBUG=0 FORCE_DEPENDS=0 CPUS=0
|
||||||
declare -g USER_RELEASE SSH_UPGRADE_PATH SSH_BACKUP_PATH FLASH_DEV USER_MODE USER_CLEAN
|
declare -g USER_RELEASE SSH_UPGRADE_PATH SSH_BACKUP_PATH FLASH_DEV USER_MODE USER_CLEAN USER_MIRROR USER_DL_TIMEOUT
|
||||||
local long_opts='release:,version:,profile:,buildroot:,cpus:,mode:,clean:'
|
local long_opts='release:,version:,profile:,buildroot:,cpus:,mode:,clean:,mirror:,dl-timeout:'
|
||||||
long_opts+='ssh-upgrade:,ssh-backup:,flash:,reset,depends,yes,debug,help'
|
long_opts+='ssh-upgrade:,ssh-backup:,flash:,reset,depends,yes,debug,help'
|
||||||
|
|
||||||
if _input=$(getopt -o +r:v:p:b:m:c:f:ydh -l $long_opts -- "$@"); then
|
if _input=$(getopt -o +r:v:p:b:m:c:f:ydh -l $long_opts -- "$@"); then
|
||||||
@@ -145,6 +149,8 @@ parse_input() {
|
|||||||
--ssh-upgrade) shift; SSH_UPGRADE_PATH="$1" ;;
|
--ssh-upgrade) shift; SSH_UPGRADE_PATH="$1" ;;
|
||||||
--ssh-backup) shift; SSH_BACKUP_PATH="$1" ;;
|
--ssh-backup) shift; SSH_BACKUP_PATH="$1" ;;
|
||||||
--flash|-f) shift; FLASH_DEV="$1" ;;
|
--flash|-f) shift; FLASH_DEV="$1" ;;
|
||||||
|
--mirror) shift; USER_MIRROR="$1" ;;
|
||||||
|
--dl-timeout) shift; USER_DL_TIMEOUT="$1" ;;
|
||||||
--reset) RESET=1 ;;
|
--reset) RESET=1 ;;
|
||||||
--depends) FORCE_DEPENDS=1 ;;
|
--depends) FORCE_DEPENDS=1 ;;
|
||||||
--yes|-y) YES=1 ;;
|
--yes|-y) YES=1 ;;
|
||||||
@@ -697,7 +703,8 @@ from_source() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Use a custom (faster) mirror
|
# Use a custom (faster) mirror
|
||||||
execute sed -i -E 's;git.openwrt.org/(feed|project);github.com/openwrt;' feeds.conf.default
|
local mirror_prefix="${USER_MIRROR:-github.com/openwrt}"
|
||||||
|
execute sed -i -E "s;git.openwrt.org/(feed|project);${mirror_prefix};" feeds.conf.default
|
||||||
|
|
||||||
# Update package feed
|
# Update package feed
|
||||||
./scripts/feeds update -a -f &&
|
./scripts/feeds update -a -f &&
|
||||||
@@ -736,7 +743,8 @@ from_source() {
|
|||||||
execute make "${make_opts[@]}" "-j1" defconfig
|
execute make "${make_opts[@]}" "-j1" defconfig
|
||||||
|
|
||||||
# Run serial make download for better reliability
|
# Run serial make download for better reliability
|
||||||
execute make "${make_opts[@]}" "-j1" download
|
# CURL_EXTRA_ARGS is picked up by OpenWRT's scripts/download.pl
|
||||||
|
CURL_EXTRA_ARGS="--max-time ${USER_DL_TIMEOUT:-300}" execute make "${make_opts[@]}" "-j1" download
|
||||||
|
|
||||||
# (Optional) Disable multicore make world
|
# (Optional) Disable multicore make world
|
||||||
# ((DEBUG)) && make_opts+=("-j1") || make_opts+=("-j$JOBS)")
|
# ((DEBUG)) && make_opts+=("-j1") || make_opts+=("-j$JOBS)")
|
||||||
|
|||||||
6
profiles
6
profiles
@@ -56,7 +56,8 @@ declare -Ag abby_router=(
|
|||||||
[target]="mediatek/filogic"
|
[target]="mediatek/filogic"
|
||||||
[filesystem]="squashfs"
|
[filesystem]="squashfs"
|
||||||
[packages]="${default_router[*]} \
|
[packages]="${default_router[*]} \
|
||||||
kmod-crypto-hw-safexcel kmod-leds-ws2812b kmod-mt7915e \
|
wpad-basic-mbedtls \
|
||||||
|
kmod-leds-ws2812b kmod-mt7915e \
|
||||||
kmod-mt7986-firmware mt7986-wo-firmware"
|
kmod-mt7986-firmware mt7986-wo-firmware"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -67,7 +68,8 @@ declare -Ag ax6000_uboot_ap=(
|
|||||||
[release]="snapshot"
|
[release]="snapshot"
|
||||||
[filesystem]="squashfs"
|
[filesystem]="squashfs"
|
||||||
[packages]="${default_ap[*]} \
|
[packages]="${default_ap[*]} \
|
||||||
kmod-crypto-hw-safexcel kmod-leds-ws2812b kmod-mt7915e \
|
wpad-basic-mbedtls \
|
||||||
|
kmod-leds-ws2812b kmod-mt7915e \
|
||||||
kmod-mt7986-firmware mt7986-wo-firmware"
|
kmod-mt7986-firmware mt7986-wo-firmware"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user