From ea1f8911cd69216027df5f9d727f47a1b67ef29b Mon Sep 17 00:00:00 2001 From: Filip Pytloun Date: Wed, 9 Mar 2016 11:09:41 +0100 Subject: Refactor: split bootstrap actions and allow custom --- functions.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 functions.sh (limited to 'functions.sh') diff --git a/functions.sh b/functions.sh new file mode 100644 index 0000000..cc932ee --- /dev/null +++ b/functions.sh @@ -0,0 +1,19 @@ +cleanup (){ + # Clean up all temporary mount points + set +x + set +e + echo "removing temporary mount points ..." + umount -l $R/proc 2> /dev/null + umount -l $R/sys 2> /dev/null + umount -l $R/dev/pts 2> /dev/null + umount "$BUILDDIR/mount/boot/firmware" 2> /dev/null + umount "$BUILDDIR/mount" 2> /dev/null + losetup -d "$EXT4_LOOP" 2> /dev/null + losetup -d "$VFAT_LOOP" 2> /dev/null + trap - 0 1 2 3 6 +} + +chroot_exec() { + # Exec command in chroot + LANG=C LC_ALL=C chroot $R $* +} -- cgit v1.2.3 From 5aea90096d1658770bdd602de3df36285c2ff600 Mon Sep 17 00:00:00 2001 From: Filip Pytloun Date: Thu, 10 Mar 2016 15:43:59 +0100 Subject: Force noninteractive debian frontend --- functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'functions.sh') diff --git a/functions.sh b/functions.sh index cc932ee..95f8480 100644 --- a/functions.sh +++ b/functions.sh @@ -15,5 +15,5 @@ cleanup (){ chroot_exec() { # Exec command in chroot - LANG=C LC_ALL=C chroot $R $* + LANG=C LC_ALL=C DEBIAN_FRONTEND=noninteractive chroot $R $* } -- cgit v1.2.3 From a1508536fc6e1d31692e42945a7bc8191892615f Mon Sep 17 00:00:00 2001 From: Filip Pytloun Date: Thu, 10 Mar 2016 15:45:38 +0100 Subject: Enhance cleanup by killing processes running in endpoint --- functions.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'functions.sh') diff --git a/functions.sh b/functions.sh index 95f8480..e94a42c 100644 --- a/functions.sh +++ b/functions.sh @@ -2,6 +2,10 @@ cleanup (){ # Clean up all temporary mount points set +x set +e + echo "killing processes using mount point ..." + fuser -k $R + sleep 3 + fuser -9 -k -v $R echo "removing temporary mount points ..." umount -l $R/proc 2> /dev/null umount -l $R/sys 2> /dev/null -- cgit v1.2.3