-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
51 lines (41 loc) · 1.89 KB
/
install.sh
File metadata and controls
51 lines (41 loc) · 1.89 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
#!/bin/bash
set -e
TMP=/tmp/antora-builder.zip
INSTALL_DIR=${HOME}/.antora-builder
curl https://codeload.github.com/Sebbia/antora-builder/zip/master > ${TMP}
[ -d /tmp/antora-builder-master ] && rm -rf /tmp/antora-builder-master
unzip -d /tmp ${TMP}
[ -d ${INSTALL_DIR} ] && rm -rf ${INSTALL_DIR}
mv /tmp/antora-builder-master ${INSTALL_DIR}
NEXT_STEP=
if [ -d ${HOME}/bin ]; then
[ ! -f ${HOME}/bin/sebbia-antora-builder ] && ln -s ${INSTALL_DIR}/sebbia-antora-builder.sh ${HOME}/bin/sebbia-antora-builder
chmod +x ${HOME}
else
BIN_DIR=${INSTALL_DIR}/bin
mkdir -p ${BIN_DIR}
ln -s ${INSTALL_DIR}/sebbia-antora-builder.sh ${BIN_DIR}/sebbia-antora-builder
chmod +x ${BIN_DIR}/sebbia-antora-builder
updateProfile() {
FILE_PATH="${HOME}/$1"
[ -f "${FILE_PATH}" ] || return 1
grep -q "${BIN_DIR}" ${FILE_PATH} && return 0
echo -e "\nexport PATH=${BIN_DIR}:\${PATH}" >> ${FILE_PATH}
}
if updateProfile ".bash_profile" || updateProfile ".bashrc" || updateProfile ".profile" || updateProfile ".zshrc"; then
NEXT_STEP="\nWARNING: Before you start you have to reload your terminal application\n"
else
echo "Cannot install. Your system is not supported. We are sorry :("
exit 1
fi
fi
echo
echo " ____________ "
echo "Sebbia Antora Builder installed successfully! < SUCCESS!!! >"
echo "Just proceed with: ------------ "
echo " \ ^__^"
echo " $ sebbia-antora-builder \ (oo)\_______"
echo " (__)\ )\/\\"
echo " ||----w |"
echo " || ||"
echo -e "$NEXT_STEP"