forked from nomad-cli/shenzhen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·77 lines (66 loc) · 2.26 KB
/
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
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
#!/bin/bash
GEMSPEC_BASENAME="${1}"
if (( ${#GEMSPEC_BASENAME} > 0 )) ; then GEMSPEC_BASENAME="$(basename ${GEMSPEC_BASENAME} .gemspec)"; fi
if (( ${#GEMSPEC_BASENAME} <= 0 )) ; then
cd $(dirname $0)
gemspecFilePaths=( $(find -E . -regex '.*(gemspec)' -maxdepth 1) )
GEMSPEC_FILENAME=${gemspecFilePaths[0]}
else
GEMSPEC_FILENAME="${GEMSPEC_BASENAME}.gemspec"
fi
echo
read -p "Would you like to build the gemspec file \"${GEMSPEC_FILENAME}\"? (Y/N): " -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
gem build "${GEMSPEC_FILENAME}"
fi
if (( ${#GEMSPEC_BASENAME} <= 0 )) ; then
cd $(dirname $0)
gemspecFilePaths=( $(find -E . -regex '.*(gemspec)' -maxdepth 1) )
GEMSPEC_FILENAME=${gemspecFilePaths[0]}
else
GEMSPEC_FILENAME="${GEMSPEC_BASENAME}.gemspec"
fi
gemFilePaths=( $(find -E . -regex '.*(gem)' -maxdepth 1) )
GEM_FILENAME=${gemFilePaths[0]}
if (( ${#GEM_FILENAME} <= 0 )) ; then
echo
echo "No gem file found. Skipping gem install..."
else
echo
read -p "Would you like to install the gem file \"${GEM_FILENAME}\"? (Y/N): " -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo
echo "Installing \"${GEM_FILENAME}\" (This will take a few moments)..."
gem install "${GEM_FILENAME}" || exit
echo ""
fi
fi
BIN_PATH="$(dirname $0)/bin/"
SYS_BIN_PATH="/usr/bin/"
echo
read -p "Would you like to copy all executables in \"${BIN_PATH}\" to \"${SYS_BIN_PATH}\"? This is necessary to use some of the executable files correctly! (Y/N): " -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
cp -R "${BIN_PATH}/." ${SYS_BIN_PATH} || exit
echo "Successfully copied all executables from \"${BIN_PATH}\" to \"${SYS_BIN_PATH}\"."
else
echo "Install of executables in \"${BIN_PATH}\" canceled."
fi
echo
LOCAL_BIN_PATH="$(dirname $0)/local/bin/"
SYS_LOCAL_BIN_PATH="/usr/local/bin/"
read -p "Would you like to copy all executables in \"${LOCAL_BIN_PATH}\" to \"${SYS_LOCAL_BIN_PATH}\"? (Y/N): " -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
cp -R "${LOCAL_BIN_PATH}/." ${SYS_LOCAL_BIN_PATH} || exit
echo "Successfully copied all executables from \"${LOCAL_BIN_PATH}\" to \"${SYS_LOCAL_BIN_PATH}\"."
else
echo "Install of executables in \"${LOCAL_BIN_PATH}\" canceled."
fi
echo