forked from Entware/Entware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdl_check.sh
executable file
·36 lines (31 loc) · 943 Bytes
/
dl_check.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
if [ -e .config ]; then
read -p 'Please note: .config will be rewriten during downloading! Press Ctrl+C to abort or Enter to continue' i
fi
for entware_target in $(ls -1 configs); do
echo "Checking $entware_target downloads..."
cp configs/$entware_target .config
for openwrt_target in tools toolchain target package; do
make -j4 $openwrt_target/download
if [ $? -ne 0 ]; then
echo "$openwrt_target downloads failed for $entware_target:("
exit 1
fi
done
done
mirrors="https://sources.openwrt.org
https://mirror2.openwrt.org/sources"
echo 'Creating upload mirror...'
mkdir -p dl.2upload
cp dl/* dl.2upload
echo 'Deduplicating local mirror...'
for src in $(ls -1 dl); do
for mirror in $mirrors; do
wget --quiet --spider $mirror/$src
if [ $? -eq 0 ]; then
echo "$src found @ $mirror"
rm -f "dl.2upload/$src"
break
fi
done
done