Merge pull request #345 from ublue-os/image-info

feat: Add image info for auto-signing via ublue-update
This commit is contained in:
Kyle Gospodnetich 2023-09-22 14:24:51 -07:00 committed by GitHub
commit ed7c645323
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 74 additions and 121 deletions

View File

@ -12,7 +12,7 @@ ARG BASE_IMAGE_NAME="${BASE_IMAGE_NAME}"
ARG IMAGE_FLAVOR="${IMAGE_FLAVOR}"
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION}"
COPY system_files/desktop/shared system_files/desktop/${BASE_IMAGE_NAME} /
COPY system_files/shared system_files/desktop/shared system_files/desktop/${BASE_IMAGE_NAME} /
# Add ublue packages, add needed negativo17 repo and then immediately disable due to incompatibility with RPMFusion
COPY --from=ghcr.io/ublue-os/akmods:${FEDORA_MAJOR_VERSION} /rpms /tmp/akmods-rpms
@ -158,7 +158,8 @@ RUN if grep -qv "nvidia" <<< "${IMAGE_NAME}"; then \
; fi
# Cleanup & Finalize
RUN rm /usr/share/applications/shredder.desktop && \
RUN /tmp/image-info.sh && \
rm /usr/share/applications/shredder.desktop && \
rm /usr/share/vulkan/icd.d/lvp_icd.*.json && \
mkdir -p "/usr/etc/profile.d/" && \
ln -s "/usr/share/ublue-os/firstboot/launcher/login-profile.sh" \
@ -210,7 +211,6 @@ RUN rm /usr/share/applications/shredder.desktop && \
rm /usr/share/wayland-sessions/weston.desktop \
; fi && \
mkdir -p /usr/etc/default && \
echo -e "IMAGE_NAME=${IMAGE_NAME}\nIMAGE_VENDOR=${IMAGE_VENDOR}\nBASE_IMAGE_NAME=${BASE_IMAGE_NAME}\nIMAGE_FLAVOR=${IMAGE_FLAVOR}\nFEDORA_MAJOR_VERSION=${FEDORA_MAJOR_VERSION}" >> /usr/etc/default/bazzite && \
rm -rf \
/tmp/* \
/var/* && \
@ -226,7 +226,7 @@ ARG BASE_IMAGE_NAME="${BASE_IMAGE_NAME}"
ARG IMAGE_FLAVOR="${IMAGE_FLAVOR}"
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION}"
COPY system_files/deck/shared system_files/deck/${BASE_IMAGE_NAME} /
COPY system_files/shared system_files/deck/shared system_files/deck/${BASE_IMAGE_NAME} /
# Setup Copr repos
RUN wget https://copr.fedorainfracloud.org/coprs/kylegospo/LatencyFleX/repo/fedora-$(rpm -E %fedora)/kylegospo-LatencyFleX-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_kylegospo-latencyflex.repo && \
@ -383,7 +383,8 @@ RUN rpm-ostree install \
; fi
# Cleanup & Finalize
RUN rm /usr/share/applications/wine*.desktop && \
RUN /tmp/image-info.sh && \
rm /usr/share/applications/wine*.desktop && \
ln -s /usr/bin/steamos-logger /usr/bin/steamos-info && \
ln -s /usr/bin/steamos-logger /usr/bin/steamos-notice && \
ln -s /usr/bin/steamos-logger /usr/bin/steamos-warning && \
@ -428,7 +429,6 @@ RUN rm /usr/share/applications/wine*.desktop && \
systemctl disable ublue-update.timer && \
rm -f /usr/etc/sddm.conf && \
rm -f /usr/etc/default/bazzite && \
echo -e "IMAGE_NAME=${IMAGE_NAME}\nIMAGE_VENDOR=${IMAGE_VENDOR}\nBASE_IMAGE_NAME=${BASE_IMAGE_NAME}\nIMAGE_FLAVOR=${IMAGE_FLAVOR}\nFEDORA_MAJOR_VERSION=${FEDORA_MAJOR_VERSION}" >> /usr/etc/default/bazzite && \
rm -rf \
/tmp/* \
/var/* && \

View File

@ -1,8 +1,10 @@
#!/usr/bin/env bash
source /etc/default/bazzite
source /etc/default/desktop-wayland
IMAGE_INFO="/usr/share/ublue-os/image-info.json"
BASE_IMAGE_NAME=$(jq '."base-image-name"' $IMAGE_INFO)
USER=$(id -nu 1000)
# SteamOS SDDM config

View File

@ -1,6 +1,7 @@
#!/usr/bin/env bash
source /etc/default/bazzite
IMAGE_INFO="/usr/share/ublue-os/image-info.json"
BASE_IMAGE_NAME=$(jq '."base-image-name"' $IMAGE_INFO)
USER=$(id -nu 1000)

View File

@ -4,9 +4,11 @@ set -e
die() { echo >&2 "!! $*"; exit 1; }
source /etc/default/bazzite
source /etc/default/desktop-wayland
IMAGE_INFO="/usr/share/ublue-os/image-info.json"
BASE_IMAGE_NAME=$(jq '."base-image-name"' $IMAGE_INFO)
# File this script will modify, in addition to (potentially) the per-user sentinel file
CONF_FILE="/etc/sddm.conf.d/zz-steamos-autologin.conf"

View File

@ -10,21 +10,6 @@ screens:
icon: "/usr/share/ublue-os/bazzite/logo.svg"
description: |
Configure your system to get started. Completion of this process is required for Game mode to function.
sign-image:
source: yafti.screen.package
values:
title: Signing Bazzite
condition:
run: grep -qvz "signed" <<< $(rpm-ostree status)
show_terminal: true
package_manager: yafti.plugin.run
groups:
Sign Bazzite:
description: |
This will sign your current install of Bazzite. Mandatory for offline installs. This will take awhile.
default: true
packages:
- Sign Bazzite: just --unstable sign-image
configure-bazzite:
source: yafti.screen.package
values:
@ -217,7 +202,7 @@ screens:
values:
title: "GNOME Theme"
condition:
run: grep -q 'silverblue' <<< $(cat /etc/default/bazzite)
run: grep -q 'silverblue' <<< $(jq '."base-image-name"' /usr/share/ublue-os/image-info.json)
links:
- "Vapor Theme":
run: just --unstable enable-vapor-theme

View File

@ -144,7 +144,8 @@ install-fleek:
install-fleek-themes:
#!/usr/bin/env bash
if [[ -x "/var/usrlocal/bin/fleek" ]]; then
source /etc/default/bazzite
IMAGE_INFO="/usr/share/ublue-os/image-info.json"
BASE_IMAGE_NAME=$(jq '."base-image-name"' $BASE_IMAGE_NAME)
if [[ ${BASE_IMAGE_NAME} == 'silverblue' ]]; then
fleek add adw-gtk3 --apply
else
@ -233,7 +234,8 @@ patch-gmod:
# Activate Valve-inspired Vapor theme on GNOME
enable-vapor-theme:
#!/usr/bin/env bash
source /etc/default/bazzite
IMAGE_INFO="/usr/share/ublue-os/image-info.json"
BASE_IMAGE_NAME=$(jq '."base-image-name"' $BASE_IMAGE_NAME)
if [[ ${BASE_IMAGE_NAME} == 'silverblue' ]]; then
gnome-extensions enable user-theme@gnome-shell-extensions.gcampax.github.com
gsettings set org.gnome.mutter center-new-windows true
@ -255,7 +257,8 @@ enable-vapor-theme:
# Activate Valve-inspired VGUI2 theme on GNOME
enable-vgui2-theme:
#!/usr/bin/env bash
source /etc/default/bazzite
IMAGE_INFO="/usr/share/ublue-os/image-info.json"
BASE_IMAGE_NAME=$(jq '."base-image-name"' $BASE_IMAGE_NAME)
if [[ ${BASE_IMAGE_NAME} == 'silverblue' ]]; then
gnome-extensions enable user-theme@gnome-shell-extensions.gcampax.github.com
gsettings set org.gnome.mutter center-new-windows true
@ -277,6 +280,8 @@ enable-vgui2-theme:
# Install Adwaita-for-Steam theme for CSS Loader (https://github.com/tkashkin/Adwaita-for-Steam)
install-adwaita-for-steam:
#!/usr/bin/env bash
IMAGE_INFO="/usr/share/ublue-os/image-info.json"
BASE_IMAGE_NAME=$(jq '."base-image-name"' $BASE_IMAGE_NAME)
if [[ ${BASE_IMAGE_NAME} == 'silverblue' ]]; then
if [ -d "$HOME/homebrew/themes" ]; then
git clone https://github.com/tkashkin/Adwaita-for-Steam.git --single-branch "$HOME/homebrew/themes/Adwaita-for-Steam"
@ -476,36 +481,3 @@ use-broadcom-wl:
# Enable Flatpak Theming
enable-flatpak-theming:
flatpak override --user --filesystem=xdg-config/gtk-4.0:ro --filesystem=xdg-config/gtk-3.0:ro --filesystem=~/.icons:ro --filesystem=~/.themes:ro
# Sign the current OCI OSTree Image (If unsigned)
sign-image:
source /etc/default/bazzite && \
ublue-update --wait && \
if grep -qvz "/var/${IMAGE_VENDOR}/image" <<< $(rpm-ostree status); then \
rpm-ostree rebase ostree-image-signed:$(just --unstable _get-image); \
else \
rpm-ostree rebase ostree-image-signed:docker://ghcr.io/${IMAGE_VENDOR}/${IMAGE_NAME}:${FEDORA_MAJOR_VERSION}; \
fi
_get-image:
#!/usr/bin/env python
from json import loads
from subprocess import PIPE, run
"""Pull deployment status via rpm-ostree"""
status = "rpm-ostree status --json"
out = run(status, shell=True, stdout=PIPE).stdout
"""Parse current image"""
deployments = loads(out)["deployments"][0]
current_image = deployments["container-image-reference"].split(":", 1)
"""Dissect current image to form URL to latest image"""
protocol = "docker://"
url = current_image[1]
"""Add protocol if URL doesn't contain it"""
if protocol not in url:
url = protocol + url
print(url)

View File

@ -1,5 +1,4 @@
#!/usr/bin/env bash
source /etc/default/bazzite
# Script Version
VER=1

View File

@ -1,5 +1,8 @@
#!/usr/bin/env bash
source /etc/default/bazzite
IMAGE_INFO="/usr/share/ublue-os/image-info.json"
IMAGE_NAME=$(jq '."image-name"' $IMAGE_INFO)
BASE_IMAGE_NAME=$(jq '."base-image-name"' $IMAGE_INFO)
# SCRIPT VERSION
HWS_VER=1

View File

@ -1,5 +1,8 @@
#!/usr/bin/env bash
source /etc/default/bazzite
IMAGE_INFO="/usr/share/ublue-os/image-info.json"
IMAGE_NAME=$(jq '."image-name"' $IMAGE_INFO)
BASE_IMAGE_NAME=$(jq '."base-image-name"' $IMAGE_INFO)
if [[ ! -f "${HOME}/.justfile" ]]; then
echo "!include /usr/share/ublue-os/just/custom.just" >> "${HOME}/.justfile"

View File

@ -1,5 +1,8 @@
#!/usr/bin/env bash
source /etc/default/bazzite
IMAGE_INFO="/usr/share/ublue-os/image-info.json"
BASE_IMAGE_NAME=$(jq '."base-image-name"' $IMAGE_INFO)
if [[ ${BASE_IMAGE_NAME} == 'kinoite' ]]; then
SUDO_ASKPASS='/usr/bin/ksshaskpass'
elif [[ ${BASE_IMAGE_NAME} == 'silverblue' ]]; then

View File

@ -10,21 +10,6 @@ screens:
icon: "/usr/share/ublue-os/bazzite/logo.svg"
description: |
Configure your system to get started
sign-image:
source: yafti.screen.package
values:
title: Signing Bazzite
condition:
run: grep -qvz "signed" <<< $(rpm-ostree status)
show_terminal: true
package_manager: yafti.plugin.run
groups:
Sign Bazzite:
description: |
This will sign your current install of Bazzite. Mandatory for offline installs. This will take awhile.
default: true
packages:
- Sign Bazzite: just --unstable sign-image
configure-bazzite-arch:
source: yafti.screen.package
values:
@ -72,7 +57,7 @@ screens:
values:
title: AMD Additions
condition:
run: grep -q 'main' <<< $(cat /etc/default/bazzite)
run: grep -q 'main' <<< $(jq '."image-flavor"' /usr/share/ublue-os/image-info.json)
show_terminal: true
package_manager: yafti.plugin.run
packages:
@ -82,7 +67,7 @@ screens:
values:
title: Nvidia Additions
condition:
run: grep -q 'nvidia' <<< $(cat /etc/default/bazzite)
run: grep -q 'nvidia' <<< $(jq '."image-flavor"' /usr/share/ublue-os/image-info.json)
show_terminal: true
package_manager: yafti.plugin.run
packages:
@ -211,7 +196,7 @@ screens:
values:
title: "GNOME Theme"
condition:
run: grep -q 'silverblue' <<< $(cat /etc/default/bazzite)
run: grep -q 'silverblue' <<< $(jq '."base-image-name"' /usr/share/ublue-os/image-info.json)
links:
- "Vapor Theme":
run: just --unstable enable-vapor-theme

View File

@ -40,7 +40,8 @@ setup-firefox-vaapi-nvidia:
# Set up Bazzite-Arch Distrobox container
install-bazzite-arch:
source /etc/default/bazzite && \
IMAGE_INFO="/usr/share/ublue-os/image-info.json" && \
BASE_IMAGE_NAME=$(jq '."base-image-name"' $BASE_IMAGE_NAME) && \
if grep -qz "bazzite-arch" <<< $(distrobox list); then \
echo 'Removing existing Bazzite Arch install...' && \
distrobox rm bazzite-arch --force; \
@ -145,7 +146,8 @@ install-fleek:
install-fleek-themes:
#!/usr/bin/env bash
if [[ -x "/var/usrlocal/bin/fleek" ]]; then
source /etc/default/bazzite
IMAGE_INFO="/usr/share/ublue-os/image-info.json"
BASE_IMAGE_NAME=$(jq '."base-image-name"' $BASE_IMAGE_NAME)
if [[ ${BASE_IMAGE_NAME} == 'silverblue' ]]; then
fleek add adw-gtk3 --apply
else
@ -171,7 +173,8 @@ get-greenlight:
# Enable Supergfxctl, a Nvidia GPU switcher for hybrid laptops
enable-supergfxctl:
#!/usr/bin/env bash
source /etc/default/bazzite
IMAGE_INFO="/usr/share/ublue-os/image-info.json"
IMAGE_FLAVOR=$(jq '."image-flavor"' $IMAGE_FLAVOR)
if [[ ${IMAGE_FLAVOR} == 'nvidia' ]]; then
systemctl enable --now supergfxd.service
else
@ -201,7 +204,8 @@ patch-gmod:
# Activate Valve-inspired Vapor theme on GNOME
enable-vapor-theme:
#!/usr/bin/env bash
source /etc/default/bazzite
IMAGE_INFO="/usr/share/ublue-os/image-info.json"
BASE_IMAGE_NAME=$(jq '."base-image-name"' $BASE_IMAGE_NAME)
if [[ ${BASE_IMAGE_NAME} == 'silverblue' ]]; then
gnome-extensions enable user-theme@gnome-shell-extensions.gcampax.github.com
gsettings set org.gnome.mutter center-new-windows true
@ -225,7 +229,8 @@ enable-vapor-theme:
# Activate Valve-inspired VGUI2 theme on GNOME
enable-vgui2-theme:
#!/usr/bin/env bash
source /etc/default/bazzite
IMAGE_INFO="/usr/share/ublue-os/image-info.json"
BASE_IMAGE_NAME=$(jq '."base-image-name"' $BASE_IMAGE_NAME)
if [[ ${BASE_IMAGE_NAME} == 'silverblue' ]]; then
gnome-extensions enable user-theme@gnome-shell-extensions.gcampax.github.com
gsettings set org.gnome.mutter center-new-windows true
@ -314,36 +319,3 @@ use-broadcom-wl:
# Enable Flatpak Theming
enable-flatpak-theming:
flatpak override --user --filesystem=xdg-config/gtk-4.0:ro --filesystem=xdg-config/gtk-3.0:ro --filesystem=~/.icons:ro --filesystem=~/.themes:ro
# Sign the current OCI OSTree Image (If unsigned)
sign-image:
source /etc/default/bazzite && \
ublue-update --wait && \
if grep -qvz "/var/${IMAGE_VENDOR}/image" <<< $(rpm-ostree status); then \
rpm-ostree rebase ostree-image-signed:$(just --unstable _get-image); \
else \
rpm-ostree rebase ostree-image-signed:docker://ghcr.io/${IMAGE_VENDOR}/${IMAGE_NAME}:${FEDORA_MAJOR_VERSION}; \
fi
_get-image:
#!/usr/bin/env python
from json import loads
from subprocess import PIPE, run
"""Pull deployment status via rpm-ostree"""
status = "rpm-ostree status --json"
out = run(status, shell=True, stdout=PIPE).stdout
"""Parse current image"""
deployments = loads(out)["deployments"][0]
current_image = deployments["container-image-reference"].split(":", 1)
"""Dissect current image to form URL to latest image"""
protocol = "docker://"
url = current_image[1]
"""Add protocol if URL doesn't contain it"""
if protocol not in url:
url = protocol + url
print(url)

View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -oue pipefail
IMAGE_REF="docker://ghcr.io/$IMAGE_VENDOR/$IMAGE_NAME"
case $FEDORA_MAJOR_VERSION in
38)
IMAGE_TAG="latest"
;;
*)
IMAGE_TAG="$FEDORA_MAJOR_VERSION"
;;
esac
{
echo "{"
echo '"image-name": "'"$IMAGE_NAME"'",'
echo '"image-flavor": "'"$IMAGE_FLAVOR"'",'
echo '"image-vendor": "'"$IMAGE_VENDOR"'",'
echo '"image-ref": "'"$IMAGE_REF"'",'
echo '"image-tag":"'"$IMAGE_TAG"'",'
echo '"base-image-name": "'"$BASE_IMAGE_NAME"'",'
echo '"fedora-version": "'"$FEDORA_MAJOR_VERSION"'"'
echo "}"
} > "/usr/share/ublue-os/image-info.json"