| @@ -1,16 +1,16 @@ | | | @@ -1,16 +1,16 @@ |
1 | #!/bin/sh | | 1 | #!/bin/sh |
2 | # | | 2 | # |
3 | # $NetBSD: fetch,v 1.16 2015/09/08 11:13:12 joerg Exp $ | | 3 | # $NetBSD: fetch,v 1.17 2015/09/08 12:37:56 joerg Exp $ |
4 | # | | 4 | # |
5 | # Copyright (c) 2006, 2015 The NetBSD Foundation, Inc. | | 5 | # Copyright (c) 2006, 2015 The NetBSD Foundation, Inc. |
6 | # All rights reserved. | | 6 | # All rights reserved. |
7 | # | | 7 | # |
8 | # This code is derived from software contributed to The NetBSD Foundation | | 8 | # This code is derived from software contributed to The NetBSD Foundation |
9 | # by Johnny C. Lam. | | 9 | # by Johnny C. Lam. |
10 | # | | 10 | # |
11 | # Redistribution and use in source and binary forms, with or without | | 11 | # Redistribution and use in source and binary forms, with or without |
12 | # modification, are permitted provided that the following conditions | | 12 | # modification, are permitted provided that the following conditions |
13 | # are met: | | 13 | # are met: |
14 | # 1. Redistributions of source code must retain the above copyright | | 14 | # 1. Redistributions of source code must retain the above copyright |
15 | # notice, this list of conditions and the following disclaimer. | | 15 | # notice, this list of conditions and the following disclaimer. |
16 | # 2. Redistributions in binary form must reproduce the above copyright | | 16 | # 2. Redistributions in binary form must reproduce the above copyright |
| @@ -58,28 +58,29 @@ | | | @@ -58,28 +58,29 @@ |
58 | # OPTIONS | | 58 | # OPTIONS |
59 | # -c Verify the checksum for the file. If the checksum | | 59 | # -c Verify the checksum for the file. If the checksum |
60 | # does not match, then the fetch is determined to be | | 60 | # does not match, then the fetch is determined to be |
61 | # not successful. | | 61 | # not successful. |
62 | # | | 62 | # |
63 | # -d dir Fetch the files into the specified directory. | | 63 | # -d dir Fetch the files into the specified directory. |
64 | # | | 64 | # |
65 | # -f distinfo | | 65 | # -f distinfo |
66 | # The path to the distinfo file containing the checksums | | 66 | # The path to the distinfo file containing the checksums |
67 | # for the file. The file format should match what is | | 67 | # for the file. The file format should match what is |
68 | # needed by the pkgsrc/mk/checksum/checksum script. | | 68 | # needed by the pkgsrc/mk/checksum/checksum script. |
69 | # | | 69 | # |
70 | # -p hook | | 70 | # -p hook |
71 | # After a successful fetch, run hook with the relative path | | 71 | # After a successful fetch, run hook. The first argument is |
72 | # as argument. | | 72 | # the relative path of the distfile and the second argument |
| | | 73 | # the full URL the file was obtained from. |
73 | # | | 74 | # |
74 | # -r Resume a previous fetch for the file. In this case, | | 75 | # -r Resume a previous fetch for the file. In this case, |
75 | # the file is first saved to a ".pkgsrc.resume" file, | | 76 | # the file is first saved to a ".pkgsrc.resume" file, |
76 | # and is later renamed to the final file name if the | | 77 | # and is later renamed to the final file name if the |
77 | # complete file has been sucessfully fetched. | | 78 | # complete file has been sucessfully fetched. |
78 | # | | 79 | # |
79 | # -v Show the actual command line used to fetch the file | | 80 | # -v Show the actual command line used to fetch the file |
80 | # from each site. | | 81 | # from each site. |
81 | # | | 82 | # |
82 | # ENVIRONMENT | | 83 | # ENVIRONMENT |
83 | # PKGSRCDIR This is a hint to help locate the default | | 84 | # PKGSRCDIR This is a hint to help locate the default |
84 | # checksum script. | | 85 | # checksum script. |
85 | # | | 86 | # |
| @@ -298,20 +299,20 @@ while ${TEST} $# -gt 0; do | | | @@ -298,20 +299,20 @@ while ${TEST} $# -gt 0; do |
298 | if verify_file -v $outputpath; then | | 299 | if verify_file -v $outputpath; then |
299 | ${TEST} -z "$resume" || ${MV} -f $outputpath $path | | 300 | ${TEST} -z "$resume" || ${MV} -f $outputpath $path |
300 | break | | 301 | break |
301 | fi | | 302 | fi |
302 | if ${TEST} -n "$resume"; then | | 303 | if ${TEST} -n "$resume"; then |
303 | if ${TEST} -f $path; then | | 304 | if ${TEST} -f $path; then |
304 | ${CP} -f $path $outputpath | | 305 | ${CP} -f $path $outputpath |
305 | else | | 306 | else |
306 | ${TOUCH} $outputpath | | 307 | ${TOUCH} $outputpath |
307 | fi | | 308 | fi |
308 | fi | | 309 | fi |
309 | done | | 310 | done |
310 | if ${TEST} -f $path && ${TEST} -n "$post_fetch"; then | | 311 | if ${TEST} -f $path && ${TEST} -n "$post_fetch"; then |
311 | "$post_fetch" $path | | 312 | "$post_fetch" $path "$url" |
312 | fi | | 313 | fi |
313 | if ${TEST} -f $path; then | | 314 | if ${TEST} -f $path; then |
314 | exit 0 | | 315 | exit 0 |
315 | else | | 316 | else |
316 | exit 1 | | 317 | exit 1 |
317 | fi | | 318 | fi |