Skip to content

Commit

Permalink
inst BalenaCli: added
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnButare committed May 18, 2023
1 parent 7eca98c commit 384f3ef
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 11 deletions.
26 changes: 26 additions & 0 deletions BalenaCli
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
. app.sh || exit

usage()
{
ScriptUsage "$1" "\
Usage: $(ScriptName) [OPTION]... [start|program|IsInstalled|IsRunning|version](start)
$(ScriptName) commands."
}

init()
{
defaultCommand="start"
program="$P/balena-cli/balena"
}

closeCommand() { ! isRunningCommand && return 0; ProcessClose "$program"; }
isInstalledCommand() { [[ -f "$program" ]]; }
isRunningCommand() { IsProcessRunning "$program"; }
programCommand() { echo "$program"; }
startArgs() { startArgs=( "$@" ); (( shift+=$# )); return 0; }
startCommand() { AppInstallCheck && "$program" "${startArgs[@]}" "${otherArgs[@]}"; }
startupCommand() { isRunningCommand && return; startCommand; }
versionCommand() { AppInstallCheck && AppVersion "$program"; }

ScriptRun "$@"
57 changes: 46 additions & 11 deletions inst
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ installInit()
debian=(audacity bind ChronyServer cron CronLog DnsServer DhcpServer kea KeaService mDns SaltMinion terminator)
debian64=() debianWin=()
mac=(amphetamine AppleConfigurator batteries bear Calendar366 CanaryMail CarrotWeather DayOne DiskInventortyX HomeAssistant iTerm KarabinerElements LiveDesktop Magnet MakrdownView pcalc rectagle spark speedtest WallpaperWizard warp xcode XcodeCli XQuartz yoink)
macDebian=(BalenaEtcher bat bc btop chrony colorls DotNet Dropbox DropboxDownload docker etcher exa fzf ghq gnupg NetbootxyzDocker passh PiDiskImager RpiBoot ruby RubyAsdf RubyPackage RubyRvm StandardNotes SublimeMerge tmux thunderbird unison)
macDebian=(BalenaCli BalenaEtcher bat bc btop chrony colorls DotNet Dropbox DropboxDownload docker etcher exa fzf ghq gnupg NetbootxyzDocker passh PiDiskImager RpiBoot ruby RubyAsdf RubyPackage RubyRvm StandardNotes SublimeMerge tmux thunderbird unison)
macWin=(BlueSherpa BrotherPrinter calibre CleanMyMac CreativeCloud cricut deezer DuetDisplay edge firefox fork garmin iExplorer keybase loom miro notion nVidia PdfElement plex quicken qvr slack sonos spotify SurveillanceStation VisualStudio VisualStudioExtensions xpra xServer zoom)
pi=(wifi)
win=(AjaSystemTest backupper bonjourSdk CoreTemp CorsairUtilityEngine cpuz DiskImager EdgeDeflector FileLocatorPro GigabyteMotherboard HardwareMonitor HiddenStart HiddenStartConfigure Hp9020 iCloud kindle KindleDrm vcxsrv WinScp xMing AjaSystemTest CPUZ DiskImager hyperv HiddenStart java LgMonitor MarkdownView NitroPdf nVidiaDriver nVidiaGeForceExperience OneDrive pa PartitionAssistant PowerPanel PowerrToys QuickBooks RealtekCardReader stamps SystemInternals TemperatureLogger Todoist UupDump Wallpaper4k WslConfig x410 xMing)
Expand Down Expand Up @@ -1727,7 +1727,7 @@ appDirCreate()

DownloadInstall()
{
local app apps=(Alfred AltTab Bartender BetterDisplay BeyondCompare CleanMyMac Docker Dropbox Firefox GitKraken Hashi iTerm KarabinerElements NoMachine rectangle shottr SoundSource Sublime SublimeMerge VisualStudioCode warp)
local app apps=(1Password 1PasswordCli Alfred AltTab BalenaCli BalenaEtcher Bartender BetterDisplay BeyondCompare CleanMyMac Docker Dropbox Firefox GitKraken Hashi iTerm KarabinerElements NoMachine rectangle shottr SoundSource Sublime SublimeMerge VisualStudioCode warp)

# regular downloads
for app in "${apps[@]}"; do i "${app}Download" || return; done
Expand Down Expand Up @@ -3028,7 +3028,7 @@ DropboxFinalWin()
DropboxDownload()
{
local app="dropbox"; downloadStart "$app" || return 0
local v; v="$(getVersionCurrent "dropbox")" || return
local v; v="$(getVersionCurrent "$app")" || return
local item items=("mac-arm64-dmg" "mac-x64-dmg" "win-x64-exe")

for item in "${items[@]}"; do
Expand Down Expand Up @@ -3677,15 +3677,10 @@ PowerCoreInstall()
UpdateDone "PowerCore"
}

BalenaEtcherInstall() # disc image burner
balenaEtcherInstall()
{
header "Balena Etcher"
local v="1.18.4" dir="hardware/Balena/Etcher" # https://www.balena.io/etcher/
run "$dir/setup/balenaEtcher-Setup-$v.exe|balenaEtcher-$v.dmg|balena-etcher-electron-$v-linux-x64.zip" || return

v="v15.2.3"
file="balena-cli-$v" # https://github.com/balena-io/balena-cli/releases
run "$dir/cli/$file-windows-x64-standalone.zip|$file-macOS-x64-standalone.zip|$file-linux-x64-standalone.zip" --dest "balena-cli" --elevate || return
local v; v="$(getVersionCurrent "BalenaEtcher")" || return
run --name="BalenaEtcher" "$(balenaEtcherDir)/balenaEtcher-Setup-${v}.exe|balenaEtcher-${v}.dmg|balena-etcher_${v}_amd64.deb" --version="$v" && i BalenaCli
}

BalenaEtcherFinalWin()
Expand All @@ -3694,6 +3689,46 @@ BalenaEtcherFinalWin()
$rm "$ud/balenaEtcher.lnk" || return
}

BalenaEtcherDownload()
{
local app="BalenaEtcher"; downloadStart "$app" || return 0
local v; v="$(getVersionCurrent "$app")" || return

items=( "balenaEtcher-${v}.dmg" "balena-etcher_${v}_amd64.deb" "balenaEtcher-Setup-${v}.exe" )

for item in "${items[@]}"; do
download "https://github.com/balena-io/etcher/releases/download/v$v/$item" "$(balenaEtcherDir)" || return
done

downloadDone "$app" "$v"
}

balenaEtcherDir() { echo "hardware/Balena/Etcher/setup"; }
balenaEtcherVersion() { curl --silent "https://github.com/balena-io/etcher/releases" | grep "/balena-io/etcher/tree" | head -1 | sed 's/.*tree\/v//' | cut -d"\"" -f1; }

BalenaCliInstall()
{
local v; v="$(getVersionCurrent "BalenaCli")" || return
local file="balena-cli-v$v"; run "$(balenaCliDir)/$file-windows-x64-standalone.zip|$file-macOS-x64-standalone.zip|$file-linux-x64-standalone.zip" --dest "balena-cli" --elevate --version=$v || return
}

BalenaCliDownload()
{
local app="BalenaCli"; downloadStart "$app" || return 0
local v; v="$(getVersionCurrent "$app")" || return

items=( "linux-arm64-standalone.zip" "linux-x64-standalone.zip" "macOS-x64-standalone.zip" "windows-x64-standalone.zip" )

for item in "${items[@]}"; do
download "https://github.com/balena-io/balena-cli/releases/download/v$v/balena-cli-v${v}-$item" "$(balenaCliDir)" || return
done

downloadDone "$app" "$v"
}

balenaCliDir() { echo "hardware/Balena/cli"; }
balenaCliVersion() { curl --silent "https://github.com/balena-io/balena-cli/releases" | grep "/balena-io/balena-cli/tree" | head -1 | sed 's/.*tree\/v//' | cut -d"\"" -f1; }

BetterDisplayInstall()
{
local v; v="$(getVersionCurrent "BetterDisplay")" || return
Expand Down

0 comments on commit 384f3ef

Please sign in to comment.