mirror of https://github.com/Chizi123/Arch-autobuild-repo.git

Chizi123
2019-07-14 90d52f3e6fb701749fb193caba21f15dd3a9bbc6
commit | author | age
90d52f 1 #!/bin/bash
C 2
3 #Where to download the image from
4 BOOTSTRAP_SOURCE=mirror.rackspace.com/archlinux/iso/latest/
5 BOOTSTRAP_FILE=archlinux-bootstrap-*-x86_64.tar.gz
6 #Directory for the chroot, default is the same folder as this script
7 CHDIR=$(dirname "$(realpath $0)")/chroot
8 #Your username, this is for the chroot user. Needs to be a user on your system
9 #Need to change the username in all the other files
10 USER=joel
11 #Locale for chroot as it appears in /etc/locale.gen. This needs to be the same as the host system's locale
12 LOCALE=en_US.UTF-8 UTF-8
13 #Git details
14 GIT_USER=Chizi123
15 GIT_EMAIL=joelgrun@gmail.com
16
17 #Download bootstrap image
18 cd /tmp
19 echo wget -r --no-parent -A \'$BOOTSTRAP_FILE\' http://$BOOTSTRAP_SOURCE | bash
20 tar xzf $BOOTSTRAP_SOURCE/$BOOTSTRAP_FILE
21 mv root.x86_64/ $CHDIR
22 rm -r $BOOTSTRAP_SOURCE
23
24 #set up image in directory
25 cd $CHDIR
26 sed -i 's/^#Server/Server/' etc/pacman.d/mirrorlist
27 mkdir home/$USER
28 echo $USER:x:1000:1000:$USER:/home/$USER:/bin/bash >> etc/passwd
29 echo $USER::14871:::::: >> /etc/shadow
30 mkdir build
31 mkdir build/repo
32 echo $LOCALE >> /etc/locale.gen
33 mount --bind $CHDIR $CHDIR
34 bin/arch-chroot . bash -c "locale-gen;
35                            pacman-key --init;
36                            pacman-key --populate archlinux;
37                            pacman -Syu --noconfirm base-devel vim git;
38                            chown $USER:users /home/$USER;
39                            su $USER -c \"git config --global credential.helper store;
40                                                  git config --global user.name $GIT_USER;
41                                             git config --global user.email $GIT_EMAIL\";
42                            ln build.sh chroot/build/repo/build.sh"
43 echo "$USER ALL=(ALL) NOPASSWD:ALL" >> etc/sudoers
44 echo "Please set up the remote git repo for hosting"
45 echo "Navagate to /build/repo to init the repository"
46 echo "Press ctrl+d when finished"
47 bin/arch-chroot . su $USER
48 umount $CHDIR