Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·59 lines (52 loc) · 2.09 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·59 lines (52 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-or-later
set -euo pipefail
for tool in curl sha256sum dpkg apt-get; do
if ! command -v "$tool" >/dev/null 2>&1; then
echo "LinuxPlayer needs a Debian-based system with $tool installed." >&2
exit 1
fi
done
architecture="$(dpkg --print-architecture)"
if [[ "$architecture" != amd64 && "$architecture" != arm64 ]]; then
echo "There is no LinuxPlayer release package for $architecture yet." >&2
exit 1
fi
release_url="https://github.com/teamkrope/linuxplayer/releases/latest/download"
download_dir="$(mktemp -d)"
trap 'rm -rf "$download_dir"' EXIT
asset="linuxplayer_${architecture}.deb"
package="$download_dir/$asset"
if ! curl -fsSL --retry 3 "$release_url/$asset" -o "$package" ||
! curl -fsSL --retry 3 "$release_url/$asset.sha256" -o "$package.sha256"; then
echo "Could not download the latest LinuxPlayer release." >&2
exit 1
fi
if ! (cd "$download_dir" && sha256sum --check --status "$asset.sha256"); then
echo "Checksum verification failed for $asset; installation stopped." >&2
exit 1
fi
if apt-get -s --no-remove install "$package" >"$download_dir/apt-check.log" 2>&1; then
echo "Installing LinuxPlayer..."
if [[ "${EUID:-$(id -u)}" -eq 0 ]]; then
apt-get --no-remove install "$package"
else
sudo apt-get --no-remove install "$package"
fi
exit 0
fi
# Older packages could be left unpacked after a distribution upgrade changed
# Qt's package names. APT refuses an upgrade while that old package is broken,
# but dpkg can replace it with this release's compatible dependency alternatives.
if [[ "$(dpkg-query -W -f='${Status}' linuxplayer 2>/dev/null || true)" == "install ok unpacked" ]]; then
echo "Replacing an incomplete LinuxPlayer installation..."
if [[ "${EUID:-$(id -u)}" -eq 0 ]]; then
dpkg -i "$package"
else
sudo dpkg -i "$package"
fi
exit 0
fi
echo "No current LinuxPlayer package fits this system's available dependencies." >&2
echo "See https://github.com/teamkrope/linuxplayer/blob/main/docs/BUILDING.md for other systems." >&2
exit 1