This commit is contained in:
Valentin Boettcher 2020-03-01 22:01:20 +01:00
commit 7dc4d7e629
3 changed files with 125 additions and 0 deletions

8
docker-setup.sh Normal file
View file

@ -0,0 +1,8 @@
#!/bin/bash
docker run \
-i \
--rm --privileged=true \
--name archiso \
--mount type=bind,source="$(pwd)",target=/archiso \
archlinux:latest bash < ./in_docker.sh

28
in_docker.sh Normal file
View file

@ -0,0 +1,28 @@
#!/bin/sh
# install the basics
pacman --noconfirm -Syu
pacman --noconfirm -S archiso sudo git base-devel bash
# add a user for makepkg
useradd -m archiso
# make him sudoer
cat >> /etc/sudoers <<EOF
archiso ALL=(ALL) NOPASSWD: ALL
EOF
# fix sudo: setrlimit(RLIMIT_CORE): Operation not permitted
echo "Set disable_coredump false" > /etc/sudo.conf
# more dependencies
cd /tmp
su archiso
git clone https://aur.archlinux.org/libscrypt.git
cd libscrypt
makepkg -si --noconfirm
# make the bacon
cd /archiso
bash make_iso.sh

89
make_iso.sh Normal file
View file

@ -0,0 +1,89 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd $DIR
ARCH=x86_64
REPO_DIR=$DIR/repo/$ARCH
REPO=$REPO_DIR/repo.db.tar.gz
PACKAGE_DIR=$DIR/packages
WORKDIR=$DIR/archlive/
echo "Init Workdir"
echo "============"
echo "Removing $WORKDIR"
sudo rm -rf $WORKDIR
cp -r /usr/share/archiso/configs/releng/ $WORKDIR
# echo "Setting up mkinitcpio.conf"
# sed -i 's/\(HOOKS=(.*\))/\1 bcachefs)/' $WORKDIR/mkinitcpio.conf
# cat >> $WORKDIR/mkinitcpio.conf <<EOF
# MODULES=(bcachefs)
# BINARIES=(bcachefs)
# EOF
echo "Patching build.sh"
sed -i 's/vmlinuz-linux/vmlinuz-linux-bcachefs-git/' archlive/build.sh
echo "Adding Packages"
cat >> $WORKDIR/packages.x86_64 <<EOF
libscrypt-git
bcachefs-tools-git
linux-bcachefs-git
linux-bcachefs-git-headers
linux-bcachefs-git-docs
EOF
echo "Setting up pacman.conf"
cat >> $WORKDIR/pacman.conf <<EOF
[repo]
SigLevel = Optional TrustAll
Server = file:///$REPO_DIR/
EOF
echo "Init Repo"
echo "========="
mkdir -p $REPO_DIR
mkdir -p $PACKAGE_DIR
repo-add $REPO
printf "\nBuilding AUR Packages\n"
echo "====================="
# git clone linux-bcachefs-git
# git clone https://aur.archlinux.org/bcachefs-tools-git.git
# git clone https://aur.archlinux.org/linux-bcachefs-git.git
function add_aur {
CURRDIR=$(pwd)
URL=$1
NAME=$(echo $URL | sed -r 's/^.*\.org\/(.*).git$/\1/')
cd $PACKAGE_DIR
if [ ! -d "$NAME" ]; then
git clone $URL
cd $NAME
makepkg -s
else
cd $NAME
fi
repo-add $REPO *.pkg.tar.xz
cp *.pkg.tar.xz $REPO_DIR
# restore
cd $CURRDIR
}
add_aur https://aur.archlinux.org/libscrypt-git.git
add_aur https://aur.archlinux.org/bcachefs-tools-git.git
add_aur https://aur.archlinux.org/linux-bcachefs-git.git
printf "\nBuilding the ISO\n"
echo "====================="
cd $WORKDIR
sudo ./build.sh -v