forked from QubesOS/qubes-builder-archlinux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-local-repo.sh
executable file
·46 lines (35 loc) · 1.63 KB
/
update-local-repo.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
#!/bin/sh
# update-local-repo.sh: Add all available packages to the custom repository,
# initialising it if necessary
echo "-> Archlinux update-local-repo.sh"
PKGS_DIR="${BUILDER_REPO_DIR}/pkgs"
[ "$VERBOSE" -ge 2 -o "$DEBUG" -gt 0 ] && set -x
chroot_cmd() {
systemd-nspawn --directory="$CHROOT_DIR" \
--keep-unit \
--register=no \
--bind="${BUILDER_REPO_DIR}":"/tmp/qubes-packages-mirror-repo" \
--chdir=/tmp/qubes-packages-mirror-repo \
"$@"
}
mkdir -p "$PKGS_DIR"
if [ ! -f "${PKGS_DIR}/qubes.db" ]; then
echo " -> Repo '${PKGS_DIR}' appears empty; initialising..."
chroot_cmd --user=user repo-add pkgs/qubes.db.tar.gz
fi
set -e
# Remove local qubes packages signatures because pacman will only trust these
# local packages if no signature is provided
chroot_cmd --user=user /bin/sh -c 'if [ -n "$(ls pkgs/*.sig)" ] ; then rm pkgs/*.sig ; fi'
# Generate custom repository metadata based on packages that are available
# Repo Add need packages to be added in the right version number order as it only keeps the last entered package version
chroot_cmd --user=user /bin/sh -c \
'for pkg in `ls -v pkgs/*.pkg.tar.*`; do repo-add pkgs/qubes.db.tar.gz "$pkg"; done;'
# Ensure pacman doesn't check for disk free space -- it doesn't work in chroots
chroot_cmd sed "s/^ *CheckSpace/#CheckSpace/g" -i /etc/pacman.conf
# Update archlinux keyring first so that Archlinux can be updated even after a long time
chroot_cmd /bin/sh -c \
"http_proxy='${REPO_PROXY}' pacman -Sy --noconfirm archlinux-keyring"
# Now update system
chroot_cmd /bin/sh -c \
"http_proxy='${REPO_PROXY}' pacman -Syu --noconfirm"