iglunix-autobuild/chroot_prepare_iglunix

132 lines
2.9 KiB
Text
Raw Normal View History

2021-02-04 16:58:42 +00:00
#! /bin/bash
if [ "$#" -ne 1 ]; then
echo "You must enter exactly the container id of the docker in which the compilation took place. (the client not the volunteers)"
2021-02-12 16:20:35 +00:00
echo "This can be false, then the builds fodler will be used."
echo "The builds folder is a folder where llvm, musl, musl-dev, bmake can reside which will can be used instead of the automatic docker cp mechanism."
2021-02-04 16:58:42 +00:00
exit -1
fi
#Unmount the mounts
sudo umount root/tmp/
sudo umount root/proc/
sudo umount root/sys/
sudo mount --make-rprivate root/dev/
sudo umount -l root/dev/
#Delete everything!
#umout has problems :(
# Just delete a couple of this ot clean it..
#sudo rm -r -f ./root
if true; then
sudo rm -rf ./root/lib
sudo rm -rf ./root/bin
sudo rm -rf ./root/sbin
sudo rm -rf ./root/usr
2021-02-06 12:46:14 +00:00
sudo rm -rf ./root/iglunix
2021-02-04 16:58:42 +00:00
sudo rm -rf ./root/etc
fi
mkdir root
mkdir root/bin
mkdir root/sbin
mkdir root/usr
mkdir root/usr/sbin
mkdir root/etc
2021-02-06 12:46:14 +00:00
docker cp $1:/iglunix/pkgs/llvm/out/llvm.11.0.1.tar.xz ./root/llvm.tar.xz
docker cp $1:/iglunix/pkgs/musl/out/musl-dev.1.2.2.tar.xz ./root/musl-dev.tar.xz
docker cp $1:/iglunix/pkgs/musl/out/musl.1.2.2.tar.xz ./root/musl.tar.xz
docker cp $1:/iglunix/pkgs/bmake/out/bmake.20210110.tar.xz ./root/bmake.tar.xz
2021-02-04 16:58:42 +00:00
2021-02-12 16:20:35 +00:00
cp ./builds/* ./root/
2021-02-04 16:58:42 +00:00
cd ./root
ROOT=$(pwd)
tar -xf musl.tar.xz -C ./
tar -xf musl-dev.tar.xz -C ./
tar -xf llvm.tar.xz -C ./
tar -xf bmake.tar.xz -C ./
#---
2021-02-12 16:20:35 +00:00
rm ./busybox-x86_64
2021-02-04 16:58:42 +00:00
wget -nc -q https://busybox.net/downloads/binaries/1.31.0-defconfig-multiarch-musl/busybox-x86_64
chmod +x ./busybox-x86_64
mv busybox-x86_64 ./bin/busybox
2021-02-12 16:20:35 +00:00
rm ./toybox-x86_64
2021-02-04 16:58:42 +00:00
wget -nc -q http://landley.net/toybox/bin/toybox-x86_64
chmod +x ./toybox-x86_64
mv toybox-x86_64 ./bin/toybox
echo ""
#---
2021-02-06 12:46:14 +00:00
git clone https://github.com/iglunix/iglunix.git
2021-02-04 16:58:42 +00:00
#----
# Mount some things, we'll need it later
mkdir proc
mkdir sys
mkdir dev
mkdir tmp
echo "mounted tmp, proc, sysfs, rbind"
# We'll need to compile mksh
# But we don't have tools to get the sources from inside the chroot yet..
cd ..
echo "Starting chroot_fetch"
./chroot_fetch
echo "Need to compile a lex file in om4, because of a circular dependency with flex"
#For the other attempt at fixing this circular dependency see inside_chroot
2021-02-06 12:46:14 +00:00
cd ${ROOT}/iglunix/pkgs/om4/src/om4-*/
2021-02-04 16:58:42 +00:00
lex ./tokenizer.l
sudo chroot ${ROOT} /bin/busybox --install -s
echo "installed busybox"
2021-03-28 13:49:17 +00:00
printf "export PATH=/usr/sbin:/usr/bin:/sbin:/bin:\nexport JOBS=16\n" > ${ROOT}/etc/iglupkg.conf
2021-02-04 16:58:42 +00:00
echo "---------------------------------"
echo " Kayboard configuration"
echo "---------------------------------"
echo "Copying host keymap"
cp /etc/vconsole.conf ${ROOT}/etc/vconsole.conf
2021-02-04 16:58:42 +00:00
echo "---------------------------------"
echo "Starting networking configuration"
echo "---------------------------------"
RANDOM=$$
2021-02-06 12:46:14 +00:00
HOSTNAME="iglunix-$RANDOM"
2021-02-04 16:58:42 +00:00
echo "Hostname: ${HOSTNAME}"
mkdir ${ROOT}/etc
echo "$HOSTNAME" > ${ROOT}/etc/hostname
echo "Finished prepare_chroot_lazy"