-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstaller
More file actions
executable file
·101 lines (82 loc) · 2.46 KB
/
Copy pathinstaller
File metadata and controls
executable file
·101 lines (82 loc) · 2.46 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
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
#!/bin/bash
#
# curl -sSL https://hedzr.com/bash-framework/installer | sudo bash -si
# curl -sSL https://hedzr.com/bash-framework/installer | sudo bash -s
#
#
#
#
#
#
#
#set -e
#set -x
echo "Install....$0 $@"
OPS_NAME="${OPS_NAME:-bash-framework}"
OPS_HOME_CMD="${OPS_HOME_CMD:-ops}"
URL_BASE="${OPS_URL_BASE:-https://hedzr.com/$OPS_NAME/}"
INSTALL_PREFIX="${INSTALL_TARGET:-/usr/local/bin}"
INSTALL_NAME="${INSTALL_NAME:-ops-fw}"
INSTALL_TARGET="$INSTALL_PREFIX"
function self_download () {
if [ -z $# ]; then
false
elif [ $# -gt 1 ]; then
echo "try"
for file in $*; do
self_download $file
done
else
local context=$1
local cdir=$(dirname $context)
local cname=$(basename $context)
if [[ $context != */* ]]; then
cdir="./"
cname=$context
fi
echo "#### Downloading $context... dir: $cdir, name: $cname, @: $INSTALL_TARGET, PWD: $PWD"
[ ! -d $INSTALL_TARGET/$cdir ] && mkdir -p $INSTALL_TARGET/$cdir
#curl -sSL https://ops.suweia.net/suwei-init/$context -o $INSTALL_TARGET/$cdir/$cname
wget -q $URL_BASE/$context -O $INSTALL_TARGET/$cdir/$cname
fi
}
_ops_add_path () {
false
}
self_download "$OPS_NAME";
for f in "$INSTALL_NAME"/.env \
"$INSTALL_NAME"/ops-fw.d/10.common.sh \
"$INSTALL_NAME"/ops-fw.d/01.install.sh \
"$INSTALL_NAME"/ops-fw.d/00.init.sh \
"$INSTALL_NAME"/VERSION
# $INSTALL_NAME/ops-fw.d/
do
self_download $f
done
[ -f "$INSTALL_TARGET/$OPS_HOME_CMD" ] && rm -f "$INSTALL_TARGET/$OPS_HOME_CMD"
ln -s "$INSTALL_TARGET/$OPS_NAME" "$INSTALL_TARGET/$OPS_HOME_CMD"
chmod a+x "$INSTALL_TARGET/$OPS_NAME" "$INSTALL_TARGET/$OPS_HOME_CMD"
# shellcheck source=suwei-ops/suwei-init.d/01.install.sh
# shellcheck disable=SC1091
OPS_BASE="$INSTALL_TARGET/$INSTALL_NAME"
source $OPS_BASE/.env && SCRIPT=$(realpathx $0) && CD=$(dirname $SCRIPT) && DEBUG "'$SCRIPT' in '$CD', \$0='$0','$1'." #echo "SCRIPT=$SCRIPT, MY_DIR=$CD"
. "$INSTALL_TARGET/$INSTALL_NAME/ops-fw.d/01.install.sh"
echo ""
echo "#### Installing BASH Auto-completion supports"
install-bash-auto-completion
echo ""
echo "#### Installing to current user shell environment"
#set -x
#append-ops-env $USER $INSTALL_NAME
install-self-to-current-user $INSTALL_NAME
echo ""
echo ""
w 2>/dev/null
ls -l --color "$INSTALL_TARGET/$OPS_NAME"
cat <<EOF
====================================================================
'$OPS_NAME' was installed, please re-login into terminal for them.
1. update $OPS_NAME toolset, run:
$ curl -sSL $URL_BASE/installer | sudo bash -s
All folks, Enjoy it!
EOF