packages/hyprspace: remove update command
We have Nix for installing software ;)
This commit is contained in:
parent
b7cf168ada
commit
bdc623056b
6 changed files with 1 additions and 100 deletions
|
@ -74,7 +74,6 @@ curl -L https://hyprspace.io/install.sh | bash
|
|||
| `init` | `i` | Initialize an interface's configuration. |
|
||||
| `up` | `up` | Create and Bring Up a Hyprspace Interface |
|
||||
| `down ` | `d` | Bring Down and Delete A Hyprspace Interface |
|
||||
| `update` | `upd` | Have Hyprspace update its own binary to the latest release. |
|
||||
|
||||
### Global Flags
|
||||
| Flag | Alias | Description |
|
||||
|
|
|
@ -31,7 +31,6 @@ func init() {
|
|||
cmd.Register(&Init)
|
||||
cmd.Register(&Up)
|
||||
cmd.Register(&Down)
|
||||
cmd.Register(&Update)
|
||||
cmd.Register(&cmd.Version)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
package cli
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/DataDrake/cli-ng/v2/cmd"
|
||||
"github.com/inconshreveable/go-update"
|
||||
"github.com/tcnksm/go-latest"
|
||||
)
|
||||
|
||||
// Update checks for a new version of the Hyprspace program and updates itself
|
||||
// if a newer version is found and the user agrees to update.
|
||||
var Update = cmd.Sub{
|
||||
Name: "update",
|
||||
Alias: "upd",
|
||||
Short: "Update Hyprspace to the lastest version.",
|
||||
Args: &UpdateArgs{},
|
||||
Flags: &UpdateFlags{},
|
||||
Run: UpdateRun,
|
||||
}
|
||||
|
||||
// UpdateArgs handles the specific arguments for the update command.
|
||||
type UpdateArgs struct {
|
||||
}
|
||||
|
||||
// UpdateFlags handles the specific flags for the update command.
|
||||
type UpdateFlags struct {
|
||||
Yes bool `short:"y" long:"yes" desc:"If a newer version is found update without prompting the user."`
|
||||
}
|
||||
|
||||
// UpdateRun handles the checking and self updating of the AIT program.
|
||||
func UpdateRun(r *cmd.Root, c *cmd.Sub) {
|
||||
fmt.Printf("Current Version: %s\n", appVersion)
|
||||
|
||||
flags := c.Flags.(*UpdateFlags)
|
||||
latestVersion := &latest.GithubTag{
|
||||
Owner: "hyprspace",
|
||||
Repository: "hyprspace",
|
||||
}
|
||||
|
||||
res, _ := latest.Check(latestVersion, appVersion)
|
||||
fmt.Printf("Latest Version: %s\n", res.Current)
|
||||
|
||||
if res.Outdated {
|
||||
if !flags.Yes {
|
||||
fmt.Println("Would you like to update Hyprspace to the newest version? ([y]/n)")
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
input, _ := reader.ReadString('\n')
|
||||
input = strings.ToLower(strings.TrimSpace(input))
|
||||
if input == "n" {
|
||||
return
|
||||
}
|
||||
}
|
||||
url := "https://github.com/hyprspace/hyprspace/releases/download/v" + res.Current + "/hyprspace-v" + res.Current + "-" + runtime.GOOS + "-" + runtime.GOARCH
|
||||
|
||||
doneChan := make(chan int, 1)
|
||||
wg := sync.WaitGroup{}
|
||||
wg.Add(1)
|
||||
|
||||
// Display Spinner on Update.
|
||||
go SpinnerWait(doneChan, "Updating Hyprspace...", &wg)
|
||||
|
||||
resp, err := http.Get(url)
|
||||
checkErr(err)
|
||||
|
||||
defer resp.Body.Close()
|
||||
err = update.Apply(resp.Body, update.Options{})
|
||||
checkErr(err)
|
||||
|
||||
doneChan <- 0
|
||||
wg.Wait()
|
||||
|
||||
fmt.Print("\rUpdating Hyprspace: Done!\n")
|
||||
} else {
|
||||
fmt.Println("Already Up-To-Date!")
|
||||
}
|
||||
}
|
|
@ -4,7 +4,6 @@ go 1.18
|
|||
|
||||
require (
|
||||
github.com/DataDrake/cli-ng/v2 v2.0.2
|
||||
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf
|
||||
github.com/ipfs/go-datastore v0.6.0
|
||||
github.com/libp2p/go-libp2p v0.23.2
|
||||
github.com/libp2p/go-libp2p-core v0.20.1
|
||||
|
@ -14,7 +13,6 @@ require (
|
|||
github.com/multiformats/go-multibase v0.1.1
|
||||
github.com/nxadm/tail v1.4.8
|
||||
github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8
|
||||
github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e
|
||||
github.com/vishvananda/netlink v1.1.0
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
)
|
||||
|
@ -37,14 +35,11 @@ require (
|
|||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang/mock v1.6.0 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/google/go-github v17.0.0+incompatible // indirect
|
||||
github.com/google/go-querystring v1.1.0 // indirect
|
||||
github.com/google/gopacket v1.1.19 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/gorilla/websocket v1.5.0 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-version v1.6.0 // indirect
|
||||
github.com/hashicorp/golang-lru v0.5.4 // indirect
|
||||
github.com/huin/goupnp v1.0.3 // indirect
|
||||
github.com/ipfs/go-cid v0.3.2 // indirect
|
||||
|
|
|
@ -176,11 +176,8 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
|||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
|
||||
github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY=
|
||||
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
|
||||
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
|
||||
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/gopacket v1.1.17/go.mod h1:UdDNZ1OO62aGYVnPhxT1U6aI7ukYtA/kB8vaU0diBUM=
|
||||
github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8=
|
||||
|
@ -213,8 +210,6 @@ github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY
|
|||
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
|
||||
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
||||
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
|
||||
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
|
||||
|
@ -225,8 +220,6 @@ github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ=
|
|||
github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y=
|
||||
github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf h1:WfD7VjIE6z8dIvMsI4/s+1qr5EL+zoIGev1BQj1eoJ8=
|
||||
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf/go.mod h1:hyb9oH7vZsitZCiBt0ZvifOrB+qc8PS5IiilCIb87rg=
|
||||
github.com/ipfs/go-cid v0.3.2 h1:OGgOd+JCFM+y1DjWPmVH+2/4POtpDzwcr7VgnB7mZXc=
|
||||
github.com/ipfs/go-cid v0.3.2/go.mod h1:gQ8pKqT/sUxGY+tIwy1RPpAojYu7jAyCp5Tz1svoupw=
|
||||
github.com/ipfs/go-datastore v0.6.0 h1:JKyz+Gvz1QEZw0LsX1IBn+JFCJQH4SJVFtM4uWU0Myk=
|
||||
|
@ -501,8 +494,6 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
|||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
|
||||
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
|
||||
github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e h1:IWllFTiDjjLIf2oeKxpIUmtiDV5sn71VgeQgg6vcE7k=
|
||||
github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e/go.mod h1:d7u6HkTYKSv5m6MCKkOQlHwaShTMl3HjqSGW3XtVhXM=
|
||||
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU=
|
||||
github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM=
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
]);
|
||||
};
|
||||
|
||||
vendorSha256 = "sha256-K1s1zKwzjS2ybj4sF20s+G2px9jfzqeA2rimoKCOPvo=";
|
||||
vendorSha256 = "sha256-lxJZ4W+VY1XWLePrT0uLT2Y2tIOETLzn8NC8FVDruNM=";
|
||||
|
||||
meta = with lib; {
|
||||
description = "A Lightweight VPN Built on top of Libp2p for Truly Distributed Networks.";
|
||||
|
|
Loading…
Reference in a new issue