提交脚本

This commit is contained in:
halliday 2024-06-16 01:04:54 +08:00
parent b1a22f817c
commit 501c55bc0e
2 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,58 @@
#!/bin/bash
set -x
PRG="$0"
while [ -h "$PRG" ]; do
ls=$(ls -ld "$PRG")
link=$(expr "$ls" : '.*-> \(.*\)$')
if expr "$link" : '.*/.*' >/dev/null; then
PRG="$link"
else
PRG=$(dirname "$PRG")/"$link"
fi
done
PRGDIR=$(dirname "$PRG")
#full path
cd $PRGDIR
ROOT_DIR=$(pwd)
cd - >/dev/null
# 生成最新的rbp配置文件
./RDPWrapOffsetFinder/64bit/RDPWrapOffsetFinder.exe >"$ROOT_DIR"/rdp.ini
# 和之前的比较
diff "$ROOT_DIR"/rdp.ini "$ROOT_DIR"/rdpold.ini
if [ $? -eq 0 ]; then
echo "文件一致无需修改"
exit 0
fi
echo "文件不一致,更新配置"
#组装成完整的文件
rm -rf "$ROOT_DIR"/rdpwrap.ini
cat "$ROOT_DIR"/rdp-head.ini >"$ROOT_DIR"/rdpwrap.ini
cat "$ROOT_DIR"/rdp.ini >>"$ROOT_DIR"/rdpwrap.ini
uptime=`date +"%Y-%m-%d"`
sed -i "s/uptime/$uptime/g" "$ROOT_DIR"/rdpwrap.ini
# 处理换行符的问题
unix2dos "$ROOT_DIR"/rdpwrap.ini
#替换之前的配置,并重启服务
mv "/C/program Files/RDP Wrapper/rdpwrap.ini" "/C/program Files/RDP Wrapper/rdpwrap.ini-bak"
cp "$ROOT_DIR"/rdpwrap.ini "/C/program Files/RDP Wrapper/rdpwrap.ini"
net stop TermService //y
sleep 5
net start TermService
# 最后将本次更新的重命名
mv "$ROOT_DIR"/rdp.ini "$ROOT_DIR"/rdpold.ini

Binary file not shown.