From d2e70da2cb115cc632ca38e52860bbe298260399 Mon Sep 17 00:00:00 2001 From: Tulili Date: Mon, 5 Jun 2023 04:12:13 -0300 Subject: [PATCH] feat: lightdm and groupinstalls for image --- Containerfile | 25 +++++++++++++++++-- etc/profile.d/cinnamon-firstboot.sh | 6 +++++ .../system/ublue-lightdm-workaround.service | 16 ++++++++++++ etc/ublue-lightdm-workaround.sh | 11 ++++++++ packages.json | 2 +- 5 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 etc/profile.d/cinnamon-firstboot.sh create mode 100644 etc/systemd/system/ublue-lightdm-workaround.service create mode 100644 etc/ublue-lightdm-workaround.sh diff --git a/Containerfile b/Containerfile index 55a28b4..fb56cac 100644 --- a/Containerfile +++ b/Containerfile @@ -6,7 +6,9 @@ ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-38}" FROM ${BASE_IMAGE}:${FEDORA_MAJOR_VERSION} AS builder +COPY etc /etc COPY usr /usr +RUN chmod +x /etc/ublue-lightdm-workaround.sh ARG IMAGE_NAME="${IMAGE_NAME}" ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION}" @@ -17,11 +19,30 @@ ADD build.sh /tmp/build.sh RUN /tmp/build.sh && \ pip install --prefix=/usr yafti && \ rm -rf /tmp/* /var/* && \ - systemctl enable gdm && \ + systemctl enable lightdm && \ + systemctl enable ublue-lightdm-workaround && \ ostree container commit && \ mkdir -p /var/tmp && \ chmod -R 1777 /var/tmp -COPY config/touchegg.conf /usr/share/touchegg +FROM fedora:38 as deepinList + +# Try to get a list of unversioned packages +RUN dnf group info \ + deepin-desktop \ + deepin-desktop-environment \ + deepin-applications \ + | awk '/^ /' \ + | xargs dnf group info -v 2>/dev/null \ + | awk '($2 == "fedora" || $2 == "updates" || $2 == "@System") && ($1 ~ /noarch/ || $1 ~ /x86_64/){print $1}' \ + | awk 'NF -= 2{$0=$0; print}' FS='-' OFS='-' \ + | tee /deepin.txt + +FROM builder + +COPY --from=deepinList /deepin.txt /tmp/deepin.txt + +RUN xargs -a /tmp/deepin.txt rpm-ostree install \ + && rm -rf /var/* RUN ostree container commit diff --git a/etc/profile.d/cinnamon-firstboot.sh b/etc/profile.d/cinnamon-firstboot.sh new file mode 100644 index 0000000..472f213 --- /dev/null +++ b/etc/profile.d/cinnamon-firstboot.sh @@ -0,0 +1,6 @@ +if test "$(id -u)" -gt "0" && test -d "$HOME"; then + if test ! -e "$HOME"/.config/autostart/cinnamon-firstboot.desktop; then + mkdir -p "$HOME"/.config/autostart + cp -f /usr/share/ublue-os/firstboot/cinnamon-firstboot.desktop "$HOME"/.config/autostart + fi +fi \ No newline at end of file diff --git a/etc/systemd/system/ublue-lightdm-workaround.service b/etc/systemd/system/ublue-lightdm-workaround.service new file mode 100644 index 0000000..77ee2ab --- /dev/null +++ b/etc/systemd/system/ublue-lightdm-workaround.service @@ -0,0 +1,16 @@ +# LightDM install from a container is currently bugged. +# https://github.com/coreos/rpm-ostree/issues/4369 +# https://github.com/fedora-silverblue/issue-tracker/issues/452 +# This workaround creates the user before LightDM runs. + +[Unit] +Description=Work around broken LightDM install +Before=lightdm.service + +[Service] +Type=oneshot +ExecStart=/etc/ublue-lightdm-workaround.sh +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/etc/ublue-lightdm-workaround.sh b/etc/ublue-lightdm-workaround.sh new file mode 100644 index 0000000..3007d49 --- /dev/null +++ b/etc/ublue-lightdm-workaround.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +if [ ! -d /var/cache/lightdm ]; then mkdir /var/cache/lightdm; fi +if [ ! -d /var/log/lightdm ]; then mkdir /var/log/lightdm; fi +if [ ! -d /var/lib/lightdm ]; then mkdir /var/lib/lightdm; fi +if [ ! -d /var/lib/lightdm-data ]; then mkdir /var/lib/lightdm-data; fi + +getent group lightdm >/dev/null || groupadd -r lightdm +getent passwd lightdm >/dev/null || useradd -g lightdm -M -d /var/lib/lightdm -s /sbin/nologin -r lightdm + +systemctl set-default graphical.target diff --git a/packages.json b/packages.json index d37f377..d39af1a 100644 --- a/packages.json +++ b/packages.json @@ -2,7 +2,7 @@ "all": { "include": { "all": [ - "gdm", + "lightdm", "python3-pip", "deepin-control-center", "deepin-desktop",