-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpreinstall
89 lines (83 loc) · 2.29 KB
/
preinstall
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
IfExistAuth=`ps -Ac -o command|grep -x AuthenMngService`
IfExistMon=`ps -Ac -o command|grep -x iNodeMon`
LIB_TARGET_DIR="/usr/local/lib"
if [ "$IfExistAuth" != "" -o "$IfExistMon" != "" ]
then
sudo launchctl unload /Library/LaunchDaemons/com.apple.iNodeClient.plist
sudo sh /Applications/iNodeClient/StopService.sh
sudo rm -f /Library/LaunchDaemons/com.apple.iNodeClient.plist
fi
Sec=0
while [ 1 ]
do
IfExistMon=`ps -Ac -o command|grep -x iNodeMon`
if [ "$IfExistMon" != "" ]
then
sleep 1
Sec=`expr $Sec + 1`
if [ "$Sec" -gt 10 ]
then
sudo killall -9 iNodeMon
fi
else
break
fi
done
Sec=0
while [ 1 ]
do
IfExistAuth=`ps -Ac -o command|grep -x AuthenMngService`
if [ "$IfExistAuth" != "" ]
then
sleep 1
Sec=`expr $Sec + 1`
if [ "$Sec" -gt 10 ]
then
sudo killall -9 AuthenMngService
fi
else
break
fi
done
IfExistUI=`ps -Ac -o command|grep -x iNodeClient`
if [ "$IfExistUI" != "" ]
then
sleep 5
sudo killall -9 iNodeClient
fi
echo "当前安装位置"
echo $PWD
echo "文件列表"
ls
# 1. 移动
mkdir /etc/iNode
echo "移动inodesys.conf"
sudo cp ./inodesys.conf /etc/iNode/inodesys.conf
echo "移动inodesys.conf完成✅"
echo "/usr/local/lib目录检查"
# 2. 移动依赖文件
echo "检查依赖库目录"
# 检查目录是否存在
if [ -d "$LIB_TARGET_DIR" ]; then
echo "Directory $LIB_TARGET_DIR already exists."
else
echo "Directory $LIB_TARGET_DIR does not exist. Creating it..."
# 创建目录并设置权限
sudo mkdir -p "$LIB_TARGET_DIR"
sudo chmod 755 "$LIB_TARGET_DIR"
echo "Directory $LIB_TARGET_DIR created and permissions set to 755."
fi
echo "移动依赖文件"
sudo cp -r ./lib/* /usr/local/lib/
echo "移动依赖文件完成✅"
# 3. 移动启动项和配置文件
echo "移动启动项和配置文件"
sudo cp ./Library/LaunchDaemons/com.apple.iNodeClient.plist /Library/LaunchDaemons/
echo "移动启动项和配置文件完成✅"
echo "创建/Library/StartupItems/iNodeAuthService"
sudo mkdir /Library/StartupItems/iNodeAuthService
echo "创建/Library/StartupItems/iNodeAuthService完成✅"
echo "移动StartupItems"
sudo cp -r ./Library/StartupItems/iNodeAuthService/* /Library/StartupItems/iNodeAuthService
exit 0