-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·63 lines (56 loc) · 1.28 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·63 lines (56 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# Consts
readonly PATH_LINK=~/bin/ezlogs;
function installRequirements {
[[ ! $(which jq) ]] && installJQ=true || installJQ=false;
[[ ! $(which awk) ]] && installAwk=true || installAwk=false;
if ($installJQ || $installAwk); then
echo "Installing requirements";
if [[ "$(uname)" == "Darwin" ]]; then
brew update;
if $installJQ; then
echo "Installing jq";
brew install jq;
fi
if $installAwk; then
echo "Installing awk";
brew install awk;
fi
fi
if [[ "$(expr substr "$(uname -s)" 1 5)" == "Linux" ]]; then
sudo apt update;
if $installJQ; then
echo "Installing jq";
sudo apt install jq -y;
fi
if $installAwk; then
echo "Installing awk";
sudo apt install awk -y;
fi
fi
fi
}
function Install {
# Install requirements
installRequirements;
# Install symlink to script
if [[ ! -h $PATH_LINK ]]; then
ln -s "`pwd`/ezlogs.sh" $PATH_LINK;
echo "ezlogs successfully installed";
else
echo "ezlogs already installed";
fi
}
function Uninstall {
if [[ -h $PATH_LINK ]]; then
rm $PATH_LINK;
echo "ezlogs uninstalled";
else
echo "ezlogs already uninstalled";
fi
}
if [[ $1 == "-r" ]]; then
Uninstall
else
Install
fi