@@ -9,6 +9,15 @@ The code below is from an installer project that can be refered to at this link:
99# and 'installer_prep.sh'. To prevent any conflicts with updates to the installer, this
1010# script has as little code as deemed necessary.
1111#
12+ # README: Because this script remains on the user's system, any changes to the code that
13+ # are pushed to github, are never applied to the version on the user's system.
14+ # To get around this, the variable $_LINUXAIO_REVISION contains a revision
15+ # number that is updated every time any changes are made to 'linuxAIO.sh'.
16+ # Another variable in 'installer_prep.sh' ($current_linuxAIO_revision) gets
17+ # updated alongside with $_LINUXAIO_REVISION. Whenever the user executes the
18+ # installer, 'installer_prep.sh' will compare the two variables. If they are not
19+ # of equal value, the newest version of 'linuxAIO.sh' is retrieved from github.
20+ #
1221# #######################################################################################
1322# ### [ Variables ]
1423
@@ -19,59 +28,84 @@ The code below is from an installer project that can be refered to at this link:
1928# ### ~~~ THESE VARIABLES CAN BE MODIFIED BY THE END-USER ~~~
2029# ###
2130# ### Whenever the installer retrieves the newest version of 'linuxAIO.sh', all modified
22- # ### variables, with the exception of $installer_repo, will be applied to the new
23- # ### version of this script.
31+ # ### variables, with the exception of $installer_repo and $_FILES_TO_BACK_UP , will be
32+ # ### applied to the new version of this script.
2433
2534
26- # The repository that the installer will use .
35+ # The repository containing all of the scripts used by the installer .
2736#
2837# The only time that this variable should be modified, is if you have created a fork of
2938# the repo and plan on making your own modifications to the installer.
3039#
3140# Format: installer_repo="[github username]/[repository name]"
3241installer_repo=" StrangeRanger/NadekoBot-BashScript"
3342
34- # The branch that the installer will use.
43+ # The branch of $installer_repo that the installer will download its scripts from.
3544#
36- # Options
37- # -------
38- # master = Production ready code (the latest stable code)
39- # dev = Non-production ready code (has the possibility of breaking something)
45+ # Options:
46+ # master = Production ready code (the latest stable code)
47+ # dev = Non-production ready code (has the possibility of breaking something)
4048#
41- # Default: master
49+ # Default: " master"
4250installer_branch=" master"
4351
44- # Determines whether or not the installer can be run as the root user.
52+ # The branch/tag, of NadekoBot's official repo, that the installer will download the bot
53+ # from.
54+ #
55+ # IMPORTANT: Using a branch/tag containing code older than the one currently on your
56+ # system, increases the likelihood of failed builds due to incompatible
57+ # changes in the code/files coppied from the current to the newly downloaded
58+ # version.
4559#
46- # Options
47- # -------
48- # true = can be run with root privilege
49- # false = cannot be run with root privilege (recommended )
60+ # Options:
61+ # v3 = Latest version (the master/main branch)
62+ # x.x.x = Any other branch/tag (refer to the NadekoBot repo for available tags and
63+ # branches )
5064#
51- # Default: false
52- allow_run_as_root=false
65+ # Default: "v3"
66+ export _NADEKO_INSTALL_VERSION= " v3 "
5367
54- # The branch or tag that the installer will download NadekoBot from .
68+ # A list of files to be backed up when executing option 7 .
5569#
56- # Options
57- # -------
58- # 1.9 = Latest version (the master/main branch)
59- # x.x.x = Any other branch/tag (refer to the NadekoBot repo for available tags and
60- # branches)
70+ # When adding a new file to the variable below, make sure to follow these rules:
71+ # 1. The path, starting at the project's parent directory, to the file must always be
72+ # included. This means that unless modified by the end-user, the beginning of the
73+ # path will start with 'nadekobot/', followed by the rest of the path to the file.
74+ # 2. Each file must be seperated by a single space or placed on its own line.
75+ # - Valid: "nadekobot/output/creds.yml
76+ # nadekobot/output/data/bot.yml"
77+ # - Valid: "nadekobot/output/creds.yml nadekobot/output/data/bot.yml"
78+ # - Invalid: "nadekobot/output/creds.yml, nadekobot/output/data/bot.yml"
79+ # - Invalid: "nadekobot/output/creds.yml,nadekobot/output/data/bot.yml"
80+ # 3. Both the file nor the path to the file can contain a space.
81+ # - Valid: 'nadekobot/output/data/NadekoBot.db'
82+ # - Invalid: 'nadeko bot/output/data/NadekoBot.db'
6183#
62- # Default: 1.9
63- export _NADEKO_INSTALL_VERSION=" 1.9"
84+ # Default: "nadekobot/output/creds.yml
85+ # nadekobot/output/data/gambling.yml
86+ # nadekobot/output/data/xp.yml
87+ # nadekobot/output/data/images.json
88+ # nadekobot/output/data/xp_template.json
89+ # nadekobot/output/data/bot.yml
90+ # nadekobot/output/data/NadekoBot.db"
91+ export _FILES_TO_BACK_UP=" nadekobot/output/creds.yml
92+ nadekobot/output/data/gambling.yml
93+ nadekobot/output/data/xp.yml
94+ nadekobot/output/data/images.json
95+ nadekobot/output/data/xp_template.json
96+ nadekobot/output/data/bot.yml
97+ nadekobot/output/data/NadekoBot.db"
6498
6599
66100# ### End of [[ Configuration Variables ]]
67101# #######################################################################################
68102# ### [[ General Variables ]]
69103
70104
71- # Used to keep track of changes to 'linuxAIO.sh' .
72- # Refer to the '[ Prepping ]' section of 'installer_prep.sh' for more information.
73- export _LINUXAIO_REVISION=" 17 "
74- # URL to the raw version of a specified script .
105+ # Revision number of this script .
106+ # Refer to the 'README' note at the beginning of this file for more information.
107+ export _LINUXAIO_REVISION=" 30 "
108+ # The URL to the raw code of a script that is specified by the other scripts .
75109export _RAW_URL=" https://raw.githubusercontent.com/$installer_repo /$installer_branch "
76110
77111
@@ -83,19 +117,13 @@ export _RAW_URL="https://raw.githubusercontent.com/$installer_repo/$installer_br
83117# ### [ Main ]
84118
85119
86- # If executed with root privilege and $allow_run_as_root is false...
87- if [[ $EUID = 0 && $allow_run_as_root = false ]]; then
88- echo " \033[1;31mPlease run this script without root privilege" >&2
89- echo " \033[0;36mWhile you will be performing specific tasks with root privilege," \
90- " running the installer in it's entirety as root is not recommended\033[0m"
91- echo -e " \nExiting..."
92- exit 1
93- fi
94-
95120echo " Downloading the latest installer..."
96121curl -O " $_RAW_URL " /installer_prep.sh
97- sudo chmod +x installer_prep.sh
98- ./installer_prep.sh
122+ # NOTE: The meaning of the exit codes passed by 'installer_prep.sh' can be found here:
123+ # TODO: Add a link to the error code meaning at the wiki
124+ sudo chmod +x installer_prep.sh \
125+ && ./installer_prep.sh \
126+ || exit " $? " # Uses the exit code passed by 'installer_prep.sh'.
99127
100128
101129# ### End of [ Main ]
0 commit comments