-
Notifications
You must be signed in to change notification settings - Fork 3
/
gnuradio-offline-install.bash
executable file
·62 lines (54 loc) · 1.61 KB
/
gnuradio-offline-install.bash
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
[ ! -f urls_file.txt ] && echo "Where is urls_list.txt?" && exit 1
DLD=/home/lanforge/Downloads
installed_list=()
already_downloaded_list=()
not_found_list=()
candidate_list=()
while read L; do
# echo "$L"
bzname=`basename $L`
short=${bzname%.fc30*}
if [[ x$short = x ]]; then
echo "bad substitution on $L"
continue
fi
echo -n "Looking for $short"
rez=`rpm -qa ${short}*`
# echo "result $?"
if [[ x$rez = x ]]; then
echo -n "$bzname is not installed"
if compgen -G "${DLD}/${bzname}"; then
echo " already downloaded"
already_downloaded_list+=($bzname);
else
wget -q -O "${DLD}/${bzname}" "$L"
if (( $? != 0 )); then
letterurl="${L%/*}/"
needle="${short:0:13}"
echo -n " need to look for ${letterurl}${needle} ..."
some_match=`curl -sq "${letterurl}" | grep -- "$needle"`
if (( $? != 0 )) || [[ x$some_match = x ]]; then
echo "Unable to find $short"
not_found_list+=("$L")
else
echo "possible candidate"
candidate_list+=("$some_match")
fi
fi
fi
fi
done < urls_file.txt
echo ""
echo "Installed list: "
printf "%s, " "${installed_list[@]}"
echo ""
echo "Already downloaded list: "
printf " %s\\n" "${already_downloaded_list[@]}"
echo ""
echo "Not found list: "
printf " %s\\n" "${not_found_list[@]}"
echo ""
echo "Candidate list: "
printf " %s\\n" "${candidate_list[@]}"
echo "done."