Skip to content

Commit

Permalink
chore(CI): 新增deb包升级功能的测试
Browse files Browse the repository at this point in the history
fix: 修复卸载和升级时的残留文件问题
  • Loading branch information
MemoryShadow committed Sep 12, 2023
1 parent 29bf5c6 commit bc447a7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 这里暂时先不测试升级后存档继承的问题. 因为目前只有一个版本
Expand All @@ -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: |
Expand Down
4 changes: 2 additions & 2 deletions build/info
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
4 changes: 2 additions & 2 deletions build/prerm
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit bc447a7

Please sign in to comment.