Annotation of embedaddon/strongswan/testing/scripts/build-certs, revision 1.1.1.1

1.1       misho       1: #!/bin/bash
                      2: 
                      3: DIR="$(dirname `readlink -f $0`)/.."
                      4: . $DIR/testing.conf
                      5: . $DIR/scripts/function.sh
                      6: 
                      7: [ `id -u` -eq 0 ] || die "You must be root to run $0"
                      8: [ -f "$BASEIMG" ] || die "Base image $BASEIMG not found"
                      9: [ -f "$ROOTIMG" ] || die "Root image $ROOTIMG not found"
                     10: running_any $STRONGSWANHOSTS && die "Please stop test environment before running $0"
                     11: 
                     12: SRCUID=${SUDO_UID:-$(id -u)}
                     13: SRCGID=${SUDO_GID:-$(id -g)}
                     14: 
                     15: check_commands partprobe qemu-img qemu-nbd bindfs
                     16: 
                     17: load_qemu_nbd
                     18: 
                     19: mkdir -p $LOOPDIR
                     20: mkdir -p $IMGDIR
                     21: 
                     22: log_action "Connecting root image to NBD device $NBDEV"
                     23: execute "qemu-nbd -c $NBDEV $ROOTIMG"
                     24: do_on_exit qemu-nbd -d $NBDEV
                     25: partprobe $NBDEV
                     26: 
                     27: log_action "Mounting $NBDPARTITION to $LOOPDIR"
                     28: execute "mount $NBDPARTITION $LOOPDIR"
                     29: do_on_exit umount $LOOPDIR
                     30: 
                     31: log_action "Mounting proc filesystem to $LOOPDIR/proc"
                     32: execute "mount -t proc none $LOOPDIR/proc"
                     33: do_on_exit umount $LOOPDIR/proc
                     34: 
                     35: mkdir -p $LOOPDIR/root/testing
                     36: log_action "Mounting ${DIR} as /root/testing"
                     37: execute "bindfs -u $SRCUID -g $SRCGID --create-for-user=$SRCUID --create-for-group=$SRCGID ${DIR} $LOOPDIR/root/testing"
                     38: do_on_exit umount $LOOPDIR/root/testing
                     39: 
                     40: log_action "Building certificates"
                     41: execute_chroot "/root/testing/scripts/build-certs-chroot"
                     42: 
                     43: # rebuild the guest images to generate the CRLs on winnetou
                     44: if [ -z "$2" ]; then
                     45:        # cleanup before mounting guest images
                     46:        on_exit
                     47:        $DIR/scripts/build-guestimages
                     48: fi

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>