| @@ -1,16 +1,16 @@ | | | @@ -1,16 +1,16 @@ |
1 | #!/bin/sh | | 1 | #!/bin/sh |
2 | # | | 2 | # |
3 | # $NetBSD: fetch,v 1.11 2008/12/14 14:09:32 rillig Exp $ | | 3 | # $NetBSD: fetch,v 1.12 2008/12/15 09:01:30 taca Exp $ |
4 | # | | 4 | # |
5 | # Copyright (c) 2006 The NetBSD Foundation, Inc. | | 5 | # Copyright (c) 2006 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 |
| @@ -194,28 +194,26 @@ fi | | | @@ -194,28 +194,26 @@ fi |
194 | # checksums in the distinfo file. If we can check the size, then | | 194 | # checksums in the distinfo file. If we can check the size, then |
195 | # check that instead. We strip off ".pkgsrc.resume" from the | | 195 | # check that instead. We strip off ".pkgsrc.resume" from the |
196 | # filename so that we can verify the checksum for the temporary | | 196 | # filename so that we can verify the checksum for the temporary |
197 | # fetch file as well. | | 197 | # fetch file as well. |
198 | # | | 198 | # |
199 | verify_file() { | | 199 | verify_file() { |
200 | _if_verbose=:; if [ "x$1" = "x-v" ]; then shift; _if_verbose=; fi | | 200 | _if_verbose=:; if [ "x$1" = "x-v" ]; then shift; _if_verbose=; fi |
201 | _file="${1#./}" | | 201 | _file="${1#./}" |
202 | ${TEST} -f $_file || { | | 202 | ${TEST} -f $_file || { |
203 | $_if_verbose ${ECHO} 1>&2 "$self: File $_file does not exist." | | 203 | $_if_verbose ${ECHO} 1>&2 "$self: File $_file does not exist." |
204 | return 1 | | 204 | return 1 |
205 | } | | 205 | } |
206 | if ${TEST} -n "$checksum"; then | | 206 | if ${TEST} -n "$checksum"; then |
207 | echo "foo" | | | |
208 | read line | | | |
209 | ${CHECKSUM} -s ".pkgsrc.resume" $distinfo ${_file} || { | | 207 | ${CHECKSUM} -s ".pkgsrc.resume" $distinfo ${_file} || { |
210 | $_if_verbose ${ECHO} 1>&2 "$self: Checksum of the file $_file doesn't match." | | 208 | $_if_verbose ${ECHO} 1>&2 "$self: Checksum of the file $_file doesn't match." |
211 | return 1 | | 209 | return 1 |
212 | } | | 210 | } |
213 | return 0 | | 211 | return 0 |
214 | elif ${TEST} -n "$distsize"; then | | 212 | elif ${TEST} -n "$distsize"; then |
215 | _size=`${WC} -c < $_file` | | 213 | _size=`${WC} -c < $_file` |
216 | ${TEST} "$_size" -eq "$distsize" || { | | 214 | ${TEST} "$_size" -eq "$distsize" || { |
217 | $_if_verbose ${ECHO} 1>&2 "$self: Size of the file $_file doesn't match." | | 215 | $_if_verbose ${ECHO} 1>&2 "$self: Size of the file $_file doesn't match." |
218 | return 1 | | 216 | return 1 |
219 | } | | 217 | } |
220 | return 0 | | 218 | return 0 |
221 | fi | | 219 | fi |