-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdeploy3.sh
executable file
·91 lines (68 loc) · 2.68 KB
/
deploy3.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
83
84
85
86
87
88
89
90
91
#!/bin/bash
export results_dir="/var/www/html/build-results"
export log_dir="$results_dir/../logs" #"
export build_id=$(cat "$log_dir/last_id")
export reponame="nemomobile"
export CUSTOM_REPO_NAME=nemomobile
export CUSTOM_REPO_URL="http://localhost/build-results"
export BUILD_CHROOT=/var/lib/manjaro-arm-tools/pkg/aarch64
export USE_GIT_PACKAGES="${USE_GIT_PACKAGES-0}"
SED_EXPR=""
if [ "$USE_GIT_PACKAGES" = 1 ]; then
eval $(./list_of_pkgs.sh) # list of packages are loaded into PACKAGES_BUILD see # declare -p PACKAGES_BUILD
for pkg in ${PACKAGES_BUILD[@]}; do
pkg=$(basename "$pkg")
non_git=${pkg%-git}
if [ "$pkg" = "$non_git" ]; then
continue
fi
SED_EXPR+="s/'$non_git'/'$pkg'/g;"
done
fi
export SED_EXPR
#
# $1 name of repo to build e.g. 'tut-git'
#
function build_directory() {
echo "building $1 ..."
log_name=$(printf "%s/%03d-%s.log" "$log_dir" "$build_id" "${1//\//.}")
mkdir -p $(dirname "$log_name");
(
if test -f "$BUILD_CHROOT/etc/pacman.conf" && ! grep -q "^\[$CUSTOM_REPO_NAME\]" "$BUILD_CHROOT/etc/pacman.conf"; then
sed -i "s/^\[core\]/\[$CUSTOM_REPO_NAME\]\nSigLevel = Optional TrustAll\nServer = ${CUSTOM_REPO_URL//\//\\/}\n\n\[core\]/" "$BUILD_CHROOT/etc/pacman.conf"
fi
rsync -r -v /var/cache/manjaro-arm-tools/pkg/aarch64/. "$results_dir"
rm -rvf "${results_dir}/${CUSTOM_REPO_NAME}".db*
rm -rvf "${results_dir}/${CUSTOM_REPO_NAME}".files*
repo-add -q "$results_dir/$CUSTOM_REPO_NAME.db.tar.xz" "$results_dir"/*.pkg.tar.*
manjaro-chroot "$BUILD_CHROOT/" pacman -Syyu --noconfirm
if [ -n "$SED_EXPR" ]; then
sed -i "$SED_EXPR" "$1/PKGBUILD"
fi
buildarmpkg ${BRANCH:+-b "${BRANCH}"} -k -p $* #"
) 2>&1 | tee "$log_name"
ret="${PIPESTATUS[0]}"
if [ "$ret" -eq 0 ]; then
status="OK"
else
status="FAIL"
fi
echo $status
mv "$log_name" "${log_name%.log}.${status}.log"
build_id=$(( build_id + 1 ))
echo "$build_id" > "$log_dir/last_id"
}
export BUILDARCH="aarch64"
export BUILD="build_directory"
export -f build_directory
mkdir -p "$results_dir"
mkdir -p "$log_dir"
rm -rfv /var/cache/manjaro-arm-tools/pkg/aarch64
rm -rfv /var/cache/manjaro-arm-tools/pkg/pkg-cache/*
buildarmpkg -p none-just-init-the-chroot
./deploy.sh
rsync -r -v /var/cache/manjaro-arm-tools/pkg/aarch64/. "$results_dir"
rm -rvf "${results_dir}/${CUSTOM_REPO_NAME}".db*
rm -rvf "${results_dir}/${CUSTOM_REPO_NAME}".files*
repo-add -q "$results_dir/$CUSTOM_REPO_NAME.db.tar.xz" "$results_dir"/*.pkg.tar.*
manjaro-chroot "$BUILD_CHROOT/" pacman -Syyu --noconfirm