~j-harbott/cirros/dev

« back to all changes in this revision

Viewing changes to bin/build-release

  • Committer: Scott Moser
  • Date: 2014-09-05 16:36:30 UTC
  • Revision ID: smoser@ubuntu.com-20140905163630-5h4bl309fo2f42y2
bin/build-release: avoid re-downloading kernels, re-run cleanups

on re-run, we'd fail on existing directories or gzip would prompt
for overwrite.  This fixes those things.

also, now do not re-download kernels or the buildroot tarball.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
ARCHES="${ARCHES:-i386 x86_64 arm}"
9
9
KVER="3.2.0-60.91";
10
10
 
 
11
dl() {
 
12
   local url="$1" target="$2" tfile="" t=""
 
13
   [ -f "$target" ] && return
 
14
   t=$(dirname "$target")
 
15
   tfile=$(mktemp "$t/.${0##*/}.XXXXXX") || return
 
16
   wget "$url" -O "$tfile" &&
 
17
      mv "$tfile" "$target" ||
 
18
      { t=$?; rm -f "$tfile"; return $t; }
 
19
}
 
20
 
11
21
set -e
12
22
set -o pipefail
13
23
 
21
31
rm -f download
22
32
mkdir -p ../download
23
33
ln -snf ../download download
24
 
[ -f "download/buildroot-${BR_VER}.tar.gz" ] ||
25
 
  wget "http://buildroot.uclibc.org/downloads/buildroot-${BR_VER}.tar.gz" \
26
 
    -O "download/buildroot-${BR_VER}.tar.gz"
 
34
brtgz="buildroot-${BR_VER}.tar.gz"
 
35
dl "http://buildroot.uclibc.org/downloads/$brtgz" "download/$brtgz"
 
36
   "download/buildroot-${BR_VER}.tar.gz"
27
37
 
28
38
rm -Rf "buildroot-${BR_VER}"
29
39
rm -f buildroot
51
61
     [ "$arch" = "x86_64" ] && xarch="amd64";
52
62
     [ "$arch" = "arm" ] && xarch="armel" && flav="omap"
53
63
     url="$burl-${KVER%.*}-${flav}_${KVER}_${xarch}.deb"
54
 
     wget "$url" -O download/${url##*/}
55
 
     ln -sf ${url##*/} download/kernel-${arch}.deb
 
64
     tfile="download/${url##*/}"
 
65
     dl "$url" "$tfile"
 
66
     ln -sf "${tfile##*/}" download/kernel-${arch}.deb
56
67
done
57
68
echo "$(date): end kernel download" >> "$out/date.txt";
58
69
 
111
122
     cp "$out/stage/$arch/$p-disk.img" "$out/release/$p-disk.img"
112
123
done
113
124
 
114
 
mkdir "$out/release/buildroot_rootfs"
 
125
mkdir -p "$out/release/buildroot_rootfs"
115
126
for arch in ${ARCHES}; do
116
127
  t="$out/release/buildroot_rootfs/buildroot-$VER-$arch.tar"
117
 
  cp "$out/build/$arch/rootfs.tar" "$t" && gzip -9 "$t"
 
128
  cp "$out/build/$arch/rootfs.tar" "$t" && gzip --force -9 "$t"
118
129
done
119
130
 
120
131
chmod u+rwX,go+rX -R "$out/release/"*