Skip to content

Commit

Permalink
add postinstall_download
Browse files Browse the repository at this point in the history
  • Loading branch information
honjow committed Feb 16, 2024
1 parent c3fc963 commit 497c86e
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 3 deletions.
11 changes: 8 additions & 3 deletions build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -211,6 +215,7 @@ rm -rf ${FILES_TO_DELETE}
mkdir /home
mkdir /var
mkdir /frzr_root
mkdir /nix
EOF

# copy files into chroot again
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions manifest
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export PACKAGES="\
xorg-server \
xz \
zip \
zram-generator \
zsh \
"

Expand Down Expand Up @@ -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 \
Expand All @@ -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 \
Expand All @@ -263,7 +267,9 @@ export SERVICES="\

export USER_SERVICES="\
chimera.service \
clear-gamescope-modes \
pipewire \
sk-first-run-daemon \
steam-patch.service \
"

Expand Down
77 changes: 77 additions & 0 deletions postinstall
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 497c86e

Please sign in to comment.