index : al32-torrent | |
Archlinux32 iso to torrent tools - obsolete | gitolite user |
summaryrefslogtreecommitdiff |
-rwxr-xr-x | al32-mktorrent.sh | 17 |
diff --git a/al32-mktorrent.sh b/al32-mktorrent.sh index 6c01aff..2ed7aaf 100755 --- a/al32-mktorrent.sh +++ b/al32-mktorrent.sh @@ -51,16 +51,18 @@ function create_torrent_for_arch () { iso_string="archlinux-$iso_date-$arch.iso" - for i in $mirrorlist ; do + for i in "${available_mirrors[@]}"; do echo -n -e "$fg_reset${fg_bold}Checking $fg_reset$fg_blue$i$fg_reset " - curl --connect-timeout 10 -g "$i" 2>/dev/null | grep -q "$iso_string" && ( + curl --connect-timeout 10 -g "$i" 2>/dev/null | grep -qF "$iso_string" && ( echo -e "$fg_reset${fg_green}OK$fg_reset" ) || ( echo -e "$fg_reset${fg_red}Failed$fg_reset" ; false ) || continue available_mirrors=(${available_mirrors[@]} "$i") done echo "${#available_mirrors[@]} mirrors available" - + if [ ${#available_mirrors[@]} -eq 0 ]; then + available_mirrors=($mirrorlist) + fi if [ ! -f "$iso_string" ] ; then echo -e "$fg_reset${fg_bold}Downloading iso...$fg_reset" @@ -71,8 +73,12 @@ function create_torrent_for_arch () { echo -e "$fg_reset${fg_bold}Downloading verification files...$fg_reset" - curl -O "${available_mirrors[0]}$iso_string.sig" - curl -O "${available_mirrors[0]}sha512sums" + if [ ! -f "$iso_string.sig" ] ; then + curl -O "${available_mirrors[0]}$iso_string.sig" + fi + if [ ! -f "sha512sums" ] ; then + curl -O "${available_mirrors[0]}sha512sums" + fi echo -n -e "$fg_reset${fg_bold}Checking PGP signature...$fg_reset " gpg --verify "$iso_string.sig" "$iso_string" || exit 100 @@ -89,6 +95,7 @@ function create_torrent_for_arch () { echo -e "$fg_reset${fg_bold}Create magnet link...$fg_reset" magnet_link="$(transmission-show --magnet "$iso_string.torrent")" + "${0%/*}/update-website" --magnet-"$arch" "$magnet_link" echo "$magnet_link" echo -e "$fg_reset${fg_bold}Create RSS feed files...$fg_reset" |