-
Notifications
You must be signed in to change notification settings - Fork 0
/
genrebuild
executable file
·94 lines (78 loc) · 2.45 KB
/
genrebuild
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
#!/bin/sh
set -eu
if [ ! -d /mnt/distfiles ]; then
echo "This must be run in a chroot. Be careful!" >&2
exit 1
fi
portage_logdir="${PORTAGE_LOGDIR:-/mnt/build/buildlogs}"
unset PORTAGE_LOGDIR
export FEATURES='-news -parallel-fetch -buildpkg -binpkg-logs -unmerge-logs'
export GENTOO_MIRRORS=/mnt/distfiles
export FETCHCOMMAND='bash -c "echo ${FILE}; read"'
export CONFIG_PROTECT='-* /etc/locale.gen'
# kernel and modules to use
kern_pkgs="
sys-kernel/gentoo-kernel
app-emulation/virtualbox
sys-power/acpi_call
"
#app-emulation/virtualbox-guest-additions
kern_del_pkgs="
virtual/dist-kernel
virtual/linux-sources
app-emulation/virtualbox-modules
"
# packages to delete
del_grps="
@group-sway-desktop
"
del_pkgs="
sys-apps/fwupd
app-doc/python-docs
dev-java/openjdk:11
dev-java/openjdk:17
sys-devel/gcc:11
sys-boot/plymouth-openrc-plugin
"
# packages to install in final system
ins_pkgs="
sys-firmware/intel-microcode
sys-kernel/dracut
"
# packages to install in build environment (deps for ./geniso)
bld_pkgs="
dev-libs/libisoburn
sys-fs/mtools
sys-fs/squashfs-tools
"
# Remove some packages
emerge --ask=n -W $del_grps $del_pkgs $kern_pkgs $kern_del_pkgs
# Check if packages are actually going to be removed
# NOTE: No status code on exit, so the output must be examined manually
emerge -pvc $del_pkgs $kern_del_pkgs $kern_pkgs
# Download everything
emerge --ask=n -fNe @world $ins_pkgs $bld_pkgs $kern_pkgs
# Disabling USE=wayland on gtk+:3 causes everything to not link
# immodules are loaded to update the cache, causing builds to fail
# Remove them so they don't get picked up until rebuilt
rm -rf /usr/lib64/gtk-3.0/3.0.0/immodules
# Configure /etc/locale.gen to avoid building all locales
cat > /etc/locale.gen << 'EOF'
C.UTF-8 UTF-8
EOF
# Make sure USE flags check out before doing anything
emerge -puDU @world
emerge --ask=n -uDU @world
# Install extra packages
emerge --ask=n -n $ins_pkgs
# Get rid of unnecessary packages
emerge --ask=n -c
# Perform a gcc->glibc cycle (rebuild for -march flags)
EXTRA_ECONF='--disable-bootstrap' emerge --ask=n -1 sys-devel/gcc
emerge --ask=n -1 sys-libs/glibc
# Rebuild everything
PORTAGE_LOGDIR="$portage_logdir" emerge --ask=n -bNe --with-bdeps=y @world
# Install the kernel and modules
PORTAGE_LOGDIR="$portage_logdir" emerge --ask=n -bNn $kern_pkgs
# Install extra utilities in the build environment
PORTAGE_LOGDIR="$portage_logdir" emerge --ask=n -bN1n $bld_pkgs