Skip to content

Instantly share code, notes, and snippets.

@Gorialis
Created August 8, 2022 19:30
Show Gist options
  • Save Gorialis/a9569ccf86a87f8499a2b6b03c31641c to your computer and use it in GitHub Desktop.
Save Gorialis/a9569ccf86a87f8499a2b6b03c31641c to your computer and use it in GitHub Desktop.
pacman & systemd state of an (almost) stock Steam Deck
Server = https://steamdeck-packages.steamos.cloud/archlinux-mirror/$repo/os/$arch
accounts-qml-module 0.7-4
accountsservice 0.6.55-3
acl 2.3.1-1
adobe-source-code-pro-fonts 2.038ro+1.058it+1.018var-1
adwaita-icon-theme 41.0-1
alsa-card-profiles 1:0.3.50-2
alsa-lib 1.2.6.1-1
alsa-plugins 1:1.2.6-2
alsa-topology-conf 1.2.5.1-1
alsa-ucm-conf 1.2.6.3-1
alsa-utils 1.2.6-1
amd-ucode 20220119.0c6a7b3-2
anthy 9100h-6
aom 3.2.0-1
appstream 0.15.1-2
appstream-glib 0.7.18-2
appstream-qt 0.15.1-2
arch-install-scripts 24-2
archlinux-appstream-data 20220107-1
archlinux-keyring 20220125-1
argon2 20190702-4
ark 21.12.1-1
aspell 0.60.8-2
aspell-en 2020.12.07-1
assimp 5.1.4-1
at-spi2-atk 2.38.0-1
at-spi2-core 2.42.0-1
atk 2.36.0-1
atkmm 2.28.2-2
attica 5.90.0-1
attr 2.5.1-1
audit 3.0.6-5
avahi 0.8+22+gfd482a7-3
baloo 5.90.0-1
baloo-widgets 21.12.1-1
base 2-2
bash 5.1.016-1
bash-bats 1.5.0-1
bash-completion 2.11-2
bcc 0.23.0-1
binutils 2.36.1-3
bluedevil 1:5.23.5-1
bluez 5.63-1.8
bluez-libs 5.63-1.8
bluez-plugins 5.63-1.8
bluez-qt 5.90.0-1
bluez-utils 5.63-1.8
bolt 0.9.1-1
boost-libs 1.78.0-1
bpftrace 0.14.1-1
breeze 5.23.5-1
breeze-grub 5.23.5-1
breeze-gtk 5.23.5-1
breeze-icons 5.90.0-1
brotli 1.0.9-7
btop 1.2.0-1
btrfs-progs 5.16-1
bubblewrap 0.5.0-1
bzip2 1.0.8-4
ca-certificates 20210603-1
ca-certificates-mozilla 3.74-1
ca-certificates-utils 20210603-1
cairo 1.17.4-5
cairomm 1.14.3-2
cantarell-fonts 1:0.303.1-1
caps 0.9.26-2
casync-git 2.r227.g99559cd-2
cdparanoia 10.2-8
cfitsio 1:4.0.0-1
cifs-utils 6.14-1
clang 13.0.0-4.3
clang-libs 13.0.0-4.3
compiler-rt 13.0.0-2
convertlit 1.8-10
coreutils 9.0-2
cpio 2.13-2
cpupower 5.13-1
crda 4.14-4
cryptsetup 2.4.3-1
curl 7.81.0-1
dav1d 0.9.2-1
db 5.3.28-5
dbus 1.12.20-1
dbus-glib 0.112-2
dbus-python 1.2.18-3
dconf 0.40.0-1
desktop-file-utils 0.26-1
desync-git 0.9.2.r19.gb545768-1
device-mapper 2.03.14-2
diffutils 3.8-1
discount 2.2.7-1
discover 5.23.5-1
dkms 3.0.3-1.1
dmidecode 3.3-1
dmraid 1.0.0.rc16.3-13
dnssec-anchors 20190629-3
dolphin 21.12.1-1
dos2unix 7.4.2-1
dosfstools 4.2-1
double-conversion 3.2.0-1
dracut 055-2
drkonqi 5.23.5-1
drm_info-git 2.3.0.r0.g7ba7907-1
e2fsprogs 1.46.5-1
ebook-tools 0.2.2-7
editorconfig-core-c 0.12.5-1
efibootmgr 17-2
efivar 38-2
elfutils 0.186-2
ell 0.48-1
enchant 2.3.2-1
evtest 1.34-2
exfat-utils 1.3.0-2
exiv2 0.27.5-1
expat 2.4.3-1
f3 8.0-2
fatresize 1.1.0-1
fd 8.3.1-1
ffmpeg 2:4.4.1-1.2
file 5.41-1
filesystem 2021.12.07-1.6
findutils 4.8.0-1
fish 3.3.1-1
flac 1.3.3-3
flatpak 1.12.4-1
fontconfig 2:2.13.94-2
frameworkintegration 5.90.0-2
freerdp 2:2.5.0-1
freetype2 2.11.1-1
fribidi 1.0.11-1
fuse-common 3.10.5-1
fuse2 2.9.9-4
fuse3 3.10.5-1
gamemode 1.6.1-1
gamescope 3.11.33.jupiter.3.3.1-4
gawk 5.1.1-1
gc 8.2.0-2
gcab 1.4-1
gcc 11.1.0-3
gcc-libs 11.1.0-3
gdb 11.2-1
gdb-common 11.2-1
gdbm 1.22-1
gdk-pixbuf2 2.42.6-2
geoclue 2.5.7-4
geocode-glib 3.26.2-1
gettext 0.21-1
giflib 5.2.1-2
git 2.35.0-1
glew 2.2.0-2
glfw-x11 3.3.6-1
glib-networking 1:2.70.1-1
glib2 2.70.3-1
glibc 2.33-5
glibmm 2.66.2-1
glslang 11.7.1-3
glu 9.0.2-2
gmp 6.2.1-1
gnupg 2.2.32-2
gnutls 3.7.3-1
gobject-introspection-runtime 1.70.0-5
gpgme 1.16.0-3
gpm 1.20.7.r38.ge82d1a6-4
gptfdisk 1.0.8-1
gpu-trace 2.7-3
graphene 1.10.6-1
graphite 1:1.3.14-1
grep 3.7-1
groff 1.22.4-6
grub 2:2.06-4.5
gsettings-desktop-schemas 41.0-1
gsm 1.0.19-1
gst-plugins-base 1.18.5-1
gst-plugins-base-libs 1.18.5-1
gstreamer 1.18.5-1
gtk-update-icon-cache 1:4.6.0-2
gtk3 1:3.24.31-1
gtkmm3 3.24.5-2
guile 2.2.7-2
gwenview 21.12.1-1
gzip 1.11-1
harfbuzz 3.2.0-1
hicolor-icon-theme 0.17-2
hidapi 0.11.2-1
holo-desync r667.d02b4b6-1
holo-keyring 20220203-4
holo-pacman r659.757aeed-1
holo-pipewire r667.d02b4b6-1
holo-sudo r667.d02b4b6-1
holo-wireplumber r667.d02b4b6-1
htop 3.1.2-1
hunspell 1.7.0-3
hwdata 0.355-1
iana-etc 20220110-1
ibus 1.5.25-5
ibus-anthy 1.5.14-4
ibus-hangul 1.5.4-3
ibus-pinyin 1.5.0-8
ibus-table 1.15.0-1
ibus-table-cangjie-lite 1.8.8-2
icu 70.1-1
iniparser 4.1-4
iotop 0.6-9
iproute2 5.16.0-1
iptables 1:1.8.7-1
iputils 20211215-1
iso-codes 4.9.0-1
iw 5.16-1
iwd 1.23-1
jansson 2.14-1
jasper 2.0.33-1
jq 1.6-4
js78 78.15.0-3
json-c 0.15-2
json-glib 1.6.6-1
jupiter-dock-updater-bin 20220615.02-1
jupiter-fan-control 20220705.1-1
jupiter-hw-support 3.3.20220719.1-1
jupiter-legacy-support 1.124-1
kaccounts-integration 21.12.1-1
kactivities 5.90.0-1
kactivities-stats 5.90.0-1
kactivitymanagerd 5.23.5-1
karchive 5.90.0-1
kauth 5.90.0-1
kbd 2.4.0-2
kbookmarks 5.90.0-1
kcmutils 5.90.0-1
kcodecs 5.90.0-1
kcolorpicker 0.1.6-1
kcompletion 5.90.0-1
kconfig 5.90.0-1
kconfigwidgets 5.90.1-1
kcoreaddons 5.90.0-1
kcrash 5.90.0-1
kdbusaddons 5.90.0-1
kde-cli-tools 5.23.5-1
kde-gtk-config 5.23.5-1
kdeclarative 5.90.0-1
kdecoration 5.23.5-1
kded 5.90.0-1
kdelibs4support 5.90.0-1
kdeplasma-addons 5.23.5-1
kdesu 5.90.0-1
kdnssd 5.90.0-1
kdsoap 2.0.0-1
kdsoap-ws-discovery-client git20200927-2
kemoticons 5.90.0-1
keyutils 1.6.3-1
kfilemetadata 5.90.0-1
kgamma5 5.23.5-1
kglobalaccel 5.90.0-1
kguiaddons 5.90.0-1
kholidays 1:5.90.0-1
khotkeys 5.23.5-1
ki18n 5.90.0-1
kiconthemes 5.90.0-1
kidletime 5.90.0-1
kimageannotator 0.5.3-1
kinfocenter 5.23.5-1
kio 5.90.0-1
kio-extras 21.12.1-1
kio-fuse 5.0.1-1
kirigami2 5.90.0-1
kitemmodels 5.90.0-1
kitemviews 5.90.0-1
kitty-terminfo 0.24.1-1
kjobwidgets 5.90.0-1
kmenuedit 5.23.5-1
kmod 29-1.2
knewstuff 5.90.0-1
knotifications 5.90.0-1
knotifyconfig 5.90.0-1
konsole 21.12.1-1
kpackage 5.90.0-1
kparts 5.90.0-1
kpeople 5.90.0-1
kpmcore 21.12.1-1
kpty 5.90.0-1
kquickcharts 5.90.0-1
krb5 1.19.2-2
krunner 5.90.0-1
kscreen 5.23.5-2
kscreenlocker 5.23.5-1
kservice 5.90.0-1
ksshaskpass 5.23.5-1
ksystemstats 5.23.5-1
ktexteditor 5.90.0-1
ktextwidgets 5.90.0-1
kunitconversion 5.90.0-1
kuserfeedback 1.0.0-1
kwallet 5.90.0-1
kwallet-pam 5.23.5-1
kwayland 5.90.0-1
kwayland-integration 5.23.5-1
kwayland-server 5.23.5-1
kwidgetsaddons 5.90.0-1
kwin 5.23.5-1
kwindowsystem 5.90.0-1
kwrite 21.12.1-1
kwrited 5.23.5-1
kxmlgui 5.90.0-1
l-smash 2.14.5-2
lame 3.100-3
layer-shell-qt 5.23.5-1
lcms2 2.12-1
ldb 2:2.4.1-4
ldns 1.8.1-1
less 1:590-1
lib32-alsa-lib 1.2.6.1-1.1
lib32-alsa-plugins 1.2.6-1
lib32-brotli 1.0.9-3
lib32-bzip2 1.0.8-2
lib32-curl 7.81.0-1
lib32-dbus 1.12.20-1
lib32-e2fsprogs 1.46.5-1
lib32-expat 2.4.3-1
lib32-flac 1.3.3-1
lib32-fontconfig 2:2.13.94-1
lib32-freetype2 2.11.1-1
lib32-gamemode 1.6.1-1
lib32-gcc-libs 11.1.0-3
lib32-glib2 2.70.3-1
lib32-glibc 2.33-5
lib32-harfbuzz 3.2.0-1
lib32-icu 70.1-1
lib32-keyutils 1.6.3-1
lib32-krb5 1.19.2-2
lib32-libasyncns 0.8+3+g68cd5af-2
lib32-libcap 2.63-1
lib32-libdrm 2.4.110-1
lib32-libelf 0.186-2
lib32-libffi 3.4.2-3
lib32-libgcrypt 1.9.4-1
lib32-libglvnd 1.4.0-1
lib32-libgpg-error 1.43-1
lib32-libice 1.0.10-1
lib32-libidn2 2.3.2-1
lib32-libldap 2.6.1-1
lib32-libogg 1.3.5-1
lib32-libpciaccess 0.16-1
lib32-libpng 1.6.37-3
lib32-libpsl 0.21.1-1
lib32-libpulse 15.0-1
lib32-libsm 1.2.3-1
lib32-libsndfile 1.0.31-1
lib32-libssh2 1.10.0-1
lib32-libtasn1 4.18.0-1
lib32-libtirpc 1.3.2-1
lib32-libunistring 0.9.10-1
lib32-libunwind 1.6.2-1
lib32-libva 2.13.0-1
lib32-libva-mesa-driver 22.0.2.150118.radeonsi_20220427-1
lib32-libvdpau 1.4-1
lib32-libvorbis 1.3.7-1
lib32-libx11 1.7.3.1-1
lib32-libxau 1.0.9-1
lib32-libxcb 1.14-1
lib32-libxcrypt 4.4.27-1
lib32-libxdamage 1.1.5-1
lib32-libxdmcp 1.1.3-1
lib32-libxext 1.3.4-1
lib32-libxfixes 6.0.0-1
lib32-libxi 1.8-1
lib32-libxml2 2.9.12-2
lib32-libxshmfence 1.3-2
lib32-libxss 1.2.3-1
lib32-libxtst 1.2.3-2
lib32-libxxf86vm 1.1.4-2
lib32-llvm-libs 13.0.0-1
lib32-lm_sensors 1:3.6.0.r41.g31d1f125-1
lib32-mangohud 0.6.7.1.r16.gf81369b-1
lib32-mesa 22.0.2.150118.radeonsi_20220427-1
lib32-mesa-vdpau 22.0.2.150118.radeonsi_20220427-1
lib32-ncurses 6.3-1
lib32-nspr 4.33-1
lib32-nss 3.74-1
lib32-openal 1.21.1-2
lib32-openssl 1:1.1.1.m-1
lib32-opus 1.3.1-1
lib32-p11-kit 0.24.1-1
lib32-pam 1.5.2-1
lib32-pcre 8.45-1
lib32-pipewire 1:0.3.44-1
lib32-readline 8.1.001-1
lib32-sqlite 3.37.2-1
lib32-systemd 250.3-1
lib32-util-linux 2.37.3-1
lib32-vulkan-icd-loader 1.2.203-1
lib32-vulkan-radeon 22.2.0_devel.152969.jupiter_22.2.1-1
lib32-wayland 1.20.0-1
lib32-xz 5.2.5-2
lib32-zlib 1.2.11-3
lib32-zstd 1.5.2-1
libaccounts-glib 1.25-6
libaccounts-qt 1.16-3
libaio 0.3.112-2
libarchive 3.5.2-2
libass 0.15.2-1
libassuan 2.5.5-1
libasyncns 0.8+3+g68cd5af-3
libatasmart 0.19-5
libavc1394 0.5.4-4
libblockdev 2.26-3
libbluray 1.3.0-1
libbpf 0.6.1-1
libbsd 0.11.5-1
libbytesize 2.6-3
libcanberra 0.30+2+gc0620e4-5
libcap 2.63-1
libcap-ng 0.8.2-6
libclc 13.0.0-1
libcloudproviders 0.3.1-2
libcolord 1.4.5-4
libcroco 0.6.13-2
libcups 1:2.4.0-4
libdaemon 0.14-5
libdatrie 0.2.13-1
libdbusmenu-qt5 0.9.3+16.04.20160218-6
libdmtx 0.7.5-2
libdrm 2.4.110-1
libedit 20210910_3.1-1
libelf 0.186-2
libepoxy 1.5.9-1
libevdev 1.12.0-1
libevent 2.1.12-1
libfdk-aac 2.0.2-1
libffi 3.4.2-4
libfontenc 1.1.4-3
libfreeaptx 0.1.1-1
libgcrypt 1.9.4-1
libglvnd 1.4.0-1
libgpg-error 1.43-1
libgssglue 0.4-4
libgudev 237-1
libhangul 0.1.0-4
libibus 1.5.25-5
libical 3.0.13-1
libice 1.0.10-3
libidn2 2.3.2-1
libiec61883 1.2.0-6
libimobiledevice 1.3.0-5
libinih 53-1
libinput 1.19.3-2
libjpeg-turbo 2.1.2-1
libkdcraw 21.12.1-1
libkipi 21.12.1-1
libksba 1.6.0-1
libkscreen 5.23.5-1
libksysguard 5.23.5-1
libldac 2.0.2.3-1
libldap 2.6.1-1
libmbim 1.26.2-1
libmd 1.0.4-1
libmfx 21.3.5-2
libmm-glib 1.18.4-1
libmnl 1.0.4-3
libmodplug 0.8.9.0-3
libmpc 1.2.1-1
libmtp 1.1.19-1
libndp 1.8-1
libnetfilter_conntrack 1.0.8-1
libnewt 0.52.21-8
libnfnetlink 1.0.1-4
libnftnl 1.2.1-1
libnghttp2 1.46.0-1
libnl 3.5.0-3
libnm 1.34.0-1
libnotify 0.7.9-2
libnsl 2.0.0-1
libogg 1.3.5-1
libomxil-bellagio 0.9.3-3
libp11-kit 0.24.1-1
libpcap 1.10.1-1
libpciaccess 0.16-2
libpgm 5.3.128-1
libpipeline 1.5.5-1
libplist 2.2.0-5
libpng 1.6.37-3
libproxy 0.4.17-6
libpsl 0.21.1-1
libpulse 15.0-1
libqaccessibilityclient 0.4.1-2
libqalculate 3.22.0-1
libqmi 1.30.2-1
libqrtr-glib 1.2.0-1
libraw 0.20.2-1
libraw1394 2.1.2-3
librsvg 2:2.52.5-1
libsamplerate 0.2.2-1
libsasl 2.1.27-3
libseccomp 2.5.3-3
libsecret 0.20.4-1
libsigc++ 2.10.7-2
libsm 1.2.3-2
libsndfile 1.0.31-1
libsodium 1.0.18-2
libsoup 2.74.2-2
libsoup3 3.0.4-2
libsoxr 0.1.3-2
libssh 0.9.6-1
libssh2 1.10.0-1
libstemmer 2.2.0-1
libsysprof-capture 3.42.1-2
libtasn1 4.18.0-1
libteam 1.31-5
libthai 0.1.29-1
libtheora 1.1.1-5
libtiff 4.3.0-1
libtirpc 1.3.2-1
libtommath 1.2.0-3
libtool 2.4.6+42+gb88cebd5-16
libtraceevent 1:1.5.0-1
libtracefs 1.2.5-1
libunistring 0.9.10-3
libunwind 1.6.2-1
liburcu 0.13.1-1
libusb 1.0.24-2
libusbmuxd 2.0.2-1
libutempter 1.2.1-1
libva 2.13.0-1
libva-intel-driver 2.4.1-1
libva-mesa-driver 22.0.2.150118.radeonsi_20220427-1
libvdpau 1.4-1
libvisual 0.4.0-8
libvorbis 1.3.7-2
libvpx 1.11.0-1
libwacom 2.0.0-2
libwebp 1.2.2-1
libx11 1.7.3.1-1
libxau 1.0.9-3
libxaw 1.0.14-1
libxcb 1.14-1
libxcomposite 0.4.5-3
libxcrypt 4.4.27-1
libxcursor 1.2.0-2
libxcvt 0.1.1-1
libxdamage 1.1.5-3
libxdmcp 1.1.3-3
libxext 1.3.4-3
libxfixes 6.0.0-1
libxfont2 2.0.5-1
libxft 2.3.4-1
libxi 1.8-1
libxinerama 1.1.4-3
libxkbcommon 1.3.1-1
libxkbcommon-x11 1.3.1-1
libxkbfile 1.1.0-2
libxml2 2.9.12-7
libxmlb 0.3.6-1
libxmu 1.1.3-2
libxpm 3.5.13-2
libxrandr 1.5.2-3
libxrender 0.9.10-4
libxres 1.2.1-1
libxshmfence 1.3-2
libxslt 1.1.34-6
libxss 1.2.3-3
libxt 1.2.1-1
libxtst 1.2.3-4
libxv 1.0.11-4
libxxf86vm 1.1.4-4
libyaml 0.2.5-1
libzip 1.8.0-1
licenses 20220125-1
lilv 0.24.12-4
linux-api-headers 5.12.3-1
linux-firmware-neptune 20220624.650ab31-1
linux-neptune 5.13.0.valve21-1
llvm-libs 13.0.0-6
lm_sensors 1:3.6.0.r41.g31d1f125-1
lmdb 0.9.29-1
lsb-release 1.4-18.3
lsof 4.94.0-1
lua 5.4.4-1
luit 20210218-1
lv2 1.18.2-1
lvm2 2.03.14-2
lz4 1:1.9.3-2
lzo 2.10-3
make 4.3-3
maliit-framework 2.1.1-1
maliit-keyboard 2.1.0-1
man-db 2.9.4-2
mangohud 0.6.7.1.r16.gf81369b-1
md4c 0.4.8-1
mdadm 4.2-1
media-player-info 24-2
mesa 22.0.2.150118.radeonsi_20220427-1
mesa-utils 8.4.0-6
mesa-vdpau 22.0.2.150118.radeonsi_20220427-1
milou 5.23.5-1
minizip 1:1.2.11-5
mobile-broadband-provider-info 20210805-1
modemmanager 1.18.4-1
modemmanager-qt 5.90.0-1
mpfr 4.1.0.p13-1
mtdev 1.1.6-1
nano 6.0-1
ncurses 6.3-1
ndctl 72.1-1
nethogs 0.8.6-1
nettle 3.7.3-1
networkmanager 1.34.0-1
networkmanager-qt 5.90.0-1
noise-suppression-for-voice-git 0.91.r8.g6922453-1
noto-fonts 20201226-2
noto-fonts-cjk 20220126-1
npth 1.6-3
nspr 4.33-1
nss 3.74-1
ntfs-3g 2021.8.22-1
ntp 4.2.8.p15-1
numactl 2.0.14-1
nvme-cli 1.16-2
ocl-icd 2.3.1-1
oniguruma 6.9.7.1-1
openal 1.21.1-2
opencl-mesa 22.0.2.150118.radeonsi_20220427-1
opencore-amr 0.1.5-5
openjpeg2 2.4.0-1
openssh 8.8p1-1
openssl 1.1.1.m-1
openvpn 2.5.5-1
opus 1.3.1-2
orc 0.4.32-1
ostree 2022.1-1
oxygen 5.23.5-1
p11-kit 0.24.1-1
p7zip 1:17.04-3
pacman 6.0.1-3
pacman-mirrorlist 20220116-1
pacman-system-update 1.1-2
pam 1.5.2-1
pambase 20211210-1
pango 1:1.50.3-1
pangomm 2.46.2-1
parted 3.4-2
partitionmanager 21.12.1-1
patch 2.7.6-8
pavucontrol 1:5.0-1
pciutils 3.7.0-2
pcre 8.45-1
pcre2 10.39-1
pcsclite 1.9.5-1
perf 5.16-1
perl 5.34.0-3
perl-error 0.17029-3
perl-mailtools 2.21-5
perl-timedate 2.33-3
phonon-qt5 4.11.1-2
phonon-qt5-gstreamer 4.10.0-2
pinentry 1.2.0-1
pipewire 1:0.3.50-2
pipewire-alsa 1:0.3.50-2
pipewire-jack 1:0.3.50-2
pipewire-pulse 1:0.3.50-2
pixman 0.40.0-1
pkcs11-helper 1.28.0-1
pkgconf 1.8.0-1
plasma-browser-integration 5.23.5-1
plasma-desktop 5.23.5-1
plasma-disks 5.23.5-1
plasma-firewall 5.23.5-1
plasma-framework 5.90.0-1
plasma-integration 5.23.5-1
plasma-meta 5.23-2
plasma-nm 5.23.5-1
plasma-pa 5.23.5-1
plasma-systemmonitor 5.23.5-1
plasma-thunderbolt 5.23.5-1
plasma-vault 5.23.5-1
plasma-wayland-protocols 1.6.0-1
plasma-wayland-session 5.23.5-5
plasma-workspace 5.23.5-5
plasma-workspace-wallpapers 5.23.5-1
plymouth 22.02.122-1.2
polkit 0.120-4
polkit-kde-agent 5.23.5-1
polkit-qt5 0.114.0-1
ponymix 5-3
poppler 22.01.0-1
poppler-qt5 22.01.0-1
popt 1.18-2
powerdevil 5.23.5-1
powertop 2.14-1
ppp 2.4.9-1
presage 0.9.1-1
prison 5.90.0-1
procps-ng 3.3.17-1
psmisc 23.4-1
purpose 5.90.0-1
python 3.10.2-1
python-aiohttp 3.8.1-4
python-aiosignal 1.2.0-3
python-async-timeout 4.0.2-1
python-attrs 21.4.0-1
python-chardet 4.0.0-5
python-charset-normalizer 2.0.10-1
python-click 8.0.3-3
python-crcmod 1.7-1
python-dnspython 1:2.2.0-1
python-evdev 1.4.0-3
python-frozenlist 1.2.0-3
python-gobject 3.42.0-3
python-hid 1.0.4-7
python-idna 3.3-3
python-importlib-metadata 4.8.1-3
python-markdown 3.3.6-3
python-multidict 5.2.0-3
python-progressbar 4.0.0-1
python-psutil 5.9.0-1
python-pyaml 21.8.3-3
python-pyenchant 3.2.2-1
python-semantic-version 2.8.5-5
python-six 1.16.0-5
python-systemd 234-11
python-sysv_ipc 1.1.0-2
python-typing_extensions 4.0.1-1
python-utils 3.1.0-1
python-yaml 5.4.1.1-4
python-yarl 1.7.2-3
python-zipp 3.7.0-1
pyzy 1.0-6
qca-qt5 2.3.4-2
qqc2-desktop-style 5.90.0-1
qrencode 4.1.1-1
qt5-base 5.15.2+kde+r294-1
qt5-declarative 5.15.2+kde+r43-1
qt5-feedback 0.0.0.20150918-4
qt5-graphicaleffects 5.15.2-1
qt5-location 5.15.2-4
qt5-multimedia 5.15.2-1
qt5-quickcontrols 5.15.2-1
qt5-quickcontrols2 5.15.2+kde+r10-1
qt5-sensors 5.15.2-1
qt5-speech 5.15.2-1
qt5-svg 5.15.2+kde+r16-1
qt5-tools 5.15.2+kde+r17-4
qt5-translations 5.15.2+kde+r20-2
qt5-wayland 5.15.2+kde+r45-1
qt5-webchannel 5.15.2+kde+r5-1
qt5-webengine 5.15.8-1
qt5-x11extras 5.15.2-1
rauc 1.4-5
rav1e 0.4.1-1
re2 1:20211101-1
readline 8.1.001-1
rest 0.8.1+r4+ge5ee6ef-1
ripgrep 13.0.0-2
rsync 3.2.3-4
rtkit 0.13-1
rxvt-unicode-terminfo 9.26-2
sbc 1.5-2
sddm-kcm 5.23.5-1
sddm-wayland v0.19.0.valve4.d19813cb03c7d71b896aead28e5285bc131500a9-1
sdl2 2.0.20-1
seatd 0.6.3-2
sed 4.8-1
serd 0.30.10-1
shadow 4.8.1-4
shared-mime-info 2.0+115+gd74a913-1
signon-kwallet-extension 21.12.1-1
signon-plugin-oauth2 0.25-1
signon-ui 0.17+20171022-2
signond 8.60-3
slang 2.3.2-2
smartmontools 7.2-1
smbclient 4.15.4-1
snappy 1.1.9-2
socat 1.7.4.1-1
solid 5.90.0-1
sonnet 5.90.0-1
sord 0.16.8-1
sound-theme-freedesktop 0.8-4
source-highlight 3.1.9-7
spectacle 21.12.1-1
speex 1.2.0-3
speexdsp 1.2.0-2
sqlite 3.37.2-1
squashfs-tools 4.5-1
sratom 0.6.8-3
srt 1.4.4-1
sshfs 3.7.2-2
steam-im-modules jupiter.20220223-1
steam-jupiter-stable 1.0.0.74-2.1701
steamdeck-kde-presets 0.11-1
steamos-atomupd-client-git r157.4d50d6d-1
steamos-customizations-jupiter 20220617.1-1
steamos-devkit-service 0.20220401.0-7
steamos-efi 20220615.1-1
steamos-netrc 2022.01.18-2
strace 5.16-1
stressapptest 1.0.9-1
sudo 1.9.8.p2-3
svt-av1 0.9.0-1
syndication 5.90.0-1
syntax-highlighting 5.90.0-1
sysfsutils 2.1.1-1
systemd 250.3-1
systemd-libs 250.3-1
systemd-swap 4.4.0-2
systemd-sysvcompat 250.3-1
systemsettings 5.23.5-1
taglib 1.12-1
talloc 2.3.3-3
tar 1.34-1
tcl 8.6.12-3
tdb 1.4.5-3
tevent 1:0.11.0-3
texinfo 6.8-2
thin-provisioning-tools 0.9.0-1
threadweaver 5.90.0-1
tk 8.6.12-1
trace-cmd 2.9.6-2
tracker3 3.2.1-2
tree 2.0.1-2
tslib 1.22-1
ttf-dejavu 2.37+18+g9b5d1b2f-3
ttf-hack 3.003-3
ttf-twemoji-default 13.1.0-2
tzdata 2021e-1
udisks2 2.9.4-1
unrar 1:6.1.4-1
unzip 6.0-16
upower 0.99.15.jupiter-1
usbmuxd 1.1.1-1
usbutils 014-2
util-linux 2.37.3-1
util-linux-libs 2.37.3-1
v4l-utils 1.22.1-1
vid.stab 1.1-3
vim 8.2.4106-1
vim-runtime 8.2.4106-1
vkmark-git r129.cf45f2f-3
vmaf 1.5.3-1
volume_key 0.3.12-7
vpower 1.4.0-1
vulkan-icd-loader 1.2.203-1
vulkan-radeon 22.2.0_devel.152969.jupiter_22.2.1-1
vulkan-tools 1.2.203-1
wayland 1.20.0-1
wayland-utils 1.0.0-2
webrtc-audio-processing 0.3.1-3
wget 1.21.2-1
which 2.21-5
wireless-regdb 2021.08.28-1
wireless_tools 30.pre9-3
wireplumber 0.4.10.5.dv1-2
wpa_supplicant 2:2.10-1
x264 3:0.163.r3060.5db6aa6-1
x265 3.5-1
xbindkeys 1.8.7-2
xbitmaps 1.1.2-2
xcb-proto 1.14.1-5
xcb-util 0.4.0-3
xcb-util-cursor 0.1.3-3
xcb-util-errors 1.0-4
xcb-util-image 0.4.0-3
xcb-util-keysyms 0.4.0-3
xcb-util-renderutil 0.3.9-3
xcb-util-wm 0.4.1-3
xdg-dbus-proxy 0.1.2-3
xdg-desktop-portal 1.12.1-1.1
xdg-desktop-portal-kde 5.23.5-1
xdg-user-dirs 0.17-3
xdg-utils 1.1.3+19+g9816ebb-1
xdotool 3.20211022.1-1
xf86-input-libinput 1.2.1-1
xf86-video-amdgpu 21.0.0-2
xfsprogs 5.14.2-1
xkeyboard-config 2.34-1
xorg-fonts-encodings 1.0.5-2
xorg-server 21.1.3-1
xorg-server-common 21.1.3-1
xorg-setxkbmap 1.3.2-2
xorg-xauth 1.1.1-1
xorg-xdpyinfo 1.3.2-4
xorg-xhost 1.0.8-2
xorg-xkbcomp 1.4.5-1
xorg-xmessage 1.0.5-2
xorg-xprop 1.2.5-1
xorg-xrandr 1.5.1-2
xorg-xrdb 1.2.1-1
xorg-xset 1.2.4-2
xorg-xsetroot 1.1.2-2
xorg-xwayland-jupiter jupiter.20220512.c838945c6-3
xorg-xwininfo 1.1.5-2
xorgproto 2021.5-1
xterm 370-1
xvidcore 1.3.7-2
xxhash 0.8.1-1
xz 5.2.5-2
yay-git 10.3.0.r0.g4a93199-1
zenity-light 3.32.0+55+gd7bedff-1
zeromq 4.3.4-2
zimg 3.0.3-1
zip 3.0-9
zlib 1:1.2.11-5
zsh 5.8-1
zstd 1.5.2-1
zxing-cpp 1.2.0-1
#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives
#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir = /
#DBPath = /var/lib/pacman/
#CacheDir = /var/cache/pacman/pkg/
#LogFile = /var/log/pacman.log
#GPGDir = /etc/pacman.d/gnupg/
#HookDir = /etc/pacman.d/hooks/
HoldPkg = pacman glibc
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
Architecture = auto
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
#IgnoreGroup =
#NoUpgrade =
#NoExtract =
# Misc options
#UseSyslog
Color
#TotalDownload
# We cannot check disk space from within a chroot environment
CheckSpace
#VerbosePkgLists
ParallelDownloads = 10
# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required
# NOTE: You must run `pacman-key --init` before first using pacman; the local
# keyring can then be populated with the keys of all official Arch Linux
# packagers with `pacman-key --populate archlinux`.
#
# REPOSITORIES
# - can be defined here or included from another file
# - pacman will search repositories in the order defined here
# - local/custom mirrors can be added here or in separate files
# - repositories listed first will take precedence when packages
# have identical names, regardless of version number
# - URLs will have $repo replaced by the name of the current repo
# - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
# [repo-name]
# Server = ServerName
# Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#
# The testing repositories are disabled by default. To enable, uncomment the
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
#[testing]
#Include = /etc/pacman.d/mirrorlist
[jupiter]
Include = /etc/pacman.d/mirrorlist
SigLevel = Never
[holo]
Include = /etc/pacman.d/mirrorlist
SigLevel = Never
[core]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
#[community-testing]
#Include = /etc/pacman.d/mirrorlist
[community]
Include = /etc/pacman.d/mirrorlist
[multilib]
Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs
#! /bin/sh
add_to_steam() {
encodedUrl="steam://addnonsteamgame/$(python3 -c "import urllib.parse;print(urllib.parse.quote(\"$1\", safe=''))")"
touch /tmp/addnonsteamgamefile
xdg-open $encodedUrl
}
create_desktop_file()
{
name=$(basename "$1")
file="/tmp/$name.desktop"
cat << EOF > "$file"
[Desktop Entry]
Type=Application
Name=$name
Exec="$1"
EOF
}
file=$1
if [ ! -e "$file" ]
then
exit 1
fi
mime=$(xdg-mime query filetype "$file")
case "$mime" in
"application/x-desktop")
add_to_steam "$file"
;;
"application/x-executable"|"application/vnd.appimage"|"application/x-shellscript"|"application/x-ms-dos-executable")
create_desktop_file "$file"
add_to_steam "$file"
;;
esac
#!/usr/bin/python3
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2018-2019 Collabora Ltd
#
# This package 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.
#
# This package is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this package. If not, see
# <http://www.gnu.org/licenses/>.
import os
import sys
if os.environ.get('IN_SOURCE_TREE'):
sys.path.insert(1, os.getcwd())
sys.dont_write_bytecode = True
if __name__ == "__main__":
try:
from steamosatomupd import client
except ModuleNotFoundError as e:
print('\n'.join([
"Module not found: {}.".format(e),
"If you're running from the source tree, set the",
"environment variable IN_SOURCE_TREE and try again.",
]), file=sys.stderr)
sys.exit(1)
client.main()
#!/usr/bin/python3
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2018-2019 Collabora Ltd
#
# This package 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.
#
# This package is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this package. If not, see
# <http://www.gnu.org/licenses/>.
import argparse
import os
import sys
if os.environ.get('IN_SOURCE_TREE'):
sys.path.insert(1, os.getcwd())
sys.dont_write_bytecode = True
if __name__ == "__main__":
try:
from steamosatomupd.image import Image
from steamosatomupd.manifest import Manifest
except ModuleNotFoundError as e:
print('\n'.join([
"Module not found: {}.".format(e),
"If you're running from the source tree, set the",
"environment variable IN_SOURCE_TREE and try again.",
]), file=sys.stderr)
sys.exit(1)
parser = argparse.ArgumentParser(
description='\n'.join([
"Create a manifest of the current system, using the os-release file.",
"Feel free to use the optional arguments to override the values from",
"the os-release file, in case you know better."
]))
parser.add_argument('--product')
parser.add_argument('--release')
parser.add_argument('--variant')
parser.add_argument('--arch')
parser.add_argument('--version')
parser.add_argument('--buildid')
parser.add_argument('--checkpoint', action='store_true')
args = parser.parse_args()
try:
image = Image.from_os(args.product, args.release, args.variant, args.arch,
args.version, args.buildid, args.checkpoint)
except Exception as e:
print("Failed to create manifest: {}".format(e), file=sys.stderr)
sys.exit(1)
manifest = Manifest(image)
manifest_string = manifest.to_string()
print("{}".format(manifest_string))
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et sts=4 sw=4
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2020-2021 Collabora Ltd.
# Copyright © 2020-2021 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.
# This is a simple wrapper that provides backwards compatibility to the renamed steamos-finalize-install
source "${BASH_SOURCE%/*}"/steamos-finalize-install "$@";
# SPDX-License-Identifier: LGPL-2.1+
#
# 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.
[Unit]
Description=SteamOS Boot Registration
After=graphical.target
Requisite=graphical.target
RefuseManualStart=yes
ConditionPathExists=/efi/SteamOS
RequiresMountsFor=/efi/SteamOS
Before=shutdown.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/steamos-bootconf set-mode booted
[Install]
WantedBy=graphical.target steamos-update-os.target
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et sts=4 sw=4
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2022 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.
# NOTE: This is just a debugfs settings helper, in order we can apply some
# CFS tunings to optimize the scheduler.
set_sched_dbgfs() {
if [ ! -f "${DBGMNT}/$1" ]; then
IS_ERR=1
return
fi
if ! echo "$2" > "${DBGMNT}/$1" 2>/dev/null; then
IS_ERR=1
fi
}
IS_ERR=0
DBGMNT="/sys/kernel/debug/sched"
set_sched_dbgfs "latency_ns" "3000000"
set_sched_dbgfs "min_granularity_ns" "300000"
set_sched_dbgfs "wakeup_granularity_ns" "500000"
set_sched_dbgfs "migration_cost_ns" "50000"
set_sched_dbgfs "nr_migrate" "128"
if [ "${IS_ERR}" -ne 0 ]; then
logger "Not all CFS debugfs settings applied successfuly"
fi
# SPDX-License-Identifier: LGPL-2.1+
#
# This file is part of steamos-customizations.
#
# Copyright © 2022 Valve Corporation.
#
# 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.
[Unit]
Description=set multiple CFS tunings in sched debugfs
After=sysinit.target
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/usr/lib/steamos/steamos-cfs-debugfs-settings
[Install]
WantedBy=multi-user.target
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et sts=4 sw=4
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2019-2020 Collabora Ltd.
# Copyright © 2019-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
DISK= # --disk=
PARTSET= # --partset=
SYMLINKS_DIR=/dev/disk/by-partsets
[ -e /usr/lib/steamos/steamos-partitions-lib ] && \
. /usr/lib/steamos/steamos-partitions-lib || \
{ echo "Failed to source '/usr/lib/steamos/steamos-partitions-lib'"; exit 1; }
# Helpers
fail() { echo >&2 "$@"; exit 1; }
usage() {
local status=${1-2}
if [ $status -ne 0 ]; then
exec >&2
fi
echo
echo "Usage: $(basename $0) [--disk=DISK] --partset=A|B|self|other -- COMMAND"
echo
echo "Run COMMAND in a chroot. The chroot is SteamOS specific, which means"
echo "that the various SteamOS partitions are mounted within the chroot."
echo
echo "There are two use-cases for this command:"
echo
echo "1. Chroot into the 'other' SteamOS, useful for atomic update. For example:"
echo
echo " $(basename $0) --partset other -- COMMAND"
echo
echo "2. Chroot into another SteamOS install, on another disk. For example:"
echo
echo " $(basename $0) --disk /dev/sdb --partset A -- COMMAND"
echo
echo "The second mode works if SteamOS is installed alone on the disk, however"
echo "if there are other partitions on the disk then it's not guaranteed to work."
echo "This is because we rely on partition labels to find SteamOS partitions and"
echo "setup the chroot. This is too fragile, and if we're unlucky there could be"
echo "another partition that doesn't belong to SteamOS but uses the same partition"
echo "label."
echo
exit $status
}
while [ $# -gt 0 ]; do
case "$1" in
-h|--help)
usage 0
;;
-d|--disk)
shift
[ "${1:-}" ] || usage 1
DISK=$1
shift
;;
-p|--partset)
shift
[ "${1:-}" ] || usage 1
PARTSET=$1
shift
;;
--)
shift
break
;;
*)
usage 1
;;
esac
done
[ "$PARTSET" ] || usage 1
# Find devices
ESP_DEVICE=
EFI_DEVICE=
ROOTFS_DEVICE=
if [ "$DISK" ]; then
# A disk was provided, which means that we're chrooting into another
# SteamOS install. We do our best to 'guess' the partitions, ie. we
# mostly rely on partition labels. This is OK if SteamOS is alone on
# this disk, but it's fragile if it's installed along another OS.
[ -b "$DISK" ] || fail "'$DISK' is not a block device"
ROOTFS_DEVICE=$(get_device_by_partlabel $DISK rootfs-$PARTSET)
EFI_DEVICE=$(get_device_by_partlabel $DISK efi-$PARTSET)
VAR_DEVICE=$(get_device_by_partlabel $DISK var-$PARTSET)
ESP_DEVICE=$(get_device_by_partlabel $DISK esp)
if [ -z "$ESP_DEVICE" ]; then
ESP_DEVICE=$(get_device_by_typeuuid $DISK \
c12a7328-f81f-11d2-ba4b-00a0c93ec93b)
fi
else
# No disk was provided, which means that we're chrooting into the
# 'other' install, A or B. We can find these partitions reliably
# using the existing symlinks.
ROOTFS_DEVICE=$(realpath $SYMLINKS_DIR/$PARTSET/rootfs)
EFI_DEVICE=$(realpath $SYMLINKS_DIR/$PARTSET/efi)
ESP_DEVICE=$(realpath $SYMLINKS_DIR/shared/esp)
VAR_DEVICE=$(realpath $SYMLINKS_DIR/$PARTSET/var)
fi
[ -b "$ROOTFS_DEVICE" ] || fail "'$ROOTFS_DEVICE' is not a block device"
[ -b "$EFI_DEVICE" ] || fail "'$EFI_DEVICE' is not a block device"
[ -b "$ESP_DEVICE" ] || fail "'$ESP_DEVICE' is not a block device"
[ -b "$VAR_DEVICE" ] || fail "'$VAR_DEVICE' is not a block device"
# Do the job
prepare_chroot_at() {
local dir=$1
mount -o ro "$ROOTFS_DEVICE" $dir
mount --bind /dev $dir/dev
mount --bind /proc $dir/proc
mount --bind /run $dir/run
mount --bind /sys $dir/sys
mount --bind /sys/firmware/efi/efivars $dir/sys/firmware/efi/efivars
mount -t tmpfs -o size=128M tmpfs $dir/tmp
mount "$EFI_DEVICE" $dir/efi
mount "$ESP_DEVICE" $dir/esp
mount "$VAR_DEVICE" $dir/var
if [ -d $dir/var/boot ]; then
mount --bind $dir/var/boot $dir/boot
fi
}
cleanup_chroot_at() {
local dir=$1
if mountpoint -q $dir/boot; then
umount $dir/boot || :
fi
umount $dir/var || :
umount $dir/esp || :
umount $dir/efi || :
umount $dir/tmp || :
umount $dir/sys/firmware/efi/efivars || :
umount -R $dir/sys || :
umount $dir/run || :
umount -R $dir/proc || :
umount $dir/dev || :
umount $dir || :
rmdir $dir
}
CHROOTDIR=$(mktemp -d)
trap "cleanup_chroot_at $CHROOTDIR" EXIT
prepare_chroot_at $CHROOTDIR
chroot $CHROOTDIR "$@"
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et sts=4 sw=4
# SPDX-License-Identifier: MPL-2.0
#
# Copyright © 2015-2021 Collabora Ltd.
# Copyright © 2019-2021 Valve Corporation.
#
# This file is part of steamos-customizations.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# NOTE: this script is essentially open-coding the mkhomedir_helper utility
# with additional cp/install on top. The latter are workarounds for the bad
# separation that we currently have - for example:
# - kupdate-notifier is provided by one package, its config in another.
set -e
set -u
if [[ "$#" -eq 0 ]]
then
cat <<EOF
Usage: ${0##*/} UID
EOF
echo "Too few argument" >&2
exit 1
fi
IFS=: read -r user _ uid gid _ homedir _ < <(getent passwd "$1")
if [[ ! "${homedir:-}" ]]
then
echo "$1: No such USER" >&2
exit 1
fi
if [[ -d "${homedir:-}" ]]
then
exit 0
fi
echo "Creating homedir $homedir for UID $uid"
install -d -m 700 "$homedir"
find /etc/skel -maxdepth 1 -mindepth 1 -exec cp -vPax {} "$homedir" \;
cp -vPax /usr/share/pixmaps/steamos.png "$homedir/.face.icon"
install -d -m755 "$homedir/Desktop"
for i in /usr/share/applications/steam.desktop /usr/share/applications/steamos-install{,-devel}.desktop
do
[ -e "$i" ] || continue
ln -sf "$i" "$homedir/Desktop/${i##*/}"
done
install -d -m755 "$homedir/.config/autostart"
ln -sf /usr/share/applications/steamos-update-os-notifier.desktop "$homedir/.config/autostart/steamos-update-os-notifier.desktop"
install -D -m644 /usr/share/steamos/kupdatenotifierrc "$homedir/.config/kupdatenotifierrc"
mkdir -p "$homedir/.config/systemd/user/default.target.wants"
ln -sf /usr/lib/systemd/user/gamemoded.service "$homedir/.config/systemd/user/default.target.wants/gamemoded.service"
chown -R "$uid:$gid" "$homedir"
# SPDX-License-Identifier: LGPL-2.1+
#
# 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.
[Unit]
Description=Create UID 1000 homedir on first boot/after factory reset
Before=systemd-user-sessions.service
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/usr/lib/steamos/steamos-create-homedir 1000
[Install]
WantedBy=multi-user.target
[Unit]
Description="SteamOS Devkit Service"
[Service]
ExecStart=/usr/bin/python /usr/share/steamos-devkit/steamos-devkit-service.py
User=deck
[Install]
WantedBy=multi-user.target
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et sts=4 sw=4
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2022 Joshua Ashton for 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 -euo pipefail
# a file that gets removed when the image changes
# that we can touch to see if this script
# has previously been run on this install.
touch_file=/usr/share/steamos/devmode-enabled
print_warning() {
echo -e "\033[1;35mSteamOS \033[0;35mDeveloper Mode\033[0m\n"
echo -e "\033[0;31m\033[1mNOTE:\033[0m\033[0;33m You (probably) don't want to run this script!\033[0m"
echo -e "\e[3mThere is most likely a much better way to do what you want to do:\033[0m\033[0;36m"
echo -e "- Have you considered packaging your app with Flatpak? This is a much better (and safer) experience for users."
echo -e "- Have you considered building your package in the SteamOS docker image with 'toolbox'? (This works on desktop too!)\033[0m\n"
}
usage() {
cat <<EOF
Usage: ${0##*/} enable|status
EOF
print_warning
cat <<EOF
A small helper script to enable developer mode on SteamOS.
It does the following:
- Disables read-only mode.
- Populates the pacman keyring.
- Restores missing files stripped from the shipping image of SteamOS (ie. headers, etc) so you can build your own software.
If you wish to re-enable readonly mode after using this script, you can use the "steamos-readonly disable" command.
If status reports "enabled", you can still run "enable" again to restore packages if you mess up. ;)
EOF
}
enable_devmode() {
# ask nicely and give some guidance
print_warning
while true; do
read -p "Are you sure you wish to enable developer mode? [y/N] " yn
case $yn in
[Yy]* ) break;;
* ) exit 1;
esac
done
# don't bother running steamos-readonly disable again.
# if it's already writeable, produces concerning spew.
if steamos-readonly status >/dev/null 2>&1; then
steamos-readonly disable
fi
pacman-key --init
pacman-key --populate
pacman --noconfirm -S $(pacman -Qnkq | cut -d' ' -f1 | sort | uniq)
touch "$touch_file"
}
# returns if 'dev mode' is enabled,
# ie. we are writeable and we know
# we have restored the packages on this install
status() {
if ! steamos-readonly status >/dev/null 2>&1 && [[ -f "$touch_file" ]]; then
echo "enabled"
else
echo "disabled"
return 1
fi
}
if [[ "$(id -u)" -ne 0 ]]; then
echo "$(basename $0) needs to be run as root"
exit 1
fi
case "${1:-}" in
enable)
enable_devmode
;;
status)
status
;;
*)
usage
exit 1
esac
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et sts=4 sw=4
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2019-2021 Collabora Ltd.
# Copyright © 2019-2021 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
FORCE=0 # --force
FACTORY_RESET_CONFIG_DIR=/esp/efi/steamos/factory-reset
[ -e /usr/lib/steamos/steamos-partitions-lib ] && \
. /usr/lib/steamos/steamos-partitions-lib || \
{ echo "Failed to source '/usr/lib/steamos/steamos-partitions-lib'"; exit 1; }
usage() {
local status=${1-2}
if [ $status -ne 0 ]; then
exec >&2
fi
echo
echo "Usage: $(basename $0) [OPTIONS]"
echo
echo "Factory reset of SteamOS, wipe out the data partitions."
echo
echo "This script records the partitions to be reset in:"
echo " $FACTORY_RESET_CONFIG_DIR"
echo "On reboot the initrd scrubs them and does a first-boot setup."
echo
exit $status
}
ask() {
local message="$1 [y/n] "
local answer=
while read -r -t 0; do
read -n 256 -r -s
done
while true; do
read -p "$message" answer
case "$answer" in
[Yy]|YES|Yes|yes) return 0;;
[Nn]|NO|No|no) return 1;;
*) echo "Please answer yes or no.";;
esac
done
}
while [ $# -gt 0 ]; do
case "$1" in
-h|--help)
usage 0
;;
*)
usage 1
;;
esac
done
echo
echo "You're about to perform a factory reset of your SteamOS install!"
echo
echo "The data partitions will be erased, all your personal data will be lost."
echo "Then the system will reboot, and you'll be back to a pristine SteamOS install."
echo
if ! ask "Do you want to continue?"; then
echo "Alright buddy. Come back when you feel ready."
exit 0
fi
if steamos-factory-reset-config "$FACTORY_RESET_CONFIG_DIR"; then
reboot
fi
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et sts=4 sw=4
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2021 Collabora Ltd.
# Copyright © 2021 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 -eu
SYMLINKS_DIR=/dev/disk/by-partsets
FACTORY_RESET_CONFIG_DIR=/esp/efi/steamos/factory-reset
HOME_DEVICE=$SYMLINKS_DIR/all/home
ESP_DEVICE=$SYMLINKS_DIR/all/esp
cdir=${1:-$FACTORY_RESET_CONFIG_DIR}
wdir=$(mktemp -t -d rest-conf-XXXXXXXXXX)
dev=
opts=
for dev in $SYMLINKS_DIR/all/efi-*; do
echo EFI $dev $(readlink -f $dev) > ${wdir}/${dev##*/}.cfg
done
for dev in $SYMLINKS_DIR/all/var-*; do
opts=$(tune2fs -l "$dev" | sed -n 's/^Filesystem features:\s*//p')
echo VAR $dev $(readlink -f $dev) "$opts" > ${wdir}/${dev##*/}.cfg
done
opts=$(tune2fs -l "$HOME_DEVICE" | sed -n 's/^Filesystem features:\s*//p')
echo HOME $HOME_DEVICE $(readlink -f $HOME_DEVICE) "$opts" > ${wdir}/home.cfg
mkdir -p "$cdir"
mv "${wdir}"/* "$cdir"
rmdir "$wdir"
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et sts=4 sw=4
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright ©2022 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 -o pipefail
set -u
function usage
{
cat <<EOF
Usage: ${0##*/} [--roothash=HASH] [--no-bootloaders] [--no-kernel] [--no-migrate]
Perform post-update migration steps before marking the new installation ready.
Install boot artifacts on your device.
EOF
}
# Install boot artifacts
function install_bootloaders
{
if [[ ! "${no_bootloaders:-}" ]]
then
typeset ident
ident=$(steamos-bootconf this-image)
# fallback if there are no bootconfs in /esp, so we can't determine our image name
if [[ -z ${ident} ]]
then
rootdsk=$(findmnt --noheadings -o PARTLABEL / )
ident=${rootdsk#rootfs-}
fi
if [[ -z ${ident} ]]
then
echo "Failed to determine new boot identifier"
exit 1
fi
steamcl-install
if mountpoint -q /boot
then
grub-install
else
echo "Warning: Skipping installation artifacts to /boot!" >&2
grub-mkimage
fi
if [[ ! -e /efi/SteamOS ]]
then
mkdir -p /efi/SteamOS
fi
if [[ ! -e /esp/SteamOS/conf/${ident}.conf ]]
then
echo "Initializing boot configuration at /esp/SteamOS/conf for ${ident}"
mkdir -p /esp/SteamOS/conf
steamos-bootconf --conf-dir /esp/SteamOS/conf create --image ${ident}
fi
# we want to know our buildid
. /etc/os-release ||:
# mostly just a nice-to-have, but it also resolves a condition where an empty conf doesn't get updated
steamos-bootconf --conf-dir /esp/SteamOS/conf config --image ${ident} --set comment "${BUILD_ID:-}"
fi
if [[ ! "${no_kernel:-}" ]]
then
mapfile -t moduledirs < <(ls -1d /usr/lib/steamos/modules/* 2>/dev/null)
for moduledir in "${moduledirs[@]}"
do
if ! read -r pkgbase > /dev/null 2>&1 < "$moduledir/pkgbase"
then
# if the kernel has no pkgbase, we skip it
continue
fi
kver="${moduledir##*/}"
install -Dm644 "/usr/share/factory/var/lib/modules/$kver/vmlinuz" "/boot/vmlinuz-$pkgbase"
mkdir -p "/var/lib/modules/$kver"
cp -a "/usr/share/factory/var/lib/modules/$kver" "/var/lib/modules/"
dracut --force --hostonly "/boot/initramfs-$pkgbase.img" "$kver"
dracut --force --no-hostonly "/boot/initramfs-$pkgbase-fallback.img" "$kver"
done
fi
if [[ "${roothash:-}" ]]
then
mkdir -p /efi/SteamOS
echo "$roothash" >/efi/SteamOS/roothash
fi
mapfile -t linux < <(ls -1 /boot/vmlinuz-* 2>/dev/null)
if [[ "${#linux[*]}" -eq 0 ]]
then
echo "Warning: /boot: No such vmlinuz!" >&2
fi
mapfile -t initramfs < <(ls -1 /boot/initramfs-*.img 2>/dev/null)
if [[ "${#initramfs[*]}" -eq 0 ]]
then
echo "Warning: /boot: No such initramfs!" >&2
fi
mapfile -t modules < <(ls -d1 /usr/lib/modules/* 2>/dev/null)
if [[ "${#modules[*]}" -eq 0 ]]
then
echo "Warning: /usr/lib/modules: No such modules!" >&2
fi
update-grub
}
function in_chroot
{
local proc_root;
local root;
if ! proc_root="$(stat --printf "%d %i" /proc/1/root/ 2>/dev/null)" || ! root="$(stat --printf "%d %i" / 2>/dev/null)"; then
return 1;
fi;
test "$proc_root" != "$root"
}
# Migrate configuration before booting new image.
# Currently:
# Convert wifi system connections to a form that iwd can handle
#
function migrate_network
{
# remove properties used by NetworkManager that are not permitted by iwd:
local nm_dir=/var/lib/overlays/etc/upper/NetworkManager/system-connections
test -d "$nm_dir" && find "$nm_dir" -type f -name \*.nmconnection -print0 | while read -r -d $'\0' file;
do
if grep -q '^type=wifi' "$file"
then
sed -i 's/^\(mac-address\|interface-name\|permissions\|bssid\)=.*//' "$file" ||:
fi
done
# when converting from early OS builds, we may not have masked out NetworkManager ephemeral files
rm -f /var/lib/NetworkManager/*
}
while [[ "$#" -ne 0 ]]
do
if [[ "$1" =~ ^(-h|--help)$ ]]
then
usage
exit
elif [[ "$1" =~ ^(--roothash)$ ]]
then
shift
roothash="$1"
elif [[ "$1" =~ ^(--no-bootloaders)$ ]]
then
no_bootloaders=1
elif [[ "$1" =~ ^(--no-kernel)$ ]]
then
no_kernel=1
elif [[ "$1" =~ ^(--no-boot-install)$ ]]
then
no_boot_install=1
elif [[ "$1" =~ ^(--no-migrate)$ ]]
then
no_migrate=1
elif [[ "$1" =~ ^(-f|--force)$ ]]
then
force_migrate=1
else
usage
echo "$1: Too many arguments" >&2
exit 1
fi
shift
done
if [[ ! ${no_migrate:-} ]]
then
if in_chroot || [[ ${force_migrate:-} ]]
then
migrate_network
else
echo "Skipping configuration migration steps as this is not running in a chroot."
fi
fi
if [[ ! ${no_boot_install:-} ]]
then
install_bootloaders
fi
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: et sts=2 sw=2
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2022 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.
##
## This migrates all data in /home/doorstop to the current username, e.g. /home/deck,
## with a few cleanups
##
# The original OOBE username, should match what the service file is keyed on.
MIGRATE_USERNAME=doorstop
# The user id that user's data is migrated to
MIGRATE_USERID=1000
old_home=/home/$MIGRATE_USERNAME
new_username=$(id -nu $MIGRATE_USERID)
new_home=/home/$new_username
info() { logger -p daemon.info "$*"; }
warn() { logger -p daemon.warning "$*"; }
die() { logger -p daemon.error "$*"; exit 1; }
on_err() { die "Failed to migrate OOBE user data, some stale data may exist in '$old_home'"; }
trap on_err ERR
# Shouldn't have been invoked if $old_home isn't here or is a symlink.
[[ -d $old_home && ! -L $old_home ]] || die "'$old_home' does not exist or is not a folder, nothing to migrate"
# We only want to do opinionated things to $old_home if it is owned by $MIGRATE_USERID, but $MIGRATE_USERID is no longer
# named $MIGRATE_USERNAME. Otherwise we'd delete random things if you renamed your user doorstop, or made a new user
# named doorstop.
# Unfortunately there's not a clear OOBE-sentinel we've left behind that's cleaner to check.
if [[ $(stat --format="%u:%g" "$old_home") != $MIGRATE_USERID:$MIGRATE_USERID ]]; then
info "$old_home exists, but is not owned by user $MIGRATE_USERID, not touching"
exit 0
fi
if [[ $new_username = "$MIGRATE_USERNAME" ]]; then
info "$old_home exists, but user $MIGRATE_USERID is still named $MIGRATE_USERNAME, so no migration desired"
exit 0
fi
## Do the migration
# Case 1: $new_home already exists
# If we've already migrated and made a home directory, then repeated the OOBE, we'd prefer to just drop old OOBE data
# than risk blowing away actual accumulated userdata.
if [[ -e $new_home ]]; then
warn "New home directory $new_home already exists, dropping repeat OOBE data from $old_home"
rm -rf "$old_home"
exit 0
fi
# Case 2:
# Fixup old data and move to new home folder. Note that these steps are idempotent, in case the migration is interrupted.
# First, we want to re-acquire anything in /etc/skel, rather than the skeleton that was copied in OOBE
cp -rv /etc/skel/. "$old_home"/
# The OOBE dropped a debug shortcut on the default desktop that shouldn't be there.
rm -rf "${old_home}/Desktop/RTST Validation.desktop"
# Do this as the final step such that interruptions just retry.
sync
mv -v "$old_home" "$new_home"
# Create an old->new symlink. This is a fallback for cases where the old home directory is still referenced, but
# shouldn't really be in use. This part is less-indempotent.
ln -sv ./"$new_username" "$old_home"
sync
info "Successfully migrated $old_home -> $new_home"
# SPDX-License-Identifier: LGPL-2.1+
#
# This file is part of steamos-customizations.
#
# Copyright © 2022 Valve Corporation.
#
# 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.
[Unit]
Description=Finish migration from OOBE build
After=sysinit.target
# We don't want anything that will start user sessions to happen before we fix the /home/ folder
Before=multi-user.target
Before=steamos-create-homedir.service
ConditionPathIsDirectory=/home/doorstop
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/usr/lib/steamos/steamos-finish-oobe-migration
[Install]
WantedBy=basic.target
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et sts=4 sw=4
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2019-2021 Collabora Ltd.
# Copyright © 2019-2021 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 -eu;
export LC_ALL=C;
export LANG=C;
PCI_DISPLAY_CONTROLLER=0300;
PCI_VENDOR_NVIDIA=10de;
gpu_class=;
gpu_class_list=();
gpu_class_from_id ()
{
local vend="$1";
local dev="$2"; # Not used at present
gpu_class=;
if [ "$vend" = "$PCI_VENDOR_NVIDIA" ];
then
gpu_class="nvidia";
elif [ "$vend" ];
then
gpu_class="mesa";
fi;
}
get_gpu_class_list ()
{
local k=;
local v=;
local device=;
local vendor=;
local class=;
while read k v;
do
case "$k" in
Slot:) class=; device=; vendor=; ;;
Class:) class="$v"; ;;
Vendor:) vendor="$v"; ;;
Device:) device="$v"; ;;
esac;
if [ "$class" = "$PCI_DISPLAY_CONTROLLER" ] &&
[ "$vendor" ] && [ "$device" ];
then
gpu_class_from_id "$vendor" "$device";
echo "Device $vendor:$class is in class '$gpu_class'" >&2;
vendor=;
class=;
gpu_class_list+=("$gpu_class")
fi
done < <(lspci -vmmn);
}
get_gpu_class_list;
echo "GPUs found:" "${gpu_class_list[@]}" >&2;
exec /usr/lib/steamos/steamos-glx-driver "${gpu_class_list[@]}" "$@";
# SPDX-License-Identifier: LGPL-2.1+
#
# 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.
[Unit]
Description=Choose a GLX backend on boot
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-tmpfiles-setup.service
Before=sysinit.target shutdown.target
RefuseManualStop=yes
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/lib/steamos/steamos-glx-backend
[Install]
WantedBy=sysinit.target
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et sts=4 sw=4
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2019-2020 Collabora Ltd.
# Copyright © 2019-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 -eu;
export LC_ALL=C;
export LANG=C;
initrd=;
module_list=();
initrd_module_list=();
missing_module_list=();
uptodate_module_list=();
nvidia_module=;
get_initrd ()
{
local ver="$1";
local pkgbase="/usr/lib/modules/$(uname -r)/pkgbase";
initrd=;
if [ -e "$pkgbase" ];
then
initrd="/boot/initramfs-$(<"$pkgbase").img";
else
initrd="/boot/initrd.img-$ver";
fi;
}
get_nvidia_module ()
{
nvidia_module=;
if [ -e /etc/arch-release ];
then
nvidia_module="nvidia";
else
nvidia_module="nvidia-current";
fi;
}
get_module_list ()
{
mapfile -t module_list < <(ls -1 "$1");
}
get_initrd_module_list ()
{
mapfile -t initrd_module_list < <(lsinitrd "$1" | sed -n -E '/\.ko(\.xz)*$/s/.*\/(.*)$/\1/p');
}
get_missing_module_list ()
{
local initrd="$1"; shift;
get_initrd_module_list "$initrd";
mapfile -t missing_module_list < <( \
comm -13 <(printf "%s\n" "${initrd_module_list[@]}" | sort;) \
<(printf "%s\n" "$@" | sort;) \
);
}
get_uptodate_module_list ()
{
local initrd="$1"; shift;
local modpath="$1"; shift;
mapfile -t uptodate_module_list < <( \
local mod;
for mod in "$@";
do
if [ "$modpath/$mod" -nt "$initrd" ];
then
echo "$mod";
fi;
done;
);
}
initrd_is_up_to_date ()
{
local initrd="$1"; shift;
local modpath="$1"; shift;
get_missing_module_list "$initrd" "$@";
if [ "${#missing_module_list[@]}" -ne 0 ];
then
steamos-info "Module list in $initrd incomplete:" "${missing_module_list[@]}";
return 1;
fi;
get_uptodate_module_list "$initrd" "$modpath" "$@";
if [ "${#uptodate_module_list[@]}" -ne 0 ];
then
steamos-info "Module list in $initrd is outdated:" "${uptodate_module_list[@]}";
return 1;
fi;
}
get_status ()
{
local kver=;
local arch=;
local words=();
local status=();
kver="$(uname -r)";
arch="$(uname -m)";
while IFS="$IFS:," read -r -a words;
do
# module version status=added
if [ "${#words[@]}" -eq 3 ] && [ "${words[2]}" = "added" ];
then
status=("${words[@]}");
# module version kernel-version arch status=(built|installed)
elif [ "${words[2]}" = "$kver" ] && [ "${words[3]}" = "$arch" ];
then
status=("${words[@]}");
fi;
done < <(dkms status "$nvidia_module");
if [ "${#status[@]}" -eq 0 ];
then
return 1
fi;
echo "${status[@]:-}"
}
check_nvidia_dkms_modules ()
{
local mod=;
local ver=;
local krn=;
local arc=;
local sta=;
local modpath=;
# get the module status
get_nvidia_module;
if ! read -r mod ver krn arc sta _ < <(get_status "$nvidia_module");
then
# the module is not even added, quit!
steamos-info "The driver $nvidia_module is not added!";
return 1;
fi;
if [ -z "$sta" ]; then sta="$krn"; krn=; fi;
# the module is added or built but it is not installed though, install it!
if [ "$sta" != "installed" ];
then
steamos-notice "Installing the driver $nvidia_module...";
if ! dkms install "$mod/$ver" ||
! read -r mod ver krn arc sta _ < <(get_status "$nvidia_module");
then
# the module is not installed, quit!
steamos-error "The driver $nvidia_module cannot be installed!";
sleep 5s;
return 1;
fi;
if [ -z "$sta" ]; then sta="$krn"; krn=; fi;
fi;
# blacklist nouveau
cat <<EOF > /etc/modprobe.d/nvidia-dkms.conf;
#
# Automatically generated file; DO NOT EDIT.
# ${0##*/} modprobe.conf
#
blacklist nouveau
EOF
# the modules lives there
modpath="/var/lib/dkms/$mod/$ver/$krn/$arc/module";
get_module_list "$modpath";
# regenerate the dracut configuration
steamos-info "Adding modules ${module_list[*]} to dracut";
cat <<EOF > /etc/dracut.conf.d/99-nvidia-dkms.conf;
#
# Automatically generated file; DO NOT EDIT.
# ${0##*/} dracut.conf
#
add_drivers+=" ${module_list[*]%.ko*} "
install_items+=" /etc/modprobe.d/nvidia-dkms.conf "
EOF
# the initrd is outdated, rebuild it!
get_initrd "$ver";
if ! initrd_is_up_to_date "$initrd" "$modpath" "${module_list[@]}";
then
steamos-notice "Rebuilding the Initial RAM-disk...";
update-dracut;
fi;
}
for mod in "$@";
do
if [[ "$mod" =~ ^nvidia ]];
then
if ! check_nvidia_dkms_modules;
then
# remove the dracut configuration
rm -f /etc/dracut.conf.d/99-nvidia-dkms.conf;
# do not blacklist nouveau
rm -f /etc/modprobe.d/nvidia-dkms.conf;
fi;
# the module nvidia is not loaded...
if ! grep -q '^nvidia' /proc/modules;
then
# the system has rebooted already, load nouveau instead!
if [[ -e /var/lib/.steamos-glx-driver-has-rebooted ]];
then
rm -f /var/lib/.steamos-glx-driver-has-rebooted;
steamos-warning "The system falls back to the driver nouveau!";
if ! grep -q "^nouveau" /proc/modules
then
modprobe nouveau;
fi
# the system has not rebooted yet, reboot!
else
touch /var/lib/.steamos-glx-driver-has-rebooted;
steamos-notice "Rebooting in 5 seconds...";
reboot;
fi;
sleep 5s;
else
rm -f /var/lib/.steamos-glx-driver-has-rebooted;
fi;
# clear the splash screen
steamos-notice;
fi;
done;
#!/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 © 2019-2020 Collabora Ltd.
# Copyright © 2019-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
exec /usr/lib/grub/grub-install \
--grub-mkimage /usr/lib/steamos/steamos-grub-mkimage \
--efi-directory /efi \
--no-nvram \
"$@"
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et sts=4 sw=4
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2019 Collabora Ltd.
# Copyright © 2019 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
# Helpers
fail() { echo >&2 "$@"; exit 1; }
warn() { echo >&2 "$@"; }
usage() {
local status=${1-2}
if [ $status -ne 0 ]; then
exec >&2
fi
echo
echo "Usage: $(basename $0)"
echo
echo "Generate the GRUB early config for SteamOS. The purpose of this early config"
echo "is to find the *real* GRUB config, as it's stored in a non-standard location."
echo
echo "The content of this early config embeds the UUIDs of the root and the var"
echo "filesystems, so it's tied to the current OS. If you want to generate a"
echo "config for another set of SteamOS partitions, make sure to use a chroot."
echo
echo "This early config is meant to be embedded in a memdisk, and additionally you"
echo "must instruct GRUB lo load this memdisk using an even *earlier* config (the"
echo "so-called bootstrap config), that you pass to grub-mkimage through --config=."
echo
echo "If the environment \$STEAMOS_DEBUG is set, the early config that is generated"
echo "produces additional outputs and a delay."
echo
exit $status
}
# Arguments
while [ $# -gt 0 ]; do
case "$1" in
-h|--help)
usage 0
;;
*)
usage 1
;;
esac
done
# Get UUIDs for root and var (optional) partitions
ROOTUUID=$(findmnt -no uuid /)
VARUUID=$(findmnt -no uuid /var || true)
[ "$ROOTUUID" ] || fail "Failed to get root fs uuid"
[ "$VARUUID" ] || warn "Failed to get var fs uuid"
# Generate the grub early config
if [ -n "${STEAMOS_DEBUG:-}" ]; then
cat << EOF
echo "---- Entering early config ----"
echo "cmdpath: \$cmdpath"
echo "root : \$root"
echo "prefix : \$prefix"
echo "-------------------------------"
EOF
fi
if [ "${prefix:-}" ]; then
cat << EOF
set prefix=$prefix
EOF
fi
##
## JUPITER: /var/boot support is currently disabled, and there's a bug with it here, so drop /var from the search path
## https://gitlab.steamos.cloud/jupiter/tasks/-/issues/329
##
cat << EOF
set cfg=
for uuid in $ROOTUUID; do
search --fs-uuid --no-floppy --set=altroot \$uuid
if [ -d (\$altroot)/boot/grub ]; then
set root=\$altroot
set prefix=(\$altroot)/boot/grub
if [ -e \$prefix/grub.cfg ]; then
set cfg=\$prefix/grub.cfg
fi
break
fi
done
unset altroot
EOF
cat << EOF
if [ -e "\$cmdpath/grub.cfg" ]; then
${STEMOS_DEBUG+:echo "efi partition selected to boot"}
set cfg=\$cmdpath/grub.cfg
else
echo "falling back to grub's usual default (unexpected)"
set cfg=\$prefix/grub.cfg
fi
EOF
if [ -n "${STEAMOS_DEBUG:-}" ]; then
cat << EOF
echo "---- Leaving early config ----"
echo "root : \$root"
echo "prefix : \$prefix"
echo "cfg : \$cfg"
echo "------------------------------"
echo -n "Hit any key to continue... "
read _
EOF
fi
cat << EOF
configfile \$cfg
EOF
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et sts=4 sw=4
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2019-2020 Collabora Ltd.
# Copyright © 2019-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
FORMAT= # --format=
OUTPUT= # --output=
DEFAULT_FORMAT=x86_64-efi
DEFAULT_OUTPUT=/efi/EFI/steamos/grubx64.efi
# Helpers
fail() { echo >&2 "$@"; exit 1; }
usage() {
local status=${1-2}
if [ $status -ne 0 ]; then
exec >&2
fi
echo
echo "Usage: $(basename $0) OPTIONS"
echo
echo "Generate a GRUB image suitable for SteamOS, and install it to $DEFAULT_OUTPUT."
echo
echo "For SteamOS purpose, this script should be run without any arguments,"
echo "and it will do the right things (TM)."
echo
echo "This script also supports a subset of grub-mkimage arguments, so that it"
echo "can be called by grub-install. If you're not grub-install, you shouldn't"
echo "need to provide any argument."
echo
echo "The content of this image embeds the UUIDs of the root and the var"
echo "filesystems, so it's tied to the current OS. If you want to generate a"
echo "config for another set of SteamOS partitions, make sure to use a chroot."
echo
exit $status
}
# Arguments
while [ $# -gt 0 ]; do
case "$1" in
-h|--help)
usage 0
;;
-O|--format|-O=*|--format=*)
case "$1" in
-O|--format)
shift
FORMAT=$1
;;
*)
FORMAT=${1#*=}
;;
esac
[ "${FORMAT:-}" ] || usage 1
shift
;;
-o|--output|-o=*|--output=*)
case "$1" in
-o|--output)
shift
OUTPUT=$1
;;
*)
OUTPUT=${1#*=}
;;
esac
[ "${OUTPUT:-}" ] || usage 1
shift
;;
-p|--prefix|-p=*|--prefix=*)
case "$1" in
-p|--prefix)
shift
PREFIX=$1
;;
*)
PREFIX=${1#*=}
;;
esac
# prefix can be null
#[ "${1:-}" ] || usage 1
PREFIX=$1
shift
;;
*)
echo "$0: unrecognized option '$1'" >&2
usage 1
;;
esac
done
if [ -z "$FORMAT" ] && [ -z "$OUTPUT" ]; then
[ "$(uname -m)" = "x86_64" ] || \
fail "Unsupported architecture, we expect x86_64"
FORMAT=$DEFAULT_FORMAT
OUTPUT=$DEFAULT_OUTPUT
fi
[ "$FORMAT" ] || fail "No format provided, no default either"
[ "$OUTPUT" ] || fail "No output provided, no default either"
# Work in a temporary directory
WORKDIR=$(mktemp -d)
trap "rm -fr $WORKDIR" EXIT
cd $WORKDIR
# Create the early config, pack it in a memdisk
MEMDISK=grub-memdisk.tar
MODULES=(search search_fs_uuid ext2 btrfs fat part_gpt configfile test echo sleep)
prefix=${PREFIX:-} \
/usr/lib/steamos/steamos-grub-mkearlyconfig > grub.cfg
if [ "${STEAMOS_DEBUG:-}" ]; then
MODULES+=(read)
cat - grub.cfg << EOF >&2
Using early grub.cfg
EOF
fi
tar -cf - grub.cfg > $MEMDISK
# Create the bootstrap config
BOOTSTRAP_CONFIG=grub-bootstrap.cfg
MODULES+=(normal memdisk tar)
echo 'normal (memdisk)/grub.cfg' > $BOOTSTRAP_CONFIG
if [ "${STEAMOS_DEBUG:-}" ]; then
cat - $BOOTSTRAP_CONFIG << EOF >&2
Using bootstrap grub.cfg
EOF
fi
# Create the grub image
mkdir -p "$(dirname $OUTPUT)"
if [ "${STEAMOS_DEBUG:-}" ]; then
cat << EOF >&2
Creating image using command
grub-mkimage --config="$BOOTSTRAP_CONFIG"
--memdisk="$MEMDISK"
--format="$FORMAT"
--output="$OUTPUT"
${MODULES[*]}
$*
EOF
fi
/usr/lib/grub/grub-mkimage \
--config="$BOOTSTRAP_CONFIG" \
--memdisk="$MEMDISK" \
--format="$FORMAT" \
--output="$OUTPUT" \
"${MODULES[@]}" \
"$@"
# SPDX-License-Identifier: LGPL-2.1+
#
# 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.
[Unit]
Description=SteamOS GRUB2 Installation
DefaultDependencies=no
Wants=efi.mount
After=local-fs.target efi.mount
Before=shutdown.target sysinit.target
Conflicts=shutdown.target
ConditionPathExists=|!/efi/EFI/SteamOS/grub.cfg
ConditionPathExists=|!/efi/EFI/SteamOS/grubx64.efi
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/grub-install
ExecStart=/usr/bin/update-grub
[Install]
WantedBy=sysinit.target
# SPDX-License-Identifier: LGPL-2.1+
#
# 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.
[Unit]
Description=SteamOS Chainloader Installation
DefaultDependencies=no
Wants=esp.mount
After=local-fs.target esp.mount
Before=shutdown.target sysinit.target
Conflicts=shutdown.target
ConditionPathExists=!/esp/efi/boot/bootx64.efi
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/steamcl-install
[Install]
WantedBy=sysinit.target
#!/bin/bash
# -*- 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:-}" "${*:-}"
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et sts=4 sw=4
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2021 Collabora Ltd.
# Copyright © 2021 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
declare -r esp_parttype=c12a7328-f81f-11d2-ba4b-00a0c93ec93b
declare -r efi_parttype=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
declare -r lsblk_cols=PATH,PARTTYPE,PARTUUID,PARTLABEL
MOUNTDIR="${MOUNTDIR:-/mnt}"
OUTPUTS=("path" "partuuid" "partlabel" "label" "boot-requested-at" "boot-other"
"boot-other-disabled" "boot-attempts" "boot-count" "boot-time"
"image-invalid" "update" "update-disabled" "update-window-start"
"update-window-end" "loader" "partitions" "comment")
usage() {
cat <<EOF
${0##*/} [options] [<device> ...]
List bootconf parameters about SteamOS devices.
Options:
-o, --output <list> output columns
EOF
}
opts=()
while [[ "$#" -ne 0 ]]
do
if [[ "$1" =~ ^(-h|--help)$ ]]
then
usage
exit 0
elif [[ "$1" =~ ^(-o|--output)$ ]]
then
shift
if [[ "$1" == "help" ]]
then
echo "${OUTPUTS[@]}"
exit 0
fi
IFS=, read -r -a output <<<"$1"
elif [[ "$1" == -- ]]
then
shift
break
else
opts+=("$1")
fi
shift
done
esp_path=
mapfile -t espdev < <(lsblk --noheadings --output $lsblk_cols)
for dev in "${espdev[@]}"
do
read -r path parttype partuuid partlabel <<<"$dev"
[[ "${parttype:-}" == $esp_parttype ]] || continue
# We need this check in case there are other OSes installed with
# esp_parttype tagged partitions of their own:
[[ "${partlabel:-}" == esp ]] || continue
esp_path=$path
break
done
mapfile -t devices < <(lsblk --noheadings --output $lsblk_cols "${opts[@]}" "$@")
for dev in "${devices[@]}"
do
read -r path parttype partuuid partlabel <<<"$dev"
[[ "${parttype:-}" == $efi_parttype ]] || continue
image_ident=
case $partlabel in
efi-*)
image_ident=${partlabel#efi-};
;;
esac
[[ -n "${image_ident}" ]] || continue;
if ! mount -oro "$esp_path" ${MOUNTDIR}
then
echo "Warning: $path: No such mountable device" >&2
continue
fi
trap "umount ${MOUNTDIR}" 0
cfgs=()
if [[ -e "$MOUNTDIR/SteamOS/conf/${image_ident}.conf" ]]
then
mapfile -t cfgs <"$MOUNTDIR/SteamOS/conf/${image_ident}.conf"
fi
# FIXME: Small delay to avoid umount exiting with EBUSY
while ! umount "$MOUNTDIR"
do
sleep 0.01
done 2>/dev/null
trap - 0
[[ "${#cfgs[@]}" -ne 0 ]] || continue
if [[ ! "${output[@]:-}" ]]
then
printf "$path@/SteamOS/bootconf: %s\n" "${cfgs[@]}"
continue
fi
vals=()
cfgs+=("path: $path")
cfgs+=("partuuid: $partuuid")
cfgs+=("partlabel: $partlabel")
for i in "${output[@]}"
do
val=
for cfg in "${cfgs[@]}"
do
read -r p v <<<"$cfg"
p="${p%:}"
[[ "$i" == "$p" ]] || continue
val="$v"
break
done
if [[ ! "$val" ]] && [[ "${FS:- }" == " " ]]
then
val="-"
fi
vals+=("$val")
done
( IFS="${FS:- }"; printf "%s" "${vals[*]}"; printf "\n" )
done
#!/bin/bash
# -*- 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 -o pipefail
set -u
usage() {
cat <<EOF
Usage: ${0##*/} [-o fs-options] DEVICE MOUNTPOINT
${0##*/} -u MOUNTPOINT
Mount all the SteamOS filesystems on MOUNTPOINT using the DEVICE partitions.
Options:
-o, --options <list> comma-separated list of mount options
-u umount
-h, --help display this help
Options for disk:
partset=<self|other|A|B|dev>
explicitly specifies partset
noesp no mount /esp
noefi no mount /efi
novar no mount /var (implies nooverlay and noboot)
nohome no mount /home (implies nooffload)
nooffload no bind-mount offloaded directories
nooverlay no mount overlayed /etc
noboot no bind-mount /boot
EOF
}
partset="${partset:-other}"
while [[ "$#" -ne 0 ]]
do
if [[ "$1" =~ ^(-h|--help)$ ]]
then
usage
exit
elif [[ "$1" =~ ^(-u)$ ]]
then
unmount=1
elif [[ "$1" =~ ^(-o) ]]
then
if [[ "$1" == "-o" ]]
then
shift
opt="$1"
elif [[ "$1" =~ ^-o= ]]
then
opt="${1/-o=/}"
else
opt="${1/-o/}"
fi
IFS=, read -a opts <<<"$opt"
for opt in "${opts[@]}"
do
if [[ "${opt%%=*}" = "$opt" ]]
then
opt+="=1"
fi
eval "$(echo "$opt")"
done
elif [[ "${dev:-}" ]] || ( [[ -n "${unmount:-}" ]] && [[ "${mnt:-}" ]] )
then
usage
echo "$1: Too many arguments" >&2
exit 1
elif [[ ! "${mnt:-}" ]]
then
mnt="$1"
else
dev="$mnt"
mnt="$1"
fi
shift
done
if [[ ! "${mnt:-}" ]]
then
usage
exit 1
fi
# Unmount all partitions
if [[ "${unmount:-}" ]]
then
exec umount -R "$mnt"
fi
# Mount all partitions
if [[ ! "${dev:-}" ]]
then
usage
exit 1
fi
# Get the list of partitions
case "${partset:-other}" in
A|B|dev)
PARTITIONS=("efi-$partset" "rootfs-$partset" "var-$partset")
;;
*)
if [[ ! -d "/dev/disk/by-partsets/$partset" ]]
then
echo "$partset: No such partset" >&2
exit 1
fi
mapfile -t PARTITIONS < <(blkid -s PARTLABEL -o value "/dev/disk/by-partsets/$partset"/*)
;;
esac
PARTITIONS+=("esp" "home")
# Get the devices
mapfile -t devs < <(sfdisk -o "device,name" -l "$dev" | sed -n '/Device/,/^$/{//d;p}')
declare -A devices
for dev in "${devs[@]}"
do
read -r -a device < <(echo "$dev")
if [[ ${#device[@]} -lt 2 ]]
then
continue
fi
# check if the device is a SteamOS partition using the GPT partition label:
for part in "${PARTITIONS[@]}"
do
if [[ "$part" == "${device[1]}" ]]
then
devices[${device[1]}]="${device[0]}"
break
fi
done
done
for dev in "${!devices[@]}"
do
case "$dev" in
esp)
esp="${devices[$dev]}"
;;
efi-*)
efi="${devices[$dev]}"
;;
rootfs-*)
rootfs="${devices[$dev]}"
;;
var-*)
var="${devices[$dev]}"
;;
home)
home="${devices[$dev]}"
;;
esac
done
if [[ ! "${esp:-}" ]]
then
# Get the first EFI System Partition
mapfile -t esps < <(sfdisk -o "device,uuid,type" -l "$dev" | sed -n '/Device/,/^$/{//d;/EFI System$/p}')
for dev in "${esps[@]}"
do
read -r -a device < <(echo "$dev")
if [[ ${#device[@]} -lt 2 ]]
then
continue
fi
esp="${device[0]}"
break
done
fi
if [[ ! "${noesp:-}" ]] && [[ ! "${esp:-}" ]]
then
echo "esp: No such device" >&2
exit 1
elif [[ ! "${noefi:-}" ]] && [[ ! "${efi:-}" ]]
then
echo "efi: No such device" >&2
exit 1
elif [[ ! "${rootfs:-}" ]]
then
echo "rootfs: No such device" >&2
exit 1
elif [[ ! "${novar:-}" ]] && [[ ! "${var:-}" ]]
then
echo "var: No such device" >&2
exit 1
elif [[ ! "${nohome:-}" ]] && [[ ! "${home:-}" ]]
then
echo "home: No such device" >&2
exit 1
fi
# Mount partset
mount "$rootfs" "$mnt"
trap 'umount -R "$mnt"' 0
if [[ ! "${nohome:-}" ]]
then
mount "$home" "$mnt/home"
fi
if [[ ! "${novar:-}" ]]
then
mount "$var" "$mnt/var"
fi
if [[ ! "${noefi:-}" ]]
then
mount "$efi" "$mnt/efi"
fi
if [[ ! "${noesp:-}" ]]
then
mount "$esp" "$mnt/esp"
fi
# Mount offload
if [[ ! "${nohome:-}" ]] && [[ ! "${nooverlay:-}" ]]
then
for i in /opt /root /srv /usr/lib/debug /usr/local
do
mount --bind "$mnt/home/.steamos/offload$i" "$mnt$i"
done
if [[ ! "${novar:-}" ]]
then
for i in /var/cache/pacman /var/lib/docker /var/lib/flatpak /var/lib/systemd/coredump /var/log /var/tmp
do
mount --bind "$mnt/home/.steamos/offload$i" "$mnt$i"
done
fi
fi
# Mount overlay
if [[ ! "${novar:-}" ]] && [[ ! "${nooverlay:-}" ]]
then
mount -t overlay -o "lowerdir=$mnt/etc,upperdir=$mnt/var/lib/overlays/etc/upper,workdir=$mnt/var/lib/overlays/etc/work" none "$mnt/etc"
fi
# Mount boot
if [[ ! "${novar:-}" ]] && [[ ! "${noboot:-}" ]]
then
mount --bind "$mnt/var/boot" "$mnt/boot"
fi
trap - 0
# SPDX-License-Identifier: LGPL-2.1+
#
# 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.
[Unit]
Description=SteamOS Offload
[Install]
WantedBy=local-fs.target
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et ft=sh sts=4 sw=4
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2019-2021 Collabora Ltd.
# Copyright © 2019-2021 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.
#
# /sys helpers
#
# These functions require nothing apart from /sys being up,
# and basic commands such a basename, dirname, realpath, ...
#
get_device_number() {
# Get the device number, for example:
# /dev/sda3 -> 3
# /dev/nvme0n1p3 -> 3
local device=$(realpath "$1")
[ -b "$device" ] || return
local devname=$(basename "$device")
local partition="/sys/class/block/$devname/partition"
if [ -e "$partition" ]; then
cat "$partition"
fi
}
get_parent_device() {
# Get the parent of a block device, for example:
# /dev/sda3 -> /dev/sda
local device=$(realpath "$1")
[ -b "$device" ] || return
local devname=$(basename "$device")
local diskname=$(basename "$(realpath "/sys/class/block/$devname/..")")
local disk="/dev/$diskname"
[ -b "$disk" ] || return
echo "$disk"
}
get_slave_devices() {
# Get the slaves owned by a block device, for example:
# /dev/dm-0 -> /dev/sda4 /dev/sda6 (separated with newlines)
local device=$(realpath "$1")
[ -b "$device" ] || return
local devname=$(basename "$device")
[ -d "/sys/class/block/$devname/slaves/" ] || return
local slavenames=$(ls -1 "/sys/class/block/$devname/slaves/")
local slaves=$(printf "/dev/%s\n" $slavenames)
echo "$slaves"
}
#
# sfdisk(8) helpers -- fdisk package
#
# These functions require sfdisk, hence work at the partition level.
#
get_device_by_partlabel() {
# Get the block device for a given disk and partition label, for example:
# /dev/sda, efi-A -> /dev/sda2
local disk=$(realpath "$1")
local partlabel=$2
[ -b "$disk" ] || return
[ "$partlabel" ] || return
while read device name; do
# FIXME return first match
if [ "$name" == "$partlabel" ]; then echo "$device"; return; fi
done < <(sfdisk -ql -o device,name "$disk" | tail +2)
}
get_device_by_typeuuid() {
# Get the block device for a given disk and partition type uuid, for example:
# /dev/sda, c12a7328-f81f-11d2-ba4b-00a0c93ec93b -> /dev/sda1
local disk=$(realpath "$1")
local typeuuid=${2,,}
[ -b "$disk" ] || return
[ "$typeuuid" ] || return
while read device uuid; do
# FIXME return first match
if [ "${uuid,,}" == "$typeuuid" ]; then echo "$device"; return; fi
done < <(sfdisk -ql -o device,type-uuid "$disk" | tail +2)
}
get_device_by_partnumber() {
# Get the block device for a given disk and partition number, for example:
# /dev/sda, 3 -> /dev/sda3
# TODO rework?
local disk=$(realpath "$1")
local partnumber=$2
[ -b "$disk" ] || return
[ "$partnumber" ] || return
sfdisk -ql -o device "$disk" | tail +2 | sed -n "${partnumber}p"
}
get_partlabel() {
# Get the partlabel for a given block device, for example:
# /dev/sda2 -> efi-A
local device=$(realpath "$1")
[ -b "$device" ] || return
local disk=$(get_parent_device "$device")
[ -b "$disk" ] || return
while read dev name; do
if [ "$dev" == "$device" ]; then echo "$name"; return; fi
done < <(sfdisk -ql -o device,name "$disk" | tail +2)
}
get_partuuid() {
# Get the partuuid for a given block device, for example:
# /dev/sda2 -> 9f1db873-be42-485b-9993-78466a3637c7
local device=$(realpath "$1")
[ -b "$device" ] || return
local disk=$(get_parent_device "$device")
[ -b "$disk" ] || return
while read dev uuid; do
if [ "$dev" == "$device" ]; then echo "${uuid,,}"; return; fi
done < <(sfdisk -ql -o device,uuid "$disk" | tail +2)
}
get_partition_count() {
# Get the number of partitions on a disk, for example:
# /dev/sda -> 10
local disk=$(realpath "$1")
[ -b "$disk" ] || return
sfdisk -ql "$disk" | tail +2 | wc -l
}
#
# lsblk(8), blkid(8) helpers -- util-linux package
#
# ~ Caveats ~
#
# lsblk(8) is recommended over blkid, however it requires udev to be around,
# otherwise it fails to get some information. When is udev not around, you
# might ask? In containers. blkid(8), OTOH, seems to behave just fine without
# udev.
#
# Hence these functions call lsblk first, and fall back to blkid on failure.
#
lsblk_fstype() {
# Get the filesystem type for a given block device, for example:
# /dev/sda6 -> ext4
local device=$(realpath "$1")
[ -b "$device" ] || return
local fstype=
fstype=$(lsblk --nodeps -no fstype "$device")
if [ "$fstype" ]; then echo "$fstype"; return; fi
fstype=$(blkid -o value -s TYPE "$device")
if [ "$fstype" ]; then echo "$fstype"; return; fi
}
#
# findmnt(8), mountpoint(1) helpers -- util-linux package
#
# These functions require findmnt, hence (see man page):
# /etc/fstab, /etc/mtab or /proc/self/mountinfo
#
# ~ Caveats ~
#
# Automatic mountpoints (ie. autofs) must be handled with care. They're not
# triggered by findmnt, so it's up to the caller to mount it beforehand, if
# needed. If we don't decide to mount it, we face inconsistent result, ie:
#
# $ findmnt --real -no partuuid /efi # -> no result
# $ ls >/dev/null /efi # trigger mount
# $ findmnt --real -no partuuid /efi # try again
# 652313ba-e3f6-4435-9626-e9995cebb4fe
find_mountpoint_for_device() {
# Get the mountpoint associated with a block device, assuming that the
# block device is mounted (ie. it won't work for autofs). For example:
# /dev/sda8 -> /var
local device=$(realpath "$1")
[ -b "$device" ] || return
while read source target; do
# return first match
echo "$target"; return
done < <(findmnt --real -nvo source,target "$device")
}
find_device_for_mountpoint() {
# Get the block device backing a mountpoint, for example:
# /var -> /dev/sda8
# / -> /dev/dm-0
local mountpoint=$(realpath "$1")
mountpoint -q "$mountpoint" || return
# make sure autofs mountpoints is mounted
local fstype=$(findmnt -no fstype "$mountpoint")
if [ "$fstype" == "autofs" ]; then
ls >/dev/null "$mountpoint"
fi
local source=$(findmnt --real -nvo source "$mountpoint")
[ "$source" ] || return
realpath "$source"
}
find_device_for_mountpoint_deep() {
# Similar to find_device_for_mountpoint(), except that in case the device
# found is a device mapper, we go further and resolve it to the "real"
# block device.
#
# This was intended for dm-verity, and tested with dm-verity. Other kind
# of device mappers were not tested, and might not work.
#
# For example:
# / -> /dev/sda6
local mountpoint=$(realpath "$1")
mountpoint -q "$mountpoint" || return
local device=$(find_device_for_mountpoint "$mountpoint")
if [[ "$device" != /dev/dm-* ]]; then echo "$device"; return; fi
while read slave; do
# discard slaves whose fstype is DM_*
if [[ "$(lsblk_fstype "$slave")" == DM_* ]]; then continue; fi
# return first match
echo "$slave"; return
done < <(get_slave_devices "$device")
}
#
# steamos partitions helpers
#
get_partition_set() {
# Get the partition set for a given partlabel, for example:
# efi-A -> A
# var ->
local partlabel=$1
local suffix=
suffix=${partlabel##*-}
if [ "$suffix" = "$partlabel" ]; then
# delimiter was not found, hence partition set is empty
return
fi
echo "$suffix"
}
get_partition_linkname() {
# Get the partition symlink name for a given partlabel, for example:
# efi-A -> efi
# var -> var
local partlabel=$1
echo "${partlabel%-*}"
}
#
# misc helpers
#
roothash_is_valid() {
# Test whether a roothash is valid (should be a 64 chars hexa string)
local roothash=$1
local pattern='^[a-fA-F0-9]{64}$'
[[ "$roothash" =~ $pattern ]]
}
verity_is_enabled() {
# Test whether dm-verity is enabled for the rootfs
grep -q 'roothash=' /proc/cmdline
}
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et sts=4 sw=4
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2019-2020 Collabora Ltd.
# Copyright © 2019-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
OUTDIR= # $1
DEVICES= # --devices=
[ -e /usr/lib/steamos/steamos-partitions-lib ] && \
. /usr/lib/steamos/steamos-partitions-lib || \
{ echo "Failed to source '/usr/lib/steamos/steamos-partitions-lib'"; exit 1; }
# Helpers
log () { echo >&2 "$@"; }
fail() { echo >&2 "$@"; exit 1; }
usage() {
local status=${1-2}
if [ $status -ne 0 ]; then
exec >&2
fi
echo
echo "Usage: $(basename $0) [--devices 'efi esp-A esp-B ...'] OUTDIR"
echo
echo "In the output directory, this script creates 4 files that define the SteamOS"
echo "partition definitions: all, self, other, shared."
echo
echo "The output directory should not exist."
echo
echo "This program starts off the / mountpoint, and from there it guesses the disk"
echo "on which SteamOS is installed, if the current root partition belongs to A or B,"
echo "and then which partitions belong to 'self', 'other' or 'shared'."
echo
echo "It is assumed that all partitions on the disk belong to SteamOS, unless you"
echo "use --devices to provide a space-separated list of partitions. In such case,"
echo "only the partitions that belong to this list are kept."
echo
echo "This program should be used during the build of a SteamOS disk image,"
echo "and also when SteamOS is installed to another disk. Apart from that,"
echo "I don't see any other use-cases."
echo
exit $status
}
# Handle arguments
while [ $# -gt 0 ]; do
case "$1" in
-h|--help)
usage 0
;;
--devices)
shift
DEVICES=$1
shift
;;
*)
if ! [ "$OUTDIR" ]; then OUTDIR=$1; shift; continue; fi
usage 1
;;
esac
done
[ -n "$OUTDIR" ] || fail "Too few argument"
# Get to know who we are: A, B or dev?
ROOTDEV=$(find_device_for_mountpoint_deep '/')
[ -b "$ROOTDEV" ] || fail "Failed to get device for '/'"
ROOTLABEL=$(get_partlabel "$ROOTDEV")
[ "$ROOTLABEL" ] || fail "Failed to get partition label for '$ROOTDEV'"
SELF=$(get_partition_set "$ROOTLABEL")
[ "$SELF" ] || fail "Failed to determine partition set for label '$ROOTLABEL'"
OTHER=
case "$SELF" in
(A) OTHER=B;;
(B) OTHER=A;;
esac
[ "$OTHER" ] || [ "$SELF" == "dev" ] || fail "Failed to determine 'other' for self=$SELF"
# Get the disk on which SteamOS lives
DISK=$(get_parent_device "$ROOTDEV")
[ -b "$DISK" ] || fail "Failed to get disk for root device '$ROOTDEV'"
# We know everything, let's go
log "SteamOS root device: $ROOTDEV ($ROOTLABEL)"
log "SteamOS disk : $DISK"
log "A/B/dev status : self=$SELF, other=$OTHER"
log "Creating partition definitions in $OUTDIR ..."
[ -e "$OUTDIR" ] && fail "'$OUTDIR' already exists"
mkdir -p "$OUTDIR"
while read device partuuid typeuuid partlabel; do
# NOTE that 'type-uuid' and 'name' might not be set, and that break us.
# Ie. if type-uuid is not set, but name is set, then we end up with
# name assigned to typeuuid, which is problematic.
#
# Well it's not that bad, as we expect caller to provide a list of
# partitions in case there's more than one OS on the disk, and all
# those partitions belong to SteamOS (so we know that we set all
# those fields), EXCEPT for the ESP, which is shared with other OS.
#
# So we identify the ESP based on the typeuuid, which means that we
# must take care that sfdisk outputs the typeuuid before the label,
# in case there's no label set.
# If a device list was provided by caller, accept only those,
# otherwise assume all devices on the disk belong to SteamOS.
accepted=0
if [ -z "$DEVICES" ]; then
accepted=1
else
for d in $DEVICES; do
if [ "$d" == "$device" ]; then
accepted=1
break
fi
done
fi
if [ $accepted -eq 0 ]; then
log "Discarding partition '$device' ($partlabel), not part of SteamOS"
continue
fi
# Hack for ESP, as it's the only one which doesn't belong to
# SteamOS, hence we can't control the name. So we identify it
# using the type uuid, and pretend that the name is 'esp'.
if [ "${typeuuid,,}" == c12a7328-f81f-11d2-ba4b-00a0c93ec93b ]; then
partlabel=esp
fi
if [ ! "$partlabel" ]; then
log "Discarding partition '$device', label is empty"
continue
fi
# Guess partition set (A, B or dev) and linkname from label.
partset=$(get_partition_set "$partlabel")
linkname=$(get_partition_linkname "$partlabel")
partuuid=${partuuid,,}
group=
# Find the group, based on partset
case "$partset" in
("")
group=shared
;;
("$SELF")
group=self
echo "$linkname $partuuid" >> "$OUTDIR/$partset"
if [ "$SELF" == "dev" ]; then
echo "$linkname $partuuid" >> "$OUTDIR/dev"
fi
;;
("$OTHER")
group=other
echo "$linkname $partuuid" >> "$OUTDIR/$partset"
;;
("dev")
group=dev
;;
("A")
group=A
;;
("B")
group=B
;;
(*)
log "Discarding partition '$partlabel' with unexpected suffix '$partset'"
continue
;;
esac
# Add to partition definition files
echo "$linkname $partuuid" >> "$OUTDIR/$group"
echo "$partlabel $partuuid" >> "$OUTDIR/all"
done < <(sfdisk -ql -o device,uuid,type-uuid,name "$DISK" | tail +2)
#!/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.
udev_rules() {
local partset
partset="${1##*/}"
cat <<EOF
#
# Automatically generated file; DO NOT EDIT.
# ${0##*/} $partset
#
EOF
# ignore the "other" partitions, so they don't know up in dolphin
local udisks
[ "$partset" = "other" ] && udisks=1 || udisks=0
# must be after 60-persistent-storage.rules
while read -r name partuuid
do
cat <<EOF
ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_UUID}=="$partuuid", SYMLINK+="disk/by-partsets/$partset/$name", ENV{UDISKS_IGNORE}="$udisks"
EOF
done <"$1"
}
mkdir -p /run/udev/rules.d
for file in "$@"
do
udev_rules "$file" >"/run/udev/rules.d/90-steamos-partsets-${file##*/}.rules"
done
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et sts=4 sw=4
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2020-2021 Collabora Ltd.
# Copyright © 2020-2021 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 -euo pipefail
declare -r ROOTDEV=/dev/disk/by-partsets/self/rootfs
# default and future guess
fstype=btrfs
usage() {
cat <<EOF
Usage: ${0##*/} enable|disable|status
Enable or disable read-only on the current running SteamOS.
EOF
}
# mark root partition writable
read_write_extfs() {
tune2fs -O ^read-only "$ROOTDEV"
mount -o remount,rw /
}
read_write_btrfs() {
mount -o remount,rw /
btrfs property set / ro false
}
read_write() {
if ! status >/dev/null; then
echo "Warning: The rootfs is already read-write!" >&2
echo " Nothing is performed." >&2
return
fi
read_write_$fstype
}
#
# mark root partition read-only
read_only_btrfs() {
btrfs property set / ro true
}
read_only_extfs() {
mount -o remount,ro /
tune2fs -O read-only "$ROOTDEV"
}
read_only() {
if status >/dev/null; then
echo "Warning: The rootfs is already read-only!" >&2
echo " Nothing is performed." >&2
return
fi
sync /
read_only_$fstype
}
status_extfs() {
if tune2fs -l "$ROOTDEV" | grep -q '^Filesystem features: .*read-only.*$'
then
echo "enabled"
return
else
echo "disabled"
return 1
fi
}
status_btrfs() {
prop_val=$(btrfs property get / ro)
if [[ $prop_val = "ro=true" ]]
then
echo "enabled"
else
echo "disabled"
return 1
fi
}
status() {
status_$fstype
}
toggle() {
if status >/dev/null
then
read_write
else
read_only
fi
status
}
# determine file system type and set the fstype variable used above
get_fstype() {
declare -r FSTYPE=$(findmnt -fn --output FSTYPE /)
case "$FSTYPE" in
ext4)
fstype=extfs
;;
btrfs)
fstype=btrfs
;;
*)
echo "Unrecognized root filesystem type $FSTYPE"
exit 1
esac
}
# Ideally status will be root-free, alas tune2fs (ext4 rootfs)
# does not like that.
if [[ "$(id -u)" -ne 0 ]]; then
echo "$(basename $0) needs to be run as root"
exit 1
fi
get_fstype
case "${1:-}" in
disable)
read_write
;;
enable)
read_only
;;
toggle)
toggle
;;
status)
status
;;
*)
usage
exit 1
esac
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et sts=4 sw=4
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2020-2021 Collabora Ltd.
# Copyright © 2020-2021 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 -o pipefail
set -u
usage() {
cat <<EOF
${0##*/} [OPTIONS...] [ARG]
Reboot SteamOS.
Options:
--next XXXX
Set BootNext to XXXX (Boothex or Label)
to boot on XXXX at next boot
See efibootmgr --bootnext usage
Same as --reboot-to-firmware-entry XXXX
--factory-reset
Perform factory reset at shutdown
--update
Set mode update to update at next boot
--update-other
Set mode update-other to update other at next boot
--reboot-other
Set mode reboot-other to boot on other at next boot
--reboot-to-firmware-entry ENTRY
Set firmware entry at next boot
--reboot-to-bootloader-menu TIMEOUT
Set timeout in sec and enter menu at next boot
--reboot-to-bootloader-entry ENTRY
Set bootloader entry at next boot
--reboot-to-firmware-setup
Set OS indications to enter firmware setup at next boot
--list-firmware-entries
List firmware entries
--list-bootloader-entries
List bootloader entries
EOF
"${0##*/steamos-}" --help | sed -n '/^Options:/,//{//d;p}'
}
prompt() {
if [[ ! -t 0 ]]
then
return 0
fi
while true
do
echo -n "$* " >&2
read -r resp _
resp="${resp:-no}"
case "${resp,,}" in
yes) return 0;;
n|no) return 1;;
esac
done
}
get_efivar_str() {
cat "/sys/firmware/efi/efivars/$1" | dd bs=1 skip=4 status=none | \
iconv -t ASCII -f UTF-16LE | tr '\0' '\n'
}
get_efivar_hex() {
local hex
read -r hex < <(od -An -tx8 -N8 -j4 "/sys/firmware/efi/efivars/$1")
echo "0x$hex"
}
set_efivar_hex() {
local file
local fmt
local hex
hex="$(printf "%016x" "$2")"
fmt="\x07\x00\x00\x00"
fmt+="\x${hex:14:2}\x${hex:12:2}\x${hex:10:2}\x${hex:8:2}"
fmt+="\x${hex:6:2}\x${hex:4:2}\x${hex:2:2}\x${hex:0:2}"
file="$1.$$"
printf "$fmt" >"$file"
trap "rm -f $file" 0
}
set_efivar_ascii() {
local file
file="$1.$$"
touch "$file"
trap "rm -f $file" 0
printf "\x07\x00\x00\x00" >"$file"
iconv -t utf-16le <<<"$2" | tr '\n' '\0' >>"$file"
cp "$file" "/sys/firmware/efi/efivars/$1"
rm -f "$file"
trap - 0
}
opts=()
while [[ "$#" -ne 0 ]]
do
if [[ "$1" =~ ^(-h|--help)$ ]]
then
usage
exit 0
elif [[ "$1" =~ ^--factory-reset$ ]]
then
if ! prompt "Are you sure to perform factory-reset [no/yes]?"
then
echo "Abort!" >&2
exit 1
fi
steamos-factory-reset-config /esp/efi/steamos/factory-reset
/usr/bin/steamos-set-bootmode reboot
elif [[ "$1" =~ ^--update$ ]] || [[ "$1" =~ ^--(update|reboot)-other$ ]]
then
/usr/bin/steamos-set-bootmode ${1:2}
elif [[ "$1" =~ ^--next$ ]]
then
shift
if [[ ! "${1:-}" ]]
then
usage
echo "Error: Too few argument" >&2
exit 1
fi
if [[ "$1" =~ ^Boot[0-9A-Fa-F]{4,4}$ ]]
then
next="$1"
else
mapfile -t entries < <(efibootmgr | sed -n '/^Boot[0-9A-Fa-f]\{4,4\}./p')
for entry in "${entries[@]}"
do
if [[ "$1" == "${entry:10}" ]]
then
next="${entry:0:8}"
break
fi
done
fi
if [[ "${next:-}" ]]
then
efibootmgr -n "${next:4}"
else
echo "Warning: $1: No Such BootEntry" >&2
fi
elif [[ "$1" =~ ^--reboot-to-bootloader-menu$ ]]
then
shift
if [[ ! "${1:-}" ]]
then
usage
echo "Error: Too few argument" >&2
exit 1
fi
ascii="$(($1 * 1000000))"
set_efivar_ascii "LoaderConfigTimeoutOneShot-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f" "$ascii"
unset ascii
elif [[ "$1" =~ ^--reboot-to-bootloader-entry$ ]]
then
shift
if [[ ! "${1:-}" ]]
then
usage
echo "Error: Too few argument" >&2
exit 1
fi
set_efivar_ascii "LoaderEntryOneShot-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f" "$1"
elif [[ "$1" =~ ^--reboot-to-firmware-setup$ ]]
then
shift
hex="$(get_efivar_hex "OsIndicationsSupported-8be4df61-93ca-11d2-aa0d-00e098032b8c")"
hex="$((hex|1))"
set_efivar_hex "OsIndications-8be4df61-93ca-11d2-aa0d-00e098032b8c" "$hex"
unset hex
elif [[ "$1" =~ ^--list-firmware-entries$ ]]
then
efibootmgr | sed -n '/^Boot[0-9A-Fa-f]\{4,4\}. /s,\(Boot[0-9A-Fa-f]\{4\,4\}\). \(.*\),\1\n\2,p' \
| sed '/^$/d' \
| sort -u
exit 0
elif [[ "$1" =~ ^--list-bootloader-entries$ ]]
then
get_efivar_str "LoaderEntries-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f"
exit 0
else
opts+=("$1")
fi
shift
done
exec "${0##*/steamos-}" "${opts[@]}"
#!/bin/bash
set -e
BRANCH_PATH="/var/lib/steamos-branch"
if [[ "$#" = 1 ]]; then
case "$1" in
"-c")
branch=$(cat "$BRANCH_PATH" 2> /dev/null || echo "rel")
case "$branch" in
"rel" | "rc" | "beta" | "bc" | "main")
echo "$branch"
exit 0
;;
*)
echo "unknown branch name in $BRANCH_PATH: $branch" 1>&2
exit 1
;;
esac
;;
"-l")
echo rel
echo rc
echo beta
echo bc
echo main
exit 0
;;
"rel" | "rc" | "beta" | "bc" | "main")
echo "$1" > "$BRANCH_PATH"
exit 0
;;
esac
fi
echo "Usage: steamos-select-branch <-c|-l|rel|rc|beta|bc|main>" 1>&2
#!/bin/bash
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_launcher=""
create_sentinel=""
case "$session" in
plasma-wayland-persistent)
session_launcher="plasmawayland.desktop"
;;
plasma-persistent)
session_launcher="plasma.desktop"
;;
plasma)
session_launcher="plasma-steamos-oneshot.desktop"
create_sentinel=1
;;
gamescope)
session_launcher="gamescope-wayland.desktop"
;;
*)
echo >&2 "!! Unrecognized session '$session'"
exit 1
;;
esac
if [[ "$2" == "--sentinel-created" ]]; then
SENTINEL_CREATED=1
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"}"
(
cd "$HOME"
mkdir -p "$config_dir"
cd "$config_dir"
echo "$session_launcher" > "$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
echo "Updated user selected session to $session_launcher"
fi
# Become root
if [[ $EUID != 0 ]]; then
exec pkexec "$(realpath $0)" "$session" --sentinel-created
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"
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et sts=4 sw=4
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2020-2021 Collabora Ltd.
# Copyright © 2020-2021 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.
SETTINGS_DIR=/efi/settings
# Copy steam-settings files from /efi/steam-settings to /home/steamos/.steam-settings/ folder.
if [ -d /efi/steam-settings ]; then
# Create target folder if it doesn't exist
mkdir -p /home/steamos/.steam-settings
# Copy all settings files to .steam-settings
cp /efi/steam-settings/* /home/steamos/.steam-settings
# Change the owner so steam client can read the files.
chown -R steamos:steamos /home/steamos/.steam-settings
fi
if ! [ -d $SETTINGS_DIR ]; then
exit 0
fi
# Make sure to consume the settings dir, whatever happens
trap "rm -fr $SETTINGS_DIR" EXIT
# Import user settings
if [ -f $SETTINGS_DIR/settings.conf ]; then
. $SETTINGS_DIR/settings.conf
if [ "$LOCALE" ]; then
echo "Setting locale: $LOCALE"
localectl set-locale $LOCALE
fi
if [ "$TZ" ]; then
echo "Setting timezone: $TZ"
timedatectl set-timezone $TZ
fi
if [ "$KEYBOARD" ]; then
KBDLAYOUT=$(echo $KEYBOARD | cut -d ':' -f 1)
KBDMODEL="pc105"
case "$KBDLAYOUT" in
"jp" )
KBDMODEL="jp106"
;;
esac
KBDVARIANT=""
if grep -q ':' <<< "$KEYBOARD"; then
KBDVARIANT=$(echo $KEYBOARD | cut -d ':' -f 2)
fi
echo "Setting keyboard: layout=$KBDLAYOUT, model=$KBDMODEL, variant=$KBDVARIANT (from '$KEYBOARD')"
localectl set-x11-keymap $KBDLAYOUT $KBDMODEL $KBDVARIANT
# Make sure X will start with the right keyboard layout
mkdir -p /etc/X11/xorg.conf.d
cat > /etc/X11/xorg.conf.d/00-keyboard.conf << EOF
# Read and parsed by systemd-localed. It's probably wise not to edit this file
# manually too freely.
Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "$KBDLAYOUT"
Option "XkbModel" "$KBDMODEL"
Option "XkbVariant" "$KBDVARIANT"
EndSection
EOF
# Make sure the layout is applied to all ttys
# XXX No setupcon on ArchLinux, I guess we need something else,
# like loadkeys?
if command -v setupcon >/dev/null 2>&1; then
setupcon
fi
fi
fi
# Import steam libraries
if [ -f $SETTINGS_DIR/steamlibtab ]; then
echo "Setting steamlibtab:"
cat $SETTINGS_DIR/steamlibtab | tee --append /etc/steamlibtab
systemctl daemon-reload
systemctl restart local-fs.target
fi
# Import network configuration
if [ -d $SETTINGS_DIR/network-connections ]; then
echo "Installing network configuration"
mkdir -p /etc/NetworkManager/system-connections
install -v -m 0600 $SETTINGS_DIR/network-connections/* /etc/NetworkManager/system-connections/
fi
# Mark setup as complete to prevent initial setup from running
mkdir -p /var/lib/calamares-steamos
touch /var/lib/calamares-steamos/initial_setup_complete
rm -f /etc/sddm.conf.d/calamares-initial-setup.conf \
/root/.config/kwinrulesrc \
/root/.xsessions/steamos-initial-setup.desktop
# SPDX-License-Identifier: LGPL-2.1+
#
# 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.
[Unit]
Description=SteamOS Settings Importer
Wants=local-fs.target
After=local-fs.target
Before=getty@tty1.service getty@tty2.service getty@tty3.service getty@tty4.service getty@tty5.service getty@tty6.service getty@tty7.service NetworkManager.service sddm.service
ConditionPathIsDirectory=/efi/settings
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/steamos-settings-importer
[Install]
WantedBy=getty@tty1.service getty@tty2.service getty@tty3.service getty@tty4.service getty@tty5.service getty@tty6.service getty@tty7.service NetworkManager.service sddm.service
#!/bin/bash
set -eu
##
## This script must match the API the temporary Steam UI updater wants of us, including this file
##
unset tmpdir
cleanup() { rm -rf /tmp/steamos-update.pid; [[ -z ${tmpdir-} ]] || rm -rf --one-file-system -- "$tmpdir"; }
trap cleanup EXIT
touch /tmp/steamos-update.pid
info() { echo >&2 "$*"; }
die() { info "!! $*"; exit 1; }
checkmode=""
error=""
beta=""
debug=""
while [[ $# -ge 1 ]]; do
case "$1" in
"check") checkmode=1 ;;
"--beta") beta=1 ;;
"-d") debug=1 ;;
*)
error=1
info "Unknown option \"$1\""
;;
esac
shift
done
if [[ -n $error ]]; then
echo >&2 "!! Usage: $0 [check]"
exit 1
fi
atomupd_args=(--manifest "/usr/share/steamos-update/manifest-0.json")
[[ -n $debug ]] && atomupd_args+=(-d)
# Determine which branches to check.
check_rel=0
check_rc=0
check_beta=0
check_bc=0
check_main=0
if [[ -n $beta ]]; then
info "'--beta' is deprecated; use 'steamos-select-branch beta' then 'steamos-update'"
check_beta=1
else
branch_path="/var/lib/steamos-branch"
branch=$(cat "$branch_path" 2> /dev/null || echo "rel")
case "$branch" in
"rel")
check_rel=1
;;
"rc")
check_rel=1
check_rc=1
;;
"beta")
check_beta=1
;;
"bc")
check_beta=1
check_bc=1
;;
"main")
check_main=1
;;
*)
echo "unknown branch name in $branch_path: $branch" 1>&2
exit 1
;;
esac
fi
# Get the buildid for each variant.
get_buildid () {
if [[ $1 = 0 ]]; then
exit 0
fi
query="$(sudo steamos-atomupd-client "${atomupd_args[@]}" --variant="$2" --query-only)"
if [[ -z $query ]]; then
info "Failed to check for updates"
exit 1 # Unknown failure
fi
jq -r '.minor.candidates[0].image.buildid | select(type == "string")' <<< "$query"
}
buildid_rel="$(get_buildid $check_rel steamdeck)"
buildid_rc="$(get_buildid $check_rc steamdeck-rc)"
buildid_beta="$(get_buildid $check_beta steamdeck-beta)"
buildid_bc="$(get_buildid $check_bc steamdeck-bc)"
buildid_main="$(get_buildid $check_main steamdeck-main)"
if [[ -n $debug ]]; then
info "buildid_rel=$buildid_rel"
info "buildid_rc=$buildid_rc"
info "buildid_beta=$buildid_beta"
info "buildid_bc=$buildid_bc"
info "buildid_main=$buildid_main"
fi
# Choose the variant with the newest buildid.
chosen_buildid=""
chosen_variant=""
if [[ "$buildid_rel" > "$chosen_buildid" ]]; then
chosen_buildid="$buildid_rel"
chosen_variant="steamdeck"
fi
if [[ "$buildid_rc" > "$chosen_buildid" ]]; then
chosen_buildid="$buildid_rc"
chosen_variant="steamdeck-rc"
fi
if [[ "$buildid_beta" > "$chosen_buildid" ]]; then
chosen_buildid="$buildid_beta"
chosen_variant="steamdeck-beta"
fi
if [[ "$buildid_bc" > "$chosen_buildid" ]]; then
chosen_buildid="$buildid_bc"
chosen_variant="steamdeck-bc"
fi
if [[ "$buildid_main" > "$chosen_buildid" ]]; then
chosen_buildid="$buildid_main"
chosen_variant="steamdeck-main"
fi
if [[ -z "$chosen_variant" ]]; then
info "No update available"
exit 7
fi
manifest_path="/etc/steamos-atomupd/manifest.json"
current_buildid=$(jq -r .buildid < "$manifest_path")
if [[ "$current_buildid" = "$chosen_buildid" ]]; then
info "No update available"
exit 7
fi
if [[ -n $debug ]]; then
info "chosen_buildid=$chosen_buildid"
info "chosen_variant=$chosen_variant"
fi
# Update is available
info "Update available"
# Check mode, return success for update available
if [[ -n ${checkmode-} ]]; then
echo "$chosen_buildid"
exit 0
fi
# Not check mode. Update!
do_atomupd() { sudo steamos-atomupd-client "${atomupd_args[@]}" --variant="$chosen_variant" "$@"; }
if do_atomupd; then
info "Applied an update"
exit 0
else
info "Update failed"
exit 1
fi
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et sts=4 sw=4
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2019-2020 Collabora Ltd.
# Copyright © 2019-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##*/} now [ATOMUPD-OPTIONS]
${0##*/} after-reboot
${0##*/} -h|--help
EOF
}
update_now() {
if ! steamos-atomupd-client "$@"; then
echo "SteamOS cannot be updated!" >&2
sleep 5s
fi
if grep -q 'systemd.unit=steamos-update-os.target' /proc/cmdline; then
steamos-logger "Rebooting in 5 seconds...";
sleep 5s
reboot
else
echo "Reboot to run the new version of SteamOS." >&2
fi
}
update_after_reboot() {
/usr/sbin/steamos-set-bootmode update-other
echo "Reboot to start the update of SteamOS." >&2
}
if [[ $# -eq 0 ]]; then
usage
exit 1
fi
case "$1" in
(now)
shift
update_now "$@"
;;
(after-reboot)
shift
update_after_reboot
;;
(-h|--help)
usage
exit 0
(*)
usage
exit 1
;;
esac
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et sts=4 sw=4
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2020-2021 Collabora Ltd.
# Copyright © 2020-2021 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
# XXX: Disabled! The update-other boot mode is not functional and is, in fact, currently breaking boot configs.
# Removing this vector to trigger it until this is revisited.
# https://gitlab.steamos.cloud/jupiter/tasks/-/issues/547
exit 0
if [ ! -d /dev/disk/by-partsets/other ]; then
exit
fi
exec kupdate-notifier
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et sts=4 sw=4
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2020-2021 Collabora Ltd.
# Copyright © 2020-2021 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 -o pipefail
# XXX: Disabled! The update-other boot mode is not functional and is, in fact, currently breaking boot configs.
# Removing this vector to trigger it until this is revisited.
# https://gitlab.steamos.cloud/jupiter/tasks/-/issues/547
exit 1
opts=()
if [[ -e /run/steamos-atomupd/manifest.json ]]
then
opts+=(--manifest /run/steamos-atomupd/manifest.json)
fi
case "$1" in
has-updates)
opts+=(--query-only)
if ! buildid=$(steamos-atomupd-client "${opts[@]}" | \
tee /dev/stderr /run/steamos-atomupd/has-updates.json | \
jq -erM '.minor.candidates[-1].image.buildid //empty')
then
rm -f /run/steamos-atomupd/has-updates.json
echo "SteamOS is up-to-date!"
exit 1
fi
echo "SteamOS $buildid is available!"
;;
online-updates)
opts+=(--update-file /run/steamos-atomupd/has-updates.json)
steamos-atomupd-client "${opts[@]}"
jq -erM '.minor.candidates[-1].image' /run/steamos-atomupd/has-updates.json | \
tee /dev/stderr /run/steamos-atomupd/manifest.json
rm -f /run/steamos-atomupd/has-updates.json
;;
offline-updates)
qdbus org.kde.LogoutPrompt /LogoutPrompt promptReboot
/usr/bin/steamos-set-bootmode update-other
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> * <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
# There used to be a sleep 35 sec then remove the update request here
# I don't think we need or want it. Reinstate if you know better.
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> * <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;;
*)
if [[ ! "$1" ]]; then
echo "Too few argument" >&2
else
echo "$1: Invalid argument" >&2
fi
exit 127
esac
# SPDX-License-Identifier: LGPL-2.1+
#
# 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.
[Unit]
Description=SteamOS Update Operating System Plymouth
After=plymouth-start.service
Conflicts=plymouth-quit.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/lib/steamos/steamos-update-os-progress
[Install]
WantedBy=steamos-update-os.target
#!/bin/bash
# -*- 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
progress() {
if plymouth --ping 2>/dev/null
then
plymouth system-update --progress "$1"
fi
echo "$1%"
}
while [[ "$#" -ne 0 ]]
do
if [[ "$1" =~ ^(-h|--help)$ ]]
then
echo "Usage: ${0##*/} [-h|--help] [--debug]"
exit 0
elif [[ "$1" == "--debug" ]]
then
debug=true
else
echo "$1: Invalid argument" >&2
exit 1
fi
shift
done
while read -r -a words
do
# Empty line: skip it!
if [[ "${#words[@]}" -eq 0 ]]
then
continue
fi
# Print the journal to stderr
if [[ "${debug:-}" ]]
then
echo "${words[@]}" >&2
fi
# Slot needs to be updated with /run/rauc/bundle/*.img.caibx
if [[ "${words[0]}" =~ "Slot" ]]
then
slot="${words[6]##*/}"
slot="${slot%*.img.caibx}"
# Seeding... ##%
elif [[ "${words[0]}" =~ "seeding" ]] && [[ "${slot:-}" == "rootfs" ]]
then
if [[ "${words[1]}" =~ [0-9]+%$ ]]
then
percentage="${words[1]%\%}"
percentage="$(((percentage*25*90/100)/100))"
percentage="$((percentage+5))"
progress "$percentage" "${words[@]}"
fi
# Downloading chunks ##%
elif [[ "${words[0]}" == "downloading" ]] && [[ "${slot:-}" == "rootfs" ]]
then
if [[ "${words[2]}" =~ [0-9]+%$ ]]
then
percentage="${words[2]%\%}"
percentage="$(((percentage*75*90/100)/100))"
percentage="$((percentage+5+(25*90/100)))"
progress "$percentage" "${words[@]}"
fi
# installing: ...: All slots updated
elif [[ "${words[0]}" == "installing" ]] &&
[[ "${words[*]:2}" == "All slots updated" ]]
then
percentage="95"
progress "$percentage" "${words[@]}"
# installing: ...: finished
elif [[ "${words[0]}" == "installing" ]] &&
[[ "${words[*]:2}" == "finished" ]]
then
percentage="99"
progress "$percentage" "${words[@]}"
# installing: ...: started
elif [[ "${words[0]}" == "installing" ]] &&
[[ "${words[*]:2}" == "started" ]]
then
if plymouth --ping 2>/dev/null
then
plymouth change-mode --system-upgrade
percentage="0"
progress "$percentage" "${words[@]}"
fi
# installing: ...: failed: ...
elif [[ "${words[0]}" == "installing" ]] &&
[[ "${words[*]:2}" =~ "failed: " ]]
then
if plymouth --ping 2>/dev/null
then
plymouth change-mode --boot-up
plymouth display-message --text="Error: System upgrade failed!"
fi
# installing: ...: succeeded
elif [[ "${words[0]}" == "installing" ]] &&
[[ "${words[*]:2}" == "succeeded" ]]
then
percentage="100"
progress "$percentage" "${words[@]}"
if plymouth --ping 2>/dev/null
then
plymouth change-mode --boot-up
plymouth display-message --text="System upgrade completed!"
fi
# Stopped Rauc Update Service.
elif [[ "${words[*]}" == "Stopped Rauc Update Service." ]]
then
if plymouth --ping 2>/dev/null
then
plymouth change-mode --boot-up
plymouth display-message --text=
fi
# Started Rauc Update Service.
elif [[ "${words[*]}" == "Started Rauc Update Service." ]]
then
if plymouth --ping 2>/dev/null
then
plymouth change-mode --system-upgrade
percentage="0"
progress "$percentage" "${words[@]}"
fi
fi
done < <(journalctl --unit rauc.service --follow --output cat)
# SPDX-License-Identifier: LGPL-2.1+
#
# 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.
[Unit]
Description=SteamOS Update Operating System
Requires=network-online.target rauc.service
After=network-online.target rauc.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/steamos-update-os now
[Install]
WantedBy=steamos-update-os.target
# SPDX-License-Identifier: LGPL-2.1+
#
# 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.
[Unit]
Description=SteamOS Update Mode
Conflicts=rescue.service rescue.target
After=rescue.service rescue.target
AllowIsolate=yes
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et sts=4 sw=4
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2020-2021 Collabora Ltd.
# Copyright © 2020-2021 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 -euo pipefail
declare -r ROOTDEV=/dev/disk/by-partsets/self/rootfs
declare -r VERITYDEV=/dev/disk/by-partsets/self/verity
declare -r HASHFILE=/efi/SteamOS/roothash
usage() {
cat <<EOF
Usage: ${0##*/} enable|disable|status|verify
Enable or disable the block level verification on the current running SteamOS.
EOF
}
mapper_root_mounted() {
grep -q '^/dev/mapper/root / ' /proc/mounts
}
read_write() {
steamos-readonly disable
if mapper_root_mounted
then
echo "Warning: The rootfs is still read-only!" >&2
echo " Reboot to complete setup." >&2
return
fi
rm -f "$HASHFILE"
sync /
}
read_only() {
if mapper_root_mounted
then
echo "Warning: The rootfs is already read-only!" >&2
echo " Nothing is performed." >&2
return
fi
local block_size=$(blkid -o value -s BLOCK_SIZE "$ROOTDEV")
steamos-readonly enable
veritysetup format --data-block-size "$block_size" --hash-block-size "$block_size" \
"$ROOTDEV" "$VERITYDEV" | \
tee /dev/stderr | \
sed -n 's,^Root hash:[[:blank:]]\+\([[:xdigit:]]\{64\}\)$,\1,p' > "$HASHFILE"
echo "Reboot to complete setup." >&2
}
status() {
local filesystem_is_readonly
local device_is_readonly
local roothash
if mapper_root_mounted
then
device_is_readonly=yes
fi
if steamos-readonly status >/dev/null
then
filesystem_is_readonly=yes
fi
if [[ -e "$HASHFILE" ]]
then
roothash="$(cat $HASHFILE)"
fi
if [[ "${roothash:-}" ]] && [[ "${device_is_readonly:-}" ]] && [[ "${filesystem_is_readonly:-}" ]]
then
echo "enabled"
return
fi
# XXX: this seems off
if [[ ! "${roothash:-}" ]] && [[ ! "${filesystem_is_readonly:-}" ]]
then
echo "disabled"
return 1
elif [[ ! "${roothash:-}" ]] && [[ ! "${filesystem_is_readonly:-}" ]]
then
echo "disabled${device_is_readonly:+ (after reboot)}"
return 1
fi
echo "unknown"
echo "- device-is-read-only: ${device_is_readonly:-no}"
echo "- filesystem-is-read-only: ${filesystem_is_readonly:-no}"
echo "- roothash: ${roothash:-none}"
return 1
}
verify() {
if [[ ! -e "$HASHFILE" ]]
then
return 1
fi
veritysetup verify "$ROOTDEV" "$VERITYDEV" "$(cat $HASHFILE)"
}
# Ideally status will be root-free, alas steamos-readonly status
# does not like that.
if [[ "$(id -u)" -ne 0 ]]; then
echo "$(basename $0) needs to be run as root"
exit 1
fi
case "${1:-}" in
disable)
read_write
;;
enable)
read_only
;;
status)
status
;;
verify)
verify
;;
*)
usage
exit 1
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment