From bc447a7edfa13c284061c3a21e2828a055adb294 Mon Sep 17 00:00:00 2001 From: MemoryShadow <31596045+MemoryShadow@users.noreply.github.com> Date: Tue, 12 Sep 2023 02:23:33 +0000 Subject: [PATCH] =?UTF-8?q?chore(CI):=20=E6=96=B0=E5=A2=9Edeb=E5=8C=85?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E5=8A=9F=E8=83=BD=E7=9A=84=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: 修复卸载和升级时的残留文件问题 --- .github/workflows/main.yml | 15 ++++++++++++++- build/info | 4 ++-- build/prerm | 4 ++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b9eda64..d24f787 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -155,6 +155,7 @@ jobs: ls -lab packages echo $PWD pwd_path=$PWD + CheckID=`date +%s%N | md5sum | cut -c 1-10`; docker run -itd -v ${pwd_path}:${pwd_path} --name ubuntuInstance --env TZ=Asia/Shanghai --env DEBIAN_FRONTEND=noninteractive --net="host" docker.io/ubuntu:20.04 /bin/bash echo Apt update... # TODO 这里暂时先不测试升级后存档继承的问题. 因为目前只有一个版本 @@ -163,7 +164,19 @@ jobs: sudo apt install -y -q ${pwd_path}/packages/${{ needs.build.outputs.DEB_AMD64 }} | grep 'minecraftctl'; \ echo minecraftctl installed...;\ sudo minecraftctl help;\ - cat /etc/minecraftctl/config | grep --color '^export GamePath=\"\${HOME}/Minecraft\"$';" + cat /etc/minecraftctl/config | grep --color '^export GamePath=\"\${HOME}/Minecraft\"$'; \ + echo minecraftctl uninstalling...; \ + sudo apt remove --purge -y minecraftctl; \ + echo minecraftctl Install the latest release...; \ + download_url=`curl -s https://api.github.com/repos/MemoryShadow/minecraftctl/releases/latest | grep browser_download_url | grep amd64.deb`; \ + download_url=${download_url#*: \"}; download_url=${download_url%\"*}; \ + wget ${download_url}; sudo apt install -y -q ./${download_url##*/}; rm ${download_url##*/}; \ + CheckID=`date +%s%N | md5sum | cut -c 1-10`; \ + echo -e "\n\nexport CheckID='${CheckID}'" | sudo tee -a /etc/minecraftctl/config; \ + cat /etc/minecraftctl/config | grep --color \"^export CheckID='${CheckID}'\"; \ + echo minecraftctl updating...; \ + sudo apt install -y -q ${pwd_path}/packages/${{ needs.build.outputs.DEB_AMD64 }} | grep 'minecraftctl'; \ + cat /etc/minecraftctl/config | grep ${CheckID};" - name: RPM Install and test run: | diff --git a/build/info b/build/info index 338e0d9..0088531 100644 --- a/build/info +++ b/build/info @@ -1,13 +1,13 @@ ### # @Date: 2023-03-10 00:30:00 # @LastEditors: MemoryShadow - # @LastEditTime: 2023-07-20 23:06:13 + # @LastEditTime: 2023-09-12 01:56:19 # @Description: # Copyright (c) 2023 by MemoryShadow@outlook.com, All Rights Reserved. ### #!/bin/bash export PackageType='deb,rpm' -export Version='1.2.0' +export Version='1.2.0.6' export Package='minecraftctl' export Section='admin' export Priority='extra' diff --git a/build/prerm b/build/prerm index a5b5edf..a3ff544 100755 --- a/build/prerm +++ b/build/prerm @@ -5,10 +5,10 @@ if [ -e /etc/minecraftctl/config ]; then sed -i "s/\\\$/\\\\\$/g" /etc/minecraftctl/config.bak fi # 如果/usr/sbin/minecraftctl存在就将其删除 -if [ ! -e /usr/sbin/minecraftctl ]; then +if [ -e /usr/sbin/minecraftctl ]; then rm /usr/sbin/minecraftctl fi # 如果/usr/bin/minecraftctl不存在就创建软链 if [ ! -e /usr/bin/minecraftctl ]; then - ln -s /opt/minecraftctl/minecraftctl /usr/sbin/minecraftctl + ln -s /opt/minecraftctl/minecraftctl /usr/bin/minecraftctl fi \ No newline at end of file