-
Notifications
You must be signed in to change notification settings - Fork 2
/
get_latest_isos_torrent.sh
executable file
·32 lines (29 loc) · 1.13 KB
/
get_latest_isos_torrent.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
#!/bin/bash
me=`basename $0`
lock="/tmp/$me.lock"
log="/var/log/get_iso.log"
base="/home/adidenko/iso/fuel/torrents"
suff="DOWNLOADING"
fuel_urls='
http://jenkins-product.srt.mirantis.net:8080/view/6.1/job/6.1.all/lastStableBuild/
http://jenkins-product.srt.mirantis.net:8080/view/7.0/job/7.0.all/lastStableBuild/
'
if [ -f "$lock" ] ; then
echo "Lock ( $lock ) exists, exiting" >> $log
exit 0;
else
touch "$lock"
for fuel_url in $fuel_urls; do
# Check/download
fuel_artifact_url=`curl -s "$fuel_url/api/json?tree=artifacts%5BrelativePath%5D&pretty=true" | grep relativePath | grep iso.data.txt | awk '{print $3}' | sed -e 's#"##g'`
fuel_download_torrent=`curl -s "$fuel_url/artifact/$fuel_artifact_url" | grep ^HTTP_TORRENT | cut -d= -f2`
fuel_iso_name=`echo $fuel_download_torrent | egrep -o 'fuel-.*\.iso'`
fuel_iso_torrent="${fuel_iso_name}.torrent"
echo $fuel_download_torrent
if [ ! -f "$base/$fuel_iso_torrent" ] ; then
wget -O "$base/$fuel_iso_torrent" "$fuel_download_torrent" -a /tmp/wget_fuel.log
/usr/bin/transmission-remote --auth transmission:transmission --add "$base/$fuel_iso_torrent"
fi
rm -f "$lock"
done
fi