From 48a8a89efe7ebcf280d62e4c221e7362c82c42e7 Mon Sep 17 00:00:00 2001
From: Chizi123 <joelgrun@gmail.com>
Date: Mon, 10 Jun 2019 10:56:38 +0000
Subject: [PATCH] Working with a chroot environment

---
 Dockerfile        |    4 ++++
 /dev/null         |    9 ---------
 add_package.sh    |    4 ++++
 .gitignore        |    3 +--
 build_packages.sh |    4 ++++
 enter_chroot.sh   |    4 ++++
 build.sh          |    9 ++++++---
 7 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/.gitignore b/.gitignore
index c2960ef..fa32393 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1 @@
-repo
-!repo/build.sh
+chroot
diff --git a/Dockerfile b/Dockerfile
index 2543bdd..811cf69 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -13,3 +13,7 @@
 RUN /usr/sbin/groupadd --system sudo && \
     /usr/sbin/useradd -m --groups sudo user
 USER user
+
+RUN cd repo && \
+	for i in `find . -maxdepth 1 -not -path '*/\.*' -type d`
+do
diff --git a/add_package.sh b/add_package.sh
new file mode 100644
index 0000000..a345684
--- /dev/null
+++ b/add_package.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+CHDIR=$(dirname "$(realpath $0)")/chroot 
+$CHDIR/bin/arch-chroot $CHDIR su joel -c "cd /build/repo; git clone $1"
diff --git a/repo/build.sh b/build.sh
similarity index 90%
rename from repo/build.sh
rename to build.sh
index 0dce5e0..6b2728d 100644
--- a/repo/build.sh
+++ b/build.sh
@@ -34,6 +34,9 @@
     return 0
 }
 
+cd $(dirname "$(realpath $0)")
+git rm -r x86_64/*.pkg.tar.xz
+
 for d in `find . -maxdepth 1 -not -path '*/\.*' -type d`
 do
 	if [ "$d" = "./x86_64" ] || [ "$d" = "." ]; then
@@ -50,6 +53,6 @@
 
 cp Chizi123.db.tar.xz x86_64/Chizi123.db
 cp Chizi123.files.tar.xz x86_64/Chizi123.files
-# git add x86_64
-# git commit -m "'$(date +%d/%m/%y-%H:%M)'"
-# git push
+git add x86_64
+git commit -m "'$(date +%d/%m/%y-%H:%M)'"
+git push
diff --git a/build_packages.sh b/build_packages.sh
new file mode 100644
index 0000000..62f3f65
--- /dev/null
+++ b/build_packages.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+CHDIR=$(dirname "$(realpath $0)")/chroot 
+$CHDIR/bin/arch-chroot $CHDIR su joel -c "/build/repo/build.sh"
diff --git a/enter_chroot.sh b/enter_chroot.sh
new file mode 100644
index 0000000..2e7830c
--- /dev/null
+++ b/enter_chroot.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+CHDIR=$(dirname "$(realpath $0)")/chroot 
+$CHDIR/bin/arch-chroot $CHDIR su joel 
diff --git a/makebuild.sh b/makebuild.sh
deleted file mode 100644
index 3ea668f..0000000
--- a/makebuild.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-BUILDDIR=$(dirname "$(realpath $0)")
-cd $BUILDDIR
-
-docker run -ti -w /build -v $BUILDDIR/repo:/build joeleg/archbuild ./build.sh
-# git add repo/x86_64
-# git commit -m "'date =%d/%m/%y-%H:%M'"
-# git push

--
Gitblit v1.9.3