-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
95 lines (83 loc) · 3.91 KB
/
action.yml
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
name: 'Build AUR Package'
branding:
icon: user-check
color: gray-dark
inputs:
repo-name:
description: 'AUR repository name to build'
required: true
packager:
description: Packager's name
required: true
outputs:
filelist:
description: 'The file list'
value: ${{ steps.build.outputs.filelist }}
runs:
using: composite
steps:
- name: 下载 QEMU
shell: bash
run: |
sudo wget --no-show-progress https://github.com/sunhaiyong1978/CLFS-for-LoongArch/releases/download/20210903/qemu-x86_64-to-loongarch64 -O /usr/local/bin/qemu-loongarch64
sudo chmod +x /usr/local/bin/qemu-loongarch64
- name: 设置 binfmt
shell: bash
run: sudo bash -c 'echo ":qemu-loongarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02\x01:\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-loongarch64:" > /proc/sys/fs/binfmt_misc/register'
- name: 准备 rootfs
shell: bash
run: |
wget --no-show-progress https://github.com/archlinux-loongarch64/archlinux-loongarch64-base/releases/download/v0.2/archlinux-bootstrap-2022.03.18-loongarch64.tar.gz -O /tmp/bootstrap.tar.gz
sudo tar -xzf /tmp/bootstrap.tar.gz -C /
rm -rf /tmp/bootstrap.tar.gz
sudo cp /usr/local/bin/qemu-loongarch64 /loongarch64-root/usr/local/bin/qemu-loongarch64
sudo rm /loongarch64-root/etc/pacman.conf
sudo wget --no-show-progress https://0w.al/rTp5DHP4cMtTfdkTEkXa72Ym -O /loongarch64-root/etc/ca-certificates/extracted/tls-ca-bundle.pem
sudo wget --no-show-progress https://0w.al/6JmkwhPQkjsf7DAy4E67HabW -O /loongarch64-root/etc/pacman.conf
- name: 挂载文件系统
shell: bash
run: |
sudo mount --bind /loongarch64-root /loongarch64-root
sudo mount --bind /dev /loongarch64-root/dev
sudo mount --bind /proc /loongarch64-root/proc
sudo mount --bind /sys /loongarch64-root/sys
sudo mount --bind /run /loongarch64-root/run
sudo mount --bind /etc/resolv.conf /loongarch64-root/etc/resolv.conf
- name: 创建构建用的用户
shell: bash
run: sudo chroot /loongarch64-root /usr/bin/useradd -m builder
- name: 创建构建配置
shell: bash
run: |
sudo bash -c "echo 'PACKAGER=\"${{ inputs.packager }}\"
COMPRESSZST=(zstd -19 -c -z -q --threads=0 -)' > /loongarch64-root/home/builder/.makepkg.conf"
- name: 获取构建所需文件
shell: bash
run: |
if [[ ${{ inputs.repo-name }} != ./* ]];then
git clone https://aur.archlinux.org/${{ inputs.repo-name }}.git
fi # 否则为本地包
chmod -R a+rw ${{ inputs.repo-name }}
sudo mv ${{ inputs.repo-name }} /loongarch64-root/home/builder/
- name: 准备构建
shell: bash
run: |
sudo chroot /loongarch64-root /usr/bin/bash -c 'pacman -Sy && cd /home/builder/* && su builder -c "makepkg -sfAo --skipinteg"'
- name: patch config.guess / config.sub
shell: bash
run: |
all_config_guess=$(sudo find /loongarch64-root/home/builder -name config.guess || echo '')
for config_guess in ${all_config_guess};do
sudo rm ${config_guess}
sudo wget 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess' -O ${config_guess}
done
all_config_sub=$(sudo find /loongarch64-root/home/builder -name config.sub || echo '')
for config_sub in ${all_config_sub};do
sudo rm ${config_sub}
sudo wget 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub' -O ${config_sub}
done
- name: 进行构建
shell: bash
id: build
run: |
sudo chroot /loongarch64-root /usr/bin/bash -c 'cd /home/builder/* && su builder -c "makepkg -sfAe --skipinteg" && echo ::set-output name=filelist::$(su builder -c "makepkg --packagelist" | xargs)'