-
Notifications
You must be signed in to change notification settings - Fork 9
/
stage3-build-init.sh.in
124 lines (103 loc) · 3.18 KB
/
stage3-build-init.sh.in
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/bash -
# Helper to build an SRPM in the stage3 environment. DO NOT RUN
# THIS SCRIPT DIRECTLY! Follow the instructions at:
#
# https://fedoraproject.org/wiki/Architectures/RISC-V/Bootstrapping
# Set up the PATH. The GCC path is a hack because I wasn't able to
# find the right flags for configuring GCC.
PATH=/usr/libexec/gcc/riscv64-unknown-linux-gnu/6.1.0:\
/usr/local/bin:\
/usr/local/sbin:\
/usr/bin:\
/usr/sbin:\
/bin:\
/sbin
export PATH
# Work around default search path problems.
export LD_LIBRARY_PATH=/usr/lib64:/usr/lib
# Root filesystem is mounted as ro, remount it as rw.
mount.static -o remount,rw /
# Mount standard filesystems.
mount.static -t proc /proc /proc
mount.static -t sysfs /sys /sys
mount.static -t tmpfs -o "nosuid,size=20%,mode=0755" tmpfs /run
mkdir -p /run/lock
mkdir -p /dev/pts
mount.static -t devpts /dev/pts /dev/pts
mkdir -p /dev/shm
mount.static -t tmpfs -o mode=1777 shmfs /dev/shm
# XXX devtmpfs
#mount.static -t devtmpfs /dev /dev
rm -f /dev/loop*
mknod /dev/loop-control c 10 237
mknod /dev/loop0 b 7 0
mknod /dev/loop1 b 7 1
mknod /dev/loop2 b 7 2
rm -f /dev/null
mknod /dev/null c 1 3
rm -f /dev/ptmx
mknod /dev/ptmx c 5 2
rm -f /dev/tty /dev/zero
mknod /dev/tty c 5 0
mknod /dev/zero c 1 5
rm -f /dev/random /dev/urandom
mknod /dev/random c 1 8
mknod /dev/urandom c 1 9
# Initialize dynamic linker cache.
ldconfig /usr/lib64 /usr/lib /lib64 /lib
# Fix owner of umount binary.
chown root.root /usr/bin/umount
# There is no hardware clock, just ensure the date is not miles out.
date `date -r /var/tmp +%m%d%H%M%Y`
hostname stage3
echo stage3.fedoraproject.org > /etc/hostname
echo
echo "This is the stage3 SRPM automatic builder"
echo "@SRPM@"
echo
PS1='stage3:\w\$ '
export PS1
# Cleanup function called on failure or exit.
cleanup ()
{
set +e
# Sync disks and shut down.
sync
sleep 5
sync
mount.static -o remount,ro / >&/dev/null
poweroff
}
trap cleanup INT QUIT TERM EXIT ERR
if test ! -f /rpmsdone; then
# On the first run, we need to install all the RPMs and then reboot.
# Don't install documentation and debuginfo files.
rm -f /rpmbuild/RPMS/*/*-doc-*.rpm
rm -f /rpmbuild/RPMS/*/*-docs-*.rpm
rm -f /rpmbuild/RPMS/*/*-debuginfo-*.rpm
# Remove new glibc until we can fix problems.
rm -f /rpmbuild/RPMS/*/*-2.27-[12].fc27*.rpm
rpm -Uvh --nodeps /rpmbuild/RPMS/{noarch,riscv64}/*.rpm ||:
rm -f /var/lib/rpm/__db*
rpm --initdb ||:
touch /rpmsdone
else
# On the second run, we do the actual build.
set -x
set -e
rpmbuild --rebuild /var/tmp/@SRPM@ \
--define "debug_package %{nil}" \
--undefine _annotated_build \
--define "_topdir /rpmbuild" \
--define "_missing_doc_files_terminate_build %{nil}" \
--define "_unitdir /usr/lib/systemd/system" \
--define "_sysctldir /usr/lib/sysctl.d" \
--define "_tmpfilesdir /usr/lib/tmpfiles.d" \
--define "_udevrulesdir /usr/lib/udev/rules.d" \
--define "_emacs_sitestartdir /usr/share/emacs/site-lisp/site-start.d" \
--define "_emacs_sitelispdir /usr/share/emacs/site-lisp" \
--nodeps \
--nocheck
touch /buildok
fi
# cleanup() is called automatically here.