-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·47 lines (34 loc) · 1.09 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·47 lines (34 loc) · 1.09 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
#!/usr/bin/env bash
#{{{ Bash settings
set -o errexit # abort on nonzero exit status
set -o nounset # abort on unbound variable
set -o pipefail # don't hide errors within pipes
set -o errtrace # ERR trap is inherited by shell functions
# set -o xtrace # show commands as they are executed
#}}}
main() {
trap exit_stage_left EXIT ERR # Elegant exit
install
}
exit_stage_left() {
unset CURRENT_USER_BIN user_id user_name script_mode
printf "\n%s\n" "Bye!"
}
install() {
local CURRENT_USER_BIN
local user_id
local user_name
local script_mode
local xidel_url
CURRENT_USER_BIN="${HOME}/.local/bin"
user_id="$(id --user)"
user_name="$(id --user --name)"
script_mode="740"
xidel_url="https://gitlab.com/msmafra/proton-get/-/raw/master/xidel"
if [[ "${user_id}" -ne 0 ]];then
curl --silent --show-error --location "${xidel_url}" --output "${CURRENT_USER_BIN}"/proton-get
install --verbose -D -C --mode="${script_mode}" --owner="${user_name}" --group="${user_name}" "${CURRENT_USER_BIN}"/proton-get --target-directory="${CURRENT_USER_BIN}"
exit 0
fi
}
main "${@}"