-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·37 lines (24 loc) · 825 Bytes
/
install.sh
File metadata and controls
executable file
·37 lines (24 loc) · 825 Bytes
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
#!/bin/bash
SCRIPT_FILE=https://raw.github.com/cobyism/octocatsay/master/bin/octocatsay
APP_DIR=.octocatsay
# allow param for testing...
INSTALL_DIR=${1:-$HOME}
echo "Installing into $INSTALL_DIR/$APP_DIR..."
[ -d $INSTALL_DIR ] || mkdir -p $INSTALL_DIR
cd $INSTALL_DIR
# ensure the bin folder exists
if [ ! -d $APP_DIR ]; then
mkdir -p $APP_DIR/bin
fi
cd $APP_DIR/bin
# get the file and save (overwriting if needed)
curl $SCRIPT_FILE > octocatsay
# update path (if necessary)
if [ ! $(echo $PATH | fgrep "$INSTALL_DIR/$APP_DIR/bin") ] ; then
echo "Adding $APP_DIR to PATH."
echo "PATH=$INSTALL_DIR/$APP_DIR/bin:\$PATH" >> ~/.bashrc
echo "PATH=$INSTALL_DIR/$APP_DIR/bin:\$PATH" >> ~/.bash_profile
source ~/.bashrc
echo "run 'source ~/.bashrc' to update path in the current shell."
fi
echo "All done."