forked from QubesOS/qubes-builder-archlinux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-local-repo.sh
executable file
·41 lines (30 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
#!/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
mkdir -p "$PKGS_DIR"
if [ ! -f "${PKGS_DIR}/qubes.db" ]; then
# pacman does not deal correctly with empty repositories
echo " -> Repo '${PKGS_DIR}' appears empty; initialising with pacman itself..."
cp "${CHROOT_DIR}/var/cache/pacman/pkg"/{pacman,sudo}*.pkg.tar.xz "${PKGS_DIR}/"
cp "${CACHEDIR}/pacman_cache/pkg"/{pacman,sudo}*.pkg.tar.xz "${PKGS_DIR}/"
fi
set -e
# Remove local qubes packages signatures because pacman will only trust these
# local packages if no signature is provided
env $CHROOT_ENV chroot "$CHROOT_DIR" /bin/su user -c \
'cd /tmp/qubes-packages-mirror-repo/pkgs && if [ -n "$(ls *.sig)" ] ; then rm *.sig ; fi'
# Generate custom repository metadata based on packages that are available
env $CHROOT_ENV chroot "$CHROOT_DIR" /bin/su user -c \
'cd /tmp/qubes-packages-mirror-repo && repo-add pkgs/qubes.db.tar.gz pkgs/*.pkg.tar.xz;'
# Ensure pacman doesn't check for disk free space -- it doesn't work in chroots
env $CHROOT_ENV chroot "$CHROOT_DIR" /bin/sh -c \
'sed "s/^ *CheckSpace/#CheckSpace/g" -i /etc/pacman.conf'
# Update archlinux keyring first so that Archlinux can be updated even after a long time
env $CHROOT_ENV chroot "$CHROOT_DIR" /bin/sh -c \
"http_proxy='${REPO_PROXY}' pacman -Sy --noconfirm archlinux-keyring"
# Now update system
env $CHROOT_ENV chroot "$CHROOT_DIR" /bin/sh -c \
"http_proxy='${REPO_PROXY}' pacman -Syu --noconfirm"