1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#!/bin/bash
#
# copies the files to their staging location
DISTRO="${DISTRO:-$1}"
WORKSPACE="${WORKSPACE:-$2}"
SERIAL="${SERIAL:-$3}"
BTYPE="${BTYPE:-$4}"
BTYPE="${BTYPE:-server}"
# Allow for legacy positional arguments
test_build="${5:-0}"
sandbox_build="${6:-0}"
proposed_build="${7:-0}"
# Allow for environment variable to control this
TEST_BUILD="${TEST_BUILD:-$test_build}"
SANDBOX_BUILD="${SANDBOX_BUILD:-$sandbox_build}"
PROPOSED_BUILD="${PROPOSED_BUILD:-$proposed_build}"
ROOT_D="${ROOT_D:-/srv/ec2-images}"
base_d="${ROOT_D}/${DISTRO}/${SERIAL}"
[ "${TEST_BUILD}" -eq 1 ] && base_d="${ROOT_D}/test_builds/${DISTRO}/${SERIAL}"
[ "${SANDBOX_BUILD}" -eq 1 ] && base_d="${ROOT_D}/sandbox/${DISTRO}/${SERIAL}"
[ "${PROPOSED_BUILD}" -eq 1 ] && base_d="${ROOT_D}/proposed/${DISTRO}/${SERIAL}"
[ "${BTYPE}" = "desktop" ] && base_d="${ROOT_D}/desktop/${DISTRO}/${SERIAL}"
# Make sure that the HWE directory is created
if [[ "${BTYPE}" =~ server-hwe ]]; then
base_d="${base_d}/${BTYPE//server-/}"
[ ! -e "${base_d}" ] && mkdir -p "${base_d}"
fi
for roottar in $(find . -iname "*root.tar.gz"); do
echo "Generating file listing"
case ${roottar} in
*amd64*) arch_name="amd64";;
*i386*) arch_name="i386";;
*armel*) arch_name="armel";;
*armhf*) arch_name="armhf";;
*ppc64*) arch_name="ppc64el";;
*arm64*) arch_name="arm64";;
*) arch_name="unknown-$(date +%s)";;
esac
tar -tzvf ${roottar} >> "${WORKSPACE}/file-list-${arch_name}.log" ||
echo "Non fatal error. Failed to gather file list for ${roottar}"
done
cp -au ${DISTRO}-*/* ${base_d} || exit 1
exit 0
|