forked from vale981/archiso-bcachefs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_iso.sh
executable file
·112 lines (86 loc) · 2.33 KB
/
make_iso.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd $DIR
ISO_NAME="Arch Linux with bcachefs support."
ISO_PUBLISHER="Valentin Boettcher <hiro at protagon.space>"
ARCH=x86_64
KERNEL_ARCH=
REPO_BASE=$(sudo mktemp -d /var/XXXX-repo)
REPO_DIR=$REPO_BASE/$ARCH
REPO=$REPO_DIR/repo.db.tar.gz
PACKAGE_DIR=$DIR/packages
WORKDIR=$DIR/archlive/
function cleanup {
sudo rm -r $REPO_BASE
}
trap cleanup EXIT
echo "Init Workdir"
echo "============"
echo "Removing $WORKDIR"
sudo rm -rf $WORKDIR
cp -r /usr/share/archiso/configs/releng/ $WORKDIR
echo "Patching build.sh"
sed -i 's/vmlinuz-linux/vmlinuz-linux-bcachefs-git/' $WORKDIR/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 "========="
sudo mkdir -p $REPO_DIR
mkdir -p $PACKAGE_DIR
sudo ls -l $REPO_BASE
sudo 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
INSTALL=$2
NAME=$(echo $URL | sed -r 's/^.*\.org\/(.*).git$/\1/')
cd $PACKAGE_DIR
shopt -s nullglob
BUILT=( $NAME/*.pkg.* )
if (( ${#BUILT[@]} )); then
echo "$NAME already built!"
cd $NAME
else
echo "Building $NAME"
echo "=============="
sudo rm -rf $NAME
git clone $URL
cd $NAME
makepkg -sc --noconfirm
fi
if [ "$INSTALL" = true ]; then
sudo pacman -U *.pkg.* --noconfirm --needed
fi
sudo repo-add $REPO *.pkg.*
sudo cp *.pkg.* $REPO_DIR
# restore
cd $CURRDIR
shopt -u nullglob
}
add_aur https://aur.archlinux.org/libscrypt-git.git true
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 "====================="
sudo mkdir -p $WORKDIR/airootfs/$REPO_BASE
sudo cp -r $REPO_DIR $WORKDIR/airootfs/$REPO_BASE
cd $WORKDIR
sudo ./build.sh -v -N $ISO_NAME -P $ISO_PUBLISHER