-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmkosi.postinst.chroot
More file actions
executable file
·146 lines (122 loc) · 5.1 KB
/
mkosi.postinst.chroot
File metadata and controls
executable file
·146 lines (122 loc) · 5.1 KB
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
# SPDX-FileCopyrightText: 2023 Harald Sitter <sitter@kde.org>
set -ex
env
mkdir --mode 0700 /system # for the kde-linux-overlay.service
export SYSTEMD_ESP_PATH="$BOOT_MNT"
mkdir --mode 0700 "$SYSTEMD_ESP_PATH"
bootctl install
echo 'timeout 7' >> "$SYSTEMD_ESP_PATH/loader/loader.conf"
cp /usr/share/edk2-shell/x64/Shell.efi "$SYSTEMD_ESP_PATH/shellx64.efi"
# Meanwhile cleanup a bit
## Unnecessary for us
pacman --remove --noconfirm qt6-doc qt6-examples || true
# FIXME: needed by cxx-rust-cssparser; can't remove these for now
# pacman --remove --noconfirm corrosion rust || true
# No packagekit support or AppStream metadata in discover please! We don't want discover talking about pacman things.
pacman --remove --noconfirm packagekit libpackagekit-glib archlinux-appstream-data || true
rm -rf /usr/share/swcatalog
# Calamares
cd /tmp
# We're building Calamares from master, due to https://codeberg.org/Calamares/calamares/pulls/2470 not being in a release yet.
# It can be switched back to build from the latest release once a new release is cut that includes that PR.
#LATEST_RELEASE=$(curl -s "https://codeberg.org/api/v1/repos/Calamares/calamares/releases" | jq -r '.[0].tag_name')
#git clone --branch "$LATEST_RELEASE" --depth 1 https://codeberg.org/Calamares/calamares.git
git clone --depth 1 https://codeberg.org/Calamares/calamares.git
cmake -S calamares -B calamares/build -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_TESTING=OFF -DWITH_QT6=ON
cmake --build calamares/build "-j$(nproc)"
DESTDIR=/live/ cmake --install calamares/build
cat <<- EOF > /usr/share/icons/default/index.theme
[Icon Theme]
Inherits=breeze_cursors
EOF
# WARNING: only set up os-release after the build otherwise kde-build doesn't know how to handle the system currently
cat <<- EOF > /usr/lib/os-release
NAME="KDE Linux"
PRETTY_NAME="KDE Linux"
ID=kde-linux
DEFAULT_HOSTNAME=kde-linux
VERSION_ID="$VERSION_DATE"
BUILD_ID=$CI_COMMIT_SHORT_SHA
ANSI_COLOR="38;2;61;174;233"
HOME_URL="https://kde.org/linux"
DOCUMENTATION_URL="https://community.kde.org/KDE_Linux"
SUPPORT_URL="https://kde.org/support/"
BUG_REPORT_URL="https://invent.kde.org/kde-linux/kde-linux/-/issues"
PRIVACY_POLICY_URL="https://kde.org/privacypolicy-apps/"
LOGO=/usr/share/pixmaps/kde-linux-logo.png
IMAGE_ID=kde-linux
IMAGE_VERSION=$IMAGE_VERSION
# KDE Linux specific keys.
KDE_LINUX_COMMIT_SHA=$CI_COMMIT_SHA
KDE_LINUX_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA
KDE_LINUX_CI_URL=$CI_PIPELINE_URL
KDE_LINUX_SYSUPDATE_ENDPOINT=sysupdate/v2
EOF
[ -f /usr/lib/os-release ] || false
cat /usr/lib/os-release
download_flatpaks() {
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
# Do this separately, when used as part of remote-add it complains about GPG for unknown reasons
flatpak remote-modify --collection-id=org.flathub.Stable flathub
# Setting "*" will let Flatpak download all languages at once
flatpak config --set languages "*"
kde_nightly=(
ark
gwenview
kcalc
haruna
okular
qrca
)
# Add Nightly repos
for app in "${kde_nightly[@]}"; do
flatpak remote-add --if-not-exists "${app}-nightly" \
"https://cdn.kde.org/flatpak/${app}-nightly/${app}-nightly.flatpakrepo"
done
# Flatpak ignores repo priorities, prompting for remote selection.
# Looping avoids this and keeps automation working.
# Issue: https://github.com/flatpak/flatpak/issues/5421
for app in "${kde_nightly[@]}"; do
flatpak install --or-update --noninteractive --assumeyes "${app}-nightly" "org.kde.${app}"
done
# Install KWrite from Flathub for now, until it has a nightly repo.
flatpak install --or-update --noninteractive --assumeyes flathub \
org.gtk.Gtk3theme.Breeze \
org.kde.kwrite \
org.mozilla.firefox
# And restore default
flatpak config --unset languages
}
download_flatpaks
# Fetch latest distrobox config from the kde-linux-containers repo
mkdir -p /usr/share/distrobox
curl --output /usr/share/distrobox/distrobox.conf \
'https://invent.kde.org/api/v4/projects/19899/repository/files/distrobox.conf/raw'
# Enable samba usershare
cat <<- EOF >> /etc/samba/smb.conf
[global]
usershare path = /var/lib/samba/usershares
usershare max shares = 100
usershare allow guests = yes
usershare owner only = yes
EOF
# Set default shell as zsh for new users
sed -i 's%^SHELL=/usr/bin/bash%SHELL=/usr/bin/zsh%' /etc/default/useradd
# Put new users in sambashare group
sed -i 's%^GROUP=users%GROUP=users\nGROUPS=sambashare%' /etc/default/useradd
# Our Plymouth Theme
KEEP_THEME="breeze-bgrt"
# Set default Plymouth Theme
plymouth-set-default-theme "$KEEP_THEME"
# Remove all other themes except KEEP_THEME, text, and details
for theme in $(plymouth-set-default-theme --list); do
if [[ "$theme" != "$KEEP_THEME" && "$theme" != "text" && "$theme" != "details" ]]; then
theme_dir="/usr/share/plymouth/themes/$theme"
[[ -d "$theme_dir" ]] && rm -rf -- "$theme_dir"
fi
done
cd /tmp
/usr/lib/rebuild-efi
mv -v ./*.efi /