From c728be71d9cf8fa1aad071c2b47cb7cfec0d25f2 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Sat, 17 Sep 2022 17:20:39 +0200 Subject: [PATCH] GLOBAL.SH: moved write_conf function on top --- global.sh | 51 +++++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/global.sh b/global.sh index 8a4af0de..160f3fae 100755 --- a/global.sh +++ b/global.sh @@ -9,31 +9,6 @@ lockfile="/var/config/retrodeck/.lock" # where the lockfile sdcard="/run/media/mmcblk0p1" # Steam Deck SD default path hard_version="$(cat '/app/retrodeck/version')" # hardcoded version (in the readonly filesystem) - -# If there is no config file I initalize the file with the the default values -if [ ! -f "$rd_conf" ] -then - - echo "RetroDECK config file not found in $rd_conf" - echo "Initializing" - - echo "#!/bin/bash" >> $rd_conf - version="$hard_version" # if we are here means that the we are in a new installation, so the version is valorized with the hardcoded one - rdhome="$HOME/retrodeck" # the retrodeck home, aka ~/retrodeck - roms_folder="$rdhome/roms" # the default roms folder path - media_folder="$HOME/retrodeck/downloaded_media" # the media folder, where all the scraped data is downloaded into - themes_folder="$HOME/retrodeck/themes" # the themes folder - - # writing the needed variables in the config file - conf_write - -# If the config file is existing i just read the variables (source it) -else - echo "Found RetroDECK config file in $rd_conf" - echo "Loading it" - source "$rd_conf" -fi - conf_write() { # writes the variables in the retrodeck config file @@ -73,4 +48,28 @@ conf_write() { cat "$rd_conf" echo "" -} \ No newline at end of file +} + +# If there is no config file I initalize the file with the the default values +if [ ! -f "$rd_conf" ] +then + + echo "RetroDECK config file not found in $rd_conf" + echo "Initializing" + + echo "#!/bin/bash" >> $rd_conf + version="$hard_version" # if we are here means that the we are in a new installation, so the version is valorized with the hardcoded one + rdhome="$HOME/retrodeck" # the retrodeck home, aka ~/retrodeck + roms_folder="$rdhome/roms" # the default roms folder path + media_folder="$HOME/retrodeck/downloaded_media" # the media folder, where all the scraped data is downloaded into + themes_folder="$HOME/retrodeck/themes" # the themes folder + + # writing the needed variables in the config file + conf_write + +# If the config file is existing i just read the variables (source it) +else + echo "Found RetroDECK config file in $rd_conf" + echo "Loading it" + source "$rd_conf" +fi \ No newline at end of file