From 497c86eece14c3a04116399601d05ea6cefb963f Mon Sep 17 00:00:00 2001 From: honjow Date: Fri, 16 Feb 2024 14:22:10 +0800 Subject: [PATCH] add postinstall_download --- build-image.sh | 11 ++++++-- manifest | 6 ++++ postinstall | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 postinstall diff --git a/build-image.sh b/build-image.sh index e63f08d1f..611fbf180 100755 --- a/build-image.sh +++ b/build-image.sh @@ -58,7 +58,7 @@ mkdir -p rootfs/etc/pacman.d cp /etc/pacman.d/mirrorlist rootfs/etc/pacman.d/mirrorlist # copy files into chroot -cp -R manifest rootfs/. ${BUILD_PATH}/ +cp -R manifest postinstall rootfs/. ${BUILD_PATH}/ mkdir ${BUILD_PATH}/own_pkgs mkdir ${BUILD_PATH}/extra_pkgs @@ -143,7 +143,7 @@ sed -i "/^hosts:/ s/resolve/mdns resolve/" /etc/nsswitch.conf # configure ssh echo " AuthorizedKeysFile .ssh/authorized_keys -PasswordAuthentication no +PasswordAuthentication yes ChallengeResponseAuthentication no UsePAM yes PrintMotd no # pam does that @@ -183,6 +183,10 @@ trust anchor --store /extra_certs/*.crt # run post install hook postinstallhook +# pre-download +source /postinstall +postinstall_download + # record installed packages & versions pacman -Q > /manifest @@ -211,6 +215,7 @@ rm -rf ${FILES_TO_DELETE} mkdir /home mkdir /var mkdir /frzr_root +mkdir /nix EOF # copy files into chroot again @@ -243,7 +248,7 @@ rm -rf ${BUILD_IMG} IMG_FILENAME="${SYSTEM_NAME}-${VERSION}.img.tar.xz" if [ -z "${NO_COMPRESS}" ]; then - tar -c -I'xz -8 -T4' -f ${IMG_FILENAME} ${SYSTEM_NAME}-${VERSION}.img + tar -c -I'xz -9 -T0' -f ${IMG_FILENAME} ${SYSTEM_NAME}-${VERSION}.img rm ${SYSTEM_NAME}-${VERSION}.img sha256sum ${SYSTEM_NAME}-${VERSION}.img.tar.xz > sha256sum.txt diff --git a/manifest b/manifest index 6c0819a21..4439f003d 100644 --- a/manifest +++ b/manifest @@ -157,6 +157,7 @@ export PACKAGES="\ xorg-server \ xz \ zip \ + zram-generator \ zsh \ " @@ -229,6 +230,7 @@ export AUR_PACKAGES="\ ryzenadj-git \ steam_notif_daemon \ steam-removable-media-git \ + sk-chos-addon \ sk-chos-tool \ sk-boot-to-windows \ vulkan-nouveau-git \ @@ -244,8 +246,10 @@ export SERVICES="\ bluetooth \ bluetooth-workaround \ fstrim.timer \ + frzr_root-swap-swapfile.swap \ handycon \ haveged \ + hostname-fix \ home-swapfile.swap \ lightdm \ overlay-fonts \ @@ -263,7 +267,9 @@ export SERVICES="\ export USER_SERVICES="\ chimera.service \ + clear-gamescope-modes \ pipewire \ + sk-first-run-daemon \ steam-patch.service \ " diff --git a/postinstall b/postinstall new file mode 100644 index 000000000..d9d659579 --- /dev/null +++ b/postinstall @@ -0,0 +1,77 @@ +#!/bin/bash + +set -e +set -x + +postinstall_download() { + # pre download some + pre_path=/usr/local/share/sk-pre + decky_path=$pre_path/decky + decky_file=$decky_path/PluginLoader + decky_version_file=$decky_path/.loader.version + decky_plugin_path=$pre_path/decky-plugins + decky_plugin_hhd_path=$pre_path/decky-plugin-hhd + css_path=$pre_path/css + css_hhd_path=$pre_path/css-hhd + + # pre download decky + mkdir -p $decky_path + DECKY_RELEASE=$(curl -s 'https://api.github.com/repos/SteamDeckHomebrew/decky-loader/releases' | jq -r "first(.[] | select(.prerelease == "true"))") + DECKY_VERSION=$(jq -r '.tag_name' <<< ${DECKY_RELEASE} ) + DECKY_DOWNLOADURL=$(jq -r '.assets[].browser_download_url | select(endswith("PluginLoader"))' <<< ${DECKY_RELEASE}) + curl -L $DECKY_DOWNLOADURL --output $decky_file + echo $DECKY_VERSION > $decky_version_file + + # pre download HHD-Dekcy plugin + mkdir -p $decky_plugin_hhd_path + temp_hhd=$(mktemp -d) + curl -L $(curl -s "https://api.github.com/repos/hhd-dev/hhd-decky/releases/latest" | grep "browser_download_url" | cut -d '"' -f 4) -o $temp_hhd/hhd-decky.tar.gz + tar -xzvf $temp_hhd/hhd-decky.tar.gz -C $decky_plugin_hhd_path + rm -rf $temp_hhd + + # pre download decky plugins + mkdir -p $decky_plugin_path + temp_decky=$(mktemp -d) + # PowerControl + curl -L $(curl -s "https://api.github.com/repos/mengmeet/PowerControl/releases/latest" | grep "browser_download_url" | cut -d '"' -f 4) -o $temp_decky/powercontrol.tar.gz + tar -xzvf $temp_decky/powercontrol.tar.gz -C $decky_plugin_path + # AyaLed + curl -L $(curl -s "https://api.github.com/repos/honjow/ayaled/releases/latest" | grep "browser_download_url" | cut -d '"' -f 4) -o $temp_decky/ayaled.tar.gz + tar -xzvf $temp_decky/ayaled.tar.gz -C $decky_plugin_path + # SDH-CssLoader + curl -L $(curl -s "https://api.github.com/repos/DeckThemes/SDH-CssLoader/releases/latest" | grep "browser_download_url" | cut -d '"' -f 4 | grep "SDH-CSSLoader-Decky.zip") -o $temp_decky/SDH-CSSLoader-Decky.zip + unzip -o $temp_decky/SDH-CSSLoader-Decky.zip -d $decky_plugin_path + + rm -rf $temp_decky + + # pre download css themes + + # pre download hhd css themes + mkdir -p $css_hhd_path + temp_css_hhd=$(mktemp -d) + # SBP-ROG-Ally + git_url="https://github.com/semakusut/SBP-ROG-Ally.git" + commit_id="fd803c1bb95eedf98df749460d96e980de3d45d2" + git clone $git_url $temp_css_hhd/SBP-ROG-Ally + cd $temp_css_hhd/SBP-ROG-Ally && git checkout $commit_id && cd - + cp -r $temp_css_hhd/* $css_hhd_path + + # SBP-Legion-Go-Theme + git_url="https://github.com/frazse/SBP-Legion-Go-Theme.git" + if [ -d $css_hhd_path/SBP-Legion-Go-Theme ]; then + rm -rf $css_hhd_path/SBP-Legion-Go-Theme + fi + git clone --depth 1 $git_url $css_hhd_path/SBP-Legion-Go-Theme + echo '{"active": true, "Apply": "Legion-Go-Theme"}' > $css_hhd_path/SBP-Legion-Go-Theme/config_USER.json + + # PS5-to-Xbox-glyphs + git_url="https://github.com/honjow/PS5-to-Xbox-glyphs.git" + if [ -d $css_hhd_path/PS5-to-Xbox-glyphs ]; then + rm -rf $css_hhd_path/PS5-to-Xbox-glyphs + fi + git clone --depth 1 $git_url $css_hhd_path/PS5-to-Xbox-glyphs + echo '{"active": true, "Apply": "PS5-to-Xbox-glyphs"}' > $css_hhd_path/PS5-to-Xbox-glyphs/config_USER.json + # sed -i 's/Legion Go - PS5 controller emulator to xbox glyphs/PS5 controller emulator to xbox glyphs/g' $css_hhd_path/PS5-to-Xbox-glyphs/theme.json + + rm -rf $temp_css_hhd +} \ No newline at end of file