updated gitignore and linux appimage script
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,6 +4,7 @@
|
||||
.vscode/
|
||||
docs/
|
||||
.codex
|
||||
build/
|
||||
|
||||
# --- Backend (Go) ---
|
||||
backend/hightube.db
|
||||
|
||||
114
scripts/package_linux_appimage.sh
Executable file
114
scripts/package_linux_appimage.sh
Executable file
@@ -0,0 +1,114 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd -- "${SCRIPT_DIR}/.." && pwd)"
|
||||
FRONTEND_DIR="${REPO_ROOT}/frontend"
|
||||
DEFAULT_BUNDLE_DIR="${FRONTEND_DIR}/build/linux/x64/release/bundle"
|
||||
|
||||
APP_NAME="hightube"
|
||||
APP_DISPLAY_NAME="Hightube"
|
||||
BUNDLE_DIR="${BUNDLE_DIR:-${DEFAULT_BUNDLE_DIR}}"
|
||||
APPDIR="${APPDIR:-${REPO_ROOT}/build/appimage/${APP_NAME}.AppDir}"
|
||||
OUTPUT="${OUTPUT:-${REPO_ROOT}/hightube-linux_amd64.AppImage}"
|
||||
ICON_SOURCE="${ICON_SOURCE:-${FRONTEND_DIR}/assets/icon/app_icon.png}"
|
||||
APPIMAGETOOL="${APPIMAGETOOL:-appimagetool}"
|
||||
RUN_FLUTTER_BUILD=0
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Usage: $(basename "$0") [--build]
|
||||
|
||||
Package the Flutter Linux release bundle into:
|
||||
${OUTPUT}
|
||||
|
||||
Options:
|
||||
--build Run "flutter build linux --release" before packaging.
|
||||
|
||||
Environment overrides:
|
||||
BUNDLE_DIR Flutter Linux release bundle directory.
|
||||
OUTPUT Output AppImage path.
|
||||
APPDIR Temporary AppDir path.
|
||||
ICON_SOURCE PNG icon path.
|
||||
APPIMAGETOOL appimagetool executable path.
|
||||
EOF
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--build)
|
||||
RUN_FLUTTER_BUILD=1
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unknown argument: $1" >&2
|
||||
usage >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ "${RUN_FLUTTER_BUILD}" -eq 1 ]]; then
|
||||
(cd "${FRONTEND_DIR}" && flutter build linux --release)
|
||||
fi
|
||||
|
||||
if [[ ! -x "${BUNDLE_DIR}/${APP_NAME}" ]]; then
|
||||
echo "Linux release bundle not found at: ${BUNDLE_DIR}" >&2
|
||||
echo "Run: cd frontend && flutter build linux --release" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "${ICON_SOURCE}" ]]; then
|
||||
echo "Icon file not found at: ${ICON_SOURCE}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v "${APPIMAGETOOL}" >/dev/null 2>&1; then
|
||||
echo "appimagetool not found." >&2
|
||||
echo "Install appimagetool or set APPIMAGETOOL=/path/to/appimagetool" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf "${APPDIR}"
|
||||
mkdir -p \
|
||||
"${APPDIR}/usr/bin" \
|
||||
"${APPDIR}/usr/share/applications" \
|
||||
"${APPDIR}/usr/share/icons/hicolor/512x512/apps"
|
||||
|
||||
cp -a "${BUNDLE_DIR}/." "${APPDIR}/usr/bin/"
|
||||
cp "${ICON_SOURCE}" "${APPDIR}/${APP_NAME}.png"
|
||||
cp "${ICON_SOURCE}" "${APPDIR}/usr/share/icons/hicolor/512x512/apps/${APP_NAME}.png"
|
||||
|
||||
cat > "${APPDIR}/${APP_NAME}.desktop" <<EOF
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=${APP_DISPLAY_NAME}
|
||||
Comment=Open source live streaming platform
|
||||
Exec=${APP_NAME}
|
||||
Icon=${APP_NAME}
|
||||
Terminal=false
|
||||
Categories=AudioVideo;Player;
|
||||
EOF
|
||||
|
||||
cp "${APPDIR}/${APP_NAME}.desktop" "${APPDIR}/usr/share/applications/${APP_NAME}.desktop"
|
||||
|
||||
cat > "${APPDIR}/AppRun" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
HERE="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "${HERE}/usr/bin"
|
||||
exec "./hightube" "$@"
|
||||
EOF
|
||||
|
||||
chmod +x "${APPDIR}/AppRun" "${APPDIR}/usr/bin/${APP_NAME}"
|
||||
rm -f "${OUTPUT}"
|
||||
|
||||
APPIMAGE_EXTRACT_AND_RUN=1 ARCH=x86_64 "${APPIMAGETOOL}" "${APPDIR}" "${OUTPUT}"
|
||||
chmod +x "${OUTPUT}"
|
||||
|
||||
echo "Created AppImage: ${OUTPUT}"
|
||||
Reference in New Issue
Block a user