This repository has been archived by the owner on Aug 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.sh
executable file
·82 lines (71 loc) · 2.14 KB
/
build.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
#!/bin/bash
################################################################
# Tools for formatting / styling
# Define terminal color codes
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;36m'
NC='\033[0m' # No Color
# Echo with colors
colorecho() {
color="$1"
text="$2"
echo -e "${color}${text}${NC}"
}
################################################################
colorecho "$BLUE" "Arch Repo Build Tool"
echo
system_arch=$(uname -m)
colorecho "$GREEN" "System is $system_arch"
mkdir -p build
cd build
if [ ! -f "arb" ]; then
if [ "$system_arch" == "aarch64" ] || [ "$system_arch" == "arm64" ] || [ "$system_arch" == "armv8" ]; then
curl -LJO https://github.com/kwankiu/PKGBUILDs/releases/download/arb/arb-aarch64
mv arb-aarch64 arb
sudo chmod +x arb
elif [ "$system_arch" == "x86_64" ]; then
curl -LJO https://github.com/kwankiu/PKGBUILDs/releases/download/arb/arb-x86_64
mv arb-x86_64 arb
sudo chmod +x arb
else
colorecho "$RED" "Error: Unsupported System Arch. Exiting ..."
exit 1
fi
fi
if [ -n "$1" ]; then
colorecho "$BLUE" "Building packages for $1 ..."
sudo ./arb "../$1.yaml"
if [ -n "$2" ]; then
repo_name="$2"
else
repo_name="$1"
fi
else
arbconfig=($(ls ../ | grep .yaml))
for ((i = 0; i < ${#arbconfig[@]}; i++)); do
colorecho "$BLUE" "Building packages for ${arbconfig[i]} ..."
sudo ./arb "../${arbconfig[i]}"
done
repo_name="experimental"
fi
colorecho "$BLUE" "Copying new packages to repository ($repo_name) ..."
cd ../
mkdir -p repo/$repo_name
cp -L build/pkgs/updated/* repo/$repo_name
cd repo/$repo_name
# Sign pkg
colorecho "$BLUE" "Signing new packages ..."
pkg=($(ls | grep .pkg.tar | grep -v .sig))
for ((i = 0; i < ${#pkg[@]}; i++)); do
if [ -f "${pkg[i]}.sig" ]; then
echo "${pkg[i]} already signed, skipping ..."
else
echo "Signing ${pkg[i]} ..."
gpg --detach-sign --no-armor ${pkg[i]}
fi
done
repo-add -s -v -n ${repo_name}.db.tar.xz *.pkg.tar.xz
#repo-add -s -v -n ${repo_name}.db.tar.xz *.pkg.tar.zst
sudo rm -rf *db*.old *db*.old.*