Skip to content

Commit a2beeeb

Browse files
author
StrangeRanger
committed
Change a few things
1 parent 84f32ed commit a2beeeb

File tree

3 files changed

+53
-169
lines changed

3 files changed

+53
-169
lines changed

Examples/example-1.md

Lines changed: 50 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -4,81 +4,69 @@ The code below is from an installer project that can be refered to at this link:
44

55
```bash
66
#!/bin/bash
7-
8-
################################################################################
97
#
108
# linuxAIO acts as the intermediary between the system NadekoBot is being hosted
119
# on and the 'installer_prep.sh'. To prevent any conflicts with updates to
1210
# the installer, this script has as little code as deemed necessary.
1311
#
1412
################################################################################
15-
#
16-
# [ Development Variables ]
17-
#
18-
# The variables below are for dev/testing purpouses (DO NOT MODIFY).
19-
#
20-
###
21-
export linuxAIO_revision="5" # Keeps track of changes to linuxAIO.sh
22-
export installer_repo="StrangeRanger/NadekoBot-BashScript" # Determines which repo is used
23-
###
24-
#
25-
# End of [ Development Variables ]
26-
################################################################################
13+
#### [ Development Variables ]
14+
#### The variables below are for dev/testing purpouses (!!! DO NOT MODIFY !!!).
15+
16+
17+
export linuxAIO_revision="8" # Keeps track of changes to linuxAIO.sh
18+
export installer_repo="StrangeRanger/NadekoBot-BashScript" # Determines which repo is used
2719

2820

21+
#### End of [ Development Variables ]
2922
################################################################################
23+
#### [ Configuration Variables ]
24+
#### The variables below are used to modify some of the actions of the installer
25+
#### and CAN BE modified by the end user.
26+
27+
28+
# Determines from which branch the installer will use.
29+
# release/latest = The latest release
30+
# master = The latest stable code
31+
# dev = Non-production ready code (may break your system)
3032
#
31-
# [ Configuration Varaibles ]
32-
#
33-
# The variables below are used to configure the installer in one way or another,
34-
# and CAN BE modified by the end user.
35-
#
36-
###
37-
# Determines from which branch from the installer repo will be used
38-
# release/latest = The most recent release
39-
# master = The latest stable code
40-
# dev = Non-production ready code (may break your system)
41-
#
42-
# Default: release/latest
43-
export installer_branch="release/latest"
44-
45-
# Determines whether or not the installer can be run as the root user:
46-
# true = can be run with root privilege
47-
# false = cannot be run with root privilege (recommended)
48-
#
49-
# Default: false
50-
allow_run_as_root=false
51-
###
33+
# Default: master
34+
export installer_branch="master"
35+
36+
# Determines whether or not the installer can be run as the root user:
37+
# true = can be run with root privilege
38+
# false = cannot be run with root privilege (recommended)
5239
#
53-
# End of [ Configuration Varaibles ]
54-
################################################################################
40+
# Default: false
41+
allow_run_as_root=false
5542

5643

44+
#### End of [ Configuration Variables ]
5745
################################################################################
58-
#
59-
# [ Main ]
60-
#
61-
###
62-
# Checks if the script was executed with root privilege
63-
if ((EUID == 0)) && [[ $allow_run_as_root = false ]]; then
64-
echo "\033[1;31mPlease run this script without root privilege" >&2
65-
echo "\033[0;36mWhile you will be performing specific tasks with root" \
66-
"priviledge running the installer in it's entirety as root is not" \
67-
"recommended\033[0m"
68-
echo -e "\nExiting..."
69-
exit 1
70-
fi
71-
72-
echo "Downloading the latest installer..."
73-
curl https://raw.githubusercontent.com/"$installer_repo"/"$installer_branch"/installer_prep.sh \
74-
-o installer_prep.sh || {
75-
echo "Failed to download 'installer_prep.sh'..." >&2
76-
echo -e "\nExiting..."
77-
exit 1
78-
}
79-
sudo chmod +x installer_prep.sh && ./installer_prep.sh
80-
###
81-
#
82-
# End of [ Main ]
46+
#### [ Main ]
47+
48+
49+
# Checks if the script was executed with root privilege
50+
if ((EUID == 0)) && [[ $allow_run_as_root = false ]]; then
51+
echo "\033[1;31mPlease run this script without root privilege" >&2
52+
echo "\033[0;36mWhile you will be performing specific tasks with root" \
53+
"priviledge, running the installer in it's entirety as root is not" \
54+
"recommended\033[0m"
55+
echo -e "\nExiting..."
56+
exit 1
57+
fi
58+
59+
echo "Downloading the latest installer..."
60+
curl https://raw.githubusercontent.com/"$installer_repo"/"$installer_branch"/installer_prep.sh \
61+
-o installer_prep.sh || {
62+
echo "Failed to download 'installer_prep.sh'..." >&2
63+
echo -e "\nExiting..."
64+
exit 1
65+
}
66+
sudo chmod +x installer_prep.sh && ./installer_prep.sh
67+
68+
69+
#### End of [ Main ]
8370
################################################################################
71+
8472
```

Examples/example-2.md

Lines changed: 0 additions & 37 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ fi
8787

8888
### Spacing
8989

90-
No more than two consecutive newline characters, meaning no more than one blank line. The only time two blank lines are acceptable is in between the section comments described in the `Commenting/File Formatting` section below.
90+
No more than three consecutive newline characters, meaning no more than two blank lines.
9191

9292
### Comments
9393

@@ -100,76 +100,9 @@ box="Box" # This is a box (Aligned with the comment above for be
100100

101101
### Commenting/File Formatting
102102

103-
Though not required, it is preferred to follow the comment/file formatting described below.
103+
There is no required way to format your comments and files. That said, stay consistent with the chosen style.
104104

105-
If your file is fairly big and has many parts (variables, error trapping, functions, main code, etc.), then the comments and overall formatting should look similar to below:
106-
107-
``` bash
108-
#!/bin/bash
109-
110-
################################################################################
111-
#
112-
# File description
113-
#
114-
################################################################################
115-
#
116-
# [ Variables ]
117-
#
118-
###
119-
var=var
120-
###
121-
#
122-
# End of [ Variables ]
123-
################################################################################
124-
125-
126-
################################################################################
127-
#
128-
# [ Functions ]
129-
#
130-
###
131-
func() {
132-
...
133-
}
134-
###
135-
#
136-
# End of [ Functions ]
137-
################################################################################
138-
139-
140-
################################################################################
141-
#
142-
# [ Main ]
143-
#
144-
###
145-
...
146-
...
147-
...
148-
###
149-
#
150-
# End of [ Main ]
151-
################################################################################
152-
```
153-
154-
Though if your file is fairly small and doesn't have many parts (variables, functions, etc.), then the comments and overall formatting should look similar to below:
155-
156-
``` bash
157-
#!/bin/bash
158-
159-
################################################################################
160-
#
161-
# File description
162-
#
163-
################################################################################
164-
#
165-
var=var
166-
...
167-
...
168-
```
169-
170-
If you don't know which formatting to use based on your situation, use your best judgment.
171-
172-
Refer to these files for examples: [example 1](Examples/example-1.md) and [example 2](Examples/example-2.md).
105+
An example of my own style can be found in [example 1](Examples/example-1.md).
173106

174107
## Bashisms
175108

0 commit comments

Comments
 (0)