要在 CentOS 上为 AppImage 制作启动脚本,请按照以下步骤操作:
appimage_launcher.sh 的新文件:vim appimage_launcher.sh
#!/bin/bash
# 设置 AppImage 文件的路径
APPIMAGE_PATH="/path/to/your/appimage-file.AppImage"
# 设置应用程序的工作目录(可选)
WORKING_DIR="/path/to/your/working/directory"
# 设置应用程序的日志文件路径(可选)
LOG_FILE="/path/to/your/logfile.log"
# 进入工作目录(如果设置了)
cd "$WORKING_DIR" || exit
# 运行 AppImage 文件
"$APPIMAGE_PATH" >> "$LOG_FILE" 2>&1 &
# 获取 AppImage 进程的 PID
APPIMAGE_PID=$!
# 等待 AppImage 进程结束(如果需要)
wait $APPIMAGE_PID
请将 /path/to/your/appimage-file.AppImage 替换为你的 AppImage 文件的实际路径,如有需要,请设置 WORKING_DIR 和 LOG_FILE 变量。
保存并关闭脚本文件。
为脚本文件添加可执行权限:
chmod +x appimage_launcher.sh
./appimage_launcher.sh
现在,你已经成功创建了一个用于启动 AppImage 应用程序的脚本。你可以将此脚本添加到桌面环境(如 GNOME、KDE 等)的启动应用程序列表中,以便在系统启动时自动运行 AppImage 应用程序。