This commit is contained in:
zj
2025-12-14 22:38:52 +08:00
parent b1c2e68438
commit 5debc568de
3 changed files with 124 additions and 0 deletions

74
PKGBUILD Normal file
View File

@@ -0,0 +1,74 @@
# Maintainer: Your Name <your.email@example.com>
pkgname=tms-bbt
pkgver=1.0
pkgrel=1
pkgdesc="SmartTMS application suite for managing cinema devices."
arch=('x86_64')
url="https://your.company.com/smarttms"
license=('Proprietary')
options=('!strip')
depends=('python' 'sudo' 'xdg-utils' 'tms-mysql' 'tms-oracle-jdk8')
source=("${pkgname}.tar.gz")
sha256sums=('4a87404479f1a6e85fa1fd34f08ae60c350fce240b65b761b03f8db39c08c298')
install="${pkgname}.install"
prepare() {
cd "${srcdir}/${pkgname}"
# 修复 Python shebangs (如果文件存在)
find . -type f -name "*.py" -exec sed -i 's|^#!/usr/bin/env python$|#!/usr/bin/env python3|g' {} + || true
find . -type f -name "*.py" -exec sed -i 's|^#!/usr/bin/python$|#!/usr/bin/python3|g' {} + || true
# 针对 websockify/run 文件
if [ -f apache-tomcat-7.0.63/webapps/noVNC-master/utils/websockify/run ]; then
sed -i 's|^#!/usr/bin/python$|#!/usr/bin/python3|g' apache-tomcat-7.0.63/webapps/noVNC-master/utils/websockify/run || true
fi
}
build() {
msg "No build step required for this package."
}
package() {
# 定义目标目录,保持 /home/smart 路径不变
local _app_base_dir="/home/smart/.tms3"
local _tomcat_dir="${_app_base_dir}/apache-tomcat-7.0.63"
local _starter_dir="${_app_base_dir}/starter"
# 1. 创建目标目录
# 注意:/home/smart 目录本身不会由 RPM 包创建,需要系统管理员确保其存在。
# 我们按照原始 RPM Spec 的权限设置 777。
install -d -m777 "${pkgdir}${_app_base_dir}"
install -d -m777 "${pkgdir}${_tomcat_dir}"
install -d -m777 "${pkgdir}${_starter_dir}"
install -d "${pkgdir}/usr/bin"
install -d -m750 "${pkgdir}/etc/sudoers.d"
install -d "${pkgdir}/usr/lib/systemd/system" # Arch Linux systemd unit 文件标准路径
install -d "${pkgdir}/usr/share/applications"
# 2. 复制应用程序文件
# 进入已解压的 tarball 目录
cd "${srcdir}/${pkgname}"
# 复制 Tomcat 和 starter 内容
cp -r apache-tomcat-7.0.63/* "${pkgdir}${_tomcat_dir}/"
cp -r starter/* "${pkgdir}${_starter_dir}/"
# 复制 smarttms 可执行文件
install -m755 smarttms "${pkgdir}/usr/bin/smarttms"
# 复制 sudoers.d 文件 (从 $srcdir而非 tarball 内部)
install -m440 "smart" "${pkgdir}/etc/sudoers.d/smart"
# 复制 systemd 服务文件 (从 $srcdir而非 tarball 内部)
install -m644 "smarttms.service" "${pkgdir}/usr/lib/systemd/system/smarttms.service"
# 复制桌面快捷方式 (从 tarball 内部的 starter 目录)
install -m644 starter/tmsrestart.desktop "${pkgdir}/usr/share/applications/tmsrestart.desktop"
}