Skip to content

Commit

Permalink
create_install.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
hemnstill committed Mar 17, 2024
1 parent 0e8804e commit 1cec018
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions Etcher/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
balenaEtcher*/
4 changes: 4 additions & 0 deletions Etcher/create_install.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off
"%~dp0..\.tools\busybox.exe" bash "%~dp0create_install.sh"

exit /b %errorlevel%
21 changes: 21 additions & 0 deletions Etcher/create_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
dp0="$(realpath "$(dirname "$0")")"
dp0_tools="$dp0/../.tools" && source "$dp0_tools/env_tools.sh"
set -e
cd "$dp0"

latest_version=https://api.github.com/repos/balena-io/etcher/releases/latest
echo Get latest version: "$latest_version" ...
download_url=$($curl --silent --location "$latest_version" | "$grep" --only-matching '(?<="browser_download_url":\s")[^,]+balenaEtcher-[^,-]+-win\.zip(?=")' | head -n1)
[[ -z "$download_url" ]] && {
echo "Cannot get release version"
exit 1
}

echo "Downloading: $download_url ..."
$curl --location "$download_url" --remote-name


filename="$(basename -- "$download_url")"
echo Extracting '$filename' ...
"$p7z" x "$filename" "-obalenaEtcher" -aoa -r

0 comments on commit 1cec018

Please sign in to comment.