forked from szclsya/x13s-alarm
-
Notifications
You must be signed in to change notification settings - Fork 6
/
entrypoint.sh
executable file
·51 lines (42 loc) · 1.52 KB
/
entrypoint.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
#!/bin/bash
set -e
cd /build
repo_full=$(cat ./repo)
repo_owner=$(echo $repo_full | cut -d/ -f1)
repo_name=$(echo $repo_full | cut -d/ -f2)
sed -i '/\[community\]/d' /etc/pacman.conf
sed -i 's/#ParallelDownloads = 5/ParallelDownloads = 5/' /etc/pacman.conf
pacman-key --init
pacman -Syu --noconfirm --needed sudo git wget
useradd builduser -m
chown -R builduser:builduser /build
git config --global --add safe.directory /build
sudo -u builduser gpg --keyserver keyserver.ubuntu.com --recv-keys 38DBBDC86092693E
passwd -d builduser
printf 'builduser ALL=(ALL) ALL\n' | tee -a /etc/sudoers
cat ./gpg_key | base64 --decode | gpg --homedir /home/builduser/.gnupg --import
rm ./gpg_key
echo "checking out key"
gpg --homedir /home/builduser/.gnupg --list-keys
sudo pacman -S base-devel --noconfirm --needed
for i in "linux-x13s" "linux-x13s-archiso" "x13s-firmware" ; do
status=13
git submodule update --init $i
cd $i
for i in $(sudo -u builduser makepkg --packagelist); do
package=$(basename $i)
wget https://github.com/$repo_owner/$repo_name/releases/download/packages/$package \
&& echo "Warning: $package already built, did you forget to bump the pkgver and/or pkgrel? It will not be rebuilt."
done
sudo -u builduser bash -c 'export MAKEFLAGS=-j$(nproc) && makepkg --sign -s --noconfirm'||status=$?
# Package already built is fine.
if [ $status != 13 ]; then
exit 1
fi
cd ..
done
cp */*.pkg.tar.* ./
repo-add --sign ./$repo_owner-x13s.db.tar.gz ./*.pkg.tar.xz
for i in *.db *.files; do
cp --remove-destination $(readlink $i) $i
done