first
This commit is contained in:
88
PKGBUILD
Normal file
88
PKGBUILD
Normal file
@@ -0,0 +1,88 @@
|
||||
# Maintainer: zj <1052308357@qq.com>
|
||||
|
||||
pkgname=barco-tools
|
||||
pkgver=1.0
|
||||
pkgrel=1
|
||||
pkgdesc="Barco tools for Commander and Communicator applications."
|
||||
arch=('x86_64')
|
||||
url="https://www.barco.com/"
|
||||
license=('unknown')
|
||||
|
||||
depends=('xdg-utils')
|
||||
|
||||
source=(
|
||||
"barco-tools.tar.gz"
|
||||
)
|
||||
|
||||
sha256sums=('41d331dea0a412c2f50a7545b5d08178c692de58baf45ec7b857f0143eb828f2')
|
||||
|
||||
install="${pkgname}.install"
|
||||
|
||||
prepare() {
|
||||
# barco-tools.tar.gz 解压后没有顶层目录,直接将内容解压到 $srcdir
|
||||
# 为了方便处理,我们创建一个子目录并将所有内容移动进去
|
||||
local _temp_app_dir="${srcdir}/_app_contents"
|
||||
mkdir -p "${_temp_app_dir}"
|
||||
|
||||
echo "Moving application contents from $srcdir to $_temp_app_dir..."
|
||||
# 确保这些文件在 $srcdir 中存在,否则 mv 命令会报错
|
||||
mv "${srcdir}/BARCO" "${_temp_app_dir}/" || true
|
||||
mv "${srcdir}/Barco Commander.desktop" "${_temp_app_dir}/" || true
|
||||
mv "${srcdir}/Communicator.desktop" "${_temp_app_dir}/" || true
|
||||
|
||||
msg "Application contents prepared in $_temp_app_dir."
|
||||
}
|
||||
|
||||
build() {
|
||||
# 对于预编译的应用程序包,通常没有编译步骤
|
||||
msg "No build step required for pre-compiled application."
|
||||
}
|
||||
|
||||
package() {
|
||||
set -x # 启用调试输出
|
||||
|
||||
local _app_base_dir="/opt/${pkgname}" # 应用程序的根目录,例如 /opt/barco-tools/
|
||||
local _app_source_dir="${srcdir}/_app_contents" # 应用程序内容的来源目录
|
||||
|
||||
# 1. 创建目标目录
|
||||
install -d "${pkgdir}${_app_base_dir}"
|
||||
install -d "${pkgdir}/usr/share/applications"
|
||||
|
||||
# 2. 复制 BARCO 目录到 /opt/barco-tools/
|
||||
echo "Copying BARCO directory from $_app_source_dir to ${pkgdir}${_app_base_dir}/..."
|
||||
cp -a "${_app_source_dir}/BARCO" "${pkgdir}${_app_base_dir}/"
|
||||
|
||||
# 3. 设置 BARCO 目录下的可执行文件权限
|
||||
# 确保 BARCO 目录下的所有文件都可读,并且其中的脚本(如 run.sh)具有执行权限
|
||||
# 确保 BARCO 目录本身以及子目录是可遍历的
|
||||
find "${pkgdir}${_app_base_dir}/BARCO" -type f -exec chmod 755 {} \; || true # 所有文件可执行
|
||||
find "${pkgdir}${_app_base_dir}/BARCO" -type d -exec chmod 755 {} \; || true # 所有目录可遍历
|
||||
|
||||
# 4. 复制并修改 .desktop 文件
|
||||
echo "Installing and modifying .desktop files in ${pkgdir}/usr/share/applications/..."
|
||||
|
||||
# Communicator.desktop
|
||||
install -m644 "${_app_source_dir}/Communicator.desktop" "${pkgdir}/usr/share/applications/barco-communicator.desktop"
|
||||
# 修改 Exec 路径
|
||||
sed -i "s|^Exec=/home/smart/BARCO/communicator/run.sh|Exec=${_app_base_dir}/BARCO/communicator/run.sh|g" "${pkgdir}/usr/share/applications/barco-communicator.desktop"
|
||||
# 修改 Icon 路径
|
||||
sed -i "s|^Icon=/home/smart/BARCO/communicator/barco_icon.png|Icon=${_app_base_dir}/BARCO/communicator/barco_icon.png|g" "${pkgdir}/usr/share/applications/barco-communicator.desktop"
|
||||
# 修改 Path 路径
|
||||
sed -i "s|^Path=/home/smart/BARCO/communicator|Path=${_app_base_dir}/BARCO/communicator|g" "${pkgdir}/usr/share/applications/barco-communicator.desktop"
|
||||
# 确保 Name 字段存在且正确
|
||||
sed -i "/^\[Desktop Entry\]/aName=Communicator" "${pkgdir}/usr/share/applications/barco-communicator.desktop" || true
|
||||
|
||||
|
||||
# Barco Commander.desktop
|
||||
install -m644 "${_app_source_dir}/Barco Commander.desktop" "${pkgdir}/usr/share/applications/barco-commander.desktop"
|
||||
# 修改 Exec 路径
|
||||
sed -i "s|^Exec=/home/smart/BARCO/Commander-1.8.0/run.sh|Exec=${_app_base_dir}/BARCO/Commander-1.8.0/run.sh|g" "${pkgdir}/usr/share/applications/barco-commander.desktop"
|
||||
# 修改 Icon 路径
|
||||
sed -i "s|^Icon=/home/smart/BARCO/Commander-1.8.0/barco_icon.png|Icon=${_app_base_dir}/BARCO/Commander-1.8.0/barco_icon.png|g" "${pkgdir}/usr/share/applications/barco-commander.desktop"
|
||||
# 修改 Path 路径
|
||||
sed -i "s|^Path=/home/smart/BARCO/Commander-1.8.0|Path=${_app_base_dir}/BARCO/Commander-1.8.0|g" "${pkgdir}/usr/share/applications/barco-commander.desktop"
|
||||
# 确保 Name 字段存在且正确
|
||||
sed -i "/^\[Desktop Entry\]/aName=Barco Commander" "${pkgdir}/usr/share/applications/barco-commander.desktop" || true
|
||||
|
||||
echo "Package creation complete."
|
||||
}
|
||||
Reference in New Issue
Block a user