Skip to content

Modules

Jessica Brown edited this page May 4, 2022 · 11 revisions

The Modules

FileName Function Description Usage
mod_bakup backup Create a backup of a file or directory to the archive folder location backup {filename
mod_dirjump eb3_dirjump A list of the last 15 used directories you have visited eb3_dirjump (d)
mod_empty empty To empty a file with no date and keep all permissions in tact empty {filename}
mod_extract extract Automatically detect compression type and extract into a directory extract {filename}
mod_logviewer viewlog To pipe and cat logs in color with automatic detection of key elements viewlog {filename}
mod_systeminfo systeminfo Provides detailed information about the current OS, Network, and Memory systeminfo
mod_userlist userlist Gives all users information on the current system userlist
mod_weather weather Provides information on the 5 day forecast and current weather conditions weather

How it works

Line by Line

NOTE: The $(config_get {config parameter}) is gathering the information in the ./etc/conf/eb3.conf file.

./etc/setdirectories

eb3_BinPath=${scriptLocation}$(config_get dirSeparator)$(config_get eb3BinPath)$(config_get dirSeparator)
eb3_CachePath=${eb3_BinPath}$(config_get eb3CachePath)$(config_get dirSeparator)
eb3_TempPath=${eb3_CachePath}$(config_get eb3TempPath)$(config_get dirSeparator)
eb3_LibPath=${eb3_BinPath}$(config_get eb3LibPath)$(config_get dirSeparator)
eb3_ModPath=${eb3_BinPath}$(config_get eb3ModPath)$(config_get dirSeparator)
eb3_EtcPath=${scriptLocation}$(config_get dirSeparator)$(config_get eb3EtcPath)$(config_get dirSeparator)
eb3_ConfPath=${eb3_EtcPath}$(config_get eb3ConfPath)$(config_get dirSeparator)
eb3_OptPath=${eb3_EtcPath}$(config_get eb3OptPath)$(config_get dirSeparator)
eb3_UsrPath=${scriptLocation}$(config_get dirSeparator)$(config_get eb3UsrPath)$(config_get dirSeparator)
eb3_OverRidesPath=${eb3_UsrPath}$(config_get eb3OverRidePath)$(config_get dirSeparator)
eb3_VarPath=${scriptLocation}$(config_get dirSeparator)$(config_get eb3VarPath)$(config_get dirSeparator)
eb3_LogsPath=${eb3_VarPath}$(config_get eb3LogsPath)$(config_get dirSeparator)
eb3_DirJumpPath=${eb3_VarPath}$(config_get eb3DirJumpPath)$(config_get dirSeparator)
eb3_BackupPath=${eb3_VarPath}$(config_get eb3BackupPath)$(config_get dirSeparator)
eb3_LogsPath=${eb3_VarPath}$(config_get eb3LogsPath)$(config_get dirSeparator)
eb3_fontPath="${HOME}$(config_get dirSeparator).local$(config_get dirSeparator)share$(config_get dirSeparator)fonts$(config_get dirSeparator)"
eb3_ThemesPath=${eb3_UsrPath}$(config_get eb3ThemesPath)$(config_get dirSeparator)
eb3_systemFolders=("${eb3_LogsPath}" "${eb3_BinPath}" "${eb3_CachePath}" "${eb3_TempPath}" "${eb3_LibPath}" "${eb3_ModPath}" "${eb3_EtcPath}" "${eb3_ConfPath}" "${eb3_OptPath}" "${eb3_UsrPath}" "${eb3_ThemesPath}" "${eb3_VarPath}" "${eb3_OverRidesPath}" "${eb3_DirJumpPath}" "${eb3_BackupPath}" "${eb3_LogsPath}")
export eb3_systemFolders

The eb3_systemFolders is an array of all folders in the config file. Opening each folder inside the array then gathering all files that have ???_* (which represents mod_, bin_, lib_, thm_, etc). Then each file is sourced as it is found.

# Source load each file for testing with in the current environment being installed
for folder in "${eb3_systemFolders[@]}"; do
 if [[ -d ${folder} ]]; then
  for filename in "${folder}"???_*; do
   if [[ -f ${filename} ]]; then
    source "${filename}"
    if [ $? -eq 0 ]; then
     success "Loading ${filename}" >> "${eb3_LogsPath}install.log"
    else
     error "Loading ${filename}" >> "${eb3_LogsPath}install.log"
    fi
   fi
  done
 else
  mkdir -p "${folder}"
 fi
done

Creating your own module

NOTE: Read the [Line by Line](Modules#Line by Line) section to understand the file structure, to sum the basic requirement up is to start each module with mod_. This will automatically source the file upon loading the system.

NOTE: Make sure you place all commands inside a function or it will run on each load and not be called any other time.

Creating modules for eb3 has been designed to be extremely simple and have many features using builtins, and access to predefined variables.

Updating modules

When there is an update to the ebv3 system, any custom made modules, libraries, themes, and overrides will not be changes. If you would like to change the behavior of a system module, use the override system which will be explained in more details there.

Do's and Do not's

Directly modifying the ebv3 system files will be overwritten on the next update.

If you find a bug, please report it to the Issue tracker and someone will try to resolve it as quickly as possible. If you would like to over ride a function, look at the Over Ride section of this Wiki for more information on how to handle these changes. If you would like to add functionality to the system, place your custom mod_file thm_file lib_file in the appropiate directory under the bin folder, these files will not change or be removed upon upgrade.

Functions

Backup

Dir Jump

Empty

Extract

Log Viewer

System Information

User List

Weather

Clone this wiki locally