-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
48 lines (40 loc) · 905 Bytes
/
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
#!/bin/bash -e
printf 'Checking for autobuild... '
if ! command -v autobuild; then
echo 'no'
exit 2
else
echo 'yes'
fi
cleanup () {
echo "Cleaning up ..."
rm -rf "$TMPDIR"
}
get_git_date() {
local DATE
DATE="$(git log -1 --format=%ct)"
date --date "@$DATE" +%Y%m%d
}
printf 'Checking for build directory... '
OLD_WORKDIR="$PWD"
TMP_SPACE="$(df --sync /tmp/ --output=avail | tail -n1)"
if [[ "$TMP_SPACE" -gt 8388608 ]]; then
TMPDIR="$(mktemp -d)"
else
TMPDIR="$(mktemp -d -p /var/cache/)"
fi
echo "$TMPDIR"
trap cleanup EXIT SIGINT SIGTERM
cd "$TMPDIR"
echo "Start building ..."
git clone https://github.com/AOSC-Dev/repokit.git && cd repokit
sed -i 's|lto = "fat"|lto = true|g' Cargo.toml
cat << EOF >> autobuild/defines
# auto-generated ->
PKGVER=0+git$(get_git_date)
PKGREL=0
# <- auto-generated
EOF
autobuild
cp -v -- *.deb "$OLD_WORKDIR"/
rm -rv /debs