diff --git a/PKGBUILD b/PKGBUILD index b43e4fd..c66bd71 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: Your Name -pkgname=wine-dcc +pkgname=tms-wine-dcc pkgver=1.0 pkgrel=1 pkgdesc="A Wine-based package for running DCC applications with a pre-configured Wine prefix." @@ -8,7 +8,6 @@ arch=('x86_64') url="https://example.com/dcc" license=('unknown') -# 修正 depends 语法,并添加 wine 依赖 depends=('xdg-utils') source=( @@ -48,7 +47,7 @@ build() { package() { set -x # 启用调试输出 - local _app_base_dir="/opt/${pkgname}" # 应用程序的根目录,例如 /opt/wine-dcc/ + local _app_base_dir="/opt/${pkgname}" # 应用程序的根目录,例如 /opt/tms-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前缀模板 @@ -60,11 +59,11 @@ package() { 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}..." + # 2. 复制 _app_contents 目录下的所有内容到 /opt/tms-wine-dcc/ + echo "Copying tms-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/ 下的可执行文件权限 + # 3. 设置 /opt/tms-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 可执行 @@ -82,9 +81,9 @@ package() { 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" +USER_WINEPREFIX="${HOME}/.tms-wine-dcc" # 使用新的 pkgname +TEMPLATE_WINEPREFIX="/opt/tms-wine-dcc/.wine" +APP_BASE_DIR="/opt/tms-wine-dcc" CUSTOM_WINE_BINARY="${APP_BASE_DIR}/wine/bin/wine" WINDOWS_EXE="DCCs2.exe" @@ -93,8 +92,6 @@ 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 @@ -113,29 +110,27 @@ EOF 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 +USER_WINEPREFIX="${HOME}/.tms-wine-dcc" +TEMPLATE_WINEPREFIX="/opt/tms-wine-dcc/.wine" +CUSTOM_WINE_BINARY="/opt/tms-wine-dcc/wine/bin/wine" +# Define the Windows path to the executable *inside* the Wine prefix +# 注意:这里使用 Windows 路径格式,Wine 会在 USER_WINEPREFIX 中查找 +WINDOWS_EXE="C:\\Program Files (x86)\\Projector User Supportware\\Digital Cinema Communicator v2\\DigitalCinemaCommunicator2.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}" +# Execute the custom Wine binary with the Windows executable path +# 不再需要 cd 到 APP_BASE_DIR,因为我们提供了完整的 Windows 路径 +exec "${CUSTOM_WINE_BINARY}" "${WINDOWS_EXE}" EOF # 6. 复制并修改 .desktop 文件 @@ -145,6 +140,7 @@ EOF 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 "s|^Path=.*|Path=${_app_base_dir}|g" "${pkgdir}/usr/share/applications/dcc.desktop" # 保持 Path 指向应用根目录 sed -i "/^\[Desktop Entry\]/aName=DCC Application" "${pkgdir}/usr/share/applications/dcc.desktop" || true @@ -152,13 +148,14 @@ EOF 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 "s|^Path=.*|Path=${_app_base_dir}|g" "${pkgdir}/usr/share/applications/dcc2.desktop" # 保持 Path 指向应用根目录 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" + # 7. 创建 PATH 环境变量配置脚本 tms-wine-dcc.sh + # 将 /opt/tms-wine-dcc/wine/bin 添加到 PATH + echo "Creating PATH configuration script ${pkgdir}/etc/profile.d/${pkgname}.sh..." + echo "export PATH=\"${_wine_bin_path}:\$PATH\"" > "${pkgdir}/etc/profile.d/${pkgname}.sh" + chmod 0644 "${pkgdir}/etc/profile.d/${pkgname}.sh" echo "Package creation complete." } diff --git a/wine-dcc.install b/tms-wine-dcc.install similarity index 72% rename from wine-dcc.install rename to tms-wine-dcc.install index 0decc8d..4dfac02 100644 --- a/wine-dcc.install +++ b/tms-wine-dcc.install @@ -4,9 +4,9 @@ post_install() { 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 "DCC application installed to /opt/tms-wine-dcc." # 路径更新 + echo "The custom Wine binary path /opt/tms-wine-dcc/wine/bin has been added to your PATH." # 路径更新 + echo "Each user will have their own Wine prefix initialized at ~/.tms-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." } @@ -21,7 +21,7 @@ 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 "Note: User-specific Wine prefixes (~/.tms-wine-dcc) are NOT automatically removed." # 路径更新 echo "Users should manually remove them if no longer needed." }