Unpack a browser successfully

This commit is contained in:
idk
2020-06-29 02:17:22 -04:00
parent 9e78bcc519
commit 2596be4416
10 changed files with 93 additions and 69 deletions

View File

@ -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
View File

@ -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)
}

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -4,7 +4,7 @@ import (
"bytes"
"fmt"
"io"
// "io/ioutil"
// "io/ioutil"
"log"
"os"
"path/filepath"