-
Notifications
You must be signed in to change notification settings - Fork 2
151 lines (134 loc) · 7.13 KB
/
wf_build_archiso.yaml
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Build Arch ISO with LTS Kernel and ZFS
on:
workflow_dispatch:
schedule:
- cron: '30 4 4 * *'
permissions:
contents: write
jobs:
build-and-upload:
runs-on: ubuntu-latest
container:
image: archlinux:latest
options: --privileged
outputs:
release_date: ${{ steps.build-step.outputs.RELEASE_DATE }}
kernel_version: ${{ steps.build-step.outputs.KERNEL_VERSION }}
zfs_version: ${{ steps.build-step.outputs.ZFS_VERSION }}
steps:
- name: build
id: build-step
shell: bash
run: |
kernel=linux-lts
name=archlinux-lts-zfs
build="$PWD/$name"
build_out="$build/out"
release_date=$(date +'%Y.%m.%d')
echo "RELEASE_DATE=$release_date" >> ${GITHUB_ENV}
echo "BUILD_OUTPUT_DIR=$build_out" >> ${GITHUB_ENV}
pacman -Syy
[ ! "$(pacman -Q archiso)" ] && pacman -S --noconfirm archiso
[ ! "$(pacman -Q libisoburn)" ] && pacman -S --noconfirm libisoburn
[ ! "$(pacman -Q mtools)" ] && pacman -S --noconfirm mtools
[ ! "$(pacman -Q curl)" ] && pacman -S --noconfirm curl
cp -r /usr/share/archiso/configs/releng "$build"
sed -i "s/^linux$/$kernel/" "$build"/packages.x86_64
pkg_add=(
"zfs-$kernel"
"$kernel-headers"
)
for a in "${pkg_add[@]}" ; do
echo "$a" >> "$build"/packages.x86_64
done
pkg_rmv=(
broadcom-wl
b43-fwcutter
)
for a in "${pkg_rmv[@]}" ; do
sed -i "/$a/d" "$build"/packages.x86_64
done
cd "$build"/airootfs/etc/mkinitcpio.d
mv linux.preset "$kernel".preset
sed -i "s/vmlinuz-linux/vmlinuz-$kernel/" "$kernel".preset
sed -i "s/initramfs-linux.img/initramfs-$kernel.img/" "$kernel".preset
cd "$build"/syslinux
sed -i "s/vmlinuz-linux/vmlinuz-$kernel/" archiso_sys-linux.cfg
sed -i "s/initramfs-linux.img/initramfs-$kernel.img/" archiso_sys-linux.cfg
sed -i "s/vmlinuz-linux/vmlinuz-$kernel/" archiso_pxe-linux.cfg
sed -i "s/initramfs-linux.img/initramfs-$kernel.img/" archiso_pxe-linux.cfg
cd "$build"/efiboot/loader/entries
sed -i "s/vmlinuz-linux/vmlinuz-$kernel/" 01-archiso-x86_64-linux.conf
sed -i "s/initramfs-linux.img/initramfs-$kernel.img/" 01-archiso-x86_64-linux.conf
sed -i "s/vmlinuz-linux/vmlinuz-$kernel/" 02-archiso-x86_64-speech-linux.conf
sed -i "s/initramfs-linux.img/initramfs-$kernel.img/" 02-archiso-x86_64-speech-linux.conf
cp "$build"/pacman.conf "$build"/airootfs/etc/pacman.conf
mkdir -p "$build"/airootfs/usr/share/pacman/keyrings
echo -e "\n[archzfs]\nSigLevel = Never\nServer = https://github.com/archzfs/archzfs/releases/download/experimental" >> "$build"/pacman.conf
echo -e "\n[archzfs]\nServer = https://github.com/archzfs/archzfs/releases/download/experimental" >> "$build"/airootfs/etc/pacman.conf
echo -e "3A9917BF0DED5C13F69AC68FABEC0A1208037BE9:4:" >> "$build"/airootfs/usr/share/pacman/keyrings/archzfs-trusted
echo -e "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmDMEZwfegRYJKwYBBAHaRw8BAQdApTEe98tOu58rF+0NUGXXx/VxenWgb0VjnvBx\niSEYUcK0LEFyY2haRlMgUHJvamVjdCAoaHR0cHM6Ly9naXRodWIuY29tL2FyY2h6\nZnMpiJgEExYKAEAWIQQ6mRe/De1cE/aaxo+r7AoSCAN76QUCZwfegQIbAwsLCQoN\nCAwHCwQDAgcVCgkICwIDBRYCAwEAAh4FAheAAAoJEKvsChIIA3vpfFAA/2XBSvSt\nhopEFZOqY25peeXAXfl7ufCXolvGEE9iSh1sAQDm08strIIy0SNZtMtWg7r70tCw\n7I6z1M7liy+rfgLBDw==\n=SxXd\n-----END PGP PUBLIC KEY BLOCK-----" >> "$build"/airootfs/usr/share/pacman/keyrings/archzfs.gpg
echo -e '\n\t\033[1m' 'Welcome to Arch Linux LTS with OpenZFS' '\033[0m\n' > "$build"/airootfs/etc/motd
profile="$build"/profiledef.sh
sed -i "s/iso_name=\"archlinux\"/iso_name=\"archlinux-lts-zfs\"/" "$profile"
sed -i "s/iso_label=\"ARCH_\$(date +%Y%m)\"/iso_label=\"ArchLTSZFS_\$(date +%Y-%m-%d)\"/" "$profile"
sed -i "/choose-mirror/d" "$profile"
[ -d /tmp/"$name" ] && cd /tmp ; rm -rf "$name"
mkarchiso -v -w /tmp/"$name" -o "$build_out" "$build"
cd "$build_out"
ls -alh
mkdir extracted && cd extracted
osirrox -indev "../archlinux-lts-zfs-$release_date-x86_64.iso" -extract_boot_images ./ -extract /EFI/BOOT/BOOTx64.EFI loader.efi
curl -o BOOTx64.EFI https://blog.hansenpartnership.com/wp-uploads/2013/PreLoader.efi
curl -o HashTool.efi https://blog.hansenpartnership.com/wp-uploads/2013/HashTool.efi
mcopy -D oO -i eltorito_img2_uefi.img BOOTx64.EFI loader.efi HashTool.efi ::/EFI/BOOT/
xorriso -indev ../archlinux-lts-zfs-$release_date-x86_64.iso -outdev archlinux-lts-zfs-sb-$release_date-x86_64.iso -map_l ./ /EFI/BOOT/ BOOTx64.EFI loader.efi HashTool.efi -- -boot_image any replay -append_partition 2 0xef eltorito_img2_uefi.img
mv archlinux-lts-zfs-sb-$release_date-x86_64.iso ../archlinux-lts-zfs-$release_date-x86_64.iso
cd .. && rm -rf extracted
sha256sum archlinux-lts-zfs-$release_date-x86_64.iso > archlinux-lts-zfs-$release_date-x86_64.iso.sha256
echo "KERNEL_VERSION=$(chroot /tmp/$name/x86_64/airootfs pacman -Q linux-lts | sed 's/\s\+/:/')" >> ${GITHUB_OUTPUT}
echo "ZFS_VERSION=$(chroot /tmp/$name/x86_64/airootfs pacman -Q zfs-linux-lts | sed 's/\s\+/:/')" >> ${GITHUB_OUTPUT}
echo "RELEASE_DATE=$release_date" >> ${GITHUB_OUTPUT}
- name: upload-iso
uses: actions/upload-artifact@v4
with:
name: archlinux-lts-zfs-${{ env.RELEASE_DATE }}-x86_64.iso
path: ${{ env.BUILD_OUTPUT_DIR }}/archlinux-lts-zfs-${{ env.RELEASE_DATE }}-x86_64.iso
retention-days: 1
- name: upload-sha
uses: actions/upload-artifact@v4
with:
name: archlinux-lts-zfs-${{ env.RELEASE_DATE }}-x86_64.iso.sha256
path: ${{ env.BUILD_OUTPUT_DIR }}/archlinux-lts-zfs-${{ env.RELEASE_DATE }}-x86_64.iso.sha256
retention-days: 1
download-and-publish:
runs-on: ubuntu-latest
needs: build-and-upload
strategy:
matrix:
name: [iso, sha]
include:
- name: iso
file: archlinux-lts-zfs-${{ needs.build-and-upload.outputs.release_date }}-x86_64.iso
- name: sha
file: archlinux-lts-zfs-${{ needs.build-and-upload.outputs.release_date }}-x86_64.iso.sha256
steps:
- name: download
uses: actions/download-artifact@v4
with:
name: ${{ matrix.file }}
path: ./
- name: unzip
shell: bash
run: |
ls -alh
- name: publish
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./${{ matrix.file }}
asset_name: ${{ matrix.file }}
tag: ${{ needs.build-and-upload.outputs.release_date }}
body: "Packages: ${{ needs.build-and-upload.outputs.kernel_version }} & ${{ needs.build-and-upload.outputs.zfs_version }}"
overwrite: true
file_glob: false