-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathset-mac.sh
75 lines (66 loc) · 2.02 KB
/
set-mac.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
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
#!/bin/bash
# define env
JCO_DIR_USER="www-data"
# main
while [ "$1" != "${1##[-+]}" ]; do
case $1 in
--jco-dir-user)
JCO_DIR_USER=$2
shift 2
;;
--jco-dir-user=?*)
JCO_DIR_USER=${1#--jco-dir-user=}
shift
;;
esac
done
# fix dir bug
cd `dirname $0`
# check root
if [[ "$(id -u)" != "0" ]]; then
echo "please run this script as root !" >&2
exit 1
fi
# check git
if type -p git; then
echo -e "git is install!"
else
echo -e "git not install! please install use: yum install -y git"
exit 1
fi
# create dir
echo -e "start create dir:/data/service/jco-sdk ..."
mkdir -p /data/service/jco-sdk
echo -e "end create dir..."
# clone project
echo -e "start clone project to /data/service/jco-sdk ..."
git clone https://github.com/easonjim/jco-sdk.git /data/service/jco-sdk
echo -e "end clone project..."
# init env
echo -e "start set env..."
if [[ `grep -c "LD_LIBRARY_PATH" /etc/profile` = 0 ]]; then
echo "export LD_LIBRARY_PATH=/data/service/jco-sdk/3.0.11-720.612/darwinintel64">>/etc/profile
else
echo "LD_LIBRARY_PATH is set! please delete this env and set again!"
fi
if [[ `grep -c "DYLD_LIBRARY_PATH" /etc/profile` = 0 ]]; then
echo "export DYLD_LIBRARY_PATH=/data/service/jco-sdk/3.0.11-720.612/darwinintel64" >>/etc/profile
else
echo "DYLD_LIBRARY_PATH is set! please delete this env and set again!"
fi
if [[ `grep -c "JAVA_LIBRARY_PATH" /etc/profile` = 0 ]]; then
echo "export JAVA_LIBRARY_PATH=/data/service/jco-sdk/3.0.11-720.612/darwinintel64">>/etc/profile
else
echo "JAVA_LIBRARY_PATH is set! please delete this env and set again!"
fi
# 生效
source /etc/profile
echo -e "end set env..."
# set dir user
echo -e "start set dir:/data/service/jco-sdk user..."
if [ ${JCO_DIR_USER} = "www-data" ]; then
echo -e "the dir set default user: www-data! you can use command arg --jco-dir-user=\"user1\" to setting!"
fi
echo -e "dir user is:"${JCO_DIR_USER}
chown -R ${JCO_DIR_USER}: /data/service/jco-sdk
echo -e "end set dir..."