RetroPie  4
System to install/configure Emulators in a Debian Environment
Functions
helpers.sh File Reference

RetroPie Helper library. More...

Functions

 printMsgs (type, message)
 prints messages in a variety of ways More...
 
 printHeading (message)
 calls PrintMsgs with "heading" type More...
 
 fatalError (message)
 calls PrintMsgs with "heading" type, and exits immediately More...
 
 runCmd (command)
 calls command and record any non zero return codes for later printing More...
 
 hasFlag (string, flag)
 checks for a flag in a string (consisting of space separated flags) More...
 
 isPlatform ()
 check for current platform / platform flags More...
 
 hasPackage (package, version, comparison)
 check for installed Debian package / package version. More...
 
 aptUpdate ()
 calls apt-get update (unless it has already been called before)
 
 aptInstall (package)
 calls apt-get install with the packages provided More...
 
 aptRemove (package)
 calls apt-get remove with the packages provided More...
 
 getDepends (package)
 installs packages if they are not installed More...
 
 rpSwap (command, memory)
 adds additional swap to the system More...
 
 gitPullOrClone (dest, repo, branch)
 git clones or pulls a repository More...
 
 rmDirExists (dir)
 removes a directory and all contents if it exists More...
 
 mkUserDir (dir)
 creates a directory owned by the current user More...
 
 mkRomDir (dir)
 creates a directory under $romdir owned by the current user More...
 
 moveConfigDir (from, to)
 moves the contents of a folder and symlinks to the new location More...
 
 moveConfigFile (from, to)
 moves the file and symlinks to the new location More...
 
 diffFiles (file1, file2)
 compares two files using diff More...
 
 copyDefaultConfig (from, to)
 copies from the source file to the destination file if the destination file doesn't exist. If the destination is the same nothing is done. if different the source is copied to destination.rp-dist More...
 
 addUdevInputRules ()
 creates udev rule in /etc/udev/rules.d/99-input.rules for /dev/input to make it writable by any user in input group
 
 setDispmanx (module_id, status)
 sets a flag for a module as to whether it should use the sdl1 dispmanx backend by default or not (0 for framebuffer, 1 for dispmanx) More...
 
 setESSystem (fullname, name, path, extension, command, platform, theme)
 adds a system entry for Emulation Station (to /etc/emulationstation/es_systems.cfg) More...
 

Detailed Description

RetroPie Helper library.

Function Documentation

aptInstall ( package  )

calls apt-get install with the packages provided

Parameters
packagepackage / list of packages to install
aptRemove ( package  )

calls apt-get remove with the packages provided

Parameters
packagepackage / list of packages to remove
copyDefaultConfig ( from  ,
to   
)

copies from the source file to the destination file if the destination file doesn't exist. If the destination is the same nothing is done. if different the source is copied to destination.rp-dist

Parameters
fromsource file
todestination file
diffFiles ( file1  ,
file2   
)

compares two files using diff

Parameters
file1file to compare
file2file to compare
Return values
0if the files were the same
1if they were not
>1an error occured
fatalError ( message  )

calls PrintMsgs with "heading" type, and exits immediately

Parameters
messagestring or array of messages to display
getDepends ( package  )

installs packages if they are not installed

Parameters
packagepackage / list of packages to install (if not already installed)
Return values
0on success
1on failure
gitPullOrClone ( dest  ,
repo  ,
branch   
)

git clones or pulls a repository

Parameters
destdestination directory
reporepository to clone or pull from
branchbranch to clone or pull from (optional)
hasFlag ( string  ,
flag   
)

checks for a flag in a string (consisting of space separated flags)

Parameters
stringstring to search in
flagflag to search for
Return values
0if the flag was found
1if the flag was not found
hasPackage ( package  ,
version  ,
comparison   
)

check for installed Debian package / package version.

Parameters
packagename of Debian package
versionrequested version (optional)
comparisontype of comparison - defaults to ge (greater than or equal) if using a version
Return values
0if the requested package / version was installed
1if the requested package / version was not installed
isPlatform ( )

check for current platform / platform flags

Parameters
platform
mkRomDir ( dir  )

creates a directory under $romdir owned by the current user

Parameters
dirrom directory to create
mkUserDir ( dir  )

creates a directory owned by the current user

Parameters
dirdirectory to create
moveConfigDir ( from  ,
to   
)

moves the contents of a folder and symlinks to the new location

Parameters
fromsource directory
todestination directory
moveConfigFile ( from  ,
to   
)

moves the file and symlinks to the new location

Parameters
fromsource file
todestination file
printHeading ( message  )

calls PrintMsgs with "heading" type

Parameters
messagestring or array of messages to display
printMsgs ( type  ,
message   
)

prints messages in a variety of ways

Parameters
typestyle of display to use - dialog, console or heading
messagestring or array of messages to display
rmDirExists ( dir  )

removes a directory and all contents if it exists

Parameters
dirdirectory to remove
rpSwap ( command  ,
memory   
)

adds additional swap to the system

Parameters
commandon to add swap if needed and off to remove later
memorytotal memory needed (swap added = memory - available memory)
runCmd ( command  )

calls command and record any non zero return codes for later printing

Return values
0if the function name exists
1if the function name does not exist
Parameters
commandcommand to run
Returns
whatever the command returns.
setDispmanx ( module_id  ,
status   
)

sets a flag for a module as to whether it should use the sdl1 dispmanx backend by default or not (0 for framebuffer, 1 for dispmanx)

Parameters
module_idname of module to add dispmanx flag for
statusinitial status of flag (0 or 1)
setESSystem ( fullname  ,
name  ,
path  ,
extension  ,
command  ,
platform  ,
theme   
)

adds a system entry for Emulation Station (to /etc/emulationstation/es_systems.cfg)

Parameters
fullnamefull name of system
nameshort name of system
pathrom path
extensionfile extensions to show
commandcommand to run
platformplatform (used by es for scraping)
themename of theme to use