Debian Codegraph @

debian/tests/debspawn-common

raw
1 #!/bin/bash
2 set -e
3
4 #
5 # Test actions commonly used with debspawn
6 # (create image, build package, list images, update images, delete images)
7 #
8
9 . /etc/os-release
10 if [ -z ${VERSION_CODENAME+x} ]; then
11 VERSION_CODENAME=stable
12 fi
13
14 RESULTS_DIR=/var/lib/debspawn/results/
15
16 set -x
17
18 # test creating a new image
19 debspawn create $VERSION_CODENAME
20
21 mkdir -p build-test && cd build-test
22 apt-get source hello
23 cd hello-*
24
25 if compgen -G "${RESULTS_DIR}/hello_*.deb" > /dev/null; then
26 echo "Build results already existed! - Maybe the build environment is not clean?"
27 exit 1
28 fi
29 echo ""
30
31 # test building a package
32 debspawn build $VERSION_CODENAME .
33
34 if ! compgen -G "${RESULTS_DIR}/hello_*.deb" > /dev/null; then
35 echo "Build result was missing!"
36 exit 1
37 fi
38
39 cd ..
40 rm -rf build-test
41 echo ""
42
43 # test image update
44 debspawn update $VERSION_CODENAME
45 echo ""
46
47 # list all available images
48 debspawn list
49 echo ""
50
51 # show status info
52 debspawn maintain --status
53 echo ""
54
55 # delete the image
56 debspawn delete $VERSION_CODENAME