8ca5a1fdda
scripts/install-linux-app.sh installs a release archive into ~/.local/share/pipelines-app (writable, so in-app updates can swap it), with a ~/.local/bin launcher, icon and desktop entry, and checks for missing system libraries first.
44 lines
1.9 KiB
Bash
Executable File
44 lines
1.9 KiB
Bash
Executable File
#!/bin/sh
|
|
# Installs the Pipelines Linux desktop app for the current user from a release
|
|
# archive (pipelines-linux-x64-*.tar.gz from the update feed or the build cache):
|
|
# scripts/install-linux-app.sh <archive.tar.gz> [icon.png]
|
|
# The app lives in ~/.local/share/pipelines-app (writable, so in-app updates
|
|
# can swap it), with a launcher in ~/.local/bin and a desktop entry. An existing
|
|
# install is kept as pipelines-app.previous.
|
|
set -eu
|
|
archive=$1
|
|
icon=${2:-}
|
|
data=${XDG_DATA_HOME:-$HOME/.local/share}
|
|
target=$data/pipelines-app
|
|
staging=$data/.pipelines-app-install.$$
|
|
trap 'rm -rf "$staging"' EXIT
|
|
mkdir -p "$staging"
|
|
tar -xzf "$archive" -C "$staging"
|
|
bundle=$(dirname "$(find "$staging" -maxdepth 3 -type f -name pipelines-app | head -n 1)")
|
|
[ -x "$bundle/pipelines-app" ] && [ -d "$bundle/data/flutter_assets" ] && [ -d "$bundle/lib" ] || {
|
|
echo "The archive has no complete pipelines-app bundle." >&2; exit 1; }
|
|
missing=$(ldd "$bundle/pipelines-app" | grep "not found" || true)
|
|
[ -z "$missing" ] || { echo "Missing system libraries:" >&2; echo "$missing" >&2; exit 1; }
|
|
rm -rf "$target.previous"
|
|
[ -d "$target" ] && mv "$target" "$target.previous"
|
|
mv "$bundle" "$target"
|
|
mkdir -p "$HOME/.local/bin" "$data/applications"
|
|
ln -sf "$target/pipelines-app" "$HOME/.local/bin/pipelines-app"
|
|
if [ -n "$icon" ]; then
|
|
mkdir -p "$data/icons/hicolor/512x512/apps"
|
|
cp "$icon" "$data/icons/hicolor/512x512/apps/pipelines-app.png"
|
|
fi
|
|
cat > "$data/applications/pipelines-app.desktop" <<DESKTOP
|
|
[Desktop Entry]
|
|
Type=Application
|
|
Name=Pipelines App
|
|
Comment=Pipelines native desktop app
|
|
Exec=$target/pipelines-app
|
|
Icon=pipelines-app
|
|
Terminal=false
|
|
StartupWMClass=com.pipelines.app
|
|
Categories=Development;
|
|
DESKTOP
|
|
command -v update-desktop-database >/dev/null 2>&1 && update-desktop-database "$data/applications" >/dev/null 2>&1 || true
|
|
echo "Installed $(cat "$target/version.txt" 2>/dev/null || echo Pipelines) at $target"
|