blob: 3d6454637d9ef32b3baabbc5fbdcb39c717cc10e (
plain)
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
|
#!/bin/bash
##############################################################################
# parabola-riscv64-bootstrap #
# #
# Copyright (C) 2018 Andreas Grapentin #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
##############################################################################
check_stage3_chroot() {
echo -n "checking for $CARCH chroot ... "
local have_chroot=yes
[ -e "$1" ] || have_chroot=no
echo $have_chroot
[ "x$have_chroot" == "xyes" ] || return "$ERROR_MISSING"
}
build_stage3_chroot() {
rm -rf /var/cache/pacman/pkg-"$CARCH"/*
librechroot -n "$CHOST-stage3" \
-C "$BUILDDIR"/config/pacman-bootstrap.conf \
-M "$BUILDDIR"/config/makepkg.conf \
make || return
}
umount_stage3_chrootdir() {
local chrootdir
chrootdir="$(librechroot -n "$CHOST-stage3" 2>&1 | grep "copydir.*:" | awk '{print $3}')"
umount "$chrootdir"/repos/native/"$CARCH"
umount "$chrootdir"/repos/cross/"$CARCH"
trap - INT TERM EXIT
}
mount_stage3_chrootdir() {
mkdir -p "$1"/repos/{native,cross}/"$CARCH"
for repo in native cross; do
if mount | grep -q "$1/repos/$repo/$CARCH"; then umount "$1/repos/$repo/$CARCH"; fi
done
mount -o bind "$PKGDEST" "$1"/repos/native/"$CARCH"
mount -o bind "${PKGDEST//stage3/stage2}" "$1"/repos/cross/"$CARCH"
trap 'umount_stage3_chrootdir' INT TERM EXIT
}
prepare_stage3_chroot() {
local chrootdir
chrootdir="$(librechroot -n "$CHOST-stage3" 2>&1 | grep "copydir.*:" | awk '{print $3}')"
check_stage3_chroot "$chrootdir" || build_stage3_chroot "$chrootdir" || return
mount_stage3_chrootdir "$chrootdir"
librechroot -n "$CHOST-stage3" \
-C "$BUILDDIR"/config/pacman.conf \
-M "$BUILDDIR"/config/makepkg.conf \
update || return
}
|