| @@ -1,16 +1,16 @@ | | | @@ -1,16 +1,16 @@ |
1 | #!/bin/sh | | 1 | #!/bin/sh |
2 | # | | 2 | # |
3 | # $NetBSD: fetch,v 1.20 2020/08/27 11:45:45 jperkin Exp $ | | 3 | # $NetBSD: fetch,v 1.21 2021/12/16 14:10:46 schmonz 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 |
| @@ -218,30 +218,28 @@ verify_file() { | | | @@ -218,30 +218,28 @@ verify_file() { |
218 | return 0 | | 218 | return 0 |
219 | fi | | 219 | fi |
220 | return 0; | | 220 | return 0; |
221 | } | | 221 | } |
222 | | | 222 | |
223 | # If the file already exists and it verifies, then we don't need to fetch | | 223 | # If the file already exists and it verifies, then we don't need to fetch |
224 | # it again. | | 224 | # it again. |
225 | # | | 225 | # |
226 | if verify_file $path; then | | 226 | if verify_file $path; then |
227 | exit 0 | | 227 | exit 0 |
228 | fi | | 228 | fi |
229 | | | 229 | |
230 | ${TEST} -d $fetchdir || ${MKDIR} -p $fetchdir 2>/dev/null | | 230 | ${TEST} -d $fetchdir || ${MKDIR} -p $fetchdir 2>/dev/null |
231 | if ${TEST} ! -w $fetchdir; then | | 231 | |
232 | ${ECHO} 1>&2 "$self: Cannot write to `cd $fetchdir && pwd`" | | 232 | ${TEST} -w $fetchdir || ${ECHO} 1>&2 "$self: WARNING: DISTDIR `cd $fetchdir && pwd` looks non-writable." |
233 | exit 1 | | | |
234 | fi | | | |
235 | | | 233 | |
236 | # Set the name of the output file. In the "resume" case, we initialize | | 234 | # Set the name of the output file. In the "resume" case, we initialize |
237 | # the fetch loop by ensuring that the temporary output file already | | 235 | # the fetch loop by ensuring that the temporary output file already |
238 | # exists. | | 236 | # exists. |
239 | # | | 237 | # |
240 | outputfile="$file" | | 238 | outputfile="$file" |
241 | outputpath="$fetchdir/$outputfile" | | 239 | outputpath="$fetchdir/$outputfile" |
242 | if ${TEST} -n "$resume"; then | | 240 | if ${TEST} -n "$resume"; then |
243 | outputfile="${file}.pkgsrc.resume" | | 241 | outputfile="${file}.pkgsrc.resume" |
244 | outputpath="$fetchdir/$outputfile" | | 242 | outputpath="$fetchdir/$outputfile" |
245 | if ${TEST} ! -f $outputpath; then | | 243 | if ${TEST} ! -f $outputpath; then |
246 | if ${TEST} -f $path; then | | 244 | if ${TEST} -f $path; then |
247 | ${CP} -f $path $outputpath | | 245 | ${CP} -f $path $outputpath |