2021-09-27 10:38:12 +02:00
|
|
|
|
<#
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.SYNOPSIS
|
2021-10-04 21:29:23 +02:00
|
|
|
|
Installs signal-cli
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.DESCRIPTION
|
2021-09-24 17:19:49 +02:00
|
|
|
|
Installs signal-cli from github.com/AsamK/signal-cli. See the Web page for the correct version number
|
2021-10-04 21:29:23 +02:00
|
|
|
|
install-signal-cli.ps1 [<version>]
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.EXAMPLE
|
2021-09-24 17:19:49 +02:00
|
|
|
|
PS> ./install-signal-cli 0.11.12
|
2021-08-29 17:50:03 +02:00
|
|
|
|
.NOTES
|
|
|
|
|
Author: Markus Fleschutz · License: CC0
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.LINK
|
|
|
|
|
https://github.com/fleschutz/PowerShell
|
2021-06-29 20:29:22 +02:00
|
|
|
|
#>
|
|
|
|
|
|
2021-07-15 15:51:22 +02:00
|
|
|
|
param([string]$Version = "")
|
2021-06-29 20:29:22 +02:00
|
|
|
|
|
|
|
|
|
try {
|
2021-07-15 15:51:22 +02:00
|
|
|
|
if ($Version -eq "") { $Version = read-host "Enter version to install (see https://github.com/AsamK/signal-cli)" }
|
|
|
|
|
|
2021-06-29 20:29:22 +02:00
|
|
|
|
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
|
|
|
|
|
|
|
|
|
set-location /tmp
|
|
|
|
|
|
|
|
|
|
& wget --version
|
|
|
|
|
if ($lastExitCode -ne "0") { throw "Can't execute 'wget' - make sure wget is installed and available" }
|
|
|
|
|
|
|
|
|
|
& wget "https://github.com/AsamK/signal-cli/releases/download/v$Version/signal-cli-$($Version).tar.gz"
|
|
|
|
|
if ($lastExitCode -ne "0") { throw "'wget' failed" }
|
|
|
|
|
|
|
|
|
|
sudo tar xf "signal-cli-$Version.tar.gz" -C /opt
|
|
|
|
|
if ($lastExitCode -ne "0") { throw "'sudo tar xf' failed" }
|
|
|
|
|
|
2021-06-29 20:35:17 +02:00
|
|
|
|
sudo ln -sf "/opt/signal-cli-$Version/bin/signal-cli" /usr/local/bin/
|
2021-06-29 20:29:22 +02:00
|
|
|
|
if ($lastExitCode -ne "0") { throw "'sudo ln -sf' failed" }
|
|
|
|
|
|
2021-06-29 20:35:17 +02:00
|
|
|
|
rm "signal-cli-$Version.tar.gz"
|
|
|
|
|
if ($lastExitCode -ne "0") { throw "'rm' failed" }
|
|
|
|
|
|
2021-06-29 20:29:22 +02:00
|
|
|
|
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
|
|
|
|
"✔️ installed signal-cli $Version to /opt and /usr/local/bin in $Elapsed sec"
|
2021-09-27 10:09:45 +02:00
|
|
|
|
exit 0 # success
|
2021-06-29 20:29:22 +02:00
|
|
|
|
} catch {
|
2021-09-16 20:19:10 +02:00
|
|
|
|
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
2021-06-29 20:29:22 +02:00
|
|
|
|
exit 1
|
|
|
|
|
}
|