diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..453792e --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/*.pkg.tar.zst +/src/ +/pkg/ diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..327902f --- /dev/null +++ b/PKGBUILD @@ -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." +} diff --git a/barco-tools.install b/barco-tools.install new file mode 100644 index 0000000..1eaae3e --- /dev/null +++ b/barco-tools.install @@ -0,0 +1,23 @@ +# post_install: 在软件包安装后执行 +post_install() { + echo "Updating desktop database and icon cache..." + xdg-icon-resource forceupdate --theme hicolor >/dev/null 2>&1 || true + update-desktop-database -q >/dev/null 2>&1 || true + + echo "Barco tools installed to /opt/barco-tools." + echo "You can launch applications from your application menu (Barco Commander, Communicator)." +} + +# post_upgrade: 在软件包升级后执行 +post_upgrade() { + post_install "$1" +} + +# post_remove: 在软件包删除后执行 +post_remove() { + echo "Updating desktop database and icon cache after removal..." + xdg-icon-resource forceupdate --theme hicolor >/dev/null 2>&1 || true + update-desktop-database -q >/dev/null 2>&1 || true +} + +# vim:set ts=2 sw=2 et: diff --git a/barco-tools.tar.gz b/barco-tools.tar.gz new file mode 100644 index 0000000..465ad74 Binary files /dev/null and b/barco-tools.tar.gz differ diff --git a/up+.sh b/up+.sh new file mode 100755 index 0000000..1a6d204 --- /dev/null +++ b/up+.sh @@ -0,0 +1,68 @@ +#!/bin/bash +#set -e +################################################################################################################## +# Author : Erik Dubois +# Website : https://www.erikdubois.be +# Website : https://www.alci.online +# Website : https://www.ariser.eu +# Website : https://www.arcolinux.info +# Website : https://www.arcolinux.com +# Website : https://www.arcolinuxd.com +# Website : https://www.arcolinuxb.com +# Website : https://www.arcolinuxiso.com +# Website : https://www.arcolinuxforum.com +################################################################################################################## +# +# DO NOT JUST RUN THIS. EXAMINE AND JUDGE. RUN AT YOUR OWN RISK. +# +################################################################################################################## +#tput setaf 0 = black +#tput setaf 1 = red +#tput setaf 2 = green +#tput setaf 3 = yellow +#tput setaf 4 = dark blue +#tput setaf 5 = purple +#tput setaf 6 = cyan +#tput setaf 7 = gray +#tput setaf 8 = light blue +################################################################################################################## + +# reset - commit your changes or stash them before you merge +# git reset --hard - personal alias - grh + +echo "Deleting the work folder if one exists" +[ -d work ] && rm -rf work + +# checking if I have the latest files from github +echo "Checking for newer files online first" +git pull + +# Below command will backup everything inside the project folder +git add --all . + +# Give a comment to the commit if you want +echo "####################################" +echo "Write your commit comment!" +echo "####################################" + +read input + +# Committing to the local repository with a message containing the time details and commit text + +git commit -m "$input" + +# Push the local files to github + +if grep -q main .git/config; then + echo "Using main" + git push -u origin main +fi + +if grep -q master .git/config; then + echo "Using master" + git push -u origin master +fi + +echo "################################################################" +echo "################### Git Push Done ######################" +echo "################################################################"