This commit is contained in:
2025-08-28 23:45:56 +08:00
parent a26d4b88d9
commit a70bc2477e
11 changed files with 153 additions and 0 deletions

View File

@@ -0,0 +1,119 @@
#!/bin/bash
# Special thank to Shiroko, he give me the insight of coding in proper way
# Usage: $0 [arch]
################################# Here we set the configs
REALPATH=`realpath $0`
HERE_PATH=`dirname $REALPATH`
STORE_APP_PATH="$HERE_PATH"
WORKDIR=`mktemp -d`
ARCH="" # Define it later
ARCH_ANOTHERWAY="" # Define it later
PKG_NAME="net.hmcl.huangyuhui"
APP_NAME="HMCL我的世界启动器"
GITHUB_REPO="HMCL-dev/HMCL" #格式像这样。只在从github获取信息才使用如果不是则注释掉。后续下载也整合进入helper
VERSION="" # 定义版本号。或者在后续prepare或build中定义。可使用其他两个bashimport文件中的功能
TAGS="ubuntu;deepin;uos;debian" # 星火的tag信息
CATAGORY="games" #https://gitee.com/deepin-community-store/spark-store/blob/dev/DOCS/spk-doc.md
DETAIL="2023/12/23在原有包基础上重新打包版本号由原来的开发版3.5.4.232改为3.5.5正式版\n使用星火商店的用户不需要进行任何改动就可以正常使用如果想不安装星火商店而正常安装此包请在安装游戏前安装\nhttps://shenmo.lanzoul.com/iqj2vyrkhgj" # This should be written as json format
HOMEPAGE="https://github.com/HMCL-dev/HMCL"
MAINTAINER="shenmo<shenmo@spark-app.store>"
################################# Fill the variables below only if you use write_control function
SECTION="games"
PRIORITY="optional"
DEPENDS="deepin-elf-verify (>= 1.1.10-1), fonts-wqy-zenhei, fonts-wqy-microhei, net.hmcl.huangyuhui.jre21"
DESCRIPTION_SHORT="HMCL启动器正式版 3.5.8.249 by huanghongxun"
DESCRIPTION_LONG=""
PROVIDES=""
REPLACES=""
RECOMMENDS=""
################################# Here we import our tools
if [ ! -e "/opt/bashimport/sbs-utils.bashimport" ];then
echo "Need to install spark-building-service deb first! exit"
exit 1
fi
source /opt/bashimport/sbs-utils.bashimport
source /opt/bashimport/sbs-build-helper.bashimport
##这两个里面有详尽的解释
if [ "$1" = "amd64" ] || [ "$1" = "x64" ];then
ARCH="amd64"
ARCH_ANOTHERWAY="-amd64"
elif [ "$1" = "arm64" ] || [ "$1" = "arm" ];then
ARCH="arm64"
ARCH_ANOTHERWAY="-aarch64"
elif [ "$1" = "loong64" ];then
ARCH="loong64"
ARCH_ANOTHERWAY="-loong64"
ARCH_STORE_PATH="loong64-store"
else
log.error "Err:Invalid Architecture"
exit 1
fi
# ===== Log 用法 =====
# log.info xxx
# log.warn xxx
# log.info xxx
# log.debug xxx
# 带颜色的echo
function prepare(){
# Below is the usable funcions
# aptss_get_update()更新apt源并检查是否成功如果成功则记录日志为“aptss update ok”否则记录日志为“aptss is locked.Give up”并退出。
# get_version_from_aptss()从aptss(全部)源中获取指定软件包的版本号。实战中建议使用下方的函数替代以避免无法预知的情况
# get_version_from_source_list_file ${PKG_NAME} ${PATH_TO_SOURCE_LIST}
# compare_version ${VER_Apt} ${VER_Upstream} (Will give the upstream version as variable $VERSION if it is higher or exit if they are the same or Ver_Apt is higher)
# get_version_from_github()从github上获取指定仓库的最新发布版本号。需要定义GITHUB_REPO变量。会给返回值
# get_size():获取软件包目录的大小并返回值
VER_APTSS=$(get_version_from_source_list_file ${PKG_NAME} /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore${ARCH_ANOTHERWAY}.list)
VER_GITHUB=$(get_version_from_github $GITHUB_REPO)
VER_GITHUB_NO_v=$(echo $VER_GITHUB | sed 's/^[^0-9]*//')
compare_version ${VER_APTSS} ${VER_GITHUB_NO_v}
}
function build(){
pushd $STORE_APP_PATH
# init_package_directory()初始化软件包目录创建DEBIAN、opt/apps/<PKG_NAME>/entries/applications、opt/apps/<PKG_NAME>/entries/icons和opt/apps/<PKG_NAME>/files等目录并将模板应用到软件包目录中。
# write_control()在软件包目录中生成control文件并设置软件包的基本信息如名称、版本、维护者、主页、架构、依赖关系、描述等。
# write_info():在软件包目录/opt/apps/<PKG_NAME>/下生成info文件记录软件包的基本信息如appid、名称、版本、架构、权限等。
# write_json()在软件包目录中生成app.json.update文件记录软件包的详细信息如名称、版本、文件名、种子地址、作者、贡献者、主页、更新时间、大小、更多信息、标签、截图地址和图标地址等。应当在商店目录使用而不是workdir
init_package_directory
write_control
write_info
url1="https://github.com/${GITHUB_REPO}/releases/download/${VER_GITHUB}/HMCL-${VERSION}.jar"
echo $url1
aria2c $url1 --check-certificate=false -o opt/apps/net.hmcl.huangyuhui/files/lib/hmcl/HMCL-${VERSION}.jar
popd
}
prepare
build
write_json $STORE_APP_PATH
rm -rf $WORKDIR

View File

@@ -0,0 +1,12 @@
[Desktop Entry]
Categories=Game;
Comment=The Minecraft Launcher
Exec="/opt/apps/net.hmcl.huangyuhui/files/bin/hmcl"
Icon=hmcl
Name=HMCL(dstore)
Name[zh_CN]=HMCL我的世界启动器
Terminal=false
Type=Application
X-Deepin-Vendor=user-custom
X-Deepin-CreatedBy=com.deepin.dde.daemon.Launcher
X-Deepin-AppID=HMCL

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,19 @@
#!/bin/bash
VER=$(basename $(ls /opt/apps/net.hmcl.huangyuhui/files/lib/hmcl/*.jar)).version
if [[ "$1" != "-p" ]]; then
WORKDIR=${XDG_CONFIG_HOME:-$HOME/.config}/hmcl
mkdir -p $WORKDIR
cd $WORKDIR
if [ ! -e "${VER}" ];then
rm $WORKDIR/*.version
rm $WORKDIR/*.jar
touch ${VER}
cp /opt/apps/net.hmcl.huangyuhui/files/lib/hmcl/*.jar .
fi
ls hmcl.json > /dev/null 2>&1 || touch hmcl.json
ls *.jar > /dev/null 2>&1 || cp /opt/apps/net.hmcl.huangyuhui/files/lib/hmcl/*.jar .
fi
JAR_FILE=$(ls $WORKDIR/*.jar)
exec /opt/apps/net.hmcl.huangyuhui/files/lib/jre/bin/java -jar "$JAR_FILE" "$@"

View File

@@ -0,0 +1 @@
/opt/apps/net.hmcl.huangyuhui.jre21/jre