diff --git a/Dockerfile b/Dockerfile index 4b9e226..5c03d7c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM ubuntu:18.04 ENV LFS / RUN apt-get update -RUN apt-get install -y build-essential openssh-server python3 gawk bison texinfo kpartx +RUN apt-get install -y build-essential openssh-server python3 gawk bison texinfo kpartx parallel RUN mkdir -p /root/.ssh RUN chmod 0700 /root/.ssh @@ -12,8 +12,10 @@ RUN sed -i s/^#PasswordAuthentication\ yes/PasswordAuthentication\ no/ /etc/ssh/ RUN sed -i s/^#PermitRootLogin\ prohibit-password/PermitRootLogin\ yes/ /etc/ssh/sshd_config RUN sed -i -e 's/^root:!:/root::/' /etc/shadow -RUN wget https://github.com/mvanveen.keys -O /root/.ssh/authorized_keys - +WORKDIR /root +ADD script/ . +ADD packages.txt . ADD run.sh . +ADD pkg/prep/ . -CMD ["/bin/sh", "run.sh"] +CMD ["/bin/bash", "run.sh"] diff --git a/Makefile b/Makefile index 9e73312..510308d 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ docker-build: docker-run: #docker run -v sources:/sources -p 2222:22 -d linuxfromscratch #-v ${CURDIR}/lfs.img:/root/lfs.img - docker run -p 2222:22 -d --privileged linuxfromscratch + docker run -p 2222:22 --privileged linuxfromscratch docker-kill: ./kill_container.sh @@ -71,4 +71,5 @@ build-pkgs: scp -P 2222 pkg/build/* root@localhost:/mnt/lfs/tools && ssh -p 2222 root@localhost "sh /tools/run-build.sh" -all: docker-kill clean docker-build docker-run run-stage0 ext4-img run-stage1 dl-sources prep-pkgs build-pkgs +all: docker-kill clean docker-build docker-run run-stage0 ext4-img run-stage1 dl-sources prep-pkgs build-pkgs +x-all: docker-kill clean docker-build docker-run diff --git a/run.sh b/run.sh index ddc2bac..75ecf89 100644 --- a/run.sh +++ b/run.sh @@ -1 +1,63 @@ -service ssh start && while true; do sleep 1; done; +#!/bin/bash +failed() +{ + echo ' +******************** +*** BUILD FAILED *** +******************** +' + echo "Keeping container alive for debugging..." + tail -f /dev/null +} + +trap 'failed' 0 + +set -e +set -x + +source stage0.sh +source mkext4.sh +source stage1.sh +echo "PRE PARALLEL" +cat packages.txt | parallel "wget --continue --directory-prefix=/mnt/lfs/sources {}" +echo "POST PARALLEL" +cd /mnt/lfs/sources +source binutils.sh +source gcc-pass1.sh +source linux-headers.sh +source glibc.sh +source libstdcplusplus.sh +source binutils-pass-2.sh +source gcc-pass2.sh +source tcl.sh +source expect.sh +source dejagnu.sh +source m4.sh +source ncurses.sh +source bash.sh +source bison.sh +source bzip2.sh +source coreutils.sh +source diffutils.sh +source file.sh +source findutils.sh +source gawk.sh +source gettext.sh +source grep.sh +source make.sh +source patch.sh +source perl.sh +source python.sh +source sed.sh +source tar.sh +source texinfo.sh +source xz.sh + +trap : 0 + +echo ' +*********************** +*** BUILD SUCCEEDED *** +*********************** +' +tail -f /dev/null diff --git a/script/stage0.sh b/script/stage0.sh index d3d9411..bb1713e 100644 --- a/script/stage0.sh +++ b/script/stage0.sh @@ -21,7 +21,6 @@ EOF" mkdir -p ~lfs/.ssh chmod 0700 ~/.ssh -cp ~/.ssh/authorized_keys ~lfs/.ssh/authorized_keys sed -i -e 's/^lfs:!:/lfs::/' /etc/shadow su lfs -c "ssh-keygen -A"