This repository has been archived by the owner on Feb 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
unix.sh
executable file
·115 lines (89 loc) · 2.53 KB
/
unix.sh
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/bash
installPath=$1
gomoPath=""
if [ "$installPath" != "" ]; then
gomoPath=$installPath
else
gomoPath=/usr/local/bin
fi
UNAME=$(uname)
ARCH=$(uname -m)
rmOldFiles() {
if [ -f $gomoPath/gomo ]; then
sudo rm -rf $gomoPath/gomo*
fi
}
v=$(curl --silent "https://get-latest.secman.dev/abdfnx/gomo")
releases_api_url=https://github.com/abdfnx/gomo/releases/download
successInstall() {
echo "🙏 Thanks for installing Gomo! If this is your first time using the CLI, be sure to run `gomo help` first."
}
mainCheck() {
echo "Installing gomo version $v"
name=""
if [ "$UNAME" == "Linux" ]; then
if [ $ARCH = "x86_64" ]; then
name="gomo_linux_${v}_amd64"
elif [ $ARCH = "i686" ]; then
name="gomo_linux_${v}_386"
elif [ $ARCH = "i386" ]; then
name="gomo_linux_${v}_386"
elif [ $ARCH = "arm64" ]; then
name="gomo_linux_${v}_arm64"
elif [ $ARCH = "arm" ]; then
name="gomo_linux_${v}_arm"
fi
gomoURL=$releases_api_url/$v/$name.zip
wget $gomoURL
sudo chmod 755 $name.zip
unzip $name.zip
rm $name.zip
# gomo
sudo mv $name/bin/gomo $gomoPath
rm -rf $name
elif [ "$UNAME" == "Darwin" ]; then
if [ $ARCH = "x86_64" ]; then
name="gomo_macos_${v}_amd64"
elif [ $ARCH = "arm64" ]; then
name="gomo_macos_${v}_arm64"
fi
gomoURL=$releases_api_url/$v/$name.zip
wget $gomoURL
sudo chmod 755 $name.zip
unzip $name.zip
rm $name.zip
# gomo
sudo mv $name/bin/gomo $gomoPath
rm -rf $name
elif [ "$UNAME" == "FreeBSD" ]; then
if [ $ARCH = "x86_64" ]; then
name="gomo_freebsd_${v}_amd64"
elif [ $ARCH = "i386" ]; then
name="gomo_freebsd_${v}_386"
elif [ $ARCH = "i686" ]; then
name="gomo_freebsd_${v}_386"
elif [ $ARCH = "arm64" ]; then
name="gomo_freebsd_${v}_arm64"
elif [ $ARCH = "arm" ]; then
name="gomo_freebsd_${v}_arm"
fi
gomoURL=$releases_api_url/$v/$name.zip
wget $gomoURL
sudo chmod 755 $name.zip
unzip $name.zip
rm $name.zip
# gomo
sudo mv $name/bin/gomo $gomoPath
rm -rf $name
fi
# chmod
sudo chmod 755 $gomoPath/gomo
}
rmOldFiles
mainCheck
if [ -x "$(command -v gomo)" ]; then
successInstall
else
echo "Download failed 😔"
echo "Please try again."
fi