Autoinstall.sh: Difference between revisions
No edit summary |
No edit summary |
||
Line 6: | Line 6: | ||
* 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). | * 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. | * 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: <code># Mod Name : QuickDial Top-10 Contacts Mod ( QUICKDIAL_CONTACTS ).</code><code># Author : Pascal Kolkman.</code><code># Creation date : 2024-07-14.</code><code># Version : 1.0.</code><code># Update date : 2024-07-14.</code><code># Update notes : First version.</code>Example Environment variables: <code>########################################################################################################################</code><code># DO NOT EDIT THIS BLOCK. #</code> <code># Environment variables. MODNAME. #</code> <code>########################################################################################################################</code> <code># Feel free to delete unnecessary Env. vars</code> <code>FILES_DIR="/fs/usb0/SyncMyMod/files"</code> <code># BIN_DIR="${FILES_DIR}/bin"</code> <code>PATCH_DIR="${FILES_DIR}/patch"</code> <code>SHELL_DIR="${FILES_DIR}/shell"</code> <code>OTHER_DIR="${FILES_DIR}/other"</code> <code>BACKUP_DIR="${OTHER_DIR}/backup"</code> <code>NEW_DIR="${OTHER_DIR}/new"</code> | * After that it is common to declare some general Mod information and environment variables that are used in the script. Example Mod Information: <code># Mod Name : QuickDial Top-10 Contacts Mod ( QUICKDIAL_CONTACTS ).</code><code># Author : Pascal Kolkman.</code><code># Creation date : 2024-07-14.</code><code># Version : 1.0.</code><code># Update date : 2024-07-14.</code><code># Update notes : First version.</code>Example Environment variables: <code>########################################################################################################################</code><code># DO NOT EDIT THIS BLOCK. #</code> <code># Environment variables. MODNAME. #</code> <code>########################################################################################################################</code> <code># Feel free to delete unnecessary Env. vars</code> <code>FILES_DIR="/fs/usb0/SyncMyMod/files"</code> <code># BIN_DIR="${FILES_DIR}/bin"</code> <code>PATCH_DIR="${FILES_DIR}/patch"</code> <code>SHELL_DIR="${FILES_DIR}/shell"</code> <code>OTHER_DIR="${FILES_DIR}/other"</code> <code>BACKUP_DIR="${OTHER_DIR}/backup"</code> <code>NEW_DIR="${OTHER_DIR}/new"</code> | ||
* The MODNAME variable is used to add information about the Mod to Sync3. | * 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 | * 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: <br /><code>if ! grep -q "${MODTOOLS}" /fs/rwdata/dev/mods_tools.txt; then</code> <code> displayMessage "FMods Tools not found. Installation aborted."</code> <code> else</code> <code> </code> <code> LINE=$(grep "$MODTOOLS" /fs/rwdata/dev/mods_tools.txt)</code> <code> MODS_TOOLS_VERSION=$(echo "$LINE" | awk -F'_' '{print $NF}')</code> <code> </code> <code> if ! awk 'BEGIN {exit !('"$MODS_TOOLS_VERSION"' >= '"$MIN_MODTOOLS_VERSION"') }'; then</code> <code> displayMessage "FMods Tools ${MIN_MODTOOLS_VERSION} or higher not found. Installation aborted."</code> <code> fi</code> <code>fi</code> | * Below that a section is offered in whcih is checked if FMOdsTools is insatlled (or before: Modstools). It should containg code like: <br /><code>if ! grep -q "${MODTOOLS}" /fs/rwdata/dev/mods_tools.txt; then</code> <code> displayMessage "FMods Tools not found. Installation aborted."</code> <code> else</code> <code> </code> <code> LINE=$(grep "$MODTOOLS" /fs/rwdata/dev/mods_tools.txt)</code> <code> MODS_TOOLS_VERSION=$(echo "$LINE" | awk -F'_' '{print $NF}')</code> <code> </code> <code> if ! awk 'BEGIN {exit !('"$MODS_TOOLS_VERSION"' >= '"$MIN_MODTOOLS_VERSION"') }'; then</code> <code> displayMessage "FMods Tools ${MIN_MODTOOLS_VERSION} or higher not found. Installation aborted."</code> <code> fi</code> <code>fi</code> | ||
* <br /> | * <br /> |
Revision as of 14:28, 16 July 2024
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. vars
FILES_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; then
displayMessage "FMods Tools not found. Installation aborted."
else
LINE=$(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"') }'; then
displayMessage "FMods Tools ${MIN_MODTOOLS_VERSION} or higher not found. Installation aborted."
fi
fi