Add list option to unsquashfs
This commit is contained in:
@@ -3,7 +3,9 @@ package main
|
|||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/CalebQ42/squashfs"
|
"github.com/CalebQ42/squashfs"
|
||||||
@@ -11,6 +13,7 @@ import (
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
verbose := flag.Bool("v", false, "Verbose")
|
verbose := flag.Bool("v", false, "Verbose")
|
||||||
|
list := flag.Bool("l", false, "List")
|
||||||
ignore := flag.Bool("ip", false, "Ignore Permissions and extract all files/folders with 0755")
|
ignore := flag.Bool("ip", false, "Ignore Permissions and extract all files/folders with 0755")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
if len(flag.Args()) < 2 {
|
if len(flag.Args()) < 2 {
|
||||||
@@ -25,6 +28,17 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
if *list {
|
||||||
|
root := flag.Arg(1)
|
||||||
|
fs.WalkDir(r, ".", func(path string, d fs.DirEntry, err error) error {
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
fmt.Println(filepath.Join(root, path))
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
op := squashfs.DefaultOptions()
|
op := squashfs.DefaultOptions()
|
||||||
op.Verbose = *verbose
|
op.Verbose = *verbose
|
||||||
op.IgnorePerm = *ignore
|
op.IgnorePerm = *ignore
|
||||||
|
|||||||
Reference in New Issue
Block a user