Merge pull request #82 from ceph/wip-rm-blkin
[autobuild-ceph.git] / build-cdep-deb.sh
1 #!/bin/sh -x
2 set -e
3
4 git clean -fdx
5
6 export DIST=`lsb_release -sc`
7 export GNUPGHOME="/srv/gnupg" 
8 echo "VER is $VER"
9
10 # clear out any $@ potentially passed in
11 set --
12
13 # build the debs
14 RELEASEDIR=/tmp/cdep-release.$$
15 mkdir -p $RELEASEDIR/out~
16 rm -rf $RELEASEDIR/out~/* || true
17 cp -a ../build/* $RELEASEDIR/out~
18
19 (cd $RELEASEDIR/out~ ; ./scripts/build-debian.sh)
20
21
22 REV="$(git rev-parse HEAD)"
23 OUTDIR="../out/output/sha1/$REV"
24 OUTDIR_TMP="${OUTDIR}.tmp"
25 install -d -m0755 -- "$OUTDIR_TMP"
26 printf '%s\n' "$REV" >"$OUTDIR_TMP/sha1"
27 printf '%s\n' "$VER" >"$OUTDIR_TMP/version"
28 printf '%s\n' "ceph" >"$OUTDIR_TMP/name"
29
30 cp -a $RELEASEDIR/out~/debian-repo/* $OUTDIR_TMP/.
31 rm -rf $RELEASEDIR
32
33 # we're successful, the files are ok to be published; try to be as
34 # atomic as possible about replacing potentially existing OUTDIR
35 if [ -e "$OUTDIR" ]; then
36     rm -rf -- "$OUTDIR.old"
37     mv -- "$OUTDIR" "$OUTDIR.old"
38 fi
39 mv -- "$OUTDIR_TMP" "$OUTDIR"
40 rm -rf -- "$OUTDIR.old"
41
42 # rebuild combined debian repo output
43 (
44     cd ../out/output
45     rm -rf combined
46     GNUPGHOME="/srv/gnupg" /srv/ceph-build/merge_repos.sh combined sha1/*
47 )
48
49 exit 0