Files
tms-bbt-pkg/PKGBUILD
2026-01-13 21:15:04 +08:00

75 lines
2.6 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Maintainer: Your Name <your.email@example.com>
pkgname=tms-bbt
pkgver=1.0
pkgrel=5
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=('3b94a4f61c94555b8452f8caefb25d283cd86ca6f4aec0e747634547b3f94182')
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"
}