This repository has been archived by the owner on Nov 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·58 lines (51 loc) · 1.73 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
#!/bin/bash
tmpdir=$(mktemp -d)
cleanup() {
rm -rf "$tmpdir"
}
trap cleanup EXIT
branch="arm-unstable"
arch="aarch64"
# To always use an up-to-date mirror download the page, extract the columns of 'green' mirrors, and finally extract the url of the first one
url=$(curl https://repo.manjaro.org | hxnormalize -x | hxselect -s "\n" "tr.green a" | sed -e "s/.*>\(.*\)<\/a>/\1/" | head -n 1)
baseurl="http://$url/$branch"
for repo in extra community kde-unstable; do
wget "$baseurl/$repo/$arch/$repo.db" -O "$tmpdir/$repo.db"
mkdir -p "$tmpdir/$repo"
tar -xzf "$tmpdir/$repo.db" -C "$tmpdir/$repo" >/dev/null 2>&1
done
for ui in "plasma-mobile" "lomiri" "phosh"; do
IFS=$'\n' read -d '' -r -a packages <"$ui.packages"
mkdir -p repo/$ui
for packageCombo in "${packages[@]}"; do
pkgfile=("$tmpdir/$packageCombo-"*/desc)
# shellcheck disable=SC2128
if [ ! -f "$pkgfile" ]; then
echo "Package not found: $packageCombo"
exit 1
fi
# shellcheck disable=SC2128
IFS=$'\n' read -d '' -r -a lines <"$pkgfile"
filename=""
packager=""
for i in "${!lines[@]}"; do
line="${lines[$i]}"
if [ "$line" == "%FILENAME%" ]; then
filename="${lines[$i + 1]}"
elif [ "$line" == "%PACKAGER%" ]; then
packager="${lines[$i + 1]}"
fi
if [ -n "$filename" ] && [ -n "$packager" ]; then
break
fi
done
if [[ "$packager" == *"Arch Linux ARM Build System"* ]]; then
echo "Package $packageCombo is already provided by ALARM"
exit 1
fi
if [ ! -f "repo/$ui/$filename" ]; then
wget "$baseurl/$(dirname "$packageCombo")/$arch/$filename" -O "repo/$ui/$filename"
repo-add -R -n -p "repo/$ui/$ui.db.tar.xz" "repo/$ui/$filename"
fi
done
done