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 |
a2b09f
|
29 |
echo $USER::14871:::::: >> etc/shadow |
JG |
30 |
mkdir -p build/repo |
|
31 |
ln ../build.sh build/repo/build.sh |
|
32 |
echo $LOCALE >> etc/locale.gen |
90d52f
|
33 |
mount --bind $CHDIR $CHDIR |
C |
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; |
a2b09f
|
41 |
git config --global user.email $GIT_EMAIL\";" |
90d52f
|
42 |
echo "$USER ALL=(ALL) NOPASSWD:ALL" >> etc/sudoers |
C |
43 |
echo "Please set up the remote git repo for hosting" |
|
44 |
echo "Navagate to /build/repo to init the repository" |
|
45 |
echo "Press ctrl+d when finished" |
|
46 |
bin/arch-chroot . su $USER |
|
47 |
umount $CHDIR |