Skip to content

Commit 7946e22

Browse files
author
Hunter T
authored
Update example-2.md
1 parent 4962cf2 commit 7946e22

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

Examples/example-2.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
The code below is from an installer project that can be refered to at this link: https://github.com/StrangeRanger/NadekoBot-BashScript/blob/master/installer_prep.sh
1+
The code below is from an installer project that can be refered to at this link: https://github.com/StrangeRanger/NadekoBot-BashScript/blob/master/installer_prep.sh. As a note, this code is what's executed by the code in the example-1.md file.
22

33
## Example
44

55
```bash
66
#!/bin/bash
77
#
8-
# This script looks at the operating system, architecture, bit type, etc., to
9-
# determine whether or not the system is supported by NadekoBot. Once the system
10-
# is deemed as supported, the master installer will be downloaded and executed.
8+
# This script looks at the operating system, architecture, bit type, etc., to determine
9+
# whether or not the system is supported by NadekoBot. Once the system is deemed as
10+
# supported, the master installer will be downloaded and executed.
1111
#
1212
########################################################################################
1313
#### [ Exported and/or Globally Used Variables ]
@@ -17,7 +17,7 @@ The code below is from an installer project that can be refered to at this link:
1717
# Refer to the '[ Prepping ]' section of this script for more information.
1818
current_linuxAIO_revision="10"
1919

20-
# Keeps track of this script's process id, incase it needs to be manually killed.
20+
# Keeps track of this script's process id, in case it needs to be manually killed.
2121
export _INSTALLER_PREP_PID=$$
2222

2323
# The '--no-hostname' flag for journalctl only works with systemd 230 and later.
@@ -87,9 +87,10 @@ if [[ $_LINUXAIO_REVISION != "$current_linuxAIO_revision" ]]; then
8787
# retrieved from github.
8888
####
8989

90-
# Save the value of 'installer_branch' specified in 'linuxAIO.sh', to be set in the
91-
# new 'linuxAIO.sh'.
92-
installer_branch=$(grep '^installer_branch=".*"' linuxAIO.sh);
90+
## Save the value of $installer_branch and $allow_run_as_root specified in
91+
## 'linuxAIO.sh', to be set in the new 'linuxAIO.sh'.
92+
installer_branch=$(grep '^installer_branch=".*"' linuxAIO.sh)
93+
allow_run_as_root=$(grep '^allow_run_as_root=.*' linuxAIO.sh)
9394

9495
echo "$_YELLOW'linuxAIO.sh' is not up to date$_NC"
9596
echo "Downloading latest 'linuxAIO.sh'..."
@@ -99,8 +100,13 @@ if [[ $_LINUXAIO_REVISION != "$current_linuxAIO_revision" ]]; then
99100
}
100101

101102
echo "Applying set configurations to 'linuxAIO.sh'..."
102-
sed -i "s/installer_branch=\".*\"/$installer_branch/" linuxAIO.sh || # Sed for linux
103-
sed -i '' "s/installer_branch=\".*\"/$installer_branch/" linuxAIO.sh # Sed for macOS
103+
# Sets $installer_branch variable.
104+
sed -i "s/^installer_branch=\".*\"/$installer_branch/" linuxAIO.sh || # Sed for linux
105+
sed -i '' "s/^installer_branch=\".*\"/$installer_branch/" linuxAIO.sh # Sed for macOS
106+
# Sets $allow_run_as_root variable.
107+
sed -i "s/^allow_run_as_root=.*/$allow_run_as_root/" linuxAIO.sh || # Sed for linux
108+
sed -i '' "s/^allow_run_as_root=.*/$allow_run_as_root/" linuxAIO.sh # Sed for macOS
109+
104110
sudo chmod +x linuxAIO.sh # Set execution permission
105111
echo "${_CYAN}Re-execute 'linuxAIO.sh' to continue$_NC"
106112
# TODO: Figure out a way to get exec to work, instead of exiting script
@@ -134,7 +140,6 @@ detect_sys_info() {
134140
## For Linux
135141
if [[ -f /etc/os-release ]]; then
136142
. /etc/os-release
137-
138143
pname="$PRETTY_NAME"
139144
_DISTRO="$ID"
140145
_VER="$VERSION_ID" # Version: x.x.x...
@@ -143,7 +148,6 @@ detect_sys_info() {
143148
## For macOS
144149
else
145150
_DISTRO=$(uname -s)
146-
147151
if [[ $_DISTRO = "Darwin" ]]; then
148152
_VER=$(sw_vers -productVersion) # macOS version: x.x.x
149153
_SVER=${_VER%.*} # macOS version: x.x

0 commit comments

Comments
 (0)