From 90d52f3e6fb701749fb193caba21f15dd3a9bbc6 Mon Sep 17 00:00:00 2001
From: Chizi123 <joelgrun@gmail.com>
Date: Sun, 14 Jul 2019 06:43:35 +0000
Subject: [PATCH] Begun script for creating the chroot

---
 create_chroot.sh |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/create_chroot.sh b/create_chroot.sh
new file mode 100755
index 0000000..78e9140
--- /dev/null
+++ b/create_chroot.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+#Where to download the image from
+BOOTSTRAP_SOURCE=mirror.rackspace.com/archlinux/iso/latest/
+BOOTSTRAP_FILE=archlinux-bootstrap-*-x86_64.tar.gz
+#Directory for the chroot, default is the same folder as this script
+CHDIR=$(dirname "$(realpath $0)")/chroot
+#Your username, this is for the chroot user. Needs to be a user on your system
+#Need to change the username in all the other files
+USER=joel
+#Locale for chroot as it appears in /etc/locale.gen. This needs to be the same as the host system's locale
+LOCALE=en_US.UTF-8 UTF-8
+#Git details
+GIT_USER=Chizi123
+GIT_EMAIL=joelgrun@gmail.com
+
+#Download bootstrap image
+cd /tmp
+echo wget -r --no-parent -A \'$BOOTSTRAP_FILE\' http://$BOOTSTRAP_SOURCE | bash
+tar xzf $BOOTSTRAP_SOURCE/$BOOTSTRAP_FILE
+mv root.x86_64/ $CHDIR
+rm -r $BOOTSTRAP_SOURCE
+
+#set up image in directory
+cd $CHDIR
+sed -i 's/^#Server/Server/' etc/pacman.d/mirrorlist
+mkdir home/$USER
+echo $USER:x:1000:1000:$USER:/home/$USER:/bin/bash >> etc/passwd
+echo $USER::14871:::::: >> /etc/shadow
+mkdir build
+mkdir build/repo
+echo $LOCALE >> /etc/locale.gen
+mount --bind $CHDIR $CHDIR
+bin/arch-chroot . bash -c "locale-gen;
+						   pacman-key --init;
+						   pacman-key --populate archlinux;
+						   pacman -Syu --noconfirm base-devel vim git;
+						   chown $USER:users /home/$USER;
+						   su $USER -c \"git config --global credential.helper store;
+						   	  		   	 git config --global user.name $GIT_USER;
+						   				 git config --global user.email $GIT_EMAIL\";
+						   ln build.sh chroot/build/repo/build.sh"
+echo "$USER ALL=(ALL) NOPASSWD:ALL" >> etc/sudoers
+echo "Please set up the remote git repo for hosting"
+echo "Navagate to /build/repo to init the repository"
+echo "Press ctrl+d when finished"
+bin/arch-chroot . su $USER
+umount $CHDIR

--
Gitblit v1.9.3