-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·40 lines (30 loc) · 924 Bytes
/
install
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
#!/bin/zsh
source $WS_CFG_PATH/ws-shared
main () {
local source_file="${WS_MY_PLUGIN_ROOT}/src/main.sh"
local bin_file="${WS_CFG_PATH}/bin/goggy"
_ws_log verbose "Checking if file already exits ..."
if [ -e "${WS_CFG_PATH}/bin/goggy" ]; then
_ws_log error "File at '${WS_CFG_PATH}/bin/goggy' already exists."
_ws_log warning "Please remove, and try installing again."
return 127
fi
_ws_log verbose "Linking script ..."
local linkedbin="$(realpath -s ${bin_file})"
ln -s $(realpath -s ${source_file}) "${linkedbin}"
if [ -e "${linkedbin}" ]; then
chmod +x "${bin_file}"
_ws_log verbose "Script read at '$(ls -lav ${linkedbin})' ..."
_ws_log info "Installing goggy ..."
if ! "${linkedbin}" setup; then
_ws_log error "Install could not finish properly."
return 127
fi
return 0
else
_ws_log error "No linked binary found!"
fi
_ws_log error "Install failed."
return 127
}
main $*