-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·45 lines (41 loc) · 1.05 KB
/
install.sh
File metadata and controls
executable file
·45 lines (41 loc) · 1.05 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
#!/usr/bin/env bash
current_pwd=$(pwd ".")
function registerGgit() {
OS=$1
lowerOS=$(echo "${OS}" | tr '[:upper:]' '[:lower:]')
ggit_path="${current_pwd}/main"
CGO_ENABLED=0 GOOS=${lowerOS} GOARCH=amd64 go build main.go && ln -sf "${ggit_path}" /usr/local/bin/ggit
if [[ ! -f "${ggit_path}" ]]; then
echo "${ggit_path} does not exist."
exit 1
fi
if [[ ! -f "/usr/local/bin/ggit" ]]; then
echo "/usr/local/bin/ggit does not exist."
exit 1
fi
echo "Build®ister $()ggit$() successfully, done! You can use $()ggit$() command."
}
function getOS() {
os=$(uname -s)
if [[ ${os} -eq "Darwin" ]]
then
echo "I'm a macos system."
registerGgit ${os}
elif [[ ${os} -eq "Linux" ]]
then
echo "I'm a linux system."
registerGgit ${os}
fi
}
function copyConfigFile() {
homeDir=${HOME}
configPath=${current_pwd}/configs/config.yaml
mkdir "${homeDir}"/.ggit
cp "${configPath}" "${homeDir}"/.ggit/config.yaml
echo "copy done!"
}
# Release
eval "bash ./release_build.sh"
copyConfigFile
# registerGgit
getOS