forked from zephir-lang/zephir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·30 lines (28 loc) · 934 Bytes
/
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
#!/bin/bash
# Using the -c option will copy zephir in /usr/local/bin
options='c'
while getopts $options option
do
if [[ "$option" == "c" ]]; then
# Use ZEPHIRDIR env variable if defined as installation destination dir
ZEPHIRSRC="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [[ -z $ZEPHIRDIR ]]; then
ZEPHIRDIR=$ZEPHIRSRC
elif [[ ! -d $ZEPHIRDIR ]]; then
echo "Directory defined by environment variable ZEPHIRDIR doesn't exist"
exit 1
fi
sed "s#%ZEPHIRDIR%#$ZEPHIRDIR#g" bin/zephir > bin/zephir-cmd
chmod 755 bin/zephir-cmd
sudo cp bin/zephir-cmd /usr/local/bin/zephir
rm bin/zephir-cmd
if [[ $ZEPHIRDIR != $ZEPHIRSRC ]]; then
sudo cp -r $ZEPHIRSRC/* $ZEPHIRDIR
echo "Zephir was installed correctly"
fi
exit 0
fi
done
if [[ -d "/etc/bash_completion.d/" && $EUID = 0 ]]; then
sudo cp bin/bash_completion /etc/bash_completion.d/zephir
fi