commit 30678a5632d0d7e3e2315956ef030eef843741a6 Author: zj <1052308357@qq.com> Date: Sun Dec 14 16:32:39 2025 +0800 first commit 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..b43e4fd --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,164 @@ +# Maintainer: Your Name + +pkgname=wine-dcc +pkgver=1.0 +pkgrel=1 +pkgdesc="A Wine-based package for running DCC applications with a pre-configured Wine prefix." +arch=('x86_64') +url="https://example.com/dcc" +license=('unknown') + +# 修正 depends 语法,并添加 wine 依赖 +depends=('xdg-utils') + +source=( + "wine-dcc.tar.gz" +) + +sha256sums=('c8b873e46a6cb210abf3c4b9296d413d51abce0ac238cdf50d81d2ba84bbc299') + +install="${pkgname}.install" + +prepare() { + # makepkg 已经自动将 wine-dcc.tar.gz 的内容解压到 $srcdir/ + # 根据用户反馈,解压出来的文件没有顶层目录,直接位于 $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}/DCC2.desktop" "${_temp_app_dir}/" || true + mv "${srcdir}/DCC2.jpg" "${_temp_app_dir}/" || true + mv "${srcdir}/DCC.desktop" "${_temp_app_dir}/" || true + mv "${srcdir}/DCC.jpg" "${_temp_app_dir}/" || true + mv "${srcdir}/DCCs2.exe" "${_temp_app_dir}/" || true + mv "${srcdir}/.wine" "${_temp_app_dir}/" || true + mv "${srcdir}/wine" "${_temp_app_dir}/" || true # 假设 'wine' 是一个目录,其下有 bin/wine + + msg "Application contents prepared in $_temp_app_dir." +} + +build() { + # 对于预编译的Wine应用程序包,通常没有编译步骤 + msg "No build step required for pre-compiled Wine application." +} + +package() { + set -x # 启用调试输出 + + local _app_base_dir="/opt/${pkgname}" # 应用程序的根目录,例如 /opt/wine-dcc/ + local _wine_bin_path="${_app_base_dir}/wine/bin" # Wine可执行文件所在的bin目录 + local _app_source_dir="${srcdir}/_app_contents" # 应用程序内容的来源目录 + local _template_wine_prefix="${_app_base_dir}/.wine" # 系统级的Wine前缀模板 + + # 1. 创建目标目录 + install -d "${pkgdir}${_app_base_dir}" + install -d "${pkgdir}/usr/bin" + install -d "${pkgdir}/usr/share/applications" + install -d "${pkgdir}/usr/share/pixmaps" # 用于存放图标 + install -d "${pkgdir}/etc/profile.d" # 用于存放环境变量脚本 + + # 2. 复制 _app_contents 目录下的所有内容到 /opt/wine-dcc/ + echo "Copying wine-dcc contents from $_app_source_dir to ${pkgdir}${_app_base_dir}..." + cp -a "${_app_source_dir}/." "${pkgdir}${_app_base_dir}/" + + # 3. 设置 /opt/wine-dcc/ 下的可执行文件权限 + # 确保自定义的 'wine' 可执行文件和 Windows exe 具有执行权限 + find "${pkgdir}${_wine_bin_path}" -type f -exec chmod 755 {} \; || true # 确保 wine/bin 下的所有文件可执行 + chmod 755 "${pkgdir}${_app_base_dir}/DCCs2.exe" # 确保 Windows exe 可执行 + + # 4. 复制图标文件到 /usr/share/pixmaps/ + echo "Copying icons to ${pkgdir}/usr/share/pixmaps/..." + install -m644 "${_app_source_dir}/DCC.jpg" "${pkgdir}/usr/share/pixmaps/" + install -m644 "${_app_source_dir}/DCC2.jpg" "${pkgdir}/usr/share/pixmaps/" + + # 5. 创建 /usr/bin 下的启动器脚本 + echo "Creating launcher scripts in ${pkgdir}/usr/bin/..." + + # DCC 启动器 + install -D -m755 /dev/null "${pkgdir}/usr/bin/dcc" + cat > "${pkgdir}/usr/bin/dcc" <<'EOF' +#!/bin/bash +# Define the path for the user's Wine prefix in their home directory +USER_WINEPREFIX="${HOME}/.wine-dcc" +TEMPLATE_WINEPREFIX="/opt/wine-dcc/.wine" +APP_BASE_DIR="/opt/wine-dcc" +CUSTOM_WINE_BINARY="${APP_BASE_DIR}/wine/bin/wine" +WINDOWS_EXE="DCCs2.exe" + +# Check if the user's Wine prefix exists. If not, copy the template. +if [ ! -d "${USER_WINEPREFIX}" ]; then + echo "Initializing Wine prefix for user ${USER} at ${USER_WINEPREFIX}..." + mkdir -p "$(dirname "${USER_WINEPREFIX}")" # Ensure parent directory exists + cp -a "${TEMPLATE_WINEPREFIX}" "${USER_WINEPREFIX}" + # Ensure the copied prefix is owned by the current user (cp -a to home dir usually handles this) + # chown -R "${USER}":"${USER}" "${USER_WINEPREFIX}" # Usually not needed if copying to HOME + echo "Wine prefix initialized." +fi + +# Set WINEPREFIX to the user's specific prefix +export WINEPREFIX="${USER_WINEPREFIX}" + +# Change directory to the application's installation path (where DCCs2.exe resides) +cd "${APP_BASE_DIR}" || { echo "Error: Cannot change directory to ${APP_BASE_DIR}"; exit 1; } + +# Execute the custom Wine binary from its bin directory with the Windows executable +exec "${CUSTOM_WINE_BINARY}" "${WINDOWS_EXE}" +EOF + + # DCC2 启动器 + install -D -m755 /dev/null "${pkgdir}/usr/bin/dcc2" + cat > "${pkgdir}/usr/bin/dcc2" <<'EOF' +#!/bin/bash +# Define the path for the user's Wine prefix in their home directory +USER_WINEPREFIX="${HOME}/.wine-dcc" +TEMPLATE_WINEPREFIX="/opt/wine-dcc/.wine" +APP_BASE_DIR="/opt/wine-dcc" +CUSTOM_WINE_BINARY="${APP_BASE_DIR}/wine/bin/wine" +WINDOWS_EXE_PATH="/opt/wine-dcc/.wine/drive_c/Program Files (x86)/Projector User Supportware/Digital Cinema Communicator v2/DigitalCinemaCommunicator2.exe" # Full path to the second EXE + +# Check if the user's Wine prefix exists. If not, copy the template. +if [ ! -d "${USER_WINEPREFIX}" ]; then + echo "Initializing Wine prefix for user ${USER} at ${USER_WINEPREFIX}..." + mkdir -p "$(dirname "${USER_WINEPREFIX}")" # Ensure parent directory exists + cp -a "${TEMPLATE_WINEPREFIX}" "${USER_WINEPREFIX}" + # chown -R "${USER}":"${USER}" "${USER_WINEPREFIX}" # Usually not needed if copying to HOME + echo "Wine prefix initialized." +fi + +# Set WINEPREFIX to the user's specific prefix +export WINEPREFIX="${USER_WINEPREFIX}" + +# Change directory to the application's installation path (important for Wine's working directory) +cd "${APP_BASE_DIR}" || { echo "Error: Cannot change directory to ${APP_BASE_DIR}"; exit 1; } + +# Execute the custom Wine binary from its bin directory with the full path to the Windows executable +exec "${CUSTOM_WINE_BINARY}" "${WINDOWS_EXE_PATH}" +EOF + + # 6. 复制并修改 .desktop 文件 + echo "Installing and modifying .desktop files in ${pkgdir}/usr/share/applications/..." + + # DCC.desktop + install -m644 "${_app_source_dir}/DCC.desktop" "${pkgdir}/usr/share/applications/dcc.desktop" + sed -i "s|^Exec=.*|Exec=/usr/bin/dcc|g" "${pkgdir}/usr/share/applications/dcc.desktop" + sed -i "s|^Icon=.*|Icon=DCC.jpg|g" "${pkgdir}/usr/share/applications/dcc.desktop" + sed -i "/^\[Desktop Entry\]/aName=DCC Application" "${pkgdir}/usr/share/applications/dcc.desktop" || true + + + # DCC2.desktop + install -m644 "${_app_source_dir}/DCC2.desktop" "${pkgdir}/usr/share/applications/dcc2.desktop" + sed -i "s|^Exec=.*|Exec=/usr/bin/dcc2|g" "${pkgdir}/usr/share/applications/dcc2.desktop" + sed -i "s|^Icon=.*|Icon=DCC2.jpg|g" "${pkgdir}/usr/share/applications/dcc2.desktop" + sed -i "/^\[Desktop Entry\]/aName=DCC2 Application" "${pkgdir}/usr/share/applications/dcc2.desktop" || true + + # 7. 创建 PATH 环境变量配置脚本 wine-dcc.sh + # 将 /opt/wine-dcc/wine/bin 添加到 PATH + echo "Creating PATH configuration script ${pkgdir}/etc/profile.d/wine-dcc.sh..." + echo "export PATH=\"${_wine_bin_path}:\$PATH\"" > "${pkgdir}/etc/profile.d/wine-dcc.sh" + chmod 0644 "${pkgdir}/etc/profile.d/wine-dcc.sh" + + echo "Package creation complete." +} 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 "################################################################" diff --git a/wine-dcc.install b/wine-dcc.install new file mode 100644 index 0000000..0decc8d --- /dev/null +++ b/wine-dcc.install @@ -0,0 +1,28 @@ +# 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 "DCC application installed to /opt/wine-dcc." + echo "The custom Wine binary path /opt/wine-dcc/wine/bin has been added to your PATH." + echo "Each user will have their own Wine prefix initialized at ~/.wine-dcc on first launch." + echo "You can launch it via 'dcc' or 'dcc2' commands, or from your application menu." + echo "Please log out and log back in, or source /etc/profile to apply PATH changes." +} + +# 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 + echo "Note: User-specific Wine prefixes (~/.wine-dcc) are NOT automatically removed." + echo "Users should manually remove them if no longer needed." +} + +# vim:set ts=2 sw=2 et: diff --git a/wine-dcc.tar.gz b/wine-dcc.tar.gz new file mode 100644 index 0000000..17df52d Binary files /dev/null and b/wine-dcc.tar.gz differ