From 70bd3ef803e43fb0a12c84e9ac05ad71d911446d Mon Sep 17 00:00:00 2001
From: Chizi123 <joelgrun@gmail.com>
Date: Sun, 14 Jul 2019 06:49:55 +0000
Subject: [PATCH] unbinding chroot after process is finished

---
 README.org        |    4 +---
 add_package.sh    |    1 +
 build_packages.sh |    1 +
 enter_chroot.sh   |    3 ++-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/README.org b/README.org
index 9234c35..8d13769 100755
--- a/README.org
+++ b/README.org
@@ -11,8 +11,6 @@
 
 You may also want to set ~MAKEFLAGS="-j$(nproc)"~ within the chroot to enable parallel compilation.
 
-It is also needed to mount execute ~mount --bind chroot chroot~, to set the root directory within the chroot.
-
 Script coming soon.
 * Usage
 All scripts must be run as root.
@@ -23,7 +21,7 @@
 The packages are built and put into the directory ~/build/repo/x86_64~, then pushed with git.
 Only the latest packages are stored in ~/build/repo/x86_64~ to avoid multiple older versions building up.
 
-To enable automatic building, create a cronjob for root, something of the sort of ~* 12 * * * /path/to/dir/build_packages.sh~ to build ever day at noon.
+To enable automatic building, create a cronjob for root, something of the sort of ~0 12 * * * /path/to/dir/build_packages.sh~ to build ever day at noon.
 * To Dos
 - Add a script to create the chroot folder.
 - Error catching for builds which fail.
diff --git a/add_package.sh b/add_package.sh
index f7d548b..5c78b47 100755
--- a/add_package.sh
+++ b/add_package.sh
@@ -3,3 +3,4 @@
 CHDIR=$(dirname "$(realpath $0)")/chroot 
 mount --bind $CHDIR $CHDIR
 $CHDIR/bin/arch-chroot $CHDIR su joel -c "cd /build/repo; git clone $1"
+umount $CHDIR
diff --git a/build_packages.sh b/build_packages.sh
index 98b5339..bb61675 100755
--- a/build_packages.sh
+++ b/build_packages.sh
@@ -3,3 +3,4 @@
 CHDIR=$(dirname "$(realpath $0)")/chroot
 mount --bind $CHDIR $CHDIR
 $CHDIR/bin/arch-chroot $CHDIR su joel -c "/build/repo/build.sh"
+umount $CHDIR
diff --git a/enter_chroot.sh b/enter_chroot.sh
index b944d15..a4f6270 100755
--- a/enter_chroot.sh
+++ b/enter_chroot.sh
@@ -2,4 +2,5 @@
 
 CHDIR=$(dirname "$(realpath $0)")/chroot 
 mount --bind $CHDIR $CHDIR
-$CHDIR/bin/arch-chroot $CHDIR su joel 
+$CHDIR/bin/arch-chroot $CHDIR su joel
+umount $CHDIR

--
Gitblit v1.9.3