Mercurial > hg > aboriginal
annotate sources/download_functions.sh @ 1515:63d3f491b92f
Make tarball extract failure detection not rely on "kill" command.
Propogating exit status up from a subshell in a pipeline continues to be fiddly.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sat, 24 Mar 2012 20:29:50 -0500 |
parents | d398569effd2 |
children | 90e6bdb0204b |
rev | line source |
---|---|
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
1 #!/bin/echo "This file is sourced, not run" |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 |
1257
1461d20bb6a7
Genericize the noversion() regex a bit, and make sure to only apply patches in the sources/patches directory that end in ".patch".
Rob Landley <rob@landley.net>
parents:
1253
diff
changeset
|
3 # Remove version information and extension tarball name "$1". |
1461d20bb6a7
Genericize the noversion() regex a bit, and make sure to only apply patches in the sources/patches directory that end in ".patch".
Rob Landley <rob@landley.net>
parents:
1253
diff
changeset
|
4 # If "$2", add that version number back, keeping original extension. |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
5 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
6 noversion() |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
7 { |
1257
1461d20bb6a7
Genericize the noversion() regex a bit, and make sure to only apply patches in the sources/patches directory that end in ".patch".
Rob Landley <rob@landley.net>
parents:
1253
diff
changeset
|
8 LOGRUS='s/-*\(\([0-9\.]\)*\([_-]rc\)*\(-pre\)*\([0-9][a-zA-Z]\)*\)*\(\.tar\(\..z2*\)*\)$' |
1461d20bb6a7
Genericize the noversion() regex a bit, and make sure to only apply patches in the sources/patches directory that end in ".patch".
Rob Landley <rob@landley.net>
parents:
1253
diff
changeset
|
9 [ -z "$2" ] && LOGRUS="$LOGRUS//" || LOGRUS="$LOGRUS/$2\\6/" |
1461d20bb6a7
Genericize the noversion() regex a bit, and make sure to only apply patches in the sources/patches directory that end in ".patch".
Rob Landley <rob@landley.net>
parents:
1253
diff
changeset
|
10 |
1461d20bb6a7
Genericize the noversion() regex a bit, and make sure to only apply patches in the sources/patches directory that end in ".patch".
Rob Landley <rob@landley.net>
parents:
1253
diff
changeset
|
11 echo "$1" | sed -e "$LOGRUS" |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
12 } |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
13 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
14 # Apply any patches to this package |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
15 patch_package() |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
16 { |
1257
1461d20bb6a7
Genericize the noversion() regex a bit, and make sure to only apply patches in the sources/patches directory that end in ".patch".
Rob Landley <rob@landley.net>
parents:
1253
diff
changeset
|
17 ls "$PATCHDIR/${PACKAGE}"-*.patch 2> /dev/null | sort | while read i |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
18 do |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
19 if [ -f "$i" ] |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
20 then |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
21 echo "Applying $i" |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
22 (cd "${SRCTREE}/${PACKAGE}" && |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
23 patch -p1 -i "$i" && |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
24 sha1file "$i" >> "$SHA1FILE") || |
1418
f2f1238d25e2
Actually stop after the first failed patch.
Rob Landley <rob@landley.net>
parents:
1416
diff
changeset
|
25 if [ -z "$ALLOW_PATCH_FAILURE" ] |
f2f1238d25e2
Actually stop after the first failed patch.
Rob Landley <rob@landley.net>
parents:
1416
diff
changeset
|
26 then |
f2f1238d25e2
Actually stop after the first failed patch.
Rob Landley <rob@landley.net>
parents:
1416
diff
changeset
|
27 dienow |
f2f1238d25e2
Actually stop after the first failed patch.
Rob Landley <rob@landley.net>
parents:
1416
diff
changeset
|
28 fi |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
29 fi |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
30 done |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
31 } |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
32 |
1300
a80d7f256ff9
Handle package tarballs with overlapping names (thingy and thingy-test for example).
Rob Landley <rob@landley.net>
parents:
1257
diff
changeset
|
33 # Get the tarball for this package |
a80d7f256ff9
Handle package tarballs with overlapping names (thingy and thingy-test for example).
Rob Landley <rob@landley.net>
parents:
1257
diff
changeset
|
34 |
a80d7f256ff9
Handle package tarballs with overlapping names (thingy and thingy-test for example).
Rob Landley <rob@landley.net>
parents:
1257
diff
changeset
|
35 find_package_tarball() |
a80d7f256ff9
Handle package tarballs with overlapping names (thingy and thingy-test for example).
Rob Landley <rob@landley.net>
parents:
1257
diff
changeset
|
36 { |
a80d7f256ff9
Handle package tarballs with overlapping names (thingy and thingy-test for example).
Rob Landley <rob@landley.net>
parents:
1257
diff
changeset
|
37 # If there are multiple similar files we want the newest timestamp, in case |
a80d7f256ff9
Handle package tarballs with overlapping names (thingy and thingy-test for example).
Rob Landley <rob@landley.net>
parents:
1257
diff
changeset
|
38 # the URL just got upgraded but cleanup_oldfiles hasn't run yet. Be able to |
a80d7f256ff9
Handle package tarballs with overlapping names (thingy and thingy-test for example).
Rob Landley <rob@landley.net>
parents:
1257
diff
changeset
|
39 # distinguish "package-123.tar.bz2" from "package-tests-123.tar.bz2" and |
a80d7f256ff9
Handle package tarballs with overlapping names (thingy and thingy-test for example).
Rob Landley <rob@landley.net>
parents:
1257
diff
changeset
|
40 # return the shorter one reliably. |
a80d7f256ff9
Handle package tarballs with overlapping names (thingy and thingy-test for example).
Rob Landley <rob@landley.net>
parents:
1257
diff
changeset
|
41 |
a80d7f256ff9
Handle package tarballs with overlapping names (thingy and thingy-test for example).
Rob Landley <rob@landley.net>
parents:
1257
diff
changeset
|
42 ls -tc "$SRCDIR/$1-"*.tar* 2>/dev/null | while read i |
a80d7f256ff9
Handle package tarballs with overlapping names (thingy and thingy-test for example).
Rob Landley <rob@landley.net>
parents:
1257
diff
changeset
|
43 do |
a80d7f256ff9
Handle package tarballs with overlapping names (thingy and thingy-test for example).
Rob Landley <rob@landley.net>
parents:
1257
diff
changeset
|
44 if [ "$(noversion "${i/*\//}")" == "$1" ] |
a80d7f256ff9
Handle package tarballs with overlapping names (thingy and thingy-test for example).
Rob Landley <rob@landley.net>
parents:
1257
diff
changeset
|
45 then |
a80d7f256ff9
Handle package tarballs with overlapping names (thingy and thingy-test for example).
Rob Landley <rob@landley.net>
parents:
1257
diff
changeset
|
46 echo "$i" |
a80d7f256ff9
Handle package tarballs with overlapping names (thingy and thingy-test for example).
Rob Landley <rob@landley.net>
parents:
1257
diff
changeset
|
47 break |
a80d7f256ff9
Handle package tarballs with overlapping names (thingy and thingy-test for example).
Rob Landley <rob@landley.net>
parents:
1257
diff
changeset
|
48 fi |
a80d7f256ff9
Handle package tarballs with overlapping names (thingy and thingy-test for example).
Rob Landley <rob@landley.net>
parents:
1257
diff
changeset
|
49 done |
a80d7f256ff9
Handle package tarballs with overlapping names (thingy and thingy-test for example).
Rob Landley <rob@landley.net>
parents:
1257
diff
changeset
|
50 } |
a80d7f256ff9
Handle package tarballs with overlapping names (thingy and thingy-test for example).
Rob Landley <rob@landley.net>
parents:
1257
diff
changeset
|
51 |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
52 # Extract tarball named in $1 and apply all relevant patches into |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
53 # "$BUILD/packages/$1". Record sha1sum of tarball and patch files in |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
54 # sha1-for-source.txt. Re-extract if tarball or patches change. |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
55 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
56 extract_package() |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
57 { |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
58 mkdir -p "$SRCTREE" || dienow |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
59 |
1461
ad5303b6d35a
Switch USE_UNSTABLE to USE_ALT and download.sh's UNSTABLE= to ALT= so naming is consistent with the alt- prefixes on packages and patches.
Rob Landley <rob@landley.net>
parents:
1418
diff
changeset
|
60 # Figure out whether we're using an alternative version of a package. |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
61 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
62 PACKAGE="$1" |
1461
ad5303b6d35a
Switch USE_UNSTABLE to USE_ALT and download.sh's UNSTABLE= to ALT= so naming is consistent with the alt- prefixes on packages and patches.
Rob Landley <rob@landley.net>
parents:
1418
diff
changeset
|
63 is_in_list "$PACKAGE" $USE_ALT && PACKAGE=alt-"$PACKAGE" |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
64 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
65 # Announce to the world that we're cracking open a new package |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
66 |
1358
9252453c40d0
Combine set_titlebar and "echo ===" stuff into announce() function. Consistently output target/stage info, and yank redundant instances.
Rob Landley <rob@landley.net>
parents:
1335
diff
changeset
|
67 announce "$PACKAGE" |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
68 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
69 # Find tarball, and determine type |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
70 |
1300
a80d7f256ff9
Handle package tarballs with overlapping names (thingy and thingy-test for example).
Rob Landley <rob@landley.net>
parents:
1257
diff
changeset
|
71 FILENAME="$(find_package_tarball "$PACKAGE")" |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
72 DECOMPRESS="" |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
73 [ "$FILENAME" != "${FILENAME/%\.tar\.bz2/}" ] && DECOMPRESS="j" |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
74 [ "$FILENAME" != "${FILENAME/%\.tar\.gz/}" ] && DECOMPRESS="z" |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
75 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
76 # If the source tarball doesn't exist, but the extracted directory is there, |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
77 # assume everything's ok. |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
78 |
1515
63d3f491b92f
Make tarball extract failure detection not rely on "kill" command.
Rob Landley <rob@landley.net>
parents:
1486
diff
changeset
|
79 SHA1NAME="sha1-for-source.txt" |
63d3f491b92f
Make tarball extract failure detection not rely on "kill" command.
Rob Landley <rob@landley.net>
parents:
1486
diff
changeset
|
80 SHA1FILE="$SRCTREE/$PACKAGE/$SHA1NAME" |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
81 if [ -z "$FILENAME" ] |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
82 then |
1257
1461d20bb6a7
Genericize the noversion() regex a bit, and make sure to only apply patches in the sources/patches directory that end in ".patch".
Rob Landley <rob@landley.net>
parents:
1253
diff
changeset
|
83 if [ ! -e "$SRCTREE/$PACKAGE" ] |
1461d20bb6a7
Genericize the noversion() regex a bit, and make sure to only apply patches in the sources/patches directory that end in ".patch".
Rob Landley <rob@landley.net>
parents:
1253
diff
changeset
|
84 then |
1461d20bb6a7
Genericize the noversion() regex a bit, and make sure to only apply patches in the sources/patches directory that end in ".patch".
Rob Landley <rob@landley.net>
parents:
1253
diff
changeset
|
85 echo "No tarball for $PACKAGE" >&2 |
1461d20bb6a7
Genericize the noversion() regex a bit, and make sure to only apply patches in the sources/patches directory that end in ".patch".
Rob Landley <rob@landley.net>
parents:
1253
diff
changeset
|
86 dienow |
1461d20bb6a7
Genericize the noversion() regex a bit, and make sure to only apply patches in the sources/patches directory that end in ".patch".
Rob Landley <rob@landley.net>
parents:
1253
diff
changeset
|
87 fi |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
88 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
89 # If the sha1sum file isn't there, re-patch the package. |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
90 [ ! -e "$SHA1FILE" ] && patch_package |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
91 return 0 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
92 fi |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
93 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
94 # Check the sha1 list from the previous extract. If the source is already |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
95 # up to date (including patches), keep it. |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
96 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
97 SHA1TAR="$(sha1file "$FILENAME")" |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
98 SHALIST=$(cat "$SHA1FILE" 2> /dev/null) |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
99 if [ ! -z "$SHALIST" ] |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
100 then |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
101 for i in "$SHA1TAR" $(sha1file "$PATCHDIR/$PACKAGE"-* 2>/dev/null) |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
102 do |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
103 # Is this sha1 in the file? |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
104 if [ -z "$(echo "$SHALIST" | sed -n "s/$i/$i/p" )" ] |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
105 then |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
106 SHALIST=missing |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
107 break |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
108 fi |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
109 # Remove it |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
110 SHALIST="$(echo "$SHALIST" | sed "s/$i//" )" |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
111 done |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
112 # If we matched all the sha1sums, nothing more to do. |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
113 [ -z "$SHALIST" ] && return 0 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
114 fi |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
115 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
116 # Re-extract the package, deleting the old one (if any).. |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
117 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
118 echo -n "Extracting '$PACKAGE'" |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
119 ( |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
120 UNIQUE=$(readlink /proc/self) |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
121 trap 'rm -rf "$BUILD/temp-'$UNIQUE'"' EXIT |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
122 rm -rf "$SRCTREE/$PACKAGE" 2>/dev/null |
1410
7373c4c7ecee
Don't create build/packages _and_ $SRCTREE, they should be the same and when they aren't the first is wrong.
Rob Landley <rob@landley.net>
parents:
1358
diff
changeset
|
123 mkdir -p "$BUILD/temp-$UNIQUE" "$SRCTREE" || dienow |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
124 |
1515
63d3f491b92f
Make tarball extract failure detection not rely on "kill" command.
Rob Landley <rob@landley.net>
parents:
1486
diff
changeset
|
125 { tar -xv${DECOMPRESS} -f "$FILENAME" -C "$BUILD/temp-$UNIQUE" && |
63d3f491b92f
Make tarball extract failure detection not rely on "kill" command.
Rob Landley <rob@landley.net>
parents:
1486
diff
changeset
|
126 # Wildcards only expand when they ponit to something that exists, |
63d3f491b92f
Make tarball extract failure detection not rely on "kill" command.
Rob Landley <rob@landley.net>
parents:
1486
diff
changeset
|
127 # and even then they have to be an argument to a command. |
63d3f491b92f
Make tarball extract failure detection not rely on "kill" command.
Rob Landley <rob@landley.net>
parents:
1486
diff
changeset
|
128 TARDIR="$(readlink -f "$BUILD/temp-$UNIQUE"/*)" && |
63d3f491b92f
Make tarball extract failure detection not rely on "kill" command.
Rob Landley <rob@landley.net>
parents:
1486
diff
changeset
|
129 touch "$TARDIR/$SHA1NAME" |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
130 } | dotprogress |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
131 |
1515
63d3f491b92f
Make tarball extract failure detection not rely on "kill" command.
Rob Landley <rob@landley.net>
parents:
1486
diff
changeset
|
132 [ -e "$BUILD/temp-$UNIQUE"/*/"$SHA1NAME" ] && |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
133 mv "$BUILD/temp-$UNIQUE/"* "$SRCTREE/$PACKAGE" && |
1515
63d3f491b92f
Make tarball extract failure detection not rely on "kill" command.
Rob Landley <rob@landley.net>
parents:
1486
diff
changeset
|
134 echo "$SHA1TAR" >> "$SHA1FILE" |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
135 ) |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
136 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
137 [ $? -ne 0 ] && dienow |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
138 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
139 patch_package |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
140 } |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
141 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
142 # Confirm that a file has the appropriate checksum (or exists but SHA1 is blank) |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
143 # Delete invalid file. |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
144 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
145 confirm_checksum() |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
146 { |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
147 SUM="$(sha1file "$SRCDIR/$FILENAME" 2>/dev/null)" |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
148 if [ x"$SUM" == x"$SHA1" ] || [ -z "$SHA1" ] && [ -f "$SRCDIR/$FILENAME" ] |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
149 then |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
150 if [ -z "$SHA1" ] |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
151 then |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
152 echo "No SHA1 for $FILENAME ($SUM)" |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
153 else |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
154 echo "Confirmed $FILENAME" |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
155 fi |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
156 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
157 # Preemptively extract source packages? |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
158 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
159 [ -z "$EXTRACT_ALL" ] && return 0 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
160 extract_package "$BASENAME" |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
161 return $? |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
162 fi |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
163 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
164 # If there's a corrupted file, delete it. In theory it would be nice |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
165 # to resume downloads, but wget creates "*.1" files instead. |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
166 |
1486 | 167 rm -f "$SRCDIR/$FILENAME" |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
168 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
169 return 1 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
170 } |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
171 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
172 # Attempt to obtain file from a specific location |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
173 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
174 download_from() |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
175 { |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
176 # Return success if we already have a valid copy of the file |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
177 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
178 confirm_checksum && return 0 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
179 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
180 # If we have another source, try to download file from there. |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
181 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
182 [ -z "$1" ] && return 1 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
183 wget -t 2 -T 20 -O "$SRCDIR/$FILENAME" "$1" || |
1486 | 184 (rm -f "$SRCDIR/$FILENAME"; return 2) |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
185 touch -c "$SRCDIR/$FILENAME" |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
186 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
187 confirm_checksum |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
188 } |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
189 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
190 # Confirm a file matches sha1sum, else try to download it from mirror list. |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
191 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
192 download() |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
193 { |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
194 FILENAME=`echo "$URL" | sed 's .*/ '` |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
195 [ -z "$RENAME" ] || FILENAME="$(echo "$FILENAME" | sed -r "$RENAME")" |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
196 ALTFILENAME=alt-"$(noversion "$FILENAME" -0)" |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
197 |
1335
ffb07a48a960
If sha1sum isn't installed, download falls back through all the mirrors repeatedly downloading stuff, without explaining why it failed.
Rob Landley <rob@landley.net>
parents:
1300
diff
changeset
|
198 if [ -z "$(sha1sum < /dev/null)" ] |
ffb07a48a960
If sha1sum isn't installed, download falls back through all the mirrors repeatedly downloading stuff, without explaining why it failed.
Rob Landley <rob@landley.net>
parents:
1300
diff
changeset
|
199 then |
ffb07a48a960
If sha1sum isn't installed, download falls back through all the mirrors repeatedly downloading stuff, without explaining why it failed.
Rob Landley <rob@landley.net>
parents:
1300
diff
changeset
|
200 echo "Error: please install sha1sum" >&2 |
ffb07a48a960
If sha1sum isn't installed, download falls back through all the mirrors repeatedly downloading stuff, without explaining why it failed.
Rob Landley <rob@landley.net>
parents:
1300
diff
changeset
|
201 exit 1 |
ffb07a48a960
If sha1sum isn't installed, download falls back through all the mirrors repeatedly downloading stuff, without explaining why it failed.
Rob Landley <rob@landley.net>
parents:
1300
diff
changeset
|
202 fi |
ffb07a48a960
If sha1sum isn't installed, download falls back through all the mirrors repeatedly downloading stuff, without explaining why it failed.
Rob Landley <rob@landley.net>
parents:
1300
diff
changeset
|
203 |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
204 echo -ne "checking $FILENAME\r" |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
205 |
1461
ad5303b6d35a
Switch USE_UNSTABLE to USE_ALT and download.sh's UNSTABLE= to ALT= so naming is consistent with the alt- prefixes on packages and patches.
Rob Landley <rob@landley.net>
parents:
1418
diff
changeset
|
206 # Update timestamps on both stable and alternative tarballs (if any) |
ad5303b6d35a
Switch USE_UNSTABLE to USE_ALT and download.sh's UNSTABLE= to ALT= so naming is consistent with the alt- prefixes on packages and patches.
Rob Landley <rob@landley.net>
parents:
1418
diff
changeset
|
207 # so cleanup_oldfiles doesn't delete stable when we're building alt |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
208 # or vice versa |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
209 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
210 touch -c "$SRCDIR"/{"$FILENAME","$ALTFILENAME"} 2>/dev/null |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
211 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
212 # Give package name, minus file's version number and archive extension. |
1257
1461d20bb6a7
Genericize the noversion() regex a bit, and make sure to only apply patches in the sources/patches directory that end in ".patch".
Rob Landley <rob@landley.net>
parents:
1253
diff
changeset
|
213 BASENAME="$(noversion "$FILENAME")" |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
214 |
1461
ad5303b6d35a
Switch USE_UNSTABLE to USE_ALT and download.sh's UNSTABLE= to ALT= so naming is consistent with the alt- prefixes on packages and patches.
Rob Landley <rob@landley.net>
parents:
1418
diff
changeset
|
215 # If alternative version selected, try from listed location, and fall back |
ad5303b6d35a
Switch USE_UNSTABLE to USE_ALT and download.sh's UNSTABLE= to ALT= so naming is consistent with the alt- prefixes on packages and patches.
Rob Landley <rob@landley.net>
parents:
1418
diff
changeset
|
216 # to PREFERRED_MIRROR. Do not try normal mirror locations for alt packages. |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
217 |
1461
ad5303b6d35a
Switch USE_UNSTABLE to USE_ALT and download.sh's UNSTABLE= to ALT= so naming is consistent with the alt- prefixes on packages and patches.
Rob Landley <rob@landley.net>
parents:
1418
diff
changeset
|
218 if is_in_list "$BASENAME" $USE_ALT |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
219 then |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
220 # If extracted source directory exists, don't download alt-tarball. |
1416
260580385655
Tweak download message when using manual build/package/alt-* setup.
Rob Landley <rob@landley.net>
parents:
1410
diff
changeset
|
221 if [ -e "$SRCTREE/alt-$BASENAME" ] |
260580385655
Tweak download message when using manual build/package/alt-* setup.
Rob Landley <rob@landley.net>
parents:
1410
diff
changeset
|
222 then |
260580385655
Tweak download message when using manual build/package/alt-* setup.
Rob Landley <rob@landley.net>
parents:
1410
diff
changeset
|
223 echo "Using $SRCTREE/$PACKAGE" |
260580385655
Tweak download message when using manual build/package/alt-* setup.
Rob Landley <rob@landley.net>
parents:
1410
diff
changeset
|
224 return 0 |
260580385655
Tweak download message when using manual build/package/alt-* setup.
Rob Landley <rob@landley.net>
parents:
1410
diff
changeset
|
225 fi |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
226 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
227 # Download new one as alt-packagename.tar.ext |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
228 FILENAME="$ALTFILENAME" |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
229 SHA1= |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
230 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
231 ([ ! -z "$PREFERRED_MIRROR" ] && |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
232 download_from "$PREFERRED_MIRROR/$ALTFILENAME") || |
1461
ad5303b6d35a
Switch USE_UNSTABLE to USE_ALT and download.sh's UNSTABLE= to ALT= so naming is consistent with the alt- prefixes on packages and patches.
Rob Landley <rob@landley.net>
parents:
1418
diff
changeset
|
233 download_from "$ALT" |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
234 return $? |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
235 fi |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
236 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
237 # If environment variable specifies a preferred mirror, try that first. |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
238 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
239 if [ ! -z "$PREFERRED_MIRROR" ] |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
240 then |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
241 download_from "$PREFERRED_MIRROR/$FILENAME" && return 0 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
242 fi |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
243 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
244 # Try original location, then mirrors. |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
245 # Note: the URLs in mirror list cannot contain whitespace. |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
246 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
247 download_from "$URL" && return 0 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
248 for i in $MIRROR_LIST |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
249 do |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
250 download_from "$i/$FILENAME" && return 0 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
251 done |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
252 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
253 # Return failure. |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
254 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
255 echo "Could not download $FILENAME" |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
256 echo -en "\e[0m" |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
257 return 1 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
258 } |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
259 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
260 # Clean obsolete files out of the source directory |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
261 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
262 START_TIME=`date +%s` |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
263 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
264 cleanup_oldfiles() |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
265 { |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
266 # wait for asynchronous downloads to complete |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
267 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
268 wait |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
269 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
270 for i in "${SRCDIR}"/* |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
271 do |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
272 if [ -f "$i" ] && [ "$(date +%s -r "$i")" -lt "${START_TIME}" ] |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
273 then |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
274 echo Removing old file "$i" |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
275 rm -rf "$i" |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
276 fi |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
277 done |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
278 } |