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
|
|
|
|
|
|
|
|
if false
|
|
|
|
then
|
|
|
|
sudo mount --bind /tmp tmp/
|
|
|
|
sudo mount -t proc /proc proc/
|
|
|
|
sudo mount -t sysfs /sys sys/
|
|
|
|
sudo mount --rbind /dev dev/
|
|
|
|
fi
|
|
|
|
|
|
|
|
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-02-14 17:37:53 +00:00
|
|
|
printf "export PATH=/bin:/usr/bin:/usr/sbin:\nexport JOBS=16\n" > ${ROOT}/etc/iglupkg.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
|
|
|
|
|
|
|
|
sudo cp /etc/resolv.conf ${ROOT}/etc/resolv.conf
|
|
|
|
echo "Copied the host resolv.conf into the target"
|
|
|
|
echo "Feel free to override the generated network settings prior to chrooting into the system"
|
|
|
|
|
|
|
|
echo "Finished prepare_chroot_lazy"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|