PONZU: function refactor

This commit is contained in:
XargonWan 2024-03-08 17:32:56 +01:00
parent 10e6520644
commit 9e894733ff
2 changed files with 28 additions and 36 deletions

View file

@ -658,41 +658,32 @@ manage_ryujinx_keys() {
}
ponzu() {
local tmp_folder="/tmp/extracted"
# This function is used to extract some specific appimages
# Check if any of the specified files exist
if kiroi_ponzu=$(ls "$rdhome"/ponzu/Citra*.AppImage 1> /dev/null 2>&1) \
|| kiroi_ponzu=$(ls "$rdhome"/citra*.AppImage 1> /dev/null 2>&1) ; then
log i "Found kiroi ponzu! Elaborating it"
local data_dir="/var/data/Citra"
local appimage="$kiroi_ponzu"
create_dir "$data_dir"
log d "Moving AppImage in \"$data_dir\""
mv "$appimage" "$data_dir"
cd "$data_dir"
chmod +x "$appimage"
log d "Extracting AppImage"
"$appimage" --appimage-extract
create_dir "$tmp_folder"
log d "Cleaning up"
cp -r squashfs-root/* "$tmp_folder"
rm -rf *
mv "$tmp_folder/"** .
local executable=""
log d "Making $executable executable"
chmod +x "$executable"
cd -
log i "Kiroi ponzu is served, enjoy"
fi
# Check if any of the specified files exist
if akai_ponzu=$(ls "$rdhome"/Yuzu*.AppImage 1> /dev/null 2>&1) \
|| akai_ponzu=$(ls "$rdhome"/yuzu*.AppImage 1> /dev/null 2>&1); then
log i "Found akai ponzu! Elaborating it"
local data_dir="/var/data/Yuzu"
local appimage="$akai_ponzu"
local tmp_folder="/tmp/extracted"
local ponzu_files=("$rdhome"/ponzu/Citra*.AppImage "$rdhome"/ponzu/citra*.AppImage "$rdhome"/ponzu/Yuzu*.AppImage "$rdhome"/ponzu/yuzu*.AppImage)
local data_dir
local appimage
local executable
# Loop through all ponzu files
for ponzu_file in "${ponzu_files[@]}"; do
# Check if the current ponzu file exists
if [ -f "$ponzu_file" ]; then
if [[ "$ponzu_file" == *itra*]]; then
log i "Found akai ponzu! Elaborating it"
data_dir="/var/data/Citra"
local message="Akai ponzu is served, enjoy"
elif [[ "$ponzu_file" == *uzu* ]]; then
log i "Found kiroi ponzu! Elaborating it"
data_dir="/var/data/Yuzu"
local message="Kiroi ponzu is served, enjoy"
else
log e "AppImage not recognized, not a ponzu ingredient!"
exit 1
fi
appimage="$ponzu_file"
create_dir "$data_dir"
log d "Moving AppImage in \"$data_dir\""
mv "$appimage" "$data_dir"
@ -705,12 +696,13 @@ ponzu() {
cp -r squashfs-root/* "$tmp_folder"
rm -rf *
mv "$tmp_folder/"** .
local executable=""
executable=""
log d "Making $executable executable"
chmod +x "$executable"
cd -
log i "Akai ponzu is served, enjoy"
fi
log i "$message"
fi
done
}
# TODO: this function is not yet used

@ -1 +1 @@
Subproject commit 35d4fce1b9959b8568838659ea7e8c239139d3c8
Subproject commit ea1dae930a6f61388c2b5e05f95bb6ed0120926e