Skip to content

Commit ce8f3d9

Browse files
committed
Fix README, add HELP function
1 parent b3e7ba4 commit ce8f3d9

File tree

4 files changed

+111
-25
lines changed

4 files changed

+111
-25
lines changed

README.md

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,39 @@
11
# vm-setup.sh
22
My handy bash script to quickly set up debian linux VM's how I like em :)
33

4+
### Install
5+
Run the following:
6+
```bash
7+
git clone https://github.com/intrudir/vm-setup.sh.git
8+
cd vm-setup.sh
9+
chmod +x vm-setup.sh
10+
```
11+
412
## Usage
5-
Havent tested on Mac yet btw :)
13+
Haven't tested on Mac yet :)
614

7-
No need to `git clone`. From your linux machine simply...
15+
For every script, depending on if you want the full VM install or just minimal CTF things, run with `-t full` or `-t ctf` like so:
816

9-
Run the following and follow the prompts.
17+
### Everything in one shot
1018
```bash
11-
wget https://raw.githubusercontent.com/intrudir/vm-setup.sh/main/1.vm-setup.sh
12-
13-
chmod +x 1.vm-setup.sh
14-
15-
./1.vm-setup.sh
19+
./vm-setup.sh -t ctf
1620
```
1721

18-
<br>
19-
20-
Install my favorite tools:
21-
22+
### Install just the configs
2223
```bash
23-
wget https://raw.githubusercontent.com/intrudir/vm-setup.sh/main/2.install-tools.sh
24+
chmod +x install-configs.sh
25+
./install-configs.sh -t ctf
26+
```
2427

25-
chmod +x 2.install-tools.sh
28+
### Install just the tools
29+
Requires golang to be installed already
30+
```bash
31+
chmod +x install-tools.sh
32+
./install-tools.sh -t ctf
33+
```
2634

27-
./2.install-tools.sh
35+
### Just install latest Golang for your architecture
36+
```bash
37+
chmod +x install-golang.sh
38+
./install-golang.sh
2839
```

install-configs.sh

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
11
#!/bin/bash
2+
3+
# Set Script Name variable
4+
SCRIPT=`basename ${BASH_SOURCE[0]}`
5+
6+
# Set fonts for Help.
7+
NORM=`tput sgr0`
8+
BOLD=`tput bold`
9+
REV=`tput smso`
10+
11+
# Help function
12+
function HELP {
13+
echo -e \\n"Help documentation for ${BOLD}${SCRIPT}.${NORM}"\\n
14+
echo -e "${REV}Basic usage:${NORM} ${BOLD}$SCRIPT -t [full, ctf]${NORM}"\\n
15+
echo "${REV}-t${NORM} --Choose between 'full' or 'ctf' VM installs."
16+
echo -e "${REV}-h${NORM} --Displays this help message and exits."\\n
17+
echo -e "Example: ${BOLD}$SCRIPT -t ctf"\\n
18+
exit 1
19+
}
20+
221
function check_if_success () {
322
if [ $? -eq 0 ]; then
423
echo "OK"
@@ -8,6 +27,12 @@ function check_if_success () {
827
fi
928
}
1029

30+
# Check the number of arguments. If none are passed, print help and exit.
31+
NUMARGS=$#
32+
if [ $NUMARGS -eq 0 ]; then
33+
HELP
34+
fi
35+
1136
while getopts 'h:t:' flag; do
1237
case "$flag" in
1338
h) echo "usage";;
@@ -30,27 +55,27 @@ fi
3055
echo "VM type: $type";
3156

3257
if [[ $type == 'full' ]]; then
33-
echo "\nFull vim config"
58+
echo -e \\n"Installing full vim config"
3459
# vim_rc=$(curl https://raw.githubusercontent.com/intrudir/vm-setup.sh/main/dotfiles/full-vimrc)
3560
vim_rc=$(cat ./dotfiles/full-vimrc)
3661
echo "$vim_rc" > ~/.vimrc
3762

38-
echo "\nFull shell aliases"
63+
echo -e \\n"Installing full shell aliases"
3964
# zsh_rc=$(curl https://raw.githubusercontent.com/intrudir/vm-setup.sh/main/dotfiles/full-aliases)
4065
zsh_rc=$(cat ./dotfiles/full-aliases)
4166
echo "$zsh_rc" >> ~/.zshrc
4267
echo "$zsh_rc" >> ~/.bash_aliases
4368

44-
echo "\nFull tmux.conf"
69+
echo -e \\n"Installing full tmux.conf"
4570
# tmux_conf=$(curl https://raw.githubusercontent.com/intrudir/vm-setup.sh/main/dotfiles/full-tmux.conf)
4671
tmux_conf=$(cat ./dotfiles/full-tmux.conf)
4772
echo "$tmux_conf" > ~/.tmux.conf
4873

49-
echo "\nInstall VIM plug"
74+
echo -e \\n"Installing VIM plug"
5075
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
5176
check_if_success
5277

53-
echo "\nInstall tmux themes"
78+
echo -e \\n"Installing tmux themes"
5479
sudo mkdir /opt/tmux && cd /opt/tmux
5580
check_if_success
5681
sudo git clone https://github.com/wfxr/tmux-power.git
@@ -59,18 +84,18 @@ fi
5984

6085

6186
if [[ $type == 'ctf' ]]; then
62-
echo "\nCTF vim config"
87+
echo -e \\n"Installing CTF vim config"
6388
# vim_rc=$(curl https://raw.githubusercontent.com/intrudir/vm-setup.sh/main/dotfiles/ctf-vimrc)
6489
vim_rc=$(cat ./dotfiles/ctf-vimrc)
6590
echo "$vim_rc" > ~/.vimrc
6691

67-
echo "\nCTF shell aliases"
92+
echo -e \\n"Installing CTF shell aliases"
6893
# zsh_rc=$(curl https://raw.githubusercontent.com/intrudir/vm-setup.sh/main/dotfiles/ctf-aliases)
6994
zsh_rc=$(cat ./dotfiles/ctf-aliases)
7095
echo "$zsh_rc" >> ~/.zshrc
7196
echo "$zsh_rc" >> ~/.bash_aliases
7297

73-
echo "\nCTF tmux.conf"
98+
echo -e \\n"Installing CTF tmux.conf"
7499
# tmux_conf=$(curl https://raw.githubusercontent.com/intrudir/vm-setup.sh/main/dotfiles/ctf-tmux.conf)
75100
tmux_conf=$(cat ./dotfiles/ctf-tmux.conf)
76101
echo "$tmux_conf" > ~/.tmux.conf

install-tools.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
11
#!/bin/bash
2+
3+
# Set Script Name variable
4+
SCRIPT=`basename ${BASH_SOURCE[0]}`
5+
6+
# Set fonts for Help.
7+
NORM=`tput sgr0`
8+
BOLD=`tput bold`
9+
REV=`tput smso`
10+
11+
# Help function
12+
function HELP {
13+
echo -e \\n"Help documentation for ${BOLD}${SCRIPT}.${NORM}"\\n
14+
echo -e "${REV}Basic usage:${NORM} ${BOLD}$SCRIPT -t [full, ctf]${NORM}"\\n
15+
echo "${REV}-t${NORM} --Choose between 'full' or 'ctf' VM installs."
16+
echo -e "${REV}-h${NORM} --Displays this help message and exits."\\n
17+
echo -e "Example: ${BOLD}$SCRIPT -t ctf"\\n
18+
exit 1
19+
}
20+
221
function check_if_success () {
322
if [ $? -eq 0 ]; then
423
echo "OK"
@@ -8,6 +27,12 @@ function check_if_success () {
827
fi
928
}
1029

30+
# Check the number of arguments. If none are passed, print help and exit.
31+
NUMARGS=$#
32+
if [ $NUMARGS -eq 0 ]; then
33+
HELP
34+
fi
35+
1136
while getopts 'h:t:' flag; do
1237
case "$flag" in
1338
h) echo "usage";;

vm-setup.sh

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
#!/bin/bash
22

3+
# Set Script Name variable
4+
SCRIPT=`basename ${BASH_SOURCE[0]}`
5+
6+
# Set fonts for Help.
7+
NORM=`tput sgr0`
8+
BOLD=`tput bold`
9+
REV=`tput smso`
10+
11+
# Help function
12+
function HELP {
13+
echo -e \\n"Help documentation for ${BOLD}${SCRIPT}.${NORM}"\\n
14+
echo -e "${REV}Basic usage:${NORM} ${BOLD}$SCRIPT -t [full, ctf]${NORM}"\\n
15+
echo "${REV}-t${NORM} --Choose between 'full' or 'ctf' VM installs."
16+
echo -e "${REV}-h${NORM} --Displays this help message and exits."\\n
17+
echo -e "Example: ${BOLD}$SCRIPT -t ctf"\\n
18+
exit 1
19+
}
20+
321
function check_if_success () {
422
if [ $? -eq 0 ]; then
523
echo "OK"
@@ -9,6 +27,12 @@ function check_if_success () {
927
fi
1028
}
1129

30+
# Check the number of arguments. If none are passed, print help and exit.
31+
NUMARGS=$#
32+
if [ $NUMARGS -eq 0 ]; then
33+
HELP
34+
fi
35+
1236
while getopts 'h:t:' flag; do
1337
case "$flag" in
1438
h) echo "usage";;
@@ -18,13 +42,14 @@ while getopts 'h:t:' flag; do
1842
done
1943

2044
if [ -v "$type" ]; then
45+
HELP
2146
echo "The -t flag is required. Needs to be one of the following: ['full', 'ctf']"
2247
exit 1
2348
fi
2449

25-
2650
if [[ ! $type == 'full' ]] && [[ ! $type == 'ctf' ]]; then
27-
echo "the -t flag needs to be either 'full' or 'ctf'."
51+
HELP
52+
echo "The -t flag needs to be either 'full' or 'ctf'."
2853
exit 1
2954
fi
3055

0 commit comments

Comments
 (0)