-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add a dowloader for the goepel g-api
This is the proprietary software world… We are not allowed to ship this thing (to create the best user experience), but we are allowed to download it… Best: Only a creepy self extracting bash script is available that requires root permissions and so on. Just run this in a container and grab the extracted files.
- Loading branch information
1 parent
6631249
commit 350a49c
Showing
1 changed file
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
|
||
# There is no API. If the download does not work any more (or if there are updates) | ||
# please check this page: | ||
# | ||
# https://www.goepel.com/automotive-test-solutions/support/software/g-api-software | ||
# | ||
ARCHIVE_NAME="g-api-Setup-2.2.10974_Release_Linux.run.zip" | ||
RUN_SCRIPT_NAME="${ARCHIVE_NAME%.*}" | ||
DOWNLOAD_URL="https://www.goepel.com/fileadmin/files/ats/software/g-api/$ARCHIVE_NAME" | ||
|
||
is_running_under_podman() { | ||
if [[ -n "${container:-}" && "$container" == "podman" ]]; then | ||
return 0 | ||
fi | ||
return 1 | ||
} | ||
|
||
main() { | ||
# If this script is not running under podman, then spawn podman and run | ||
# itself within the container. | ||
|
||
# Outside the container. | ||
local extractdir | ||
extractdir="/mnt$PWD/out" | ||
if ! is_running_under_podman; then | ||
podman run -it -v "$PWD:/mnt/$PWD" -w "/mnt/$PWD" --rm debian:trixie "$BASH_ARGV0" "$extractdir" | ||
|
||
# Exit the parent script outside the container. | ||
exit | ||
fi | ||
|
||
# Inside the container. | ||
# Catch the directory from the commandline; supplied outside the container. | ||
extractdir="$1" | ||
|
||
apt-get install -U -y curl unzip make pciutils xdg-user-dirs | ||
|
||
local tmpdir | ||
tmpdir="$(mktemp -d)" | ||
|
||
cd "$tmpdir" | ||
curl -L -o "$ARCHIVE_NAME" "$DOWNLOAD_URL" | ||
|
||
unzip "$ARCHIVE_NAME" | ||
|
||
if [[ ! -r "$RUN_SCRIPT_NAME" ]]; then | ||
echo "error: $ARCHIVE_NAME is not there!" | ||
exit 1 | ||
fi | ||
|
||
chmod +x "$RUN_SCRIPT_NAME" | ||
mkdir -p "$extractdir" | ||
|
||
echo "The goepel installer script is going to be executed now." | ||
echo "This scipt will break your system and we do not recommend this to be run on a production system." | ||
echo "For reference (especially point 1.4 and 1.5):" | ||
echo "" | ||
echo " https://wiki.debian.org/DontBreakDebian" | ||
echo "" | ||
echo "For this reason, the install script is run in a podman container." | ||
echo "The installer will fail but it extracts the library and .so files." | ||
echo "The extracted library will be available in: $extractdir" | ||
|
||
"./$RUN_SCRIPT_NAME" --target "$extractdir" > "$extractdir/installer.log" 2>&1 || true | ||
} | ||
|
||
main "$@" |