Autoinstall.sh
General
As explained on the previous page, a file called autoinstall.sh is used to instruct Sync 3 which commands need to be executed. The language used in this file is bash/shell. You can find a lot about in on the internet but below are some useful subjects:
- The first line of the autoinstall.sh of a Mod or App always starts with a so called "she-bang": #!/bin/sh It is used to tell the interpreter which scripting language is offered. In this case it is bash/shell. Useful sources for bash/shell online are: https://linuxconfig.org/bash-scripting-tutorial and https://www.freecodecamp.org/news/shell-scripting-crash-course-how-to-write-bash-scripts-in-linux/
- As you can see the first character is a #. That character can be used to add information to a script without being executed (but it can be interpreted, like offering the she-bang script language).
- For most Mods an Apps a section is used at the top of the script that is commented out (starting with #) to show some nice fmods information.
- After that it is common to declare some general Mod information and environment variables that are used in the script. Example Mod Information:
# Mod Name : QuickDial Top-10 Contacts Mod ( QUICKDIAL_CONTACTS ).# Author : Pascal Kolkman.# Creation date : 2024-07-14.# Version : 1.0.# Update date : 2024-07-14.# Update notes : First version.Example Environment variables:######################################################################################################################### DO NOT EDIT THIS BLOCK. ## Environment variables. MODNAME. ########################################################################################################################## Feel free to delete unnecessary Env. varsFILES_DIR="/fs/usb0/SyncMyMod/files"# BIN_DIR="${FILES_DIR}/bin"PATCH_DIR="${FILES_DIR}/patch"SHELL_DIR="${FILES_DIR}/shell"OTHER_DIR="${FILES_DIR}/other"BACKUP_DIR="${OTHER_DIR}/backup"NEW_DIR="${OTHER_DIR}/new" - The MODNAME variable is used to add information about the Mod to Sync3.
- After the environment section, there is a section with functions that are called. They are used to display stuff, like text and images
- Below that a section is offered in whcih is checked if FMOdsTools is insatlled (or before: Modstools). It should containg code like:
if ! grep -q "${MODTOOLS}" /fs/rwdata/dev/mods_tools.txt; thendisplayMessage "FMods Tools not found. Installation aborted."elseLINE=$(grep "$MODTOOLS" /fs/rwdata/dev/mods_tools.txt)MODS_TOOLS_VERSION=$(echo "$LINE" | awk -F'_' '{print $NF}')if ! awk 'BEGIN {exit !('"$MODS_TOOLS_VERSION"' >= '"$MIN_MODTOOLS_VERSION"') }'; thendisplayMessage "FMods Tools ${MIN_MODTOOLS_VERSION} or higher not found. Installation aborted."fifi