File: build-certs

package info (click to toggle)
strongswan 6.0.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 61,584 kB
  • sloc: ansic: 405,188; sh: 11,621; makefile: 6,254; sql: 2,885; javascript: 1,948; python: 990; xml: 608; perl: 586; cs: 522; lex: 485; yacc: 443; ruby: 398; ada: 114
file content (50 lines) | stat: -rwxr-xr-x 1,473 bytes parent folder | download
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
#!/bin/bash

DIR="$(dirname `readlink -f $0`)/.."
. $DIR/testing.conf
. $DIR/scripts/function.sh

[ `id -u` -eq 0 ] || die "You must be root to run $0"
[ -f "$BASEIMG" ] || die "Base image $BASEIMG not found"
[ -f "$ROOTIMG" ] || die "Root image $ROOTIMG not found"
running_any $STRONGSWANHOSTS && die "Please stop test environment before running $0"

SRCUID=${SUDO_UID:-$(id -u)}
SRCGID=${SUDO_GID:-$(id -g)}

check_commands blockdev qemu-img qemu-nbd bindfs

load_qemu_nbd

mkdir -p $LOOPDIR
mkdir -p $IMGDIR

log_action "Connecting root image to NBD device $NBDEV"
execute "qemu-nbd -c $NBDEV $ROOTIMG"
do_on_exit qemu-nbd -d $NBDEV
# wait for disk to become ready with newer QEMU versions
sleep 1
blockdev --rereadpt $NBDEV

log_action "Mounting $NBDPARTITION to $LOOPDIR"
execute "mount $NBDPARTITION $LOOPDIR"
do_on_exit umount $LOOPDIR

log_action "Mounting proc filesystem to $LOOPDIR/proc"
execute "mount -t proc none $LOOPDIR/proc"
do_on_exit umount $LOOPDIR/proc

mkdir -p $LOOPDIR/root/testing
log_action "Mounting ${DIR} as /root/testing"
execute "bindfs -u $SRCUID -g $SRCGID --create-for-user=$SRCUID --create-for-group=$SRCGID ${DIR} $LOOPDIR/root/testing"
do_on_exit umount $LOOPDIR/root/testing

log_action "Building certificates"
execute_chroot "/root/testing/scripts/build-certs-chroot"

# rebuild the guest images to generate the CRLs on winnetou
if [ -z "$2" ]; then
	# cleanup before mounting guest images
	on_exit
	$DIR/scripts/build-guestimages
fi