-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·59 lines (43 loc) · 1.71 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
#!/usr/bin/env sh
# Make sure we don't inherit these from env.
while getopts "p:h:" opt; do
case $opt in
p) PACKAGES="$OPTARG";;
h) echo "${0#/*}: [-a x86_64|x86_64-musl] [-p packages]" >&2; exit 1;;
esac
done
shift $((OPTIND - 1))
[ ! -x build.sh ] && exit 0
for arch in x86_64 x86_64-musl; do
# clean masterdir
XBPS_TARGET_ARCH=${arch} ./xbps-src clean -m masterdir-${arch}
# new masterdir
./xbps-src binary-bootstrap -A ${arch}
# build packages xbps
for pkgs in $PACKAGES; do
ver_pkgs=$(grep 'version=' $PWD/srcpkgs/${pkgs}/template | sed -e 's/version=//g' | head -1)
rev_pkgs=$(grep 'revision=' $PWD/srcpkgs/${pkgs}/template | sed -e 's/revision=//g')
basename_pkgs="${pkgs}-${ver_pkgs}_${rev_pkgs}.${arch}"
# build xbps
./xbps-src -m masterdir-${arch} pkg ${pkgs}
if [ $arch = "x86_64-musl" ]; then
main_dir="main/musl"
else
main_dir="main"
fi
# moving to musl dir if musl pkgs
if [ $arch = "x86_64-musl" ]; then
mkdir -pv $PWD/hostdir/binpkgs/main/musl
for musl_pkgs in $(ls $PWD/hostdir/binpkgs/main/ | grep "x86_64-musl" | xargs); do
mv $PWD/hostdir/binpkgs/main/${musl_pkgs} $PWD/hostdir/binpkgs/main/musl/
done
fi
# add signed by
XBPS_TARGET_ARCH=${arch} xbps-rindex --privkey ~/.ssh/privkey.pem --sign --signedby "LangitKetujuh Linux" $PWD/hostdir/binpkgs/$main_dir/
# generate signature
XBPS_TARGET_ARCH=${arch} xbps-rindex --privkey ~/.ssh/privkey.pem --sign-pkg $PWD/hostdir/binpkgs/$main_dir/${basename_pkgs}.xbps
# generate x86_64 repodata
XBPS_TARGET_ARCH=${arch} xbps-rindex -a $PWD/hostdir/binpkgs/$main_dir/*.xbps
chmod --preserve-root 644 $PWD/hostdir/binpkgs/$main_dir/*.xbps.sig2
done
done