tink-access-one/access-one.install
2026-01-09 00:01:11 +08:00

100 lines
2.7 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

pre_install(){
echo 'before install script executing...'
programDir="/opt/AOne"
processName="AOne"
echo "checking running process..."
# 检查进程是否存在
if pgrep -x "$processName" >/dev/null; then
echo "$processName is running,stopping..."
# 终止进程
killall -e $processName
fi
echo 'before install script complete'
}
post_install(){
echo 'after install script executing...'
programDir="/opt/AOne"
# 解决Ubuntu 24.04上启动时的sandbox权限报错
sudo chown root ${programDir}/chrome-sandbox
sudo chmod 4755 ${programDir}/chrome-sandbox
sudo chmod +x ${programDir}/resources/bin/ctEAO
sudo cp ${programDir}/resources/bin/aone.service /etc/systemd/system
sudo systemctl daemon-reload
sudo systemctl enable aone.service
sudo systemctl start aone.service
# 写入包的类型,用于更新时判断当前包的类型以从平台上获取更新
sudo echo "deb" > ${programDir}/pkg-type
echo 'after install script complete'
}
pre_remove(){
echo 'before remove script executing...'
programDir="/opt/AOne"
processName="AOne"
echo "checking running process..."
# 检查进程是否存在
if pgrep -x "$processName" >/dev/null; then
echo "$processName is running, stopping..."
# 终止进程
killall -e $processName
fi
# 卸载
if [ "$1" = "remove" ]; then
# 拷贝cps-agent的卸载脚本到tmp目录
if [ -f "${programDir}/resources/bin/uninst_cps.sh" ]; then
cp -f ${programDir}/resources/bin/uninst_cps.sh /tmp/uninst_cps.sh 2>/dev/null
fi
# 生成卸载标志文件
flagFile="${programDir}/resources/bin/uninstallflag.log"
if [ ! -f $flagFile ]; then
touch $flagFile
fi
fi
echo 'before remove script complete'
}
post_remove(){
echo 'after remove script executing...'
programDir="/opt/AOne"
num=`systemctl status aone|grep "Active"|grep "running"|wc -l`
if [ $num -ne 0 ]; then
sudo systemctl stop aone.service
sudo systemctl disable aone.service
fi
if [ -f /etc/systemed/system/aone.service ]; then
sudo rm -rf /etc/systemd/system/aone.service
fi
# 卸载信创主机安全
if [ "$1" = "remove" ]; then
uninst_script_path="/tmp/uninst_cps.sh"
bash_path=$(command -v bash 2>/dev/null)
if [ $? -eq 0 ] && [ -f "$uninst_script_path" ]; then
nohup "$bash_path" $uninst_script_path >/dev/null 2>&1 &
else
sudo systemctl stop cps-agent 2>/dev/null
sudo systemctl disable cps-agent 2>/dev/null
fi
fi
echo 'after remove script complete'
}