-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.sh
31 lines (25 loc) · 899 Bytes
/
install.sh
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
#!/bin/bash
INSTALL_PATH=$1
# If no install path is given, install in users home directory
if [[ -z "${INSTALL_PATH}" ]]; then
INSTALL_PATH="$HOME/bin"
fi
# Remove trailing slashes
INSTALL_PATH=${INSTALL_PATH/\/+$//}
# We use bash to install with
BASH="/bin/bash"
# Use bash with sudo if installing outside users home directory
if [[ "$INSTALL_PATH" != "$HOME"* ]]; then
BASH="sudo ${BASH}"
fi
echo "Installing rmate-perl into ${INSTALL_PATH}"
$BASH -- <<INSTALLER
mkdir -p "${INSTALL_PATH}"
curl -Lo "${INSTALL_PATH}/rmate" https://raw.github.com/davidolrik/rmate-perl/master/rmate
chmod 755 "${INSTALL_PATH}/rmate"
ln -sf "${INSTALL_PATH}/rmate" "${INSTALL_PATH}/mate"
ln -sf "${INSTALL_PATH}/rmate" "${INSTALL_PATH}/rsub"
ln -sf "${INSTALL_PATH}/rmate" "${INSTALL_PATH}/subl"
ln -sf "${INSTALL_PATH}/rmate" "${INSTALL_PATH}/rcode"
INSTALLER
echo "Done"