Unpack a browser successfully
This commit is contained in:
4
Makefile
4
Makefile
@ -102,4 +102,6 @@ gen: copy-linux
|
||||
test:
|
||||
cd import && GO111MODULE=off go test
|
||||
|
||||
|
||||
fmt:
|
||||
find import -name '*.go' -exec gofmt -w -s {} \;
|
||||
gofmt -w -s *.go
|
||||
|
7
gen.go
7
gen.go
@ -21,8 +21,7 @@ var UPPERCASE = "GINGERSHREW"
|
||||
var Full_Name = "Free GingerShrew"
|
||||
var Developer = "From A Tiny Rodent"
|
||||
var Foundation = "No Foundation"
|
||||
var Corporation ="No Corporation"
|
||||
|
||||
var Corporation = "No Corporation"
|
||||
|
||||
var unpacker = `package REPLACEME
|
||||
|
||||
@ -163,8 +162,8 @@ func splitBinaries() error {
|
||||
}
|
||||
chunkSize := len(bytes) / 12
|
||||
for index, lib := range libs {
|
||||
start := index * chunkSize
|
||||
finish := ((index+1) * chunkSize)
|
||||
start := index * chunkSize
|
||||
finish := ((index + 1) * chunkSize)
|
||||
if index == 11 {
|
||||
finish = len(bytes)
|
||||
}
|
||||
|
@ -2,6 +2,10 @@ package gingershrew
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/mholt/archiver/v3"
|
||||
|
||||
"github.com/eyedeekay/gingershrew/parts/aa"
|
||||
"github.com/eyedeekay/gingershrew/parts/ab"
|
||||
@ -93,3 +97,22 @@ func WriteTBZ() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func UnpackTBZ(destinationDirectory string) error {
|
||||
if destinationDirectory == "" {
|
||||
destinationDirectory = "."
|
||||
}
|
||||
err := os.RemoveAll(filepath.Join(destinationDirectory, "gingershrew"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = WriteTBZ()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = archiver.Unarchive("gingershrew-68.9.0.en-US.linux-x86_64.tar.bz2", destinationDirectory)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
)
|
||||
|
||||
func TestWriteTBZ(t *testing.T) {
|
||||
if err := WriteTBZ(); err != nil {
|
||||
if err := UnpackTBZ(""); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("Success")
|
||||
|
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
// "io/ioutil"
|
||||
// "io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
// "io/ioutil"
|
||||
// "io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
// "io/ioutil"
|
||||
// "io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
Reference in New Issue
Block a user