mirror of
https://github.com/ublue-os/bazzite.git
synced 2025-03-03 04:13:22 +00:00
Initial commit of Bazzite
This commit is contained in:
parent
437dc581d9
commit
dcbc63ec66
136
.github/workflows/build.yml
vendored
Normal file
136
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,136 @@
|
||||
name: build-bazzite
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
schedule:
|
||||
- cron: '0 23 * * *' # 11:00pm everyday
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
env:
|
||||
IMAGE_NAME: bazzite
|
||||
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
|
||||
|
||||
jobs:
|
||||
push-ghcr:
|
||||
name: Build and push image
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
id-token: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
major_version: [37]
|
||||
include:
|
||||
- major_version: 37
|
||||
is_latest: true
|
||||
is_stable: true
|
||||
steps:
|
||||
# Checkout push-to-registry action GitHub repository
|
||||
- name: Checkout Push to Registry action
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Generate tags
|
||||
id: generate-tags
|
||||
shell: bash
|
||||
run: |
|
||||
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
alias_tags=()
|
||||
# Only perform the follow code when the action is spawned from a Pull Request
|
||||
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||
alias_tags+=("pr-${{ github.event.number }}")
|
||||
else
|
||||
# The following is run when the timer is triggered or a merge/push to main
|
||||
echo "date=$(date +%Y%m%d)" >> $GITHUB_OUTPUT
|
||||
alias_tags+=("${{ matrix.major_version }}")
|
||||
if [[ "${{ matrix.is_latest }}" == "true" ]]; then
|
||||
alias_tags+=("latest")
|
||||
fi
|
||||
if [[ "${{ matrix.is_stable }}" == "true" ]]; then
|
||||
alias_tags+=("stable")
|
||||
fi
|
||||
fi
|
||||
echo "alias_tags=${alias_tags[*]}" >> $GITHUB_OUTPUT
|
||||
|
||||
# Build image using Buildah action
|
||||
- name: Build Image
|
||||
id: build_image
|
||||
uses: redhat-actions/buildah-build@v2
|
||||
with:
|
||||
containerfiles: |
|
||||
./Containerfile
|
||||
image: ${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
${{ steps.generate-tags.outputs.alias_tags }}
|
||||
${{ steps.generate-tags.outputs.date }}
|
||||
${{ steps.generate-tags.outputs.sha_short }}
|
||||
build-args: |
|
||||
FEDORA_MAJOR_VERSION=${{ matrix.major_version }}
|
||||
oci: true
|
||||
|
||||
# Workaround bug where capital letters in your GitHub username make it impossible to push to GHCR.
|
||||
# https://github.com/macbre/push-to-ghcr/issues/12
|
||||
- name: Lowercase Registry
|
||||
id: registry_case
|
||||
uses: ASzc/change-string-case-action@v5
|
||||
with:
|
||||
string: ${{ env.IMAGE_REGISTRY }}
|
||||
|
||||
# Push the image to GHCR (Image Registry)
|
||||
- name: Push To GHCR
|
||||
uses: redhat-actions/push-to-registry@v2
|
||||
id: push
|
||||
env:
|
||||
REGISTRY_USER: ${{ github.actor }}
|
||||
REGISTRY_PASSWORD: ${{ github.token }}
|
||||
with:
|
||||
image: ${{ steps.build_image.outputs.image }}
|
||||
tags: ${{ steps.build_image.outputs.tags }}
|
||||
registry: ${{ steps.registry_case.outputs.lowercase }}
|
||||
username: ${{ env.REGISTRY_USER }}
|
||||
password: ${{ env.REGISTRY_PASSWORD }}
|
||||
extra-args: |
|
||||
--disable-content-trust
|
||||
|
||||
# Sign container
|
||||
- uses: sigstore/cosign-installer@main
|
||||
|
||||
- name: Write cosign keys to disk
|
||||
run: |
|
||||
echo "${{ env.COSIGN_PRIVATE_KEY }}" > cosign.key
|
||||
echo "${{ env.COSIGN_PUBLIC_KEY }}" > cosign.pub
|
||||
# DEBUG: get character count of keys
|
||||
wc -c cosign.key
|
||||
wc -c cosign.pub
|
||||
env:
|
||||
COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}
|
||||
COSIGN_PUBLIC_KEY: ${{ secrets.COSIGN_PUBLIC_KEY }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Sign container image
|
||||
run: |
|
||||
cosign sign --key cosign.key -a git_sha=${{ github.sha }} -a git_tag=${{ github.ref }} ${{ steps.registry_case.outputs.lowercase }}/${{ env.IMAGE_NAME }}@${TAGS}
|
||||
env:
|
||||
TAGS: ${{ steps.push.outputs.digest }}
|
||||
COSIGN_EXPERIMENTAL: false
|
||||
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
|
||||
|
||||
- name: Verify signed image
|
||||
run: |
|
||||
cosign verify --key cosign.pub ${{ steps.registry_case.outputs.lowercase }}/${{ env.IMAGE_NAME }}@${TAGS}
|
||||
env:
|
||||
TAGS: ${{ steps.push.outputs.digest }}
|
||||
COSIGN_EXPERIMENTAL: false
|
||||
|
||||
- name: Echo outputs
|
||||
run: |
|
||||
echo "${{ toJSON(steps.push.outputs) }}"
|
79
Containerfile
Normal file
79
Containerfile
Normal file
@ -0,0 +1,79 @@
|
||||
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-37}"
|
||||
|
||||
FROM ghcr.io/ublue-os/kinoite-nvidia:latest
|
||||
|
||||
COPY etc /etc
|
||||
COPY usr /usr
|
||||
RUN mkdir -p /var/lib/duperemove && \
|
||||
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
|
||||
|
||||
# Re-enable RPMFusion Repos
|
||||
RUN sed -i 's@enabled=0@enabled=1@g' /etc/yum.repos.d/rpmfusion-nonfree{,-updates}.repo && \
|
||||
sed -i 's@enabled=0@enabled=1@g' /etc/yum.repos.d/rpmfusion-free{,-updates}.repo
|
||||
|
||||
# Add needed Copr repos
|
||||
RUN wget https://copr.fedorainfracloud.org/coprs/kylegospo/bazzite/repo/fedora-$(rpm -E %fedora)/kylegospo-bazzite-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_kylegospo-bazzite.repo && \
|
||||
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
|
||||
|
||||
# Install new packages
|
||||
RUN rpm-ostree install \
|
||||
distrobox \
|
||||
steam \
|
||||
steam-devices \
|
||||
gamescope \
|
||||
gamescope-session \
|
||||
jupiter-fan-control \
|
||||
jupiter-hw-support-btrfs \
|
||||
steamdeck-kde-presets \
|
||||
gamemode \
|
||||
latencyflex-vulkan-layer \
|
||||
vkBasalt \
|
||||
mangohud \
|
||||
duperemove \
|
||||
kdeconnectd \
|
||||
btop \
|
||||
fish \
|
||||
kate
|
||||
# $(rpm -qa --qf "%{NAME} ")
|
||||
# The above prints every package installed, this acts similarly to rpm-ostree update when making an OCI image and resolves issues with installing Steam
|
||||
|
||||
# Install dock updater, this is done manually as it has proprietary parts and cannot be built in Copr.
|
||||
RUN git clone https://github.com/KyleGospo/jupiter-dock-updater-bin.git && \
|
||||
mv -v jupiter-dock-updater-bin/packaged/usr/lib/jupiter-dock-updater /usr/lib/jupiter-dock-updater
|
||||
|
||||
# Remove unneeded packages
|
||||
RUN rpm-ostree override remove toolbox
|
||||
|
||||
# Install mesa freeworld components and ffmpeg for hardware accelerated video decode
|
||||
RUN rpm-ostree override remove \
|
||||
mesa-va-drivers \
|
||||
libavutil-free \
|
||||
libswscale-free \
|
||||
libswresample-free \
|
||||
libavformat-free \
|
||||
libavcodec-free \
|
||||
libavfilter-free \
|
||||
libpostproc-free \
|
||||
--install=mesa-va-drivers-freeworld.x86_64 \
|
||||
--install=mesa-va-drivers-freeworld.i686 \
|
||||
--install=mesa-vdpau-drivers-freeworld \
|
||||
--install=ffmpeg-libs \
|
||||
--install=ffmpeg \
|
||||
--install=libavcodec-freeworld
|
||||
|
||||
# Cleanup & Finalize
|
||||
RUN sed -i 's/#AutomaticUpdatePolicy.*/AutomaticUpdatePolicy=stage/' /etc/rpm-ostreed.conf && \
|
||||
sed -i 's/#DefaultTimeoutStopSec.*/DefaultTimeoutStopSec=15s/' /etc/systemd/user.conf && \
|
||||
sed -i 's/#DefaultTimeoutStopSec.*/DefaultTimeoutStopSec=15s/' /etc/systemd/system.conf && \
|
||||
systemctl enable rpm-ostreed-automatic.timer && \
|
||||
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/rpmfusion-nonfree{,-updates}.repo && \
|
||||
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/rpmfusion-free{,-updates}.repo && \
|
||||
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_kylegospo-bazzite.repo && \
|
||||
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_kylegospo-latencyflex.repo && \
|
||||
rpm-ostree cleanup -m && \
|
||||
rm -rf \
|
||||
/tmp/* \
|
||||
/var/* && \
|
||||
ostree container commit
|
58
README.md
58
README.md
@ -1,2 +1,56 @@
|
||||
# bazzite
|
||||
Bazzite is an OCI based off of ublue-os/kinoite-nvidia that is intended to be an alternative OS for the Steam Deck and a SteamOS-alike for desktops.
|
||||
# Bazzite
|
||||
|
||||
[](https://github.com/ublue-os/bazzite/actions/workflows/build.yml)
|
||||
|
||||
Bazzite is an OCI based off of [ublue-os/kinoite-nvidia](https://github.com/ublue-os/nvidia) that is intended to be an alternative OS for the [Steam Deck](https://www.steamdeck.com/) and a SteamOS-alike for desktops.
|
||||
|
||||
### Bazzite is currently in development and should not be used on real hardware under any circumstance. Feel free to test in a VM.
|
||||
### Bazzite is not associated with Valve Software in any way, and maintainers of the Bazzite project are not liable for any damage that may occur during use of the operating system.
|
||||
|
||||
## Usage
|
||||
|
||||
Warning: This is an experimental feature and should not be used in production, try it in a VM for a while, you have been warned!
|
||||
|
||||
sudo rpm-ostree rebase --experimental ostree-unverified-registry:ghcr.io/ublue-os/bazzite:latest
|
||||
|
||||
We build date tags as well, so if you want to rebase to a particular day's release:
|
||||
|
||||
sudo rpm-ostree rebase --experimental ostree-unverified-registry:ghcr.io/ublue-os/bazzite:20230209
|
||||
|
||||
The `latest` tag will automatically point to the latest build.
|
||||
|
||||
## Features
|
||||
|
||||
- Start with a base [ublue-os/kinoite-nvidia](https://github.com/ublue-os/nvidia image
|
||||
- Adds ported versions of Valve's Steam Deck packages
|
||||
- Adds h264 decoding out of the box via RPM Fusion
|
||||
- Supports LatencyFleX & vkBasalt out of the box
|
||||
- Ships with Distrobox already installed
|
||||
- Comes with services for automatic system, distrobox, and flatpak updates.
|
||||
- Built in duperemove
|
||||
- BTRFS by default, including the SD card
|
||||
- Matches SteamOS 1:1 whenever possible
|
||||
|
||||
## Copr
|
||||
|
||||
Ported SteamOS and ChimeraOS packages used by Bazzite are built on Copr in [this repo](https://copr.fedorainfracloud.org/coprs/kylegospo/bazzite/).
|
||||
|
||||
|Package|Status|
|
||||
|---|---|
|
||||
|gamescope-session||
|
||||
|jupiter-fan-control||
|
||||
|jupiter-hw-support||
|
||||
|jupiter-hw-support-[btrfs](https://gitlab.com/popsulfr/steamos-btrfs)||
|
||||
|steamdeck-kde-presets||
|
||||
|python3-hid||
|
||||
|
||||
Additionally, the following packages are used from other Copr repos:
|
||||
|Package|Status|
|
||||
|---|---|
|
||||
|[latencyflex-vulkan-layer](https://copr.fedorainfracloud.org/coprs/kylegospo/LatencyFleX/)||
|
||||
|
||||
## Verification
|
||||
|
||||
These images are signed with sisgstore's [cosign](https://docs.sigstore.dev/cosign/overview/). You can verify the signature by downloading the `cosign.pub` key from this repo and running the following command:
|
||||
|
||||
cosign verify --key cosign.pub ghcr.io/ublue-os/bazzite
|
4
cosign.pub
Normal file
4
cosign.pub
Normal file
@ -0,0 +1,4 @@
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEw4/2pnHlZlCaZZ4xvaqyoL37lfwm
|
||||
CwEfktC3rZKAt+5e4YC2YfJKeiUroT0jB3X3c0rTqouGAWtU8jrJZ1X6tw==
|
||||
-----END PUBLIC KEY-----
|
2
etc/default/deckswap
Normal file
2
etc/default/deckswap
Normal file
@ -0,0 +1,2 @@
|
||||
# Size of swap file created by deckswap.service
|
||||
SWAP_SIZE=1G
|
5
etc/default/duperemove
Normal file
5
etc/default/duperemove
Normal file
@ -0,0 +1,5 @@
|
||||
# Dir to store hash files. Each instance has own, named by $(systemd-escape <instance>).hashfile
|
||||
HashDir=/var/lib/duperemove
|
||||
# Additional options for duperemove binary
|
||||
OPTIONS="--skip-zeroes --hash=xxhash"
|
||||
|
1
etc/sysctl.conf
Normal file
1
etc/sysctl.conf
Normal file
@ -0,0 +1 @@
|
||||
vm.swappiness=35
|
17
etc/systemd/system/deckswap.service
Normal file
17
etc/systemd/system/deckswap.service
Normal file
@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=Traditional swap file for Steam Deck
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
Environment="SWAP_PATH=/var/vm" "SWAP_FILE=swapfile1"
|
||||
EnvironmentFile=-/etc/default/%p
|
||||
ExecStartPre=-/usr/bin/rm -rf ${SWAP_PATH}
|
||||
ExecStartPre=/usr/bin/mkdir -p ${SWAP_PATH}
|
||||
ExecStartPre=/usr/sbin/btrfs filesystem mkswapfile ${SWAP_PATH}/${SWAP_FILE} --size ${SWAP_SIZE}
|
||||
ExecStart=/sbin/swapon ${SWAP_PATH}/${SWAP_FILE}
|
||||
ExecStop=/sbin/swapoff ${SWAP_PATH}/${SWAP_FILE}
|
||||
ExecStopPost=-/usr/bin/rm -rf ${SWAP_PATH}
|
||||
RemainAfterExit=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
18
etc/systemd/system/duperemove-weekly@.timer
Normal file
18
etc/systemd/system/duperemove-weekly@.timer
Normal file
@ -0,0 +1,18 @@
|
||||
[Unit]
|
||||
# Usage: systemctl enable --now duperemove-weekly@$(systemd-escape <path>).timer
|
||||
# Utilize %J specifier for duration set.
|
||||
# One can hardlink/copy with 'weekly' part changed
|
||||
# to set other duration.
|
||||
Description=Deduplicate %I at calendar event (%J)
|
||||
After=local-fs.target
|
||||
Requires=local-fs.target
|
||||
Conflicts=shutdown.target rescue.target rescue.service emergency.service
|
||||
|
||||
[Timer]
|
||||
Unit=duperemove@%i.service
|
||||
RandomizedDelaySec=30
|
||||
Persistent=true
|
||||
OnCalendar=%J
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
22
etc/systemd/system/duperemove@.service
Normal file
22
etc/systemd/system/duperemove@.service
Normal file
@ -0,0 +1,22 @@
|
||||
[Unit]
|
||||
Description=Recursive deduplication at %I
|
||||
Documentation=man:duperemove(8)
|
||||
Documentation=https://github.com/markfasheh/duperemove.git
|
||||
Conflicts=shutdown.target rescue.target rescue.service emergency.service
|
||||
After=local-fs.target
|
||||
Before=shutdown.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment="HashDir=/var/lib/%p"
|
||||
EnvironmentFile=-/etc/default/%p
|
||||
MemoryHigh=1G
|
||||
IOWeight=25
|
||||
CPUWeight=25
|
||||
Nice=18
|
||||
IOSchedulingClass=idle
|
||||
CPUSchedulingPolicy=idle
|
||||
ExecStartPre=/bin/mkdir -p ${HashDir}
|
||||
ExecStartPre=-/bin/df -h %I
|
||||
ExecStart=/usr/sbin/duperemove --hashfile=${HashDir}/%i.hashfile -r -d -h $OPTIONS %I
|
||||
ExecStopPost=-/bin/df -h %I
|
7
etc/systemd/user/distrobox-upgrade-automatic.service
Normal file
7
etc/systemd/user/distrobox-upgrade-automatic.service
Normal file
@ -0,0 +1,7 @@
|
||||
[Unit]
|
||||
Description=distrobox-upgrade Automatic Update
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/distrobox-upgrade --all
|
||||
StandardOutput=null
|
9
etc/systemd/user/distrobox-upgrade-automatic.timer
Normal file
9
etc/systemd/user/distrobox-upgrade-automatic.timer
Normal file
@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=distrobox-upgrade Automatic Update Trigger
|
||||
|
||||
[Timer]
|
||||
OnBootSec=1h
|
||||
OnUnitInactiveSec=1d
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
12
etc/systemd/user/flatpak-upgrade-automatic.service
Normal file
12
etc/systemd/user/flatpak-upgrade-automatic.service
Normal file
@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=flatpak Automatic Update
|
||||
Documentation=man:flatpak(1)
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/flatpak update -y
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
10
etc/systemd/user/flatpak-upgrade-automatic.timer
Normal file
10
etc/systemd/user/flatpak-upgrade-automatic.timer
Normal file
@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=flatpak Automatic Update Trigger
|
||||
Documentation=man:flatpak(1)
|
||||
|
||||
[Timer]
|
||||
OnBootSec=1h
|
||||
OnUnitInactiveSec=1d
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
12
usr/bin/gamescope-wayland-teardown-workaround
Executable file
12
usr/bin/gamescope-wayland-teardown-workaround
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
TARGETS=('/bin/bash /usr/bin/gamescope-session'
|
||||
'/usr/bin/kwin_x11')
|
||||
|
||||
for target in "${TARGETS[@]}"; do
|
||||
for processtree in $(pgrep -xf "$target" || true); do
|
||||
kill -- "-$processtree"
|
||||
done
|
||||
done
|
94
usr/bin/os-session-select
Executable file
94
usr/bin/os-session-select
Executable file
@ -0,0 +1,94 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
die() { echo >&2 "!! $*"; exit 1; }
|
||||
|
||||
# FIXME Purge old files and use this one
|
||||
|
||||
# File this script will modify, in addition to (potentially) the per-user sentinel file
|
||||
CONF_FILE="/etc/sddm.conf.d/zz-steamos-autologin.conf"
|
||||
|
||||
SENTINEL_FILE="steamos-session-select"
|
||||
|
||||
# For sanity this shipped file must be present, to ensure we're still on a normal-looking steamos setup.
|
||||
CHECK_FILE="/etc/sddm.conf.d/steamos.conf"
|
||||
|
||||
session="${1:-gamescope}"
|
||||
session_type="x11"
|
||||
|
||||
session_launcher=""
|
||||
create_sentinel=""
|
||||
|
||||
if [[ "$2" == "--sentinel-created" ]]; then
|
||||
SENTINEL_CREATED=1
|
||||
if [[ "$3" == "x11" ]]; then
|
||||
session_type="x11"
|
||||
elif [[ "$3" == "wayland" ]]; then
|
||||
session_type="wayland"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Update config sentinel
|
||||
if [[ -z $SENTINEL_CREATED ]]; then
|
||||
[[ $EUID == 0 ]] && die "Running $0 as root is not allowed"
|
||||
|
||||
[[ -n ${HOME+x} ]] || die "No \$HOME variable"
|
||||
config_dir="${XDG_CONF_DIR:-"$HOME/.config"}"
|
||||
session_type=$(
|
||||
cd "$HOME"
|
||||
mkdir -p "$config_dir"
|
||||
cd "$config_dir"
|
||||
if [[ -f "steamos-session-type" ]]; then
|
||||
cp steamos-session-type "$SENTINEL_FILE"
|
||||
else
|
||||
echo "x11" > "$SENTINEL_FILE"
|
||||
fi
|
||||
cat "$SENTINEL_FILE"
|
||||
)
|
||||
|
||||
# If we were executed as a session user and then re-execute as root below, we don't want to set root's sentinel too
|
||||
export SENTINEL_CREATED=1
|
||||
fi
|
||||
|
||||
case "$session" in
|
||||
plasma-wayland-persistent)
|
||||
session_launcher="plasmawayland.desktop"
|
||||
;;
|
||||
plasma-x11-persistent)
|
||||
session_launcher="plasma.desktop"
|
||||
;;
|
||||
plasma)
|
||||
if [[ "$session_type" == "x11" ]]; then
|
||||
session_launcher="plasma-steamos-oneshot.desktop"
|
||||
else
|
||||
session_launcher="plasma-steamos-wayland-oneshot.desktop"
|
||||
fi
|
||||
create_sentinel=1
|
||||
;;
|
||||
gamescope)
|
||||
session_launcher="gamescope-wayland.desktop"
|
||||
;;
|
||||
*)
|
||||
echo >&2 "!! Unrecognized session '$session'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Updated user selected session to $session_launcher"
|
||||
|
||||
# Become root
|
||||
if [[ $EUID != 0 ]]; then
|
||||
exec pkexec "$(realpath $0)" "$session" --sentinel-created "$session_type"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
{
|
||||
echo "[Autologin]"
|
||||
echo "Session=$session_launcher"
|
||||
} > "$CONF_FILE"
|
||||
|
||||
echo "Updated system autologin session to $session_launcher"
|
||||
systemctl reset-failed sddm
|
||||
systemctl restart sddm
|
||||
echo "Restarted SDDM"
|
53
usr/bin/startplasma-steamos-oneshot
Executable file
53
usr/bin/startplasma-steamos-oneshot
Executable file
@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
die() { echo >&2 "!! $*"; exit 1; }
|
||||
|
||||
SENTINEL_FILE="steamos-session-select"
|
||||
SENTINEL_VALUE="x11"
|
||||
|
||||
# If we proceed, execute this
|
||||
CHAINED_SESSION="/usr/bin/startplasma-x11"
|
||||
# If we decide the sentinel is consumed, execute this command instead and fail
|
||||
RESTORE_SESSION=(steamos-session-select) # No arguments restores the session
|
||||
|
||||
# Find or check config sentinel
|
||||
function check_sentinel()
|
||||
{
|
||||
if [[ -z ${HOME+x} ]]; then
|
||||
echo >&2 "$0: No \$HOME variable!"
|
||||
# Rather than break we'll just launch plasma and hope for the best?
|
||||
return 0
|
||||
fi
|
||||
|
||||
local config_dir="${XDG_CONF_DIR:-"$HOME/.config"}"
|
||||
(
|
||||
cd "$HOME"
|
||||
cd "$config_dir"
|
||||
sentinel_value="$(cat "$SENTINEL_FILE")"
|
||||
if [[ "$sentinel_value" == "wayland" ]]; then
|
||||
echo "/usr/bin/startplasma-wayland"
|
||||
elif [[ "$sentinel_value" == "x11" ]]; then
|
||||
echo "/usr/bin/startplasma-x11"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
rm "$SENTINEL_FILE"
|
||||
|
||||
) || return 1 # If we couldn't read the value or it wasn't what we wanted
|
||||
|
||||
# Found value and removed it, we're good to continue
|
||||
return 0
|
||||
}
|
||||
|
||||
if CONFIGURED_CHAINED_SESSION=$(check_sentinel); then
|
||||
# We found and consumed the oneshot sentinel, proceed to launch plasma
|
||||
echo >&2 "$0: Found and removed sentinel file for one-shot plasma, proceeding to launch"
|
||||
exec "$CONFIGURED_CHAINED_SESSION"
|
||||
else
|
||||
echo >&2 "$0: Sentinel value not found, executing session-select to restore session"
|
||||
"${RESTORE_SESSION[@]}" || echo >&2 "$0: !! Failed to restore previous session, executing chained session"
|
||||
# Session restore should've stopped us, if it is broken at least let plasma continue to open
|
||||
exec "$CHAINED_SESSION"
|
||||
fi
|
132
usr/bin/steamos-logger
Executable file
132
usr/bin/steamos-logger
Executable file
@ -0,0 +1,132 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# vim: et sts=4 sw=4
|
||||
|
||||
# SPDX-License-Identifier: LGPL-2.1+
|
||||
#
|
||||
# Copyright © 2020 Collabora Ltd.
|
||||
# Copyright © 2020 Valve Corporation.
|
||||
#
|
||||
# This file is part of steamos-customizations.
|
||||
#
|
||||
# steamos-customizations is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License as
|
||||
# published by the Free Software Foundation; either version 2.1 of the License,
|
||||
# or (at your option) any later version.
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Usage: ${0##*/} [options] [<message>]
|
||||
|
||||
Echoes the message to standard output.
|
||||
|
||||
It displays the text message if splash screen is running.
|
||||
|
||||
The splash screen is cleared if message is empty.
|
||||
|
||||
Options:
|
||||
-h, --help this help message
|
||||
-l, --log-level LEVEL the level of logs
|
||||
|
||||
LEVELS
|
||||
Valid levels: emergency alert critical error warning notice info debug.
|
||||
EOF
|
||||
}
|
||||
|
||||
declare -A LOG_LEVEL
|
||||
LOG_LEVEL[emergency]="0"
|
||||
LOG_LEVEL[fatal]="1"
|
||||
LOG_LEVEL[critical]="2"
|
||||
LOG_LEVEL[error]="3"
|
||||
LOG_LEVEL[warning]="4"
|
||||
LOG_LEVEL[notice]="5"
|
||||
LOG_LEVEL[info]="6"
|
||||
LOG_LEVEL[debug]="7"
|
||||
|
||||
declare -A LOG_LEVEL_PREFIX
|
||||
LOG_LEVEL_PREFIX[emergency]="<0>"
|
||||
LOG_LEVEL_PREFIX[fatal]="<1>"
|
||||
LOG_LEVEL_PREFIX[critical]="<2>"
|
||||
LOG_LEVEL_PREFIX[error]="<3>"
|
||||
LOG_LEVEL_PREFIX[warning]="<4>"
|
||||
LOG_LEVEL_PREFIX[notice]="<5>"
|
||||
LOG_LEVEL_PREFIX[info]="<6>"
|
||||
LOG_LEVEL_PREFIX[debug]="<7>"
|
||||
|
||||
declare -A PLYMOUTH_PREFIX
|
||||
PLYMOUTH_PREFIX[emergency]="Emergency: "
|
||||
PLYMOUTH_PREFIX[fatal]="Fatal: "
|
||||
PLYMOUTH_PREFIX[critical]="Critical: "
|
||||
PLYMOUTH_PREFIX[error]="Error: "
|
||||
PLYMOUTH_PREFIX[warning]="Warning: "
|
||||
if [[ ${STEAMOS_DEBUG:-} ]]
|
||||
then
|
||||
PLYMOUTH_PREFIX[notice]="Notice: "
|
||||
PLYMOUTH_PREFIX[info]="Info: "
|
||||
PLYMOUTH_PREFIX[debug]="Debug: "
|
||||
fi
|
||||
|
||||
if [[ "${0##*/}" != steamos-logger ]]
|
||||
then
|
||||
log_level="${0##*/}"
|
||||
log_level="${log_level#steamos-}"
|
||||
else
|
||||
log_level="notice"
|
||||
fi
|
||||
|
||||
while [[ "$#" -ne 0 ]]
|
||||
do
|
||||
if [[ "$1" =~ ^(-h|--help) ]]
|
||||
then
|
||||
usage
|
||||
exit
|
||||
elif [[ "$1" =~ ^(-l|--log-level) ]]
|
||||
then
|
||||
shift
|
||||
|
||||
if [[ "$#" -eq 0 ]] || [[ -z ${LOG_LEVEL_PREFIX[$1]:-} ]]
|
||||
then
|
||||
echo "${!LOG_LEVEL_PREFIX[@]}"
|
||||
if [[ "$#" -eq 0 ]]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log_level="$1"
|
||||
else
|
||||
break
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if plymouth --ping &&
|
||||
{ [[ ${STEAMOS_DEBUG:-} ]] ||
|
||||
[[ "${LOG_LEVEL[$log_level]}" -lt "${LOG_LEVEL[info]}" ]]; }
|
||||
then
|
||||
prefix="${PLYMOUTH_PREFIX[$log_level]:-}"
|
||||
if [[ ${prefix:-} ]]
|
||||
then
|
||||
text="$prefix"
|
||||
fi
|
||||
text+="${*:-}"
|
||||
|
||||
plymouth display-message --text="$text"
|
||||
unset prefix text
|
||||
fi
|
||||
|
||||
if [[ "$#" -eq 0 ]]
|
||||
then
|
||||
exit
|
||||
fi
|
||||
|
||||
if ! [[ -t 1 ]]
|
||||
then
|
||||
prefix="${LOG_LEVEL_PREFIX[$log_level]:-}"
|
||||
fi
|
||||
|
||||
exec printf "%s%s\n" "${prefix:-}" "${*:-}"
|
4
usr/bin/steamos-update
Executable file
4
usr/bin/steamos-update
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
rpm-ostree update
|
||||
exit 7
|
6
usr/share/wayland-sessions/plasma-steamos-oneshot.desktop
Executable file
6
usr/share/wayland-sessions/plasma-steamos-oneshot.desktop
Executable file
@ -0,0 +1,6 @@
|
||||
[Desktop Entry]
|
||||
Exec=/usr/bin/startplasma-steamos-oneshot
|
||||
TryExec=/usr/bin/startplasma-steamos-oneshot
|
||||
DesktopNames=KDE (One-Time Launch)
|
||||
Name=Plasma (One-Time Launch)
|
||||
Comment=Plasma by KDE - One Time Launch Redirect for SteamOS Sessions
|
Loading…
x
Reference in New Issue
Block a user