mirror of
https://github.com/KDE/kde-linux.git
synced 2025-12-24 00:18:23 -05:00
140 lines
4.8 KiB
Bash
Executable File
140 lines
4.8 KiB
Bash
Executable File
#!/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
|
|
mkdir /snap # for snapd (will get a subvolume mounted into that snapd then mounts the snaps into)
|
|
mkdir /media # for snap, wants this to exist or fails when trying to create it
|
|
|
|
export SYSTEMD_ESP_PATH="$BOOT_MNT"
|
|
mkdir --mode 0700 "$SYSTEMD_ESP_PATH"
|
|
bootctl install
|
|
echo 'timeout 5' >> "$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
|
|
## Rust gets static compiled anyway. No need to have it in the image
|
|
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
|
|
|
|
# Calamares
|
|
cd /tmp
|
|
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
|
|
VERSION_ID="$VERSION_DATE"
|
|
BUILD_ID=$CI_COMMIT_SHORT_SHA
|
|
ANSI_COLOR="38;2;61;174;233"
|
|
HOME_URL="https://linux.kde.org/"
|
|
DOCUMENTATION_URL="https://userbase.kde.org/KDE_Linux"
|
|
SUPPORT_URL="https://kde.org/support/"
|
|
BUG_REPORT_URL="https://bugs.kde.org/enter_bug.cgi?product=kde-linux"
|
|
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
|
|
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
|
|
|
|
# Only check out en. We don't really support other languages on the live image at this time.
|
|
flatpak config --set languages en
|
|
|
|
flatpak remote-add --if-not-exists kde-runtime-nightly https://cdn.kde.org/flatpak/kde-runtime-nightly/kde-runtime-nightly.flatpakrepo
|
|
|
|
kde_nightly=(
|
|
ark
|
|
elisa
|
|
gwenview
|
|
kate
|
|
haruna
|
|
)
|
|
|
|
# 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 and Okular from Flathub for now, until they have nightly repos.
|
|
flatpak install --or-update --noninteractive --assumeyes flathub \
|
|
org.kde.kwrite \
|
|
org.kde.okular \
|
|
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
|
|
|
|
# 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/bin/_kde-linux-rebuild-efi
|
|
mv -v ./*.efi /
|