mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-25 07:25:38 +00:00
Simplyfing variable system - step 2
This commit is contained in:
parent
d93de935b6
commit
5d4baa8852
76
global.sh
76
global.sh
|
@ -2,66 +2,38 @@
|
|||
|
||||
# This file is containing some global function needed for the script such as the config file tools
|
||||
|
||||
rd_conf="/var/config/retrodeck/retrodeck.cfg" # RetroDECK config file path
|
||||
# Static variables
|
||||
rd_conf="/var/config/retrodeck/retrodeck.cfg" # RetroDECK config file path
|
||||
emuconfigs="/app/retrodeck/emu-configs" # folder with all the default emulator configs
|
||||
lockfile="/var/config/retrodeck/.lock" # where the lockfile is located
|
||||
sdcard="/run/media/mmcblk0p1" # Steam Deck SD default path
|
||||
hard_version="$(cat '/app/retrodeck/version')" # hardcoded version (in the readonly filesystem)
|
||||
|
||||
# if everything is working put this stuff down there
|
||||
|
||||
# If there is no config file I initalize the file with the the default values
|
||||
if [ ! -f $rd_conf ]
|
||||
then
|
||||
# Init default values, this may be overwritten by retrodeck.cfg as it sourced later with global.sh
|
||||
lockfile="/var/config/retrodeck/.lock" # where the lockfile is located
|
||||
emuconfigs="/app/retrodeck/emu-configs" # folder with all the default emulator configs
|
||||
sdcard="/run/media/mmcblk0p1" # Steam Deck SD default path
|
||||
|
||||
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
|
||||
hard_version="$(cat '/app/retrodeck/version')" # hardcoded version (in the readonly filesystem)
|
||||
|
||||
# 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_init() {
|
||||
# initializing and reading the retrodeck config file
|
||||
if [ ! -f $rd_conf ]
|
||||
then # I have to initialize the variables as they cannot be red from an empty config file
|
||||
echo "RetroDECK config file not found in $rd_conf"
|
||||
echo "Initializing"
|
||||
touch $rd_conf
|
||||
|
||||
# Variables to manage: adding a variable here means adding it to conf_write()
|
||||
echo "#!/bin/bash" >> $rd_conf
|
||||
|
||||
# version info taken from the version file
|
||||
# if the version variable is not set means that is a first installation, so we populate with the hardcoded version
|
||||
if [ -z $version ]
|
||||
then
|
||||
version="$hard_version"
|
||||
#else
|
||||
# version="$version"
|
||||
fi
|
||||
echo "version=$version" >> $rd_conf
|
||||
|
||||
# the retrodeck home, aka ~/retrodeck
|
||||
rdhome="$HOME/retrodeck"
|
||||
echo "rdhome=$rdhome" >> $rd_conf
|
||||
|
||||
# default roms folder location (internal)
|
||||
roms_folder="$roms_folder"
|
||||
echo "roms_folder=$roms_folder" >> $rd_conf
|
||||
|
||||
# default media folder location (internal)
|
||||
media_folder="$media_folder"
|
||||
echo "media_folder=$media_folder" >> $rd_conf
|
||||
|
||||
# default themes folder location (internal)
|
||||
themes_folder="$themes_folder"
|
||||
echo "themes_folder=$themes_folder" >> $rd_conf
|
||||
|
||||
|
||||
else # i just read the variables
|
||||
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
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
source /app/bin/global.sh
|
||||
#conf_init
|
||||
|
||||
# We moved the lockfile in /var/config/retrodeck in order to solve issue #53 - Remove in a few versions
|
||||
if [ -f "$HOME/retrodeck/.lock" ]
|
||||
|
|
Loading…
Reference in a new issue