Compare commits
136 Commits
feature/te
...
2.1
Author | SHA1 | Date | |
---|---|---|---|
|
c9de619f98 | ||
|
a519769979 | ||
|
128a48dd24 | ||
|
499136e83a | ||
|
78f8fa32fb | ||
|
d03257981f | ||
|
307fb1889f | ||
|
fa3d3268d7 | ||
|
8b67848d5c | ||
|
31ab72edbc | ||
|
bd239c0365 | ||
|
a4c3b9ff96 | ||
|
8f505ffdc8 | ||
|
fb00e9e94b | ||
|
7c2377d0c8 | ||
|
f24d0139c9 | ||
|
5e2f975bd3 | ||
|
786e09d855 | ||
|
ba1e1a77db | ||
|
fd11f4a627 | ||
|
322d6bb754 | ||
|
1f4d8737e8 | ||
|
52fc741ba8 | ||
|
31b7eb34ee | ||
|
4e97990804 | ||
|
c01b48ad25 | ||
|
6aec4d564c | ||
|
6eb01e91e6 | ||
|
790cf47060 | ||
|
4074eada55 | ||
|
a7c4fe83ce | ||
|
06f86aadc9 | ||
|
d87a33a751 | ||
|
d1e150242d | ||
|
5968622f60 | ||
|
0179a0ca5c | ||
|
33c61b3c94 | ||
|
e4fb6cef70 | ||
|
4ae678d8ce | ||
|
71c2a87d56 | ||
|
9bb326be91 | ||
|
0545d68b1d | ||
|
c6e79551f4 | ||
|
a9f4281fbd | ||
|
bb50041257 | ||
|
09c897e737 | ||
|
a8bb10ce9c | ||
|
5e65ace958 | ||
|
cbcd4408e3 | ||
|
ad560591e1 | ||
|
89f1e067da | ||
|
4259478755 | ||
|
347668caa3 | ||
|
b0e28b4215 | ||
|
c1d96f699c | ||
|
25c3c03e24 | ||
|
07c8c711c7 | ||
|
e772fe0c87 | ||
|
6f05222018 | ||
|
c23af8b541 | ||
|
bd09de9232 | ||
|
22692e48d2 | ||
|
6c2f7b972b | ||
|
e5002f5750 | ||
|
662f559286 | ||
|
a4be663e13 | ||
|
14873015c0 | ||
|
6fdc8937b5 | ||
|
fb52066d8f | ||
|
b7f520cba4 | ||
|
31bf38f663 | ||
|
71d8131bb0 | ||
|
8b99b5f45b | ||
|
e8854ff88d | ||
|
1eb35cf8ef | ||
|
696633629a | ||
|
d9b68843a3 | ||
|
93005527e0 | ||
|
1c5f16762f | ||
|
af97d4654f | ||
|
b25c9bd390 | ||
|
1a0d00e39f | ||
|
af3c47c784 | ||
|
e7bbd1cadf | ||
|
1531d7e790 | ||
|
6d77b7a2d1 | ||
|
2dd83da480 | ||
|
e00e5faf6e | ||
|
5e07b63084 | ||
|
95582ee034 | ||
|
94584050ee | ||
|
e0977b4ac1 | ||
|
4176a8a661 | ||
|
73fd85f68c | ||
|
7e80107bbe | ||
|
f714f110a1 | ||
|
690d008643 | ||
|
731a805a9e | ||
|
b90624d7dd | ||
|
2a75cf9b4e | ||
|
d52cc16c88 | ||
|
112b572dc2 | ||
|
0c0a85f3bb | ||
|
2761535e12 | ||
|
1a72589f6f | ||
|
df0b5d66d7 | ||
|
c5f1cffca5 | ||
|
7eed20e35f | ||
|
e71cab485d | ||
|
568fe7f717 | ||
|
d78c6d5a62 | ||
|
c774b610d4 | ||
|
1e00f8f1cc | ||
|
28eed4fd12 | ||
|
c9ac9d9dd6 | ||
|
a4927a8915 | ||
|
029bdd849d | ||
|
8d21ae79c0 | ||
|
4278763cdb | ||
|
a6165b3a8c | ||
|
0eacd26615 | ||
|
e926bb301c | ||
|
961c455d59 | ||
|
4f601087e1 | ||
|
8b18e444a3 | ||
|
62c52e749e | ||
|
463ff1a7e4 | ||
|
3787944141 | ||
|
584a8e4e2a | ||
|
cdf41938b0 | ||
|
3d02037e3a | ||
|
6e2b4af336 | ||
|
9843f8a9c3 | ||
|
4b8a0a0d18 | ||
|
338c89504f | ||
|
c07eafd087 |
@@ -1,13 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
echo "### Running gofmt..."
|
|
||||||
files="$(gofmt -l .)"
|
|
||||||
|
|
||||||
if [ ! -z "$files" ]; then
|
|
||||||
# run gofmt to print out the diff of what needs to be changed
|
|
||||||
gofmt -d -e .
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "### Running staticcheck..."
|
|
||||||
staticcheck ./...
|
|
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1 +1,5 @@
|
|||||||
/postmarketos-mkinitfs
|
/*.1
|
||||||
|
/*.tar.gz
|
||||||
|
/*.sha512
|
||||||
|
/mkinitfs
|
||||||
|
/vendor
|
||||||
|
@@ -3,9 +3,15 @@
|
|||||||
# global settings
|
# global settings
|
||||||
image: alpine:edge
|
image: alpine:edge
|
||||||
|
|
||||||
|
variables:
|
||||||
|
GOFLAGS: "-buildvcs=false"
|
||||||
|
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/mkinitfs-vendor-${CI_COMMIT_TAG}/${CI_COMMIT_TAG}"
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- lint
|
- lint
|
||||||
- build
|
- build
|
||||||
|
- vendor
|
||||||
|
- release
|
||||||
|
|
||||||
# defaults for "only"
|
# defaults for "only"
|
||||||
# We need to run the CI jobs in a "merge request specific context", if CI is
|
# We need to run the CI jobs in a "merge request specific context", if CI is
|
||||||
@@ -21,25 +27,37 @@ stages:
|
|||||||
- merge_requests
|
- merge_requests
|
||||||
- tags
|
- tags
|
||||||
|
|
||||||
# device documentation
|
|
||||||
gofmt linting:
|
|
||||||
stage: lint
|
|
||||||
allow_failure: true
|
|
||||||
<<: *only-default
|
|
||||||
before_script:
|
|
||||||
# specific mirror used because staticcheck hasn't made it to the other mirrors yet...
|
|
||||||
- apk -q update --repository http://dl-4.alpinelinux.org/alpine/edge/testing
|
|
||||||
- apk -q add --repository http://dl-4.alpinelinux.org/alpine/edge/testing go staticcheck
|
|
||||||
script:
|
|
||||||
- .ci/check_linting.sh
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
<<: *only-default
|
<<: *only-default
|
||||||
before_script:
|
before_script:
|
||||||
- apk -q add go
|
- apk -q add go staticcheck make scdoc
|
||||||
script:
|
script:
|
||||||
- go build -v
|
- make test
|
||||||
- go test ./...
|
- make
|
||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
|
|
||||||
|
vendor:
|
||||||
|
stage: vendor
|
||||||
|
image: alpine:latest
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
before_script:
|
||||||
|
- apk -q add curl go make
|
||||||
|
script:
|
||||||
|
- |
|
||||||
|
make VERSION="${CI_COMMIT_TAG}" vendor
|
||||||
|
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file "mkinitfs-vendor-${CI_COMMIT_TAG}.tar.gz" "${PACKAGE_REGISTRY_URL}/"
|
||||||
|
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file "mkinitfs-vendor-${CI_COMMIT_TAG}.tar.gz.sha512" "${PACKAGE_REGISTRY_URL}/"
|
||||||
|
|
||||||
|
release:
|
||||||
|
stage: release
|
||||||
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
script:
|
||||||
|
- |
|
||||||
|
release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
|
||||||
|
--assets-link "{\"name\":\"mkinitfs-vendor-${CI_COMMIT_TAG}.tar.gz\",\"url\":\"${PACKAGE_REGISTRY_URL}/mkinitfs-vendor-${CI_COMMIT_TAG}.tar.gz\"}" \
|
||||||
|
--assets-link "{\"name\":\"mkinitfs-vendor-${CI_COMMIT_TAG}.tar.gz.sha512\",\"url\":\"${PACKAGE_REGISTRY_URL}/mkinitfs-vendor-${CI_COMMIT_TAG}.tar.gz.sha512\"}"
|
||||||
|
74
Makefile
Normal file
74
Makefile
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
.POSIX:
|
||||||
|
.SUFFIXES: .1 .1.scd
|
||||||
|
|
||||||
|
VERSION?=$(shell git describe --tags --dirty 2>/dev/null || echo 0.0.0)
|
||||||
|
VPATH=doc
|
||||||
|
VENDORED="mkinitfs-vendor-$(VERSION)"
|
||||||
|
PREFIX?=/usr/local
|
||||||
|
BINDIR?=$(PREFIX)/sbin
|
||||||
|
MANDIR?=$(PREFIX)/share/man
|
||||||
|
SHAREDIR?=$(PREFIX)/share
|
||||||
|
GO?=go
|
||||||
|
GOFLAGS?=
|
||||||
|
LDFLAGS+=-s -w -X main.Version=$(VERSION)
|
||||||
|
RM?=rm -f
|
||||||
|
GOTEST=go test -count=1 -race
|
||||||
|
|
||||||
|
GOSRC!=find * -name '*.go'
|
||||||
|
GOSRC+=go.mod go.sum
|
||||||
|
|
||||||
|
DOCS := \
|
||||||
|
mkinitfs.1
|
||||||
|
|
||||||
|
all: mkinitfs $(DOCS)
|
||||||
|
|
||||||
|
mkinitfs: $(GOSRC)
|
||||||
|
$(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o mkinitfs ./cmd/mkinitfs
|
||||||
|
|
||||||
|
.1.scd.1:
|
||||||
|
scdoc < $< > $@
|
||||||
|
|
||||||
|
doc: $(DOCS)
|
||||||
|
|
||||||
|
.PHONY: fmt
|
||||||
|
fmt:
|
||||||
|
gofmt -w .
|
||||||
|
|
||||||
|
test:
|
||||||
|
@if [ `gofmt -l . | wc -l` -ne 0 ]; then \
|
||||||
|
gofmt -d .; \
|
||||||
|
echo "ERROR: source files need reformatting with gofmt"; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
@staticcheck ./...
|
||||||
|
|
||||||
|
@$(GOTEST) ./...
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) mkinitfs $(DOCS)
|
||||||
|
$(RM) $(VENDORED)*
|
||||||
|
|
||||||
|
install: $(DOCS) mkinitfs
|
||||||
|
install -Dm755 mkinitfs -t $(DESTDIR)$(BINDIR)/
|
||||||
|
install -Dm644 mkinitfs.1 -t $(DESTDIR)$(MANDIR)/man1/
|
||||||
|
|
||||||
|
.PHONY: checkinstall
|
||||||
|
checkinstall:
|
||||||
|
test -e $(DESTDIR)$(BINDIR)/mkinitfs
|
||||||
|
test -e $(DESTDIR)$(MANDIR)/man1/mkinitfs.1
|
||||||
|
|
||||||
|
RMDIR_IF_EMPTY:=sh -c '! [ -d $$0 ] || ls -1qA $$0 | grep -q . || rmdir $$0'
|
||||||
|
|
||||||
|
vendor:
|
||||||
|
go mod vendor
|
||||||
|
tar czf $(VENDORED).tar.gz vendor/
|
||||||
|
sha512sum $(VENDORED).tar.gz > $(VENDORED).tar.gz.sha512
|
||||||
|
$(RM) -rf vendor
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
$(RM) $(DESTDIR)$(BINDIR)/mkinitfs
|
||||||
|
${RMDIR_IF_EMPTY} $(DESTDIR)$(BINDIR)
|
||||||
|
$(RM) $(DESTDIR)$(MANDIR)/man1/mkinitfs.1
|
||||||
|
$(RMDIR_IF_EMPTY) $(DESTDIR)$(MANDIR)/man1
|
||||||
|
|
||||||
|
.PHONY: all clean install uninstall test vendor
|
48
README.md
Normal file
48
README.md
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
`mkinitfs` is a tool for generating an initramfs. It was originally designed
|
||||||
|
for postmarketOS, but a long term design goal is to be as distro-agnostic as
|
||||||
|
possible. It's capable of generating a split initramfs, in the style used by
|
||||||
|
postmarketOS, and supports running `boot-deploy` to install/finalize boot files
|
||||||
|
on a device.
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
Building this project requires a Go compiler/toolchain and `make`:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ make
|
||||||
|
```
|
||||||
|
|
||||||
|
To install locally:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ make install
|
||||||
|
```
|
||||||
|
|
||||||
|
Installation prefix can be set in the generally accepted way with setting
|
||||||
|
`PREFIX`:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ make PREFIX=/some/location
|
||||||
|
# make PREFIX=/some/location install
|
||||||
|
```
|
||||||
|
|
||||||
|
Other paths can be modified from the command line as well, see the top section of
|
||||||
|
the `Makefile` for more information.
|
||||||
|
|
||||||
|
Tests (functional and linting) can be executed by using the `test` make target:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ make test
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
The tool can be run with no options:
|
||||||
|
|
||||||
|
```
|
||||||
|
# mkinitfs
|
||||||
|
```
|
||||||
|
|
||||||
|
Configuration is done through a series of flat text files that list directories
|
||||||
|
and files, and by placing scripts in specific directories. See `man 1 mkinitfs`
|
||||||
|
for more information.
|
171
cmd/mkinitfs/main.go
Normal file
171
cmd/mkinitfs/main.go
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
// Copyright 2022 Clayton Craft <clayton@craftyguy.net>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/archive"
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/bootdeploy"
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/filelist"
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/filelist/hookdirs"
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/filelist/hookfiles"
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/filelist/hookscripts"
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/filelist/initramfs"
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/filelist/modules"
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/filelist/osksdl"
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/misc"
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/osutil"
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/pkgs/deviceinfo"
|
||||||
|
)
|
||||||
|
|
||||||
|
// set at build time
|
||||||
|
var Version string
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
retCode := 0
|
||||||
|
defer func() { os.Exit(retCode) }()
|
||||||
|
|
||||||
|
outDir := flag.String("d", "/boot", "Directory to output initfs(-extra) and other boot files")
|
||||||
|
|
||||||
|
var showVersion bool
|
||||||
|
flag.BoolVar(&showVersion, "version", false, "Print version and quit.")
|
||||||
|
|
||||||
|
var disableBootDeploy bool
|
||||||
|
flag.BoolVar(&disableBootDeploy, "no-bootdeploy", false, "Disable running 'boot-deploy' after generating archives.")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
if showVersion {
|
||||||
|
fmt.Printf("%s - %s\n", filepath.Base(os.Args[0]), Version)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Default().SetFlags(log.Lmicroseconds)
|
||||||
|
|
||||||
|
deviceinfoFile := "/etc/deviceinfo"
|
||||||
|
if exists, err := misc.Exists(deviceinfoFile); !exists {
|
||||||
|
log.Printf("NOTE: %q not found, this file is required by mkinitfs.\n", deviceinfoFile)
|
||||||
|
return
|
||||||
|
} else if err != nil {
|
||||||
|
retCode = 1
|
||||||
|
log.Printf("received unexpected error when getting status for %q: %s", deviceinfoFile, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
devinfo, err := deviceinfo.ReadDeviceinfo(deviceinfoFile)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
retCode = 1
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
defer misc.TimeFunc(time.Now(), "mkinitfs")
|
||||||
|
|
||||||
|
kernVer, err := osutil.GetKernelVersion()
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
retCode = 1
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// temporary working dir
|
||||||
|
workDir, err := os.MkdirTemp("", "mkinitfs")
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
log.Println("unable to create temporary work directory")
|
||||||
|
retCode = 1
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
e := os.RemoveAll(workDir)
|
||||||
|
if e != nil && err == nil {
|
||||||
|
err = e
|
||||||
|
retCode = 1
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
log.Print("Generating for kernel version: ", kernVer)
|
||||||
|
log.Print("Output directory: ", *outDir)
|
||||||
|
|
||||||
|
// deviceinfo.InitfsCompression needs a little more post-processing
|
||||||
|
compressionFormat, compressionLevel := archive.ExtractFormatLevel(devinfo.InitfsCompression)
|
||||||
|
if err := generateArchive("initramfs", compressionFormat, compressionLevel, workDir, []filelist.FileLister{
|
||||||
|
hookdirs.New("/usr/share/mkinitfs/dirs"),
|
||||||
|
hookdirs.New("/etc/mkinitfs/dirs"),
|
||||||
|
hookfiles.New("/usr/share/mkinitfs/files"),
|
||||||
|
hookfiles.New("/etc/mkinitfs/files"),
|
||||||
|
hookscripts.New("/usr/share/mkinitfs/hooks", "/hooks"),
|
||||||
|
hookscripts.New("/etc/mkinitfs/hooks", "/hooks"),
|
||||||
|
modules.New(strings.Fields(devinfo.ModulesInitfs), "/usr/share/mkinitfs/modules"),
|
||||||
|
modules.New([]string{}, "/etc/mkinitfs/modules"),
|
||||||
|
}); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
log.Println("failed to generate: ", "initramfs")
|
||||||
|
retCode = 1
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// deviceinfo.InitfsExtraCompression needs a little more post-processing
|
||||||
|
compressionFormat, compressionLevel = archive.ExtractFormatLevel(devinfo.InitfsExtraCompression)
|
||||||
|
if err := generateArchive("initramfs-extra", compressionFormat, compressionLevel, workDir, []filelist.FileLister{
|
||||||
|
hookfiles.New("/usr/share/mkinitfs/files-extra"),
|
||||||
|
hookfiles.New("/etc/mkinitfs/files-extra"),
|
||||||
|
hookscripts.New("/usr/share/mkinitfs/hooks-extra", "/hooks-extra"),
|
||||||
|
hookscripts.New("/etc/mkinitfs/hooks-extra", "/hooks-extra"),
|
||||||
|
modules.New([]string{}, "/usr/share/mkinitfs/modules-extra"),
|
||||||
|
modules.New([]string{}, "/etc/mkinitfs/modules-extra"),
|
||||||
|
osksdl.New(devinfo.MesaDriver),
|
||||||
|
}); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
log.Println("failed to generate: ", "initramfs-extra")
|
||||||
|
retCode = 1
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Final processing of initramfs / kernel is done by boot-deploy
|
||||||
|
if !disableBootDeploy {
|
||||||
|
if err := bootDeploy(workDir, *outDir, devinfo.UbootBoardname); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
log.Println("boot-deploy failed")
|
||||||
|
retCode = 1
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func bootDeploy(workDir, outDir, ubootBoardname string) error {
|
||||||
|
log.Print("== Using boot-deploy to finalize/install files ==")
|
||||||
|
defer misc.TimeFunc(time.Now(), "boot-deploy")
|
||||||
|
|
||||||
|
bd := bootdeploy.New(workDir, outDir, ubootBoardname)
|
||||||
|
return bd.Run()
|
||||||
|
}
|
||||||
|
|
||||||
|
func generateArchive(name string, format archive.CompressFormat, level archive.CompressLevel, path string, features []filelist.FileLister) error {
|
||||||
|
log.Printf("== Generating %s ==\n", name)
|
||||||
|
log.Printf("- Using compression format %s with level %q\n", format, level)
|
||||||
|
|
||||||
|
defer misc.TimeFunc(time.Now(), name)
|
||||||
|
a, err := archive.New(format, level)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fs := initramfs.New(features)
|
||||||
|
if err := a.AddItems(fs); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Println("- Writing and verifying archive: ", name)
|
||||||
|
if err := a.Write(filepath.Join(path, name), os.FileMode(0644)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
122
doc/mkinitfs.1.scd
Normal file
122
doc/mkinitfs.1.scd
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
mkinitfs(1) "mkinitfs"
|
||||||
|
|
||||||
|
# NAME
|
||||||
|
|
||||||
|
mkinitfs
|
||||||
|
|
||||||
|
# DESCRIPTION
|
||||||
|
|
||||||
|
mkinitfs is a simple, generic tool for generating an initramfs, primarily
|
||||||
|
developed for use in postmarketOS
|
||||||
|
|
||||||
|
# CONCEPTS
|
||||||
|
|
||||||
|
mkinitfs is designed to generate two archives, "initramfs" and
|
||||||
|
"initramfs-extra", however it's possible to configure mkinitfs to run without
|
||||||
|
generating an initramfs-extra archive. mkinitfs is primarily configured through
|
||||||
|
the placement of files in specific directories detailed below in the
|
||||||
|
*DIRECTORIES* section. *deviceinfo* files are also used to provide other
|
||||||
|
configuration options to mkinitfs, these are covered under the *DEVICEINFO*
|
||||||
|
section below.
|
||||||
|
|
||||||
|
mkinitfs does not provide an init script, or any boot-time logic, it's purpose
|
||||||
|
is purely to generate the archive(s). mkinitfs does call *boot-deploy* after
|
||||||
|
creating the archive(s), in order to install/deploy them and any other relevant
|
||||||
|
boot-related items onto the system.
|
||||||
|
|
||||||
|
# DEVICEINFO
|
||||||
|
|
||||||
|
The canonical deviceinfo "specification" is at
|
||||||
|
https://wiki.postmarketos.org/wiki/Deviceinfo_reference
|
||||||
|
|
||||||
|
mkinitfs reads deviceinfo values from */etc/deviceinfo*. The following variables
|
||||||
|
are *required* by mkinitfs:
|
||||||
|
|
||||||
|
- deviceinfo_initfs_compression
|
||||||
|
- deviceinfo_initfs_extra_compression
|
||||||
|
- deviceinfo_mesa_driver
|
||||||
|
- deviceinfo_modules_initfs
|
||||||
|
- deviceinfo_uboot_boardname
|
||||||
|
|
||||||
|
It is a design goal to keep the number of required variables from deviceinfo to
|
||||||
|
a bare minimum, and to require only variables that don't hold lists of things.
|
||||||
|
|
||||||
|
*NOTE*: When deviceinfo_initfs_extra_compression is set, make sure that the
|
||||||
|
necessary tools to extract the configured archive format are in the initramfs
|
||||||
|
archive.
|
||||||
|
|
||||||
|
# DIRECTORIES
|
||||||
|
|
||||||
|
The following directories are used by mkinitfs to generate the initramfs and
|
||||||
|
initramfs-extra archives. Directories that end in *-extra* indicate directories
|
||||||
|
that are used for constructing the initramfs-extra archive, while those without
|
||||||
|
it are for constructing the initramfs archive.
|
||||||
|
|
||||||
|
Configuration under */usr/share/mkinitfs* is intended to be managed by
|
||||||
|
distributions, while configuration under */etc/mkinitfs* is for users to
|
||||||
|
create/manage. mkinitfs reads configuration from */usr/share/mkinitfs* first, and then from */etc/mkinitfs*.
|
||||||
|
|
||||||
|
## /usr/share/mkinitfs/files, /etc/mkinitfs/files
|
||||||
|
## /usr/share/mkinitfs/files-extra, /etc/mkinitfs/files-extra
|
||||||
|
|
||||||
|
Files with the *.files* extension are read as a list of
|
||||||
|
files/directories. Each line is in the format:
|
||||||
|
|
||||||
|
```
|
||||||
|
<source path>:<destination path>
|
||||||
|
```
|
||||||
|
|
||||||
|
The source path is the location, at runtime, of the file or directory
|
||||||
|
which will be copied to the destination path within the initramfs
|
||||||
|
archive. Specifying a destination path, with *:<destination path>* is
|
||||||
|
optional. If it is omitted, then the source path will be used as the
|
||||||
|
destination path within the archive. The source and destination paths
|
||||||
|
are delimited by a *:* (colon.) Destination path is ignored if the source
|
||||||
|
path is a glob that returns more than 1 file. This may change in the future.
|
||||||
|
|
||||||
|
[[ *Line in .files*
|
||||||
|
:< Comment
|
||||||
|
| */usr/share/bazz*
|
||||||
|
: File or directory */usr/share/bazz* would be added to the archive under */usr/share/bazz*
|
||||||
|
| */usr/share/bazz:/bazz*
|
||||||
|
: File or directory */usr/share/bazz* would be added to the archive under */bazz*
|
||||||
|
| */root/something/\**
|
||||||
|
: Everything under */root/something* would be added to the archive under */root/something*
|
||||||
|
| */etc/foo/\*/bazz:/foo*
|
||||||
|
: Anything that matches the glob will be installed under the source path in the archive. For example, */etc/foo/bar/bazz* would be installed at */etc/foo/bar/bazz* in the archive. The destination path is ignored.
|
||||||
|
|
||||||
|
It's possible to overwrite file/directory destinations from
|
||||||
|
configuration in */usr/share/mkinitfs* by specifying the same source
|
||||||
|
path(s) under the relevant directory in */etc/mkinitfs*, and changing
|
||||||
|
the destination path.
|
||||||
|
|
||||||
|
## /usr/share/mkinitfs/hooks, /etc/mkinitfs/hooks
|
||||||
|
## /usr/share/mkinitfs/hooks-extra*, /etc/mkinitfs/hooks-extra
|
||||||
|
|
||||||
|
Any files listed under these directories are copied as-is into the
|
||||||
|
relevant archives. Hooks are generally script files, but how they are
|
||||||
|
treated in the initramfs is entirely up to whatever init script is run
|
||||||
|
there on boot.
|
||||||
|
|
||||||
|
Hooks are installed in the initramfs under the */hooks* directory, and
|
||||||
|
under */hooks-extra* for the initramfs-extra.
|
||||||
|
|
||||||
|
## /usr/share/mkinitfs/modules, /etc/mkinitfs/modules
|
||||||
|
## /usr/share/mkinitfs/modules-extra, /etc/mkinitfs/modules-extra
|
||||||
|
|
||||||
|
Files with the *.modules* extention in these directories are lists of
|
||||||
|
kernel modules to include in the initramfs. Individual modules and
|
||||||
|
directories can be listed in the files here. Globbing is also supported.
|
||||||
|
|
||||||
|
Modules are installed in the initramfs archive under the same path they
|
||||||
|
exist on the system where mkinitfs is executed.
|
||||||
|
|
||||||
|
## /usr/share/mkinitfs/dirs, /etc/mkinitfs/dirs
|
||||||
|
|
||||||
|
Files with the *.dirs* extension in these directories are lists of
|
||||||
|
directories to create within the initramfs. There is no *-extra* variant,
|
||||||
|
since directories are of negligible size.
|
||||||
|
|
||||||
|
# AUTHORS
|
||||||
|
|
||||||
|
*Clayton Craft* <clayton@craftyguy.net>
|
7
go.mod
7
go.mod
@@ -1,11 +1,10 @@
|
|||||||
module gitlab.com/postmarketOS/postmarketos-mkinitfs
|
module gitlab.com/postmarketOS/postmarketos-mkinitfs
|
||||||
|
|
||||||
go 1.16
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/cavaliercoder/go-cpio v0.0.0-20180626203310-925f9528c45e
|
github.com/cavaliercoder/go-cpio v0.0.0-20180626203310-925f9528c45e
|
||||||
github.com/klauspost/compress v1.13.3 // indirect
|
github.com/klauspost/compress v1.15.12
|
||||||
github.com/klauspost/pgzip v1.2.5
|
github.com/ulikunitz/xz v0.5.10
|
||||||
github.com/spf13/afero v1.7.1
|
|
||||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c
|
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c
|
||||||
)
|
)
|
||||||
|
442
go.sum
442
go.sum
@@ -1,442 +1,8 @@
|
|||||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
|
||||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
|
||||||
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
|
|
||||||
cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
|
|
||||||
cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
|
|
||||||
cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
|
|
||||||
cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
|
|
||||||
cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
|
|
||||||
cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=
|
|
||||||
cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4=
|
|
||||||
cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=
|
|
||||||
cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc=
|
|
||||||
cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk=
|
|
||||||
cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=
|
|
||||||
cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=
|
|
||||||
cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=
|
|
||||||
cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI=
|
|
||||||
cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk=
|
|
||||||
cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY=
|
|
||||||
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
|
|
||||||
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
|
|
||||||
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
|
|
||||||
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
|
|
||||||
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
|
|
||||||
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
|
|
||||||
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
|
||||||
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
|
|
||||||
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
|
||||||
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
|
|
||||||
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
|
|
||||||
cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=
|
|
||||||
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
|
|
||||||
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
|
|
||||||
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
|
|
||||||
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
|
|
||||||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
|
||||||
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
|
|
||||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
|
||||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
|
||||||
github.com/cavaliercoder/go-cpio v0.0.0-20180626203310-925f9528c45e h1:hHg27A0RSSp2Om9lubZpiMgVbvn39bsUmW9U5h0twqc=
|
github.com/cavaliercoder/go-cpio v0.0.0-20180626203310-925f9528c45e h1:hHg27A0RSSp2Om9lubZpiMgVbvn39bsUmW9U5h0twqc=
|
||||||
github.com/cavaliercoder/go-cpio v0.0.0-20180626203310-925f9528c45e/go.mod h1:oDpT4efm8tSYHXV5tHSdRvBet/b/QzxZ+XyyPehvm3A=
|
github.com/cavaliercoder/go-cpio v0.0.0-20180626203310-925f9528c45e/go.mod h1:oDpT4efm8tSYHXV5tHSdRvBet/b/QzxZ+XyyPehvm3A=
|
||||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
github.com/klauspost/compress v1.15.12 h1:YClS/PImqYbn+UILDnqxQCZ3RehC9N318SU3kElDUEM=
|
||||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
github.com/klauspost/compress v1.15.12/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM=
|
||||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8=
|
||||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
|
||||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
|
||||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
|
||||||
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
|
||||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
|
||||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
|
||||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
|
||||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
|
||||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
|
||||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
|
||||||
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
|
||||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
|
||||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
|
||||||
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
|
||||||
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
|
|
||||||
github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
|
||||||
github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
|
||||||
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
|
||||||
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
|
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
|
||||||
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
|
||||||
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
|
||||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
|
||||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
|
||||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
|
||||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
|
||||||
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
|
||||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
|
||||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
|
||||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
|
||||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
|
||||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
|
||||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
|
||||||
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
|
||||||
github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
|
||||||
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
|
||||||
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
|
||||||
github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
|
||||||
github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
|
||||||
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
|
||||||
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
|
||||||
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
|
||||||
github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
|
||||||
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
|
||||||
github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
|
||||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
|
||||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
|
||||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
|
||||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
|
||||||
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
|
|
||||||
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/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
|
||||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
|
||||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
|
||||||
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
|
|
||||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
|
||||||
github.com/klauspost/compress v1.13.3 h1:BtAvtV1+h0YwSVwWoYXMREPpYu9VzTJ9QDI1TEg/iQQ=
|
|
||||||
github.com/klauspost/compress v1.13.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
|
|
||||||
github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=
|
|
||||||
github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
|
|
||||||
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
|
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
|
||||||
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
|
||||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
|
||||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
|
||||||
github.com/spf13/afero v1.7.1 h1:F37zV8E8RLstLpZ0RUGK2NGg1X57y6/B0Eg6S8oqdoA=
|
|
||||||
github.com/spf13/afero v1.7.1/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo=
|
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
|
||||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
|
||||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
|
||||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
|
||||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
|
||||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
|
||||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
|
||||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
|
||||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
|
||||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
|
||||||
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
|
||||||
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
|
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
|
||||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
|
||||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
|
||||||
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
|
||||||
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
|
||||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
|
||||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
|
||||||
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
|
|
||||||
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
|
|
||||||
golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
|
||||||
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
|
||||||
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
|
||||||
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
|
||||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
|
||||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
|
||||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
|
||||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
|
||||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
|
||||||
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
|
||||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
|
||||||
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
|
||||||
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
|
||||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
|
||||||
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
|
|
||||||
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
|
||||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
|
||||||
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
|
||||||
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
|
||||||
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
|
||||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
|
||||||
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
|
||||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
|
||||||
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
|
||||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
|
||||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
|
||||||
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
|
||||||
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
|
||||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
|
||||||
golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
|
||||||
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
|
||||||
golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
|
||||||
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
|
||||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
|
||||||
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
|
||||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
|
||||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
|
||||||
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
|
||||||
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
|
||||||
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
|
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
|
||||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
|
||||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
|
||||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
|
||||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|
||||||
golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc=
|
|
||||||
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|
||||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
|
||||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
|
||||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
|
||||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
|
||||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
|
||||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
|
||||||
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
|
||||||
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
|
||||||
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
|
||||||
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
|
||||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
|
||||||
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
|
||||||
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
|
||||||
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
|
||||||
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
|
|
||||||
golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
|
|
||||||
golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
|
|
||||||
golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
|
||||||
golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
|
||||||
golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
|
||||||
golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
|
||||||
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
|
||||||
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
|
||||||
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
|
||||||
golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=
|
|
||||||
golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
|
||||||
golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
|
||||||
golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
|
||||||
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
|
||||||
golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
|
||||||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
|
||||||
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
|
|
||||||
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
|
||||||
google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
|
||||||
google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
|
||||||
google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
|
||||||
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
|
||||||
google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
|
||||||
google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
|
||||||
google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
|
||||||
google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
|
||||||
google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
|
||||||
google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
|
||||||
google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
|
||||||
google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=
|
|
||||||
google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
|
|
||||||
google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg=
|
|
||||||
google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
|
|
||||||
google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
|
|
||||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
|
||||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
|
||||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
|
||||||
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
|
|
||||||
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
|
||||||
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
|
||||||
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
|
||||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
|
||||||
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
|
||||||
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
|
||||||
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
|
||||||
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
|
||||||
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
|
||||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
|
||||||
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
|
|
||||||
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
|
||||||
google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
|
||||||
google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
|
||||||
google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
|
||||||
google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
|
||||||
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
|
||||||
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
|
|
||||||
google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U=
|
|
||||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
|
||||||
google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=
|
|
||||||
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
|
||||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
|
||||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
|
||||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
|
||||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
|
||||||
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
|
||||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
|
||||||
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
|
||||||
google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
|
|
||||||
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
|
|
||||||
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
|
||||||
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
|
||||||
google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
|
||||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
|
||||||
google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8=
|
|
||||||
google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
|
||||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
|
||||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
|
||||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
|
||||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
|
||||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
|
||||||
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
|
|
||||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
||||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
|
||||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
|
||||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
|
||||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
|
||||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
|
||||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
|
||||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
|
||||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
|
||||||
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
|
||||||
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
|
||||||
|
413
internal/archive/archive.go
Normal file
413
internal/archive/archive.go
Normal file
@@ -0,0 +1,413 @@
|
|||||||
|
// Copyright 2021 Clayton Craft <clayton@craftyguy.net>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
package archive
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"compress/gzip"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"sort"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
|
"github.com/cavaliercoder/go-cpio"
|
||||||
|
"github.com/klauspost/compress/zstd"
|
||||||
|
"github.com/ulikunitz/xz"
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/filelist"
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/osutil"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CompressFormat string
|
||||||
|
|
||||||
|
const (
|
||||||
|
FormatGzip CompressFormat = "gzip"
|
||||||
|
FormatLzma CompressFormat = "lzma"
|
||||||
|
FormatZstd CompressFormat = "zstd"
|
||||||
|
FormatNone CompressFormat = "none"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CompressLevel string
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Mapped to the "default" level for the given format
|
||||||
|
LevelDefault CompressLevel = "default"
|
||||||
|
// Maps to the fastest compression level for the given format
|
||||||
|
LevelFast CompressLevel = "fast"
|
||||||
|
// Maps to the best compression level for the given format
|
||||||
|
LevelBest CompressLevel = "best"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Archive struct {
|
||||||
|
items archiveItems
|
||||||
|
cpioWriter *cpio.Writer
|
||||||
|
buf *bytes.Buffer
|
||||||
|
compress_format CompressFormat
|
||||||
|
compress_level CompressLevel
|
||||||
|
}
|
||||||
|
|
||||||
|
func New(format CompressFormat, level CompressLevel) (*Archive, error) {
|
||||||
|
buf := new(bytes.Buffer)
|
||||||
|
archive := &Archive{
|
||||||
|
cpioWriter: cpio.NewWriter(buf),
|
||||||
|
buf: buf,
|
||||||
|
compress_format: format,
|
||||||
|
compress_level: level,
|
||||||
|
}
|
||||||
|
|
||||||
|
return archive, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type archiveItem struct {
|
||||||
|
sourcePath string
|
||||||
|
header *cpio.Header
|
||||||
|
}
|
||||||
|
|
||||||
|
type archiveItems struct {
|
||||||
|
items []archiveItem
|
||||||
|
sync.RWMutex
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExtractFormatLevel parses the given string in the format format[:level],
|
||||||
|
// where :level is one of CompressLevel consts. If level is omitted from the
|
||||||
|
// string, or if it can't be parsed, the level is set to the default level for
|
||||||
|
// the given format. If format is unknown, gzip is selected. This function is
|
||||||
|
// designed to always return something usable within this package.
|
||||||
|
func ExtractFormatLevel(s string) (format CompressFormat, level CompressLevel) {
|
||||||
|
|
||||||
|
f, l, found := strings.Cut(s, ":")
|
||||||
|
if !found {
|
||||||
|
l = "default"
|
||||||
|
}
|
||||||
|
|
||||||
|
level = CompressLevel(strings.ToLower(l))
|
||||||
|
format = CompressFormat(strings.ToLower(f))
|
||||||
|
switch level {
|
||||||
|
|
||||||
|
}
|
||||||
|
switch level {
|
||||||
|
case LevelBest:
|
||||||
|
case LevelDefault:
|
||||||
|
case LevelFast:
|
||||||
|
default:
|
||||||
|
log.Print("Unknown or no compression level set, using default")
|
||||||
|
level = LevelDefault
|
||||||
|
}
|
||||||
|
|
||||||
|
switch format {
|
||||||
|
case FormatGzip:
|
||||||
|
case FormatLzma:
|
||||||
|
log.Println("Format lzma doesn't support a compression level, using default settings")
|
||||||
|
level = LevelDefault
|
||||||
|
case FormatNone:
|
||||||
|
case FormatZstd:
|
||||||
|
default:
|
||||||
|
log.Print("Unknown or no compression format set, using gzip")
|
||||||
|
format = FormatGzip
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adds the given item to the archiveItems, only if it doesn't already exist in
|
||||||
|
// the list. The items are kept sorted in ascending order.
|
||||||
|
func (a *archiveItems) add(item archiveItem) {
|
||||||
|
a.Lock()
|
||||||
|
defer a.Unlock()
|
||||||
|
|
||||||
|
if len(a.items) < 1 {
|
||||||
|
// empty list
|
||||||
|
a.items = append(a.items, item)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// find existing item, or index of where new item should go
|
||||||
|
i := sort.Search(len(a.items), func(i int) bool {
|
||||||
|
return strings.Compare(item.header.Name, a.items[i].header.Name) <= 0
|
||||||
|
})
|
||||||
|
|
||||||
|
if i >= len(a.items) {
|
||||||
|
// doesn't exist in list, but would be at the very end
|
||||||
|
a.items = append(a.items, item)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.Compare(a.items[i].header.Name, item.header.Name) == 0 {
|
||||||
|
// already in list
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// grow list by 1, shift right at index, and insert new string at index
|
||||||
|
a.items = append(a.items, archiveItem{})
|
||||||
|
copy(a.items[i+1:], a.items[i:])
|
||||||
|
a.items[i] = item
|
||||||
|
}
|
||||||
|
|
||||||
|
// iterate through items and send each one over the returned channel
|
||||||
|
func (a *archiveItems) IterItems() <-chan archiveItem {
|
||||||
|
ch := make(chan archiveItem)
|
||||||
|
go func() {
|
||||||
|
a.RLock()
|
||||||
|
defer a.RUnlock()
|
||||||
|
|
||||||
|
for _, item := range a.items {
|
||||||
|
ch <- item
|
||||||
|
}
|
||||||
|
close(ch)
|
||||||
|
}()
|
||||||
|
return ch
|
||||||
|
}
|
||||||
|
|
||||||
|
func (archive *Archive) Write(path string, mode os.FileMode) error {
|
||||||
|
if err := archive.writeCpio(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := archive.cpioWriter.Close(); err != nil {
|
||||||
|
return fmt.Errorf("archive.Write: error closing archive: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write archive to path
|
||||||
|
if err := archive.writeCompressed(path, mode); err != nil {
|
||||||
|
return fmt.Errorf("unable to write archive to location %q: %w", path, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := os.Chmod(path, mode); err != nil {
|
||||||
|
return fmt.Errorf("unable to chmod %q to %s: %w", path, mode, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adds the given items in the map to the archive. The map format is {source path:dest path}.
|
||||||
|
// Internally this just calls AddItem on each key,value pair in the map.
|
||||||
|
func (archive *Archive) AddItems(f filelist.FileLister) error {
|
||||||
|
list, err := f.List()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for i := range list.IterItems() {
|
||||||
|
if err := archive.AddItem(i.Source, i.Dest); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adds the given file or directory at "source" to the archive at "dest"
|
||||||
|
func (archive *Archive) AddItem(source string, dest string) error {
|
||||||
|
|
||||||
|
sourceStat, err := os.Lstat(source)
|
||||||
|
if err != nil {
|
||||||
|
e, ok := err.(*os.PathError)
|
||||||
|
if e.Err == syscall.ENOENT && ok {
|
||||||
|
// doesn't exist in current filesystem, assume it's a new directory
|
||||||
|
return archive.addDir(dest)
|
||||||
|
}
|
||||||
|
return fmt.Errorf("AddItem: failed to get stat for %q: %w", source, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if sourceStat.Mode()&os.ModeDir != 0 {
|
||||||
|
return archive.addDir(dest)
|
||||||
|
}
|
||||||
|
|
||||||
|
return archive.addFile(source, dest)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (archive *Archive) addFile(source string, dest string) error {
|
||||||
|
if err := archive.addDir(filepath.Dir(dest)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceStat, err := os.Lstat(source)
|
||||||
|
if err != nil {
|
||||||
|
log.Print("addFile: failed to stat file: ", source)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Symlink: write symlink to archive then set 'file' to link target
|
||||||
|
if sourceStat.Mode()&os.ModeSymlink != 0 {
|
||||||
|
// log.Printf("File %q is a symlink", file)
|
||||||
|
target, err := os.Readlink(source)
|
||||||
|
if err != nil {
|
||||||
|
log.Print("addFile: failed to get symlink target: ", source)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
destFilename := strings.TrimPrefix(dest, "/")
|
||||||
|
|
||||||
|
archive.items.add(archiveItem{
|
||||||
|
sourcePath: source,
|
||||||
|
header: &cpio.Header{
|
||||||
|
Name: destFilename,
|
||||||
|
Linkname: target,
|
||||||
|
Mode: 0644 | cpio.ModeSymlink,
|
||||||
|
Size: int64(len(target)),
|
||||||
|
// Checksum: 1,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
if filepath.Dir(target) == "." {
|
||||||
|
target = filepath.Join(filepath.Dir(source), target)
|
||||||
|
}
|
||||||
|
// make sure target is an absolute path
|
||||||
|
if !filepath.IsAbs(target) {
|
||||||
|
target, err = osutil.RelativeSymlinkTargetToDir(target, filepath.Dir(source))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
err = archive.addFile(target, target)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
destFilename := strings.TrimPrefix(dest, "/")
|
||||||
|
|
||||||
|
archive.items.add(archiveItem{
|
||||||
|
sourcePath: source,
|
||||||
|
header: &cpio.Header{
|
||||||
|
Name: destFilename,
|
||||||
|
Mode: cpio.FileMode(sourceStat.Mode().Perm()),
|
||||||
|
Size: sourceStat.Size(),
|
||||||
|
// Checksum: 1,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (archive *Archive) writeCompressed(path string, mode os.FileMode) (err error) {
|
||||||
|
|
||||||
|
var compressor io.WriteCloser
|
||||||
|
defer func() {
|
||||||
|
e := compressor.Close()
|
||||||
|
if e != nil && err == nil {
|
||||||
|
err = e
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
fd, err := os.Create(path)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
// Note: fd.Close omitted since it'll be closed in "compressor"
|
||||||
|
|
||||||
|
switch archive.compress_format {
|
||||||
|
case FormatGzip:
|
||||||
|
level := gzip.DefaultCompression
|
||||||
|
switch archive.compress_level {
|
||||||
|
case LevelBest:
|
||||||
|
level = gzip.BestCompression
|
||||||
|
case LevelFast:
|
||||||
|
level = gzip.BestSpeed
|
||||||
|
}
|
||||||
|
compressor, err = gzip.NewWriterLevel(fd, level)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
case FormatLzma:
|
||||||
|
compressor, err = xz.NewWriter(fd)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
case FormatNone:
|
||||||
|
compressor = fd
|
||||||
|
case FormatZstd:
|
||||||
|
level := zstd.SpeedDefault
|
||||||
|
switch archive.compress_level {
|
||||||
|
case LevelBest:
|
||||||
|
level = zstd.SpeedBestCompression
|
||||||
|
case LevelFast:
|
||||||
|
level = zstd.SpeedFastest
|
||||||
|
}
|
||||||
|
compressor, err = zstd.NewWriter(fd, zstd.WithEncoderLevel(level))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
log.Print("Unknown or no compression format set, using gzip")
|
||||||
|
compressor = gzip.NewWriter(fd)
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err = io.Copy(compressor, archive.buf); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// call fsync just to be sure
|
||||||
|
if err := fd.Sync(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := os.Chmod(path, mode); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (archive *Archive) writeCpio() error {
|
||||||
|
// having a transient function for actually adding files to the archive
|
||||||
|
// allows the deferred fd.close to run after every copy and prevent having
|
||||||
|
// tons of open file handles until the copying is all done
|
||||||
|
copyToArchive := func(source string, header *cpio.Header) error {
|
||||||
|
|
||||||
|
if err := archive.cpioWriter.WriteHeader(header); err != nil {
|
||||||
|
return fmt.Errorf("archive.writeCpio: unable to write header: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// don't copy actual dirs into the archive, writing the header is enough
|
||||||
|
if !header.Mode.IsDir() {
|
||||||
|
if header.Mode.IsRegular() {
|
||||||
|
fd, err := os.Open(source)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("archive.writeCpio: uname to open file %q, %w", source, err)
|
||||||
|
}
|
||||||
|
defer fd.Close()
|
||||||
|
if _, err := io.Copy(archive.cpioWriter, fd); err != nil {
|
||||||
|
return fmt.Errorf("archive.writeCpio: unable to write out archive: %w", err)
|
||||||
|
}
|
||||||
|
} else if header.Linkname != "" {
|
||||||
|
// the contents of a symlink is just need the link name
|
||||||
|
if _, err := archive.cpioWriter.Write([]byte(header.Linkname)); err != nil {
|
||||||
|
return fmt.Errorf("archive.writeCpio: unable to write out symlink: %w", err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return fmt.Errorf("archive.writeCpio: unknown type for file: %s", source)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := range archive.items.IterItems() {
|
||||||
|
if err := copyToArchive(i.sourcePath, i.header); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (archive *Archive) addDir(dir string) error {
|
||||||
|
if dir == "/" {
|
||||||
|
dir = "."
|
||||||
|
}
|
||||||
|
|
||||||
|
subdirs := strings.Split(strings.TrimPrefix(dir, "/"), "/")
|
||||||
|
for i, subdir := range subdirs {
|
||||||
|
path := filepath.Join(strings.Join(subdirs[:i], "/"), subdir)
|
||||||
|
archive.items.add(archiveItem{
|
||||||
|
sourcePath: path,
|
||||||
|
header: &cpio.Header{
|
||||||
|
Name: path,
|
||||||
|
Mode: cpio.ModeDir | 0755,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
272
internal/archive/archive_test.go
Normal file
272
internal/archive/archive_test.go
Normal file
@@ -0,0 +1,272 @@
|
|||||||
|
// Copyright 2022 Clayton Craft <clayton@craftyguy.net>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
package archive
|
||||||
|
|
||||||
|
import (
|
||||||
|
"reflect"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/cavaliercoder/go-cpio"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestArchiveItemsAdd(t *testing.T) {
|
||||||
|
subtests := []struct {
|
||||||
|
name string
|
||||||
|
inItems []archiveItem
|
||||||
|
inItem archiveItem
|
||||||
|
expected []archiveItem
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "empty list",
|
||||||
|
inItems: []archiveItem{},
|
||||||
|
inItem: archiveItem{
|
||||||
|
sourcePath: "/foo/bar",
|
||||||
|
header: &cpio.Header{Name: "/foo/bar"},
|
||||||
|
},
|
||||||
|
expected: []archiveItem{
|
||||||
|
{
|
||||||
|
sourcePath: "/foo/bar",
|
||||||
|
header: &cpio.Header{Name: "/foo/bar"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "already exists",
|
||||||
|
inItems: []archiveItem{
|
||||||
|
{
|
||||||
|
sourcePath: "/bazz/bar",
|
||||||
|
header: &cpio.Header{Name: "/bazz/bar"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sourcePath: "/foo",
|
||||||
|
header: &cpio.Header{Name: "/foo"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sourcePath: "/foo/bar",
|
||||||
|
header: &cpio.Header{Name: "/foo/bar"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
inItem: archiveItem{
|
||||||
|
sourcePath: "/foo",
|
||||||
|
header: &cpio.Header{Name: "/foo"},
|
||||||
|
},
|
||||||
|
expected: []archiveItem{
|
||||||
|
{
|
||||||
|
sourcePath: "/bazz/bar",
|
||||||
|
header: &cpio.Header{Name: "/bazz/bar"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sourcePath: "/foo",
|
||||||
|
header: &cpio.Header{Name: "/foo"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sourcePath: "/foo/bar",
|
||||||
|
header: &cpio.Header{Name: "/foo/bar"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "add new",
|
||||||
|
inItems: []archiveItem{
|
||||||
|
{
|
||||||
|
sourcePath: "/bazz/bar",
|
||||||
|
header: &cpio.Header{Name: "/bazz/bar"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sourcePath: "/foo",
|
||||||
|
header: &cpio.Header{Name: "/foo"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sourcePath: "/foo/bar",
|
||||||
|
header: &cpio.Header{Name: "/foo/bar"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sourcePath: "/foo/bar1",
|
||||||
|
header: &cpio.Header{Name: "/foo/bar1"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
inItem: archiveItem{
|
||||||
|
sourcePath: "/foo/bar0",
|
||||||
|
header: &cpio.Header{Name: "/foo/bar0"},
|
||||||
|
},
|
||||||
|
expected: []archiveItem{
|
||||||
|
{
|
||||||
|
sourcePath: "/bazz/bar",
|
||||||
|
header: &cpio.Header{Name: "/bazz/bar"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sourcePath: "/foo",
|
||||||
|
header: &cpio.Header{Name: "/foo"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sourcePath: "/foo/bar",
|
||||||
|
header: &cpio.Header{Name: "/foo/bar"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sourcePath: "/foo/bar0",
|
||||||
|
header: &cpio.Header{Name: "/foo/bar0"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sourcePath: "/foo/bar1",
|
||||||
|
header: &cpio.Header{Name: "/foo/bar1"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "add new at beginning",
|
||||||
|
inItems: []archiveItem{
|
||||||
|
{
|
||||||
|
sourcePath: "/foo",
|
||||||
|
header: &cpio.Header{Name: "/foo"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sourcePath: "/foo/bar",
|
||||||
|
header: &cpio.Header{Name: "/foo/bar"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
inItem: archiveItem{
|
||||||
|
sourcePath: "/bazz/bar",
|
||||||
|
header: &cpio.Header{Name: "/bazz/bar"},
|
||||||
|
},
|
||||||
|
expected: []archiveItem{
|
||||||
|
{
|
||||||
|
sourcePath: "/bazz/bar",
|
||||||
|
header: &cpio.Header{Name: "/bazz/bar"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sourcePath: "/foo",
|
||||||
|
header: &cpio.Header{Name: "/foo"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sourcePath: "/foo/bar",
|
||||||
|
header: &cpio.Header{Name: "/foo/bar"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "add new at end",
|
||||||
|
inItems: []archiveItem{
|
||||||
|
{
|
||||||
|
sourcePath: "/bazz/bar",
|
||||||
|
header: &cpio.Header{Name: "/bazz/bar"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sourcePath: "/foo",
|
||||||
|
header: &cpio.Header{Name: "/foo"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
inItem: archiveItem{
|
||||||
|
sourcePath: "/zzz/bazz",
|
||||||
|
header: &cpio.Header{Name: "/zzz/bazz"},
|
||||||
|
},
|
||||||
|
expected: []archiveItem{
|
||||||
|
{
|
||||||
|
sourcePath: "/bazz/bar",
|
||||||
|
header: &cpio.Header{Name: "/bazz/bar"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sourcePath: "/foo",
|
||||||
|
header: &cpio.Header{Name: "/foo"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sourcePath: "/zzz/bazz",
|
||||||
|
header: &cpio.Header{Name: "/zzz/bazz"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, st := range subtests {
|
||||||
|
t.Run(st.name, func(t *testing.T) {
|
||||||
|
a := archiveItems{items: st.inItems}
|
||||||
|
a.add(st.inItem)
|
||||||
|
if !reflect.DeepEqual(st.expected, a.items) {
|
||||||
|
t.Fatal("expected:", st.expected, " got: ", a.items)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestExtractFormatLevel(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
in string
|
||||||
|
expectedFormat CompressFormat
|
||||||
|
expectedLevel CompressLevel
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "gzip, default level",
|
||||||
|
in: "gzip:default",
|
||||||
|
expectedFormat: FormatGzip,
|
||||||
|
expectedLevel: LevelDefault,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "unknown format, level 12",
|
||||||
|
in: "pear:12",
|
||||||
|
expectedFormat: FormatGzip,
|
||||||
|
expectedLevel: LevelDefault,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "zstd, level not given",
|
||||||
|
in: "zstd",
|
||||||
|
expectedFormat: FormatZstd,
|
||||||
|
expectedLevel: LevelDefault,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "zstd, invalid level 'fast:'",
|
||||||
|
in: "zstd:fast:",
|
||||||
|
expectedFormat: FormatZstd,
|
||||||
|
expectedLevel: LevelDefault,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "zstd, best",
|
||||||
|
in: "zstd:best",
|
||||||
|
expectedFormat: FormatZstd,
|
||||||
|
expectedLevel: LevelBest,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "zstd, level empty :",
|
||||||
|
in: "zstd:",
|
||||||
|
expectedFormat: FormatZstd,
|
||||||
|
expectedLevel: LevelDefault,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "gzip, best",
|
||||||
|
in: "gzip:best",
|
||||||
|
expectedFormat: FormatGzip,
|
||||||
|
expectedLevel: LevelBest,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "<empty>, <empty>",
|
||||||
|
in: "",
|
||||||
|
expectedFormat: FormatGzip,
|
||||||
|
expectedLevel: LevelDefault,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "lzma, fast",
|
||||||
|
in: "lzma:fast",
|
||||||
|
expectedFormat: FormatLzma,
|
||||||
|
expectedLevel: LevelDefault,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "none",
|
||||||
|
in: "none",
|
||||||
|
expectedFormat: FormatNone,
|
||||||
|
expectedLevel: LevelDefault,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, test := range tests {
|
||||||
|
t.Run(test.name, func(t *testing.T) {
|
||||||
|
format, level := ExtractFormatLevel(test.in)
|
||||||
|
if format != test.expectedFormat {
|
||||||
|
t.Fatal("format expected: ", test.expectedFormat, " got: ", format)
|
||||||
|
}
|
||||||
|
if level != test.expectedLevel {
|
||||||
|
t.Fatal("level expected: ", test.expectedLevel, " got: ", level)
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
153
internal/bootdeploy/bootdeploy.go
Normal file
153
internal/bootdeploy/bootdeploy.go
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
package bootdeploy
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"path"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type BootDeploy struct {
|
||||||
|
inDir string
|
||||||
|
outDir string
|
||||||
|
ubootBoardname string
|
||||||
|
}
|
||||||
|
|
||||||
|
// New returns a new BootDeploy, which then runs:
|
||||||
|
//
|
||||||
|
// boot-deploy -d indir -o outDir
|
||||||
|
//
|
||||||
|
// ubootBoardname is used for copying in some u-boot files prior to running
|
||||||
|
// boot-deploy. This is optional, passing an empty string is ok if this is not
|
||||||
|
// needed.
|
||||||
|
func New(inDir, outDir, ubootBoardname string) *BootDeploy {
|
||||||
|
return &BootDeploy{
|
||||||
|
inDir: inDir,
|
||||||
|
outDir: outDir,
|
||||||
|
ubootBoardname: ubootBoardname,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BootDeploy) Run() error {
|
||||||
|
|
||||||
|
if err := copyUbootFiles(b.inDir, b.ubootBoardname); errors.Is(err, os.ErrNotExist) {
|
||||||
|
log.Println("u-boot files copying skipped: ", err)
|
||||||
|
} else {
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal("copyUbootFiles: ", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return bootDeploy(b.inDir, b.outDir)
|
||||||
|
}
|
||||||
|
|
||||||
|
func bootDeploy(workDir string, outDir string) error {
|
||||||
|
// boot-deploy expects the kernel to be in the same dir as initramfs.
|
||||||
|
// Assume that the kernel is in the output dir...
|
||||||
|
kernels, _ := filepath.Glob(filepath.Join(outDir, "vmlinuz*"))
|
||||||
|
if len(kernels) == 0 {
|
||||||
|
return errors.New("Unable to find any kernels at " + filepath.Join(outDir, "vmlinuz*"))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pick a kernel that does not have suffixes added by boot-deploy
|
||||||
|
var kernFile string
|
||||||
|
for _, f := range kernels {
|
||||||
|
if strings.HasSuffix(f, "-dtb") || strings.HasSuffix(f, "-mtk") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
kernFile = f
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
kernFd, err := os.Open(kernFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer kernFd.Close()
|
||||||
|
|
||||||
|
kernFilename := path.Base(kernFile)
|
||||||
|
kernFileCopy, err := os.Create(filepath.Join(workDir, kernFilename))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err = io.Copy(kernFileCopy, kernFd); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := kernFileCopy.Close(); err != nil {
|
||||||
|
return fmt.Errorf("error closing %s: %w", kernFilename, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// boot-deploy -i initramfs -k vmlinuz-postmarketos-rockchip -d /tmp/cpio -o /tmp/foo initramfs-extra
|
||||||
|
cmd := exec.Command("boot-deploy",
|
||||||
|
"-i", "initramfs",
|
||||||
|
"-k", kernFilename,
|
||||||
|
"-d", workDir,
|
||||||
|
"-o", outDir,
|
||||||
|
"initramfs-extra")
|
||||||
|
|
||||||
|
cmd.Stdout = os.Stdout
|
||||||
|
cmd.Stderr = os.Stderr
|
||||||
|
if err := cmd.Run(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy copies the file at srcFile path to a new file at dstFile path
|
||||||
|
func copy(srcFile, dstFile string) error {
|
||||||
|
out, err := os.Create(dstFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
errClose := out.Close()
|
||||||
|
if err == nil {
|
||||||
|
err = errClose
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
in, err := os.Open(srcFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer in.Close()
|
||||||
|
|
||||||
|
_, err = io.Copy(out, in)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// copyUbootFiles uses deviceinfo_uboot_boardname to copy u-boot files required
|
||||||
|
// for running boot-deploy
|
||||||
|
func copyUbootFiles(path, ubootBoardname string) error {
|
||||||
|
if ubootBoardname == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
srcDir := filepath.Join("/usr/share/u-boot", ubootBoardname)
|
||||||
|
entries, err := os.ReadDir(srcDir)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for _, entry := range entries {
|
||||||
|
sourcePath := filepath.Join(srcDir, entry.Name())
|
||||||
|
destPath := filepath.Join(path, entry.Name())
|
||||||
|
|
||||||
|
if err := copy(sourcePath, destPath); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
65
internal/filelist/filelist.go
Normal file
65
internal/filelist/filelist.go
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
package filelist
|
||||||
|
|
||||||
|
import "sync"
|
||||||
|
|
||||||
|
type FileLister interface {
|
||||||
|
List() (*FileList, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type File struct {
|
||||||
|
Source string
|
||||||
|
Dest string
|
||||||
|
}
|
||||||
|
|
||||||
|
type FileList struct {
|
||||||
|
m map[string]string
|
||||||
|
sync.RWMutex
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewFileList() *FileList {
|
||||||
|
return &FileList{
|
||||||
|
m: make(map[string]string),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *FileList) Add(src string, dest string) {
|
||||||
|
f.Lock()
|
||||||
|
defer f.Unlock()
|
||||||
|
|
||||||
|
f.m[src] = dest
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *FileList) Get(src string) (string, bool) {
|
||||||
|
f.RLock()
|
||||||
|
defer f.RUnlock()
|
||||||
|
|
||||||
|
dest, found := f.m[src]
|
||||||
|
return dest, found
|
||||||
|
}
|
||||||
|
|
||||||
|
// Import copies in the contents of src. If a source path already exists when
|
||||||
|
// importing, then the destination path is updated with the new value.
|
||||||
|
func (f *FileList) Import(src *FileList) {
|
||||||
|
for i := range src.IterItems() {
|
||||||
|
f.Add(i.Source, i.Dest)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// iterate through the list and and send each one as a new File over the
|
||||||
|
// returned channel
|
||||||
|
func (f *FileList) IterItems() <-chan File {
|
||||||
|
ch := make(chan File)
|
||||||
|
go func() {
|
||||||
|
f.RLock()
|
||||||
|
defer f.RUnlock()
|
||||||
|
|
||||||
|
for src, dest := range f.m {
|
||||||
|
ch <- File{
|
||||||
|
Source: src,
|
||||||
|
Dest: dest,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close(ch)
|
||||||
|
}()
|
||||||
|
return ch
|
||||||
|
}
|
51
internal/filelist/hookdirs/hookdirs.go
Normal file
51
internal/filelist/hookdirs/hookdirs.go
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
package hookdirs
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/filelist"
|
||||||
|
)
|
||||||
|
|
||||||
|
type HookDirs struct {
|
||||||
|
path string
|
||||||
|
}
|
||||||
|
|
||||||
|
// New returns a new HookDirs that will use the given path to provide a list
|
||||||
|
// of directories use.
|
||||||
|
func New(path string) *HookDirs {
|
||||||
|
return &HookDirs{
|
||||||
|
path: path,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *HookDirs) List() (*filelist.FileList, error) {
|
||||||
|
log.Printf("- Searching for directories specified in %s", h.path)
|
||||||
|
|
||||||
|
files := filelist.NewFileList()
|
||||||
|
fileInfo, err := os.ReadDir(h.path)
|
||||||
|
if err != nil {
|
||||||
|
log.Println("-- Unable to find dir, skipping...")
|
||||||
|
return files, nil
|
||||||
|
}
|
||||||
|
for _, file := range fileInfo {
|
||||||
|
path := filepath.Join(h.path, file.Name())
|
||||||
|
f, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("getHookDirs: unable to open hook file: %w", err)
|
||||||
|
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
log.Printf("-- Creating directories from: %s\n", path)
|
||||||
|
|
||||||
|
s := bufio.NewScanner(f)
|
||||||
|
for s.Scan() {
|
||||||
|
dir := s.Text()
|
||||||
|
files.Add(dir, dir)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return files, nil
|
||||||
|
}
|
83
internal/filelist/hookfiles/hookfiles.go
Normal file
83
internal/filelist/hookfiles/hookfiles.go
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
package hookfiles
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/filelist"
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/misc"
|
||||||
|
)
|
||||||
|
|
||||||
|
type HookFiles struct {
|
||||||
|
filePath string
|
||||||
|
}
|
||||||
|
|
||||||
|
// New returns a new HookFiles that will use the given path to provide a list
|
||||||
|
// of files + any binary dependencies they might have.
|
||||||
|
func New(filePath string) *HookFiles {
|
||||||
|
return &HookFiles{
|
||||||
|
filePath: filePath,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *HookFiles) List() (*filelist.FileList, error) {
|
||||||
|
log.Printf("- Searching for file lists from %s", h.filePath)
|
||||||
|
|
||||||
|
files := filelist.NewFileList()
|
||||||
|
fileInfo, err := os.ReadDir(h.filePath)
|
||||||
|
if err != nil {
|
||||||
|
log.Println("-- Unable to find dir, skipping...")
|
||||||
|
return files, nil
|
||||||
|
}
|
||||||
|
for _, file := range fileInfo {
|
||||||
|
path := filepath.Join(h.filePath, file.Name())
|
||||||
|
f, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("getHookFiles: unable to open hook file: %w", err)
|
||||||
|
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
log.Printf("-- Including files from: %s\n", path)
|
||||||
|
|
||||||
|
if list, err := slurpFiles(f); err != nil {
|
||||||
|
return nil, fmt.Errorf("hookfiles: unable to process hook file %q: %w", path, err)
|
||||||
|
} else {
|
||||||
|
files.Import(list)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return files, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func slurpFiles(fd io.Reader) (*filelist.FileList, error) {
|
||||||
|
files := filelist.NewFileList()
|
||||||
|
|
||||||
|
s := bufio.NewScanner(fd)
|
||||||
|
for s.Scan() {
|
||||||
|
src, dest, has_dest := strings.Cut(s.Text(), ":")
|
||||||
|
|
||||||
|
fFiles, err := misc.GetFiles([]string{src}, true)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("unable to add %q: %w", src, err)
|
||||||
|
}
|
||||||
|
// loop over all returned files from GetFile
|
||||||
|
for _, file := range fFiles {
|
||||||
|
if !has_dest {
|
||||||
|
files.Add(file, file)
|
||||||
|
} else if len(fFiles) > 1 {
|
||||||
|
// Don't support specifying dest if src was a glob
|
||||||
|
// NOTE: this could support this later...
|
||||||
|
files.Add(file, file)
|
||||||
|
} else {
|
||||||
|
// dest path specified, and only 1 file
|
||||||
|
files.Add(file, dest)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return files, s.Err()
|
||||||
|
}
|
42
internal/filelist/hookscripts/hookscripts.go
Normal file
42
internal/filelist/hookscripts/hookscripts.go
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
package hookscripts
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/filelist"
|
||||||
|
)
|
||||||
|
|
||||||
|
type HookScripts struct {
|
||||||
|
destPath string
|
||||||
|
scriptsDir string
|
||||||
|
}
|
||||||
|
|
||||||
|
// New returns a new HookScripts that will use the given path to provide a list
|
||||||
|
// of script files. The destination for each script it set to destPath, using
|
||||||
|
// the original file name.
|
||||||
|
func New(scriptsDir string, destPath string) *HookScripts {
|
||||||
|
return &HookScripts{
|
||||||
|
destPath: destPath,
|
||||||
|
scriptsDir: scriptsDir,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *HookScripts) List() (*filelist.FileList, error) {
|
||||||
|
log.Printf("- Searching for hook scripts from %s", h.scriptsDir)
|
||||||
|
|
||||||
|
files := filelist.NewFileList()
|
||||||
|
|
||||||
|
fileInfo, err := os.ReadDir(h.scriptsDir)
|
||||||
|
if err != nil {
|
||||||
|
log.Println("-- Unable to find dir, skipping...")
|
||||||
|
return files, nil
|
||||||
|
}
|
||||||
|
for _, file := range fileInfo {
|
||||||
|
path := filepath.Join(h.scriptsDir, file.Name())
|
||||||
|
log.Printf("-- Including script: %s\n", path)
|
||||||
|
files.Add(path, filepath.Join(h.destPath, file.Name()))
|
||||||
|
}
|
||||||
|
return files, nil
|
||||||
|
}
|
34
internal/filelist/initramfs/initramfs.go
Normal file
34
internal/filelist/initramfs/initramfs.go
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package initramfs
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/filelist"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Initramfs allows building arbitrarily complex lists of features, by slurping
|
||||||
|
// up types that implement FileLister (which includes this type! yippee) and
|
||||||
|
// combining the output from them.
|
||||||
|
type Initramfs struct {
|
||||||
|
features []filelist.FileLister
|
||||||
|
}
|
||||||
|
|
||||||
|
// New returns a new Initramfs that generate a list of files based on the given
|
||||||
|
// list of FileListers.
|
||||||
|
func New(features []filelist.FileLister) *Initramfs {
|
||||||
|
return &Initramfs{
|
||||||
|
features: features,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *Initramfs) List() (*filelist.FileList, error) {
|
||||||
|
files := filelist.NewFileList()
|
||||||
|
|
||||||
|
for _, f := range i.features {
|
||||||
|
list, err := f.List()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
files.Import(list)
|
||||||
|
}
|
||||||
|
|
||||||
|
return files, nil
|
||||||
|
}
|
214
internal/filelist/modules/modules.go
Normal file
214
internal/filelist/modules/modules.go
Normal file
@@ -0,0 +1,214 @@
|
|||||||
|
package modules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/filelist"
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/misc"
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/osutil"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Modules struct {
|
||||||
|
modulesList []string
|
||||||
|
modulesListPath string
|
||||||
|
}
|
||||||
|
|
||||||
|
// New returns a new Modules that will use the given moduleto provide a list
|
||||||
|
// of script files.
|
||||||
|
func New(modulesList []string, modulesListPath string) *Modules {
|
||||||
|
return &Modules{
|
||||||
|
modulesList: modulesList,
|
||||||
|
modulesListPath: modulesListPath,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Modules) List() (*filelist.FileList, error) {
|
||||||
|
log.Printf("- Searching for kernel modules from %s", m.modulesListPath)
|
||||||
|
|
||||||
|
kernVer, err := osutil.GetKernelVersion()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
files := filelist.NewFileList()
|
||||||
|
|
||||||
|
modDir := filepath.Join("/lib/modules", kernVer)
|
||||||
|
if exists, err := misc.Exists(modDir); !exists {
|
||||||
|
// dir /lib/modules/<kernel> if kernel built without module support, so just print a message
|
||||||
|
log.Printf("-- kernel module directory not found: %q, not including modules", modDir)
|
||||||
|
return files, nil
|
||||||
|
} else if err != nil {
|
||||||
|
return nil, fmt.Errorf("received unexpected error when getting status for %q: %w", modDir, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// modules.* required by modprobe
|
||||||
|
modprobeFiles, _ := filepath.Glob(filepath.Join(modDir, "modules.*"))
|
||||||
|
for _, file := range modprobeFiles {
|
||||||
|
files.Add(file, file)
|
||||||
|
}
|
||||||
|
|
||||||
|
// slurp up given list of modules
|
||||||
|
for _, module := range m.modulesList {
|
||||||
|
if modFilelist, err := getModule(module, modDir); err != nil {
|
||||||
|
return nil, fmt.Errorf("getInitfsModules: unable to get modules from deviceinfo: %w", err)
|
||||||
|
} else {
|
||||||
|
for _, file := range modFilelist {
|
||||||
|
files.Add(file, file)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// slurp up modules from lists in modulesListPath
|
||||||
|
fileInfo, err := os.ReadDir(m.modulesListPath)
|
||||||
|
if err != nil {
|
||||||
|
log.Println("-- Unable to find dir, skipping...")
|
||||||
|
return files, nil
|
||||||
|
}
|
||||||
|
for _, file := range fileInfo {
|
||||||
|
path := filepath.Join(m.modulesListPath, file.Name())
|
||||||
|
f, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("unable to open module list file %q: %w", path, err)
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
log.Printf("-- Including modules from: %s\n", path)
|
||||||
|
|
||||||
|
if list, err := slurpModules(f, modDir); err != nil {
|
||||||
|
return nil, fmt.Errorf("unable to process module list file %q: %w", path, err)
|
||||||
|
} else {
|
||||||
|
files.Import(list)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return files, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func slurpModules(fd io.Reader, modDir string) (*filelist.FileList, error) {
|
||||||
|
files := filelist.NewFileList()
|
||||||
|
s := bufio.NewScanner(fd)
|
||||||
|
for s.Scan() {
|
||||||
|
line := s.Text()
|
||||||
|
dir, file := filepath.Split(line)
|
||||||
|
if file == "" {
|
||||||
|
// item is a directory
|
||||||
|
dir = filepath.Join(modDir, dir)
|
||||||
|
dirs, _ := filepath.Glob(dir)
|
||||||
|
for _, d := range dirs {
|
||||||
|
if modFilelist, err := getModulesInDir(d); err != nil {
|
||||||
|
return nil, fmt.Errorf("unable to get modules dir %q: %w", d, err)
|
||||||
|
} else {
|
||||||
|
for _, file := range modFilelist {
|
||||||
|
files.Add(file, file)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if dir == "" {
|
||||||
|
// item is a module name
|
||||||
|
if modFilelist, err := getModule(s.Text(), modDir); err != nil {
|
||||||
|
return nil, fmt.Errorf("unable to get module file %q: %w", s.Text(), err)
|
||||||
|
} else {
|
||||||
|
for _, file := range modFilelist {
|
||||||
|
files.Add(file, file)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.Printf("Unknown module entry: %q", line)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return files, s.Err()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getModulesInDir(modPath string) (files []string, err error) {
|
||||||
|
err = filepath.Walk(modPath, func(path string, f os.FileInfo, err error) error {
|
||||||
|
if filepath.Ext(path) != ".ko" && filepath.Ext(path) != ".xz" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
files = append(files, path)
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Given a module name, e.g. 'dwc_wdt', resolve the full path to the module
|
||||||
|
// file and all of its dependencies.
|
||||||
|
// Note: it's not necessarily fatal if the module is not found, since it may
|
||||||
|
// have been built into the kernel
|
||||||
|
func getModule(modName string, modDir string) (files []string, err error) {
|
||||||
|
|
||||||
|
modDep := filepath.Join(modDir, "modules.dep")
|
||||||
|
if exists, err := misc.Exists(modDep); !exists {
|
||||||
|
return nil, fmt.Errorf("kernel module.dep not found: %s", modDir)
|
||||||
|
} else if err != nil {
|
||||||
|
return nil, fmt.Errorf("received unexpected error when getting module.dep status: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fd, err := os.Open(modDep)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("unable to open modules.dep: %w", err)
|
||||||
|
}
|
||||||
|
defer fd.Close()
|
||||||
|
|
||||||
|
deps, err := getModuleDeps(modName, fd)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, dep := range deps {
|
||||||
|
p := filepath.Join(modDir, dep)
|
||||||
|
if exists, err := misc.Exists(p); !exists {
|
||||||
|
return nil, fmt.Errorf("tried to include a module that doesn't exist in the modules directory (%s): %s", modDir, p)
|
||||||
|
} else if err != nil {
|
||||||
|
return nil, fmt.Errorf("received unexpected error when getting status for %q: %w", p, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
files = append(files, p)
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the canonicalized name for the module as represented in the given modules.dep io.reader
|
||||||
|
func getModuleDeps(modName string, modulesDep io.Reader) ([]string, error) {
|
||||||
|
var deps []string
|
||||||
|
|
||||||
|
// split the module name on - and/or _, build a regex for matching
|
||||||
|
splitRe := regexp.MustCompile("[-_]+")
|
||||||
|
modNameReStr := splitRe.ReplaceAllString(modName, "[-_]+")
|
||||||
|
re := regexp.MustCompile("^" + modNameReStr + "$")
|
||||||
|
|
||||||
|
s := bufio.NewScanner(modulesDep)
|
||||||
|
for s.Scan() {
|
||||||
|
fields := strings.Fields(s.Text())
|
||||||
|
if len(fields) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
fields[0] = strings.TrimSuffix(fields[0], ":")
|
||||||
|
|
||||||
|
found := re.FindAll([]byte(filepath.Base(stripExts(fields[0]))), -1)
|
||||||
|
if len(found) > 0 {
|
||||||
|
deps = append(deps, fields...)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err := s.Err(); err != nil {
|
||||||
|
log.Print("Unable to get module + dependencies: ", modName)
|
||||||
|
return deps, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return deps, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func stripExts(file string) string {
|
||||||
|
return strings.Split(file, ".")[0]
|
||||||
|
}
|
82
internal/filelist/modules/modules_test.go
Normal file
82
internal/filelist/modules/modules_test.go
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
// Copyright 2023 Clayton Craft <clayton@craftyguy.net>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
package modules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestStripExts(t *testing.T) {
|
||||||
|
tables := []struct {
|
||||||
|
in string
|
||||||
|
expected string
|
||||||
|
}{
|
||||||
|
{"/foo/bar/bazz.tar", "/foo/bar/bazz"},
|
||||||
|
{"file.tar.gz.xz.zip", "file"},
|
||||||
|
{"another_file", "another_file"},
|
||||||
|
{"a.b.c.d.e.f.g.h.i", "a"},
|
||||||
|
{"virtio_blk.ko", "virtio_blk"},
|
||||||
|
}
|
||||||
|
for _, table := range tables {
|
||||||
|
out := stripExts(table.in)
|
||||||
|
if out != table.expected {
|
||||||
|
t.Errorf("Expected: %q, got: %q", table.expected, out)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var testModuleDep string = `
|
||||||
|
kernel/sound/soc/codecs/snd-soc-msm8916-digital.ko:
|
||||||
|
kernel/net/sched/act_ipt.ko.xz: kernel/net/netfilter/x_tables.ko.xz
|
||||||
|
kernel/drivers/watchdog/watchdog.ko.xz:
|
||||||
|
kernel/drivers/usb/serial/ir-usb.ko.xz: kernel/drivers/usb/serial/usbserial.ko.xz
|
||||||
|
kernel/drivers/gpu/drm/scheduler/gpu-sched.ko.xz:
|
||||||
|
kernel/drivers/hid/hid-alps.ko.xz:
|
||||||
|
kernel/net/netfilter/xt_u32.ko.xz: kernel/net/netfilter/x_tables.ko.xz
|
||||||
|
kernel/net/netfilter/xt_sctp.ko.xz: kernel/net/netfilter/x_tables.ko.xz
|
||||||
|
kernel/drivers/hwmon/gl518sm.ko.xz:
|
||||||
|
kernel/drivers/watchdog/dw_wdt.ko.xz: kernel/drivers/watchdog/watchdog.ko.xz
|
||||||
|
kernel/net/bluetooth/hidp/hidp.ko.xz: kernel/net/bluetooth/bluetooth.ko.xz kernel/net/rfkill/rfkill.ko.xz kernel/crypto/ecdh_generic.ko.xz kernel/crypto/ecc.ko.xz
|
||||||
|
kernel/fs/nls/nls_iso8859-1.ko.xz:
|
||||||
|
kernel/net/vmw_vsock/vmw_vsock_virtio_transport.ko.xz: kernel/net/vmw_vsock/vmw_vsock_virtio_transport_common.ko.xz kernel/drivers/virtio/virtio.ko.xz kernel/drivers/virtio/virtio_ring.ko.xz kernel/net/vmw_vsock/vsock.ko.xz
|
||||||
|
kernel/drivers/gpu/drm/panfrost/panfrost.ko.xz: kernel/drivers/gpu/drm/scheduler/gpu-sched.ko.xz
|
||||||
|
kernel/drivers/gpu/drm/msm/msm.ko: kernel/drivers/gpu/drm/drm_kms_helper.ko
|
||||||
|
`
|
||||||
|
|
||||||
|
func TestGetModuleDeps(t *testing.T) {
|
||||||
|
tables := []struct {
|
||||||
|
in string
|
||||||
|
expected []string
|
||||||
|
}{
|
||||||
|
{"nls-iso8859-1", []string{"kernel/fs/nls/nls_iso8859-1.ko.xz"}},
|
||||||
|
{"gpu_sched", []string{"kernel/drivers/gpu/drm/scheduler/gpu-sched.ko.xz"}},
|
||||||
|
{"dw-wdt", []string{"kernel/drivers/watchdog/dw_wdt.ko.xz",
|
||||||
|
"kernel/drivers/watchdog/watchdog.ko.xz"}},
|
||||||
|
{"gl518sm", []string{"kernel/drivers/hwmon/gl518sm.ko.xz"}},
|
||||||
|
{"msm", []string{"kernel/drivers/gpu/drm/msm/msm.ko",
|
||||||
|
"kernel/drivers/gpu/drm/drm_kms_helper.ko"}},
|
||||||
|
}
|
||||||
|
for _, table := range tables {
|
||||||
|
out, err := getModuleDeps(table.in, strings.NewReader(testModuleDep))
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("unexpected error with input: %q, error: %q", table.expected, err)
|
||||||
|
}
|
||||||
|
if !stringSlicesEqual(out, table.expected) {
|
||||||
|
t.Errorf("Expected: %q, got: %q", table.expected, out)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func stringSlicesEqual(a []string, b []string) bool {
|
||||||
|
if len(a) != len(b) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
for i, v := range a {
|
||||||
|
if v != b[i] {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
158
internal/filelist/osksdl/osksdl.go
Normal file
158
internal/filelist/osksdl/osksdl.go
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
package osksdl
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/filelist"
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/misc"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OskSdl struct {
|
||||||
|
mesaDriver string
|
||||||
|
}
|
||||||
|
|
||||||
|
// New returns a new HookScripts that will use the given path to provide a list
|
||||||
|
// of script files.
|
||||||
|
func New(mesaDriverName string) *OskSdl {
|
||||||
|
return &OskSdl{
|
||||||
|
mesaDriver: mesaDriverName,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get a list of files and their dependencies related to supporting rootfs full
|
||||||
|
// disk (d)encryption
|
||||||
|
func (s *OskSdl) List() (*filelist.FileList, error) {
|
||||||
|
files := filelist.NewFileList()
|
||||||
|
|
||||||
|
if exists, err := misc.Exists("/usr/bin/osk-sdl"); !exists {
|
||||||
|
return files, nil
|
||||||
|
} else if err != nil {
|
||||||
|
return files, fmt.Errorf("received unexpected error when getting status for %q: %w", "/usr/bin/osk-sdl", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Println("- Including osk-sdl support")
|
||||||
|
|
||||||
|
confFiles := []string{
|
||||||
|
"/etc/osk.conf",
|
||||||
|
"/etc/ts.conf",
|
||||||
|
"/etc/pointercal",
|
||||||
|
"/etc/fb.modes",
|
||||||
|
"/etc/directfbrc",
|
||||||
|
}
|
||||||
|
confFileList, err := misc.GetFiles(confFiles, false)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("getFdeFiles: failed to add files: %w", err)
|
||||||
|
}
|
||||||
|
for _, file := range confFileList {
|
||||||
|
files.Add(file, file)
|
||||||
|
}
|
||||||
|
|
||||||
|
// osk-sdl
|
||||||
|
oskFiles := []string{
|
||||||
|
"/usr/bin/osk-sdl",
|
||||||
|
"/sbin/cryptsetup",
|
||||||
|
"/usr/lib/libGL.so.1",
|
||||||
|
}
|
||||||
|
if oskFileList, err := misc.GetFiles(oskFiles, true); err != nil {
|
||||||
|
return nil, fmt.Errorf("getFdeFiles: failed to add files: %w", err)
|
||||||
|
} else {
|
||||||
|
for _, file := range oskFileList {
|
||||||
|
files.Add(file, file)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fontFile, err := getOskConfFontPath("/etc/osk.conf")
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("getFdeFiles: failed to add file %q: %w", fontFile, err)
|
||||||
|
}
|
||||||
|
files.Add(fontFile, fontFile)
|
||||||
|
|
||||||
|
// Directfb
|
||||||
|
dfbFiles := []string{}
|
||||||
|
err = filepath.Walk("/usr/lib/directfb-1.7-7", func(path string, f os.FileInfo, err error) error {
|
||||||
|
if filepath.Ext(path) == ".so" {
|
||||||
|
dfbFiles = append(dfbFiles, path)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("getFdeFiles: failed to add file %w", err)
|
||||||
|
}
|
||||||
|
if dfbFileList, err := misc.GetFiles(dfbFiles, true); err != nil {
|
||||||
|
return nil, fmt.Errorf("getFdeFiles: failed to add files: %w", err)
|
||||||
|
} else {
|
||||||
|
for _, file := range dfbFileList {
|
||||||
|
files.Add(file, file)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// tslib
|
||||||
|
tslibFiles := []string{}
|
||||||
|
err = filepath.Walk("/usr/lib/ts", func(path string, f os.FileInfo, err error) error {
|
||||||
|
if filepath.Ext(path) == ".so" {
|
||||||
|
tslibFiles = append(tslibFiles, path)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("getFdeFiles: failed to add file: %w", err)
|
||||||
|
}
|
||||||
|
libts, _ := filepath.Glob("/usr/lib/libts*")
|
||||||
|
tslibFiles = append(tslibFiles, libts...)
|
||||||
|
if tslibFileList, err := misc.GetFiles(tslibFiles, true); err != nil {
|
||||||
|
return nil, fmt.Errorf("getFdeFiles: failed to add files: %w", err)
|
||||||
|
} else {
|
||||||
|
for _, file := range tslibFileList {
|
||||||
|
files.Add(file, file)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// mesa hw accel
|
||||||
|
if s.mesaDriver != "" {
|
||||||
|
mesaFiles := []string{
|
||||||
|
"/usr/lib/libEGL.so.1",
|
||||||
|
"/usr/lib/libGLESv2.so.2",
|
||||||
|
"/usr/lib/libgbm.so.1",
|
||||||
|
"/usr/lib/libudev.so.1",
|
||||||
|
"/usr/lib/xorg/modules/dri/" + s.mesaDriver + "_dri.so",
|
||||||
|
}
|
||||||
|
if mesaFileList, err := misc.GetFiles(mesaFiles, true); err != nil {
|
||||||
|
return nil, fmt.Errorf("getFdeFiles: failed to add files: %w", err)
|
||||||
|
} else {
|
||||||
|
for _, file := range mesaFileList {
|
||||||
|
files.Add(file, file)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return files, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func getOskConfFontPath(oskConfPath string) (string, error) {
|
||||||
|
var path string
|
||||||
|
f, err := os.Open(oskConfPath)
|
||||||
|
if err != nil {
|
||||||
|
return path, err
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
s := bufio.NewScanner(f)
|
||||||
|
for s.Scan() {
|
||||||
|
fields := strings.Fields(s.Text())
|
||||||
|
// "key = val" is 3 fields
|
||||||
|
if len(fields) > 2 && fields[0] == "keyboard-font" {
|
||||||
|
path = fields[2]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if exists, err := misc.Exists(path); !exists {
|
||||||
|
return path, fmt.Errorf("unable to find font: %s", path)
|
||||||
|
} else if err != nil {
|
||||||
|
return path, fmt.Errorf("received unexpected error when getting status for %q: %w", path, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return path, nil
|
||||||
|
}
|
165
internal/misc/getfiles.go
Normal file
165
internal/misc/getfiles.go
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
package misc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"debug/elf"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
|
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/osutil"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetFiles(list []string, required bool) (files []string, err error) {
|
||||||
|
for _, file := range list {
|
||||||
|
filelist, err := getFile(file, required)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
files = append(files, filelist...)
|
||||||
|
}
|
||||||
|
|
||||||
|
files = RemoveDuplicates(files)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func getFile(file string, required bool) (files []string, err error) {
|
||||||
|
// Expand glob expression
|
||||||
|
expanded, err := filepath.Glob(file)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if len(expanded) > 0 && expanded[0] != file {
|
||||||
|
for _, path := range expanded {
|
||||||
|
if globFiles, err := getFile(path, required); err != nil {
|
||||||
|
return files, err
|
||||||
|
} else {
|
||||||
|
files = append(files, globFiles...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return RemoveDuplicates(files), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
fileInfo, err := os.Stat(file)
|
||||||
|
if err != nil {
|
||||||
|
if required {
|
||||||
|
return files, fmt.Errorf("getFile: failed to stat file %q: %w", file, err)
|
||||||
|
}
|
||||||
|
return files, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if fileInfo.IsDir() {
|
||||||
|
// Recurse over directory contents
|
||||||
|
err := filepath.Walk(file, func(path string, f os.FileInfo, err error) error {
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if f.IsDir() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
newFiles, err := getFile(path, required)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
files = append(files, newFiles...)
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return files, err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
files = append(files, file)
|
||||||
|
|
||||||
|
// get dependencies for binaries
|
||||||
|
if _, err := elf.Open(file); err == nil {
|
||||||
|
if binaryDepFiles, err := getBinaryDeps(file); err != nil {
|
||||||
|
return files, err
|
||||||
|
} else {
|
||||||
|
files = append(files, binaryDepFiles...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
files = RemoveDuplicates(files)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func getDeps(file string, parents map[string]struct{}) (files []string, err error) {
|
||||||
|
|
||||||
|
if _, found := parents[file]; found {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// get dependencies for binaries
|
||||||
|
fd, err := elf.Open(file)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("getDeps: unable to open elf binary %q: %w", file, err)
|
||||||
|
}
|
||||||
|
libs, _ := fd.ImportedLibraries()
|
||||||
|
fd.Close()
|
||||||
|
files = append(files, file)
|
||||||
|
parents[file] = struct{}{}
|
||||||
|
|
||||||
|
if len(libs) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// we don't recursively search these paths for performance reasons
|
||||||
|
libdirGlobs := []string{
|
||||||
|
"/usr/lib",
|
||||||
|
"/lib",
|
||||||
|
"/usr/lib/expect*",
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, lib := range libs {
|
||||||
|
found := false
|
||||||
|
findDepLoop:
|
||||||
|
for _, libdirGlob := range libdirGlobs {
|
||||||
|
libdirs, _ := filepath.Glob(libdirGlob)
|
||||||
|
for _, libdir := range libdirs {
|
||||||
|
path := filepath.Join(libdir, lib)
|
||||||
|
if _, err := os.Stat(path); err == nil {
|
||||||
|
binaryDepFiles, err := getDeps(path, parents)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
files = append(files, binaryDepFiles...)
|
||||||
|
files = append(files, path)
|
||||||
|
found = true
|
||||||
|
break findDepLoop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !found {
|
||||||
|
return nil, fmt.Errorf("getDeps: unable to locate dependency for %q: %s", file, lib)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recursively list all dependencies for a given ELF binary
|
||||||
|
func getBinaryDeps(file string) ([]string, error) {
|
||||||
|
// if file is a symlink, resolve dependencies for target
|
||||||
|
fileStat, err := os.Lstat(file)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("getBinaryDeps: failed to stat file %q: %w", file, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Symlink: write symlink to archive then set 'file' to link target
|
||||||
|
if fileStat.Mode()&os.ModeSymlink != 0 {
|
||||||
|
target, err := os.Readlink(file)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("getBinaryDeps: unable to read symlink %q: %w", file, err)
|
||||||
|
}
|
||||||
|
if !filepath.IsAbs(target) {
|
||||||
|
target, err = osutil.RelativeSymlinkTargetToDir(target, filepath.Dir(file))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file = target
|
||||||
|
}
|
||||||
|
|
||||||
|
return getDeps(file, make(map[string]struct{}))
|
||||||
|
|
||||||
|
}
|
65
internal/misc/misc.go
Normal file
65
internal/misc/misc.go
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
// Copyright 2022 Clayton Craft <clayton@craftyguy.net>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
package misc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Merge the contents of "b" into "a", overwriting any previously existing keys
|
||||||
|
// in "a"
|
||||||
|
func Merge(a map[string]string, b map[string]string) {
|
||||||
|
for k, v := range b {
|
||||||
|
a[k] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Removes duplicate entries from the given string slice and returns a slice
|
||||||
|
// with the unique values
|
||||||
|
func RemoveDuplicates(in []string) (out []string) {
|
||||||
|
// use a map to "remove" duplicates. the value in the map is totally
|
||||||
|
// irrelevant
|
||||||
|
outMap := make(map[string]bool)
|
||||||
|
for _, s := range in {
|
||||||
|
if ok := outMap[s]; !ok {
|
||||||
|
outMap[s] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
out = make([]string, 0, len(outMap))
|
||||||
|
for k := range outMap {
|
||||||
|
out = append(out, k)
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prints the execution time of a function, not meant to be very
|
||||||
|
// sensitive/accurate, but good enough to gauge rough run times.
|
||||||
|
// Meant to be called as:
|
||||||
|
//
|
||||||
|
// defer misc.TimeFunc(time.Now(), "foo")
|
||||||
|
func TimeFunc(start time.Time, name string) {
|
||||||
|
elapsed := time.Since(start)
|
||||||
|
log.Printf("%s completed in: %s", name, elapsed)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exists tests if the given file/dir exists or not. Returns any errors related
|
||||||
|
// to os.Stat if the type is *not* ErrNotExist. If an error is returned, then
|
||||||
|
// the value of the returned boolean cannot be trusted.
|
||||||
|
func Exists(file string) (bool, error) {
|
||||||
|
_, err := os.Stat(file)
|
||||||
|
if err == nil {
|
||||||
|
return true, nil
|
||||||
|
} else if errors.Is(err, os.ErrNotExist) {
|
||||||
|
// Don't return the error, the file doesn't exist which is OK
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Other errors from os.Stat returned here
|
||||||
|
return false, err
|
||||||
|
}
|
125
internal/misc/misc_test.go
Normal file
125
internal/misc/misc_test.go
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
// Copyright 2022 Clayton Craft <clayton@craftyguy.net>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
package misc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"reflect"
|
||||||
|
"sort"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestMerge(t *testing.T) {
|
||||||
|
subtests := []struct {
|
||||||
|
name string
|
||||||
|
inA map[string]string
|
||||||
|
inB map[string]string
|
||||||
|
expected map[string]string
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "empty B",
|
||||||
|
inA: map[string]string{
|
||||||
|
"foo": "bar",
|
||||||
|
"banana": "airplane",
|
||||||
|
},
|
||||||
|
inB: map[string]string{},
|
||||||
|
expected: map[string]string{
|
||||||
|
"foo": "bar",
|
||||||
|
"banana": "airplane",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "empty A",
|
||||||
|
inA: map[string]string{},
|
||||||
|
inB: map[string]string{
|
||||||
|
"foo": "bar",
|
||||||
|
"banana": "airplane",
|
||||||
|
},
|
||||||
|
expected: map[string]string{
|
||||||
|
"foo": "bar",
|
||||||
|
"banana": "airplane",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "both populated, some duplicates",
|
||||||
|
inA: map[string]string{
|
||||||
|
"bar": "bazz",
|
||||||
|
"banana": "yellow",
|
||||||
|
"guava": "green",
|
||||||
|
},
|
||||||
|
inB: map[string]string{
|
||||||
|
"foo": "bar",
|
||||||
|
"banana": "airplane",
|
||||||
|
},
|
||||||
|
expected: map[string]string{
|
||||||
|
"foo": "bar",
|
||||||
|
"guava": "green",
|
||||||
|
"banana": "airplane",
|
||||||
|
"bar": "bazz",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, st := range subtests {
|
||||||
|
t.Run(st.name, func(t *testing.T) {
|
||||||
|
out := st.inA
|
||||||
|
Merge(out, st.inB)
|
||||||
|
if !reflect.DeepEqual(st.expected, out) {
|
||||||
|
t.Fatalf("expected: %q, got: %q\n", st.expected, out)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestRemoveDuplicates(t *testing.T) {
|
||||||
|
subtests := []struct {
|
||||||
|
name string
|
||||||
|
in []string
|
||||||
|
expected []string
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "no duplicates",
|
||||||
|
in: []string{
|
||||||
|
"foo",
|
||||||
|
"bar",
|
||||||
|
"banana",
|
||||||
|
"airplane",
|
||||||
|
},
|
||||||
|
expected: []string{
|
||||||
|
"foo",
|
||||||
|
"bar",
|
||||||
|
"banana",
|
||||||
|
"airplane",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "all duplicates",
|
||||||
|
in: []string{
|
||||||
|
"foo",
|
||||||
|
"foo",
|
||||||
|
"foo",
|
||||||
|
"foo",
|
||||||
|
},
|
||||||
|
expected: []string{
|
||||||
|
"foo",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "empty",
|
||||||
|
in: []string{},
|
||||||
|
expected: []string{},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, st := range subtests {
|
||||||
|
t.Run(st.name, func(t *testing.T) {
|
||||||
|
// note: sorting to make comparison easier later
|
||||||
|
sort.Strings(st.expected)
|
||||||
|
out := RemoveDuplicates(st.in)
|
||||||
|
sort.Strings(out)
|
||||||
|
if !reflect.DeepEqual(st.expected, out) {
|
||||||
|
t.Fatalf("expected: %q, got: %q\n", st.expected, out)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
@@ -1,16 +1,14 @@
|
|||||||
// Copyright 2021 Clayton Craft <clayton@craftyguy.net>
|
package osutil
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
package misc
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"golang.org/x/sys/unix"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
"strings"
|
||||||
|
|
||||||
type StringSet map[string]bool
|
"golang.org/x/sys/unix"
|
||||||
|
)
|
||||||
|
|
||||||
// Converts a relative symlink target path (e.g. ../../lib/foo.so), that is
|
// Converts a relative symlink target path (e.g. ../../lib/foo.so), that is
|
||||||
// absolute path
|
// absolute path
|
||||||
@@ -48,3 +46,29 @@ func FreeSpace(path string) (uint64, error) {
|
|||||||
size := stat.Bavail * uint64(stat.Bsize)
|
size := stat.Bavail * uint64(stat.Bsize)
|
||||||
return size, nil
|
return size, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getKernelReleaseFile() (string, error) {
|
||||||
|
files, _ := filepath.Glob("/usr/share/kernel/*/kernel.release")
|
||||||
|
// only one kernel flavor supported
|
||||||
|
if len(files) != 1 {
|
||||||
|
return "", fmt.Errorf("only one kernel release/flavor is supported, found: %q", files)
|
||||||
|
}
|
||||||
|
|
||||||
|
return files[0], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetKernelVersion() (string, error) {
|
||||||
|
var version string
|
||||||
|
|
||||||
|
releaseFile, err := getKernelReleaseFile()
|
||||||
|
if err != nil {
|
||||||
|
return version, err
|
||||||
|
}
|
||||||
|
|
||||||
|
contents, err := os.ReadFile(releaseFile)
|
||||||
|
if err != nil {
|
||||||
|
return version, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.TrimSpace(string(contents)), nil
|
||||||
|
}
|
742
main.go
742
main.go
@@ -1,742 +0,0 @@
|
|||||||
// Copyright 2021 Clayton Craft <clayton@craftyguy.net>
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bufio"
|
|
||||||
"debug/elf"
|
|
||||||
"errors"
|
|
||||||
"flag"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
"os/exec"
|
|
||||||
"path/filepath"
|
|
||||||
"regexp"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/spf13/afero"
|
|
||||||
|
|
||||||
"gitlab.com/postmarketOS/postmarketos-mkinitfs/pkgs/archive"
|
|
||||||
"gitlab.com/postmarketOS/postmarketos-mkinitfs/pkgs/deviceinfo"
|
|
||||||
"gitlab.com/postmarketOS/postmarketos-mkinitfs/pkgs/misc"
|
|
||||||
)
|
|
||||||
|
|
||||||
var appFs afero.Fs
|
|
||||||
|
|
||||||
func initFs(fs afero.Fs) {
|
|
||||||
appFs = fs
|
|
||||||
}
|
|
||||||
|
|
||||||
func timeFunc(start time.Time, name string) {
|
|
||||||
elapsed := time.Since(start)
|
|
||||||
log.Printf("%s completed in: %s", name, elapsed)
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
initFs(afero.NewOsFs())
|
|
||||||
|
|
||||||
deviceinfoFile := "/etc/deviceinfo"
|
|
||||||
if !exists(deviceinfoFile) {
|
|
||||||
log.Print("NOTE: deviceinfo (from device package) not installed yet, " +
|
|
||||||
"not building the initramfs now (it should get built later " +
|
|
||||||
"automatically.)")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
devinfo, err := deviceinfo.ReadDeviceinfo(deviceinfoFile)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
outDir := flag.String("d", "/boot", "Directory to output initfs(-extra) and other boot files")
|
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
defer timeFunc(time.Now(), "mkinitfs")
|
|
||||||
|
|
||||||
kernVer, err := getKernelVersion()
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// temporary working dir
|
|
||||||
workDir, err := ioutil.TempDir("", "mkinitfs")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal("Unable to create temporary work directory:", err)
|
|
||||||
}
|
|
||||||
defer appFs.RemoveAll(workDir)
|
|
||||||
|
|
||||||
log.Print("Generating for kernel version: ", kernVer)
|
|
||||||
log.Print("Output directory: ", *outDir)
|
|
||||||
|
|
||||||
if err := generateInitfs("initramfs", workDir, kernVer, devinfo); err != nil {
|
|
||||||
log.Fatal("generateInitfs: ", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := generateInitfsExtra("initramfs-extra", workDir, devinfo); err != nil {
|
|
||||||
log.Fatal("generateInitfsExtra: ", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Final processing of initramfs / kernel is done by boot-deploy
|
|
||||||
if err := bootDeploy(workDir, *outDir); err != nil {
|
|
||||||
log.Fatal("bootDeploy: ", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func bootDeploy(workDir string, outDir string) error {
|
|
||||||
// boot-deploy expects the kernel to be in the same dir as initramfs.
|
|
||||||
// Assume that the kernel is in the output dir...
|
|
||||||
log.Print("== Using boot-deploy to finalize/install files ==")
|
|
||||||
kernels, _ := afero.Glob(appFs, filepath.Join(outDir, "vmlinuz*"))
|
|
||||||
if len(kernels) == 0 {
|
|
||||||
return errors.New("Unable to find any kernels at " + filepath.Join(outDir, "vmlinuz*"))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pick a kernel that does not have suffixes added by boot-deploy
|
|
||||||
var kernFile string
|
|
||||||
for _, f := range kernels {
|
|
||||||
if strings.HasSuffix(f, "-dtb") || strings.HasSuffix(f, "-mtk") {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
kernFile = f
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
kernFd, err := appFs.Open(kernFile)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer kernFd.Close()
|
|
||||||
|
|
||||||
kernFileCopy, err := appFs.Create(filepath.Join(workDir, "vmlinuz"))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err = io.Copy(kernFileCopy, kernFd); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
kernFileCopy.Close()
|
|
||||||
|
|
||||||
// boot-deploy -i initramfs -k vmlinuz-postmarketos-rockchip -d /tmp/cpio -o /tmp/foo initramfs-extra
|
|
||||||
cmd := exec.Command("boot-deploy",
|
|
||||||
"-i", "initramfs",
|
|
||||||
"-k", "vmlinuz",
|
|
||||||
"-d", workDir,
|
|
||||||
"-o", outDir,
|
|
||||||
"initramfs-extra")
|
|
||||||
if !exists(cmd.Path) {
|
|
||||||
return errors.New("boot-deploy command not found")
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd.Stdout = os.Stdout
|
|
||||||
cmd.Stderr = os.Stderr
|
|
||||||
if err := cmd.Run(); err != nil {
|
|
||||||
log.Print("'boot-deploy' command failed")
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func exists(file string) bool {
|
|
||||||
if _, err := appFs.Stat(file); err == nil {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func getHookFiles(filesdir string) misc.StringSet {
|
|
||||||
fileInfo, err := ioutil.ReadDir(filesdir)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
files := make(misc.StringSet)
|
|
||||||
for _, file := range fileInfo {
|
|
||||||
path := filepath.Join(filesdir, file.Name())
|
|
||||||
f, err := appFs.Open(path)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
s := bufio.NewScanner(f)
|
|
||||||
for s.Scan() {
|
|
||||||
if err := getFile(files, s.Text(), true); err != nil {
|
|
||||||
log.Fatalf("Unable to find file %q required by %q", s.Text(), path)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if err := s.Err(); err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return files
|
|
||||||
}
|
|
||||||
|
|
||||||
// Recursively list all dependencies for a given ELF binary
|
|
||||||
func getBinaryDeps(files misc.StringSet, file string) error {
|
|
||||||
lstater, ok := appFs.(afero.Lstater)
|
|
||||||
if !ok {
|
|
||||||
return errors.New("FS doesn't support Lstat")
|
|
||||||
}
|
|
||||||
|
|
||||||
// if file is a symlink, resolve dependencies for target
|
|
||||||
fileStat, _, err := lstater.LstatIfPossible(file)
|
|
||||||
if err != nil {
|
|
||||||
log.Print("getBinaryDeps: failed to stat file")
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
lreader, ok := appFs.(afero.LinkReader)
|
|
||||||
if !ok {
|
|
||||||
return errors.New("FS doesn't support Readlink")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Symlink: write symlink to archive then set 'file' to link target
|
|
||||||
if fileStat.Mode()&os.ModeSymlink != 0 {
|
|
||||||
target, err := lreader.ReadlinkIfPossible(file)
|
|
||||||
if err != nil {
|
|
||||||
log.Print("getBinaryDeps: unable to read symlink: ", file)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if !filepath.IsAbs(target) {
|
|
||||||
target, err = misc.RelativeSymlinkTargetToDir(target, filepath.Dir(file))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if err := getBinaryDeps(files, target); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// get dependencies for binaries
|
|
||||||
fd, err := elf.Open(file)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
libs, _ := fd.ImportedLibraries()
|
|
||||||
fd.Close()
|
|
||||||
files[file] = false
|
|
||||||
|
|
||||||
if len(libs) == 0 {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
libdirs := []string{"/usr/lib", "/lib"}
|
|
||||||
for _, lib := range libs {
|
|
||||||
found := false
|
|
||||||
for _, libdir := range libdirs {
|
|
||||||
path := filepath.Join(libdir, lib)
|
|
||||||
if _, err := appFs.Stat(path); err == nil {
|
|
||||||
err := getBinaryDeps(files, path)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
files[path] = false
|
|
||||||
found = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !found {
|
|
||||||
log.Fatalf("Unable to locate dependency for %q: %s", file, lib)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func getFiles(files misc.StringSet, newFiles misc.StringSet, required bool) error {
|
|
||||||
for file := range newFiles {
|
|
||||||
err := getFile(files, file, required)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func getFile(files misc.StringSet, file string, required bool) error {
|
|
||||||
// Expand glob expression
|
|
||||||
expanded, _ := afero.Glob(appFs, file)
|
|
||||||
if len(expanded) > 0 && expanded[0] != file {
|
|
||||||
for _, path := range expanded {
|
|
||||||
if err := getFile(files, path, required); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
fileInfo, err := appFs.Stat(file)
|
|
||||||
if err != nil {
|
|
||||||
if required {
|
|
||||||
return errors.New("getFile: File does not exist :" + file)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if fileInfo.IsDir() {
|
|
||||||
// Recurse over directory contents
|
|
||||||
err := afero.Walk(appFs, file, func(path string, f os.FileInfo, err error) error {
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if f.IsDir() {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return getFile(files, path, required)
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
files[file] = false
|
|
||||||
|
|
||||||
// get dependencies for binaries
|
|
||||||
if _, err := elf.Open(file); err != nil {
|
|
||||||
// file is not an elf, so don't resolve lib dependencies
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := getBinaryDeps(files, file); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func getOskConfFontPath(oskConfPath string) (string, error) {
|
|
||||||
var path string
|
|
||||||
f, err := appFs.Open(oskConfPath)
|
|
||||||
if err != nil {
|
|
||||||
return path, err
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
s := bufio.NewScanner(f)
|
|
||||||
for s.Scan() {
|
|
||||||
fields := strings.Fields(s.Text())
|
|
||||||
// "key = val" is 3 fields
|
|
||||||
if len(fields) > 2 && fields[0] == "keyboard-font" {
|
|
||||||
path = fields[2]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !exists(path) {
|
|
||||||
return path, errors.New("Unable to find font: " + path)
|
|
||||||
}
|
|
||||||
|
|
||||||
return path, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get a list of files and their dependencies related to supporting rootfs full
|
|
||||||
// disk (d)encryption
|
|
||||||
func getFdeFiles(files misc.StringSet, devinfo deviceinfo.DeviceInfo) error {
|
|
||||||
confFiles := misc.StringSet{
|
|
||||||
"/etc/osk.conf": false,
|
|
||||||
"/etc/ts.conf": false,
|
|
||||||
"/etc/pointercal": false,
|
|
||||||
"/etc/fb.modes": false,
|
|
||||||
"/etc/directfbrc": false,
|
|
||||||
}
|
|
||||||
// TODO: this shouldn't be false? though some files (pointercal) don't always exist...
|
|
||||||
if err := getFiles(files, confFiles, false); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// osk-sdl
|
|
||||||
oskFiles := misc.StringSet{
|
|
||||||
"/usr/bin/osk-sdl": false,
|
|
||||||
"/sbin/cryptsetup": false,
|
|
||||||
"/usr/lib/libGL.so.1": false}
|
|
||||||
if err := getFiles(files, oskFiles, true); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
fontFile, err := getOskConfFontPath("/etc/osk.conf")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
files[fontFile] = false
|
|
||||||
|
|
||||||
// Directfb
|
|
||||||
dfbFiles := make(misc.StringSet)
|
|
||||||
err = afero.Walk(appFs, "/usr/lib/directfb-1.7-7", func(path string, f os.FileInfo, err error) error {
|
|
||||||
if filepath.Ext(path) == ".so" {
|
|
||||||
dfbFiles[path] = false
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
log.Print("getBinaryDeps: failed to stat file")
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if err := getFiles(files, dfbFiles, true); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// tslib
|
|
||||||
tslibFiles := make(misc.StringSet)
|
|
||||||
err = afero.Walk(appFs, "/usr/lib/ts", func(path string, f os.FileInfo, err error) error {
|
|
||||||
if filepath.Ext(path) == ".so" {
|
|
||||||
tslibFiles[path] = false
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
log.Print("getBinaryDeps: failed to stat file")
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
libts, _ := afero.Glob(appFs, "/usr/lib/libts*")
|
|
||||||
for _, file := range libts {
|
|
||||||
tslibFiles[file] = false
|
|
||||||
}
|
|
||||||
if err = getFiles(files, tslibFiles, true); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// mesa hw accel
|
|
||||||
if devinfo.MesaDriver != "" {
|
|
||||||
mesaFiles := misc.StringSet{
|
|
||||||
"/usr/lib/libEGL.so.1": false,
|
|
||||||
"/usr/lib/libGLESv2.so.2": false,
|
|
||||||
"/usr/lib/libgbm.so.1": false,
|
|
||||||
"/usr/lib/libudev.so.1": false,
|
|
||||||
"/usr/lib/xorg/modules/dri/" + devinfo.MesaDriver + "_dri.so": false,
|
|
||||||
}
|
|
||||||
if err := getFiles(files, mesaFiles, true); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func getHookScripts(files misc.StringSet) {
|
|
||||||
scripts, _ := afero.Glob(appFs, "/etc/postmarketos-mkinitfs/hooks/*.sh")
|
|
||||||
for _, script := range scripts {
|
|
||||||
files[script] = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func getInitfsExtraFiles(files misc.StringSet, devinfo deviceinfo.DeviceInfo) error {
|
|
||||||
log.Println("== Generating initramfs extra ==")
|
|
||||||
binariesExtra := misc.StringSet{
|
|
||||||
"/lib/libz.so.1": false,
|
|
||||||
"/sbin/dmsetup": false,
|
|
||||||
"/sbin/e2fsck": false,
|
|
||||||
"/usr/sbin/parted": false,
|
|
||||||
"/usr/sbin/resize2fs": false,
|
|
||||||
"/usr/sbin/resize.f2fs": false,
|
|
||||||
}
|
|
||||||
log.Println("- Including extra binaries")
|
|
||||||
if err := getFiles(files, binariesExtra, true); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if exists("/usr/bin/osk-sdl") {
|
|
||||||
log.Println("- Including FDE support")
|
|
||||||
if err := getFdeFiles(files, devinfo); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.Println("- *NOT* including FDE support")
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func getInitfsFiles(files misc.StringSet, devinfo deviceinfo.DeviceInfo) error {
|
|
||||||
log.Println("== Generating initramfs ==")
|
|
||||||
requiredFiles := misc.StringSet{
|
|
||||||
"/bin/busybox": false,
|
|
||||||
"/bin/sh": false,
|
|
||||||
"/bin/busybox-extras": false,
|
|
||||||
"/usr/sbin/telnetd": false,
|
|
||||||
"/sbin/kpartx": false,
|
|
||||||
"/etc/deviceinfo": false,
|
|
||||||
"/usr/bin/unudhcpd": false,
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hook files & scripts
|
|
||||||
if exists("/etc/postmarketos-mkinitfs/files") {
|
|
||||||
log.Println("- Including hook files")
|
|
||||||
hookFiles := getHookFiles("/etc/postmarketos-mkinitfs/files")
|
|
||||||
if err := getFiles(files, hookFiles, true); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log.Println("- Including hook scripts")
|
|
||||||
getHookScripts(files)
|
|
||||||
|
|
||||||
log.Println("- Including required binaries")
|
|
||||||
if err := getFiles(files, requiredFiles, true); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func getInitfsModules(files misc.StringSet, devinfo deviceinfo.DeviceInfo, kernelVer string) error {
|
|
||||||
log.Println("- Including kernel modules")
|
|
||||||
|
|
||||||
modDir := filepath.Join("/lib/modules", kernelVer)
|
|
||||||
if !exists(modDir) {
|
|
||||||
// dir /lib/modules/<kernel> if kernel built without module support, so just print a message
|
|
||||||
log.Printf("-- kernel module directory not found: %q, not including modules", modDir)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// modules.* required by modprobe
|
|
||||||
modprobeFiles, _ := afero.Glob(appFs, filepath.Join(modDir, "modules.*"))
|
|
||||||
for _, file := range modprobeFiles {
|
|
||||||
files[file] = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// module name (without extension), or directory (trailing slash is important! globs OK)
|
|
||||||
requiredModules := []string{
|
|
||||||
"loop",
|
|
||||||
"dm-crypt",
|
|
||||||
"kernel/fs/overlayfs/",
|
|
||||||
"kernel/crypto/",
|
|
||||||
"kernel/arch/*/crypto/",
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, item := range requiredModules {
|
|
||||||
dir, file := filepath.Split(item)
|
|
||||||
if file == "" {
|
|
||||||
// item is a directory
|
|
||||||
dir = filepath.Join(modDir, dir)
|
|
||||||
dirs, _ := afero.Glob(appFs, dir)
|
|
||||||
for _, d := range dirs {
|
|
||||||
if err := getModulesInDir(files, d); err != nil {
|
|
||||||
log.Print("Unable to get modules in dir: ", d)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if dir == "" {
|
|
||||||
// item is a module name
|
|
||||||
if err := getModule(files, file, modDir); err != nil {
|
|
||||||
log.Print("Unable to get module: ", file)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.Printf("Unknown module entry: %q", item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// deviceinfo modules
|
|
||||||
for _, module := range strings.Fields(devinfo.ModulesInitfs) {
|
|
||||||
if err := getModule(files, module, modDir); err != nil {
|
|
||||||
log.Print("Unable to get modules from deviceinfo")
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// /etc/postmarketos-mkinitfs/modules/*.modules
|
|
||||||
initfsModFiles, _ := afero.Glob(appFs, "/etc/postmarketos-mkinitfs/modules/*.modules")
|
|
||||||
for _, modFile := range initfsModFiles {
|
|
||||||
f, err := appFs.Open(modFile)
|
|
||||||
if err != nil {
|
|
||||||
log.Print("getInitfsModules: unable to open mkinitfs modules file: ", modFile)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
s := bufio.NewScanner(f)
|
|
||||||
for s.Scan() {
|
|
||||||
if err := getModule(files, s.Text(), modDir); err != nil {
|
|
||||||
log.Print("getInitfsModules: unable to get module file: ", s.Text())
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func getKernelReleaseFile() (string, error) {
|
|
||||||
files, _ := afero.Glob(appFs, "/usr/share/kernel/*/kernel.release")
|
|
||||||
// only one kernel flavor supported
|
|
||||||
if len(files) != 1 {
|
|
||||||
return "", fmt.Errorf("only one kernel release/flavor is supported, found: %q", files)
|
|
||||||
}
|
|
||||||
|
|
||||||
return files[0], nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func getKernelVersion() (string, error) {
|
|
||||||
var version string
|
|
||||||
|
|
||||||
releaseFile, err := getKernelReleaseFile()
|
|
||||||
if err != nil {
|
|
||||||
return version, err
|
|
||||||
}
|
|
||||||
|
|
||||||
contents, err := afero.ReadFile(appFs, releaseFile)
|
|
||||||
if err != nil {
|
|
||||||
return version, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return strings.TrimSpace(string(contents)), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func generateInitfs(name string, path string, kernVer string, devinfo deviceinfo.DeviceInfo) error {
|
|
||||||
initfsArchive, err := archive.New()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
requiredDirs := []string{
|
|
||||||
"/bin", "/sbin", "/usr/bin", "/usr/sbin", "/proc", "/sys",
|
|
||||||
"/dev", "/tmp", "/lib", "/boot", "/sysroot", "/etc",
|
|
||||||
}
|
|
||||||
for _, dir := range requiredDirs {
|
|
||||||
initfsArchive.Dirs[dir] = false
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := getInitfsFiles(initfsArchive.Files, devinfo); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := getInitfsModules(initfsArchive.Files, devinfo, kernVer); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := initfsArchive.AddFile("/usr/share/postmarketos-mkinitfs/init.sh", "/init"); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// splash images
|
|
||||||
log.Println("- Including splash images")
|
|
||||||
splashFiles, _ := afero.Glob(appFs, "/usr/share/postmarketos-splashes/*.ppm.gz")
|
|
||||||
for _, file := range splashFiles {
|
|
||||||
// splash images are expected at /<file>
|
|
||||||
if err := initfsArchive.AddFile(file, filepath.Join("/", filepath.Base(file))); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// initfs_functions
|
|
||||||
if err := initfsArchive.AddFile("/usr/share/postmarketos-mkinitfs/init_functions.sh", "/init_functions.sh"); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Println("- Writing and verifying initramfs archive")
|
|
||||||
if err := initfsArchive.Write(filepath.Join(path, name), os.FileMode(0644)); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func generateInitfsExtra(name string, path string, devinfo deviceinfo.DeviceInfo) error {
|
|
||||||
initfsExtraArchive, err := archive.New()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := getInitfsExtraFiles(initfsExtraArchive.Files, devinfo); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Println("- Writing and verifying initramfs-extra archive")
|
|
||||||
if err := initfsExtraArchive.Write(filepath.Join(path, name), os.FileMode(0644)); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func stripExts(file string) string {
|
|
||||||
return strings.Split(file, ".")[0]
|
|
||||||
}
|
|
||||||
|
|
||||||
func getModulesInDir(files misc.StringSet, modPath string) error {
|
|
||||||
err := afero.Walk(appFs, modPath, func(path string, f os.FileInfo, err error) error {
|
|
||||||
// TODO: need to support more extensions?
|
|
||||||
if filepath.Ext(path) != ".ko" && filepath.Ext(path) != ".xz" {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
files[path] = false
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Given a module name, e.g. 'dwc_wdt', resolve the full path to the module
|
|
||||||
// file and all of its dependencies.
|
|
||||||
// Note: it's not necessarily fatal if the module is not found, since it may
|
|
||||||
// have been built into the kernel
|
|
||||||
// TODO: look for it in modules.builtin, and make it fatal if it can't be found
|
|
||||||
// anywhere
|
|
||||||
func getModule(files misc.StringSet, modName string, modDir string) error {
|
|
||||||
|
|
||||||
modDep := filepath.Join(modDir, "modules.dep")
|
|
||||||
if !exists(modDep) {
|
|
||||||
log.Fatal("Kernel module.dep not found: ", modDir)
|
|
||||||
}
|
|
||||||
|
|
||||||
fd, err := appFs.Open(modDep)
|
|
||||||
if err != nil {
|
|
||||||
log.Print("Unable to open modules.dep: ", modDep)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer fd.Close()
|
|
||||||
|
|
||||||
deps, err := getModuleDeps(modName, fd)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, dep := range deps {
|
|
||||||
p := filepath.Join(modDir, dep)
|
|
||||||
if !exists(p) {
|
|
||||||
log.Print(fmt.Sprintf("Tried to include a module that doesn't exist in the modules directory (%s): %s", modDir, p))
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
files[p] = false
|
|
||||||
}
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the canonicalized name for the module as represented in the given modules.dep io.reader
|
|
||||||
func getModuleDeps(modName string, modulesDep io.Reader) ([]string, error) {
|
|
||||||
var deps []string
|
|
||||||
|
|
||||||
// split the module name on - and/or _, build a regex for matching
|
|
||||||
splitRe := regexp.MustCompile("[-_]+")
|
|
||||||
modNameReStr := splitRe.ReplaceAllString(modName, "[-_]+")
|
|
||||||
re := regexp.MustCompile("^" + modNameReStr + "$")
|
|
||||||
|
|
||||||
s := bufio.NewScanner(modulesDep)
|
|
||||||
for s.Scan() {
|
|
||||||
fields := strings.Fields(s.Text())
|
|
||||||
if len(fields) == 0 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
fields[0] = strings.TrimSuffix(fields[0], ":")
|
|
||||||
|
|
||||||
found := re.FindAll([]byte(filepath.Base(stripExts(fields[0]))), -1)
|
|
||||||
if len(found) > 0 {
|
|
||||||
deps = append(deps, fields...)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if err := s.Err(); err != nil {
|
|
||||||
log.Print("Unable to get module + dependencies: ", modName)
|
|
||||||
return deps, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return deps, nil
|
|
||||||
}
|
|
205
main_test.go
205
main_test.go
@@ -1,205 +0,0 @@
|
|||||||
// Copyright 2021 Clayton Craft <clayton@craftyguy.net>
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/spf13/afero"
|
|
||||||
"gitlab.com/postmarketOS/postmarketos-mkinitfs/pkgs/misc"
|
|
||||||
"reflect"
|
|
||||||
"strings"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestStripExts(t *testing.T) {
|
|
||||||
tables := []struct {
|
|
||||||
in string
|
|
||||||
expected string
|
|
||||||
}{
|
|
||||||
{"/foo/bar/bazz.tar", "/foo/bar/bazz"},
|
|
||||||
{"file.tar.gz.xz.zip", "file"},
|
|
||||||
{"another_file", "another_file"},
|
|
||||||
{"a.b.c.d.e.f.g.h.i", "a"},
|
|
||||||
{"virtio_blk.ko", "virtio_blk"},
|
|
||||||
}
|
|
||||||
for _, table := range tables {
|
|
||||||
out := stripExts(table.in)
|
|
||||||
if out != table.expected {
|
|
||||||
t.Errorf("Expected: %q, got: %q", table.expected, out)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func stringSlicesEqual(a []string, b []string) bool {
|
|
||||||
if len(a) != len(b) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
for i, v := range a {
|
|
||||||
if v != b[i] {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
var testModuleDep string = `
|
|
||||||
kernel/sound/soc/codecs/snd-soc-msm8916-digital.ko:
|
|
||||||
kernel/net/sched/act_ipt.ko.xz: kernel/net/netfilter/x_tables.ko.xz
|
|
||||||
kernel/drivers/watchdog/watchdog.ko.xz:
|
|
||||||
kernel/drivers/usb/serial/ir-usb.ko.xz: kernel/drivers/usb/serial/usbserial.ko.xz
|
|
||||||
kernel/drivers/gpu/drm/scheduler/gpu-sched.ko.xz:
|
|
||||||
kernel/drivers/hid/hid-alps.ko.xz:
|
|
||||||
kernel/net/netfilter/xt_u32.ko.xz: kernel/net/netfilter/x_tables.ko.xz
|
|
||||||
kernel/net/netfilter/xt_sctp.ko.xz: kernel/net/netfilter/x_tables.ko.xz
|
|
||||||
kernel/drivers/hwmon/gl518sm.ko.xz:
|
|
||||||
kernel/drivers/watchdog/dw_wdt.ko.xz: kernel/drivers/watchdog/watchdog.ko.xz
|
|
||||||
kernel/net/bluetooth/hidp/hidp.ko.xz: kernel/net/bluetooth/bluetooth.ko.xz kernel/net/rfkill/rfkill.ko.xz kernel/crypto/ecdh_generic.ko.xz kernel/crypto/ecc.ko.xz
|
|
||||||
kernel/fs/nls/nls_iso8859-1.ko.xz:
|
|
||||||
kernel/net/vmw_vsock/vmw_vsock_virtio_transport.ko.xz: kernel/net/vmw_vsock/vmw_vsock_virtio_transport_common.ko.xz kernel/drivers/virtio/virtio.ko.xz kernel/drivers/virtio/virtio_ring.ko.xz kernel/net/vmw_vsock/vsock.ko.xz
|
|
||||||
kernel/drivers/gpu/drm/panfrost/panfrost.ko.xz: kernel/drivers/gpu/drm/scheduler/gpu-sched.ko.xz
|
|
||||||
kernel/drivers/gpu/drm/msm/msm.ko: kernel/drivers/gpu/drm/drm_kms_helper.ko
|
|
||||||
`
|
|
||||||
|
|
||||||
func TestGetModuleDeps(t *testing.T) {
|
|
||||||
tables := []struct {
|
|
||||||
in string
|
|
||||||
expected []string
|
|
||||||
}{
|
|
||||||
{"nls-iso8859-1", []string{"kernel/fs/nls/nls_iso8859-1.ko.xz"}},
|
|
||||||
{"gpu_sched", []string{"kernel/drivers/gpu/drm/scheduler/gpu-sched.ko.xz"}},
|
|
||||||
{"dw-wdt", []string{"kernel/drivers/watchdog/dw_wdt.ko.xz",
|
|
||||||
"kernel/drivers/watchdog/watchdog.ko.xz"}},
|
|
||||||
{"gl518sm", []string{"kernel/drivers/hwmon/gl518sm.ko.xz"}},
|
|
||||||
{"msm", []string{"kernel/drivers/gpu/drm/msm/msm.ko",
|
|
||||||
"kernel/drivers/gpu/drm/drm_kms_helper.ko"}},
|
|
||||||
}
|
|
||||||
for _, table := range tables {
|
|
||||||
out, err := getModuleDeps(table.in, strings.NewReader(testModuleDep))
|
|
||||||
if err != nil {
|
|
||||||
t.Errorf("unexpected error with input: %q, error: %q", table.expected, err)
|
|
||||||
}
|
|
||||||
if !stringSlicesEqual(out, table.expected) {
|
|
||||||
t.Errorf("Expected: %q, got: %q", table.expected, out)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func setUpFakeFs() {
|
|
||||||
fs := afero.NewMemMapFs()
|
|
||||||
initFs(fs)
|
|
||||||
|
|
||||||
fs.Mkdir("/foo", 0755)
|
|
||||||
afero.WriteFile(fs, "/foo/foo.txt", []byte("foo"), 0644)
|
|
||||||
|
|
||||||
fs.Mkdir("/foo/bar", 0755)
|
|
||||||
afero.WriteFile(fs, "/foo/bar/bar.txt", []byte("bar"), 0644)
|
|
||||||
afero.WriteFile(fs, "/foo/bar/foo.txt", []byte("foo"), 0644)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestGetFileWithFilePath(t *testing.T) {
|
|
||||||
setUpFakeFs()
|
|
||||||
|
|
||||||
actual := make(misc.StringSet)
|
|
||||||
file := "/foo/bar/bar.txt"
|
|
||||||
if err := getFile(actual, file, true); err != nil {
|
|
||||||
t.Errorf("Unexpected error when collecting file %q, error: %q", file, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
expected := make(misc.StringSet)
|
|
||||||
expected["/foo/bar/bar.txt"] = false
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expected, actual) {
|
|
||||||
t.Errorf("Expected: %v, got: %v", expected, actual)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestGetFileWithGlobThatExpandsToSingleFile(t *testing.T) {
|
|
||||||
setUpFakeFs()
|
|
||||||
|
|
||||||
actual := make(misc.StringSet)
|
|
||||||
file := "/foo/bar/bar.*"
|
|
||||||
if err := getFile(actual, file, true); err != nil {
|
|
||||||
t.Errorf("Unexpected error when collecting file %q, error: %q", file, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
expected := make(misc.StringSet)
|
|
||||||
expected["/foo/bar/bar.txt"] = false
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expected, actual) {
|
|
||||||
t.Errorf("Expected: %v, got: %v", expected, actual)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestGetFileWithGlobThatExpandsToMultipleFiles(t *testing.T) {
|
|
||||||
setUpFakeFs()
|
|
||||||
|
|
||||||
actual := make(misc.StringSet)
|
|
||||||
file := "/foo/bar/*.txt"
|
|
||||||
if err := getFile(actual, file, true); err != nil {
|
|
||||||
t.Errorf("Unexpected error when collecting file %q, error: %q", file, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
expected := make(misc.StringSet)
|
|
||||||
expected["/foo/bar/bar.txt"] = false
|
|
||||||
expected["/foo/bar/foo.txt"] = false
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expected, actual) {
|
|
||||||
t.Errorf("Expected: %v, got: %v", expected, actual)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestGetFileWithDirectoryPath(t *testing.T) {
|
|
||||||
setUpFakeFs()
|
|
||||||
|
|
||||||
actual := make(misc.StringSet)
|
|
||||||
file := "/foo"
|
|
||||||
if err := getFile(actual, file, true); err != nil {
|
|
||||||
t.Errorf("Unexpected error when collecting file %q, error: %q", file, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
expected := make(misc.StringSet)
|
|
||||||
expected["/foo/foo.txt"] = false
|
|
||||||
expected["/foo/bar/bar.txt"] = false
|
|
||||||
expected["/foo/bar/foo.txt"] = false
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expected, actual) {
|
|
||||||
t.Errorf("Expected: %v, got: %v", expected, actual)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestGetFileWithGlobThatExpandsToSingleDirectory(t *testing.T) {
|
|
||||||
setUpFakeFs()
|
|
||||||
|
|
||||||
actual := make(misc.StringSet)
|
|
||||||
file := "/foo/b*"
|
|
||||||
if err := getFile(actual, file, true); err != nil {
|
|
||||||
t.Errorf("Unexpected error when collecting file %q, error: %q", file, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
expected := make(misc.StringSet)
|
|
||||||
expected["/foo/bar/bar.txt"] = false
|
|
||||||
expected["/foo/bar/foo.txt"] = false
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expected, actual) {
|
|
||||||
t.Errorf("Expected: %v, got: %v", expected, actual)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestGetFileWithGlobThatExpandsToDirectoriesAndFiles(t *testing.T) {
|
|
||||||
setUpFakeFs()
|
|
||||||
|
|
||||||
actual := make(misc.StringSet)
|
|
||||||
file := "/foo/*"
|
|
||||||
if err := getFile(actual, file, true); err != nil {
|
|
||||||
t.Errorf("Unexpected error when collecting file %q, error: %q", file, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
expected := make(misc.StringSet)
|
|
||||||
expected["/foo/foo.txt"] = false
|
|
||||||
expected["/foo/bar/bar.txt"] = false
|
|
||||||
expected["/foo/bar/foo.txt"] = false
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expected, actual) {
|
|
||||||
t.Errorf("Expected: %v, got: %v", expected, actual)
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,225 +0,0 @@
|
|||||||
// Copyright 2021 Clayton Craft <clayton@craftyguy.net>
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
package archive
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"compress/flate"
|
|
||||||
"github.com/cavaliercoder/go-cpio"
|
|
||||||
"github.com/klauspost/pgzip"
|
|
||||||
"gitlab.com/postmarketOS/postmarketos-mkinitfs/pkgs/misc"
|
|
||||||
"io"
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Archive struct {
|
|
||||||
Dirs misc.StringSet
|
|
||||||
Files misc.StringSet
|
|
||||||
cpioWriter *cpio.Writer
|
|
||||||
buf *bytes.Buffer
|
|
||||||
}
|
|
||||||
|
|
||||||
func New() (*Archive, error) {
|
|
||||||
buf := new(bytes.Buffer)
|
|
||||||
archive := &Archive{
|
|
||||||
cpioWriter: cpio.NewWriter(buf),
|
|
||||||
Files: make(misc.StringSet),
|
|
||||||
Dirs: make(misc.StringSet),
|
|
||||||
buf: buf,
|
|
||||||
}
|
|
||||||
|
|
||||||
return archive, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (archive *Archive) Write(path string, mode os.FileMode) error {
|
|
||||||
if err := archive.writeCpio(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := archive.cpioWriter.Close(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write archive to path
|
|
||||||
if err := archive.writeCompressed(path, mode); err != nil {
|
|
||||||
log.Print("Unable to write archive to location: ", path)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := os.Chmod(path, mode); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (archive *Archive) AddFile(file string, dest string) error {
|
|
||||||
if err := archive.addDir(filepath.Dir(dest)); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if archive.Files[file] {
|
|
||||||
// Already written to cpio
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
fileStat, err := os.Lstat(file)
|
|
||||||
if err != nil {
|
|
||||||
log.Print("AddFile: failed to stat file: ", file)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Symlink: write symlink to archive then set 'file' to link target
|
|
||||||
if fileStat.Mode()&os.ModeSymlink != 0 {
|
|
||||||
// log.Printf("File %q is a symlink", file)
|
|
||||||
target, err := os.Readlink(file)
|
|
||||||
if err != nil {
|
|
||||||
log.Print("AddFile: failed to get symlink target: ", file)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
destFilename := strings.TrimPrefix(dest, "/")
|
|
||||||
hdr := &cpio.Header{
|
|
||||||
Name: destFilename,
|
|
||||||
Linkname: target,
|
|
||||||
Mode: 0644 | cpio.ModeSymlink,
|
|
||||||
Size: int64(len(target)),
|
|
||||||
// Checksum: 1,
|
|
||||||
}
|
|
||||||
if err := archive.cpioWriter.WriteHeader(hdr); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if _, err = archive.cpioWriter.Write([]byte(target)); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
archive.Files[file] = true
|
|
||||||
if filepath.Dir(target) == "." {
|
|
||||||
target = filepath.Join(filepath.Dir(file), target)
|
|
||||||
}
|
|
||||||
// make sure target is an absolute path
|
|
||||||
if !filepath.IsAbs(target) {
|
|
||||||
target, err = misc.RelativeSymlinkTargetToDir(target, filepath.Dir(file))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// TODO: add verbose mode, print stuff like this:
|
|
||||||
// log.Printf("symlink: %q, target: %q", file, target)
|
|
||||||
// write symlink target
|
|
||||||
err = archive.AddFile(target, target)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// log.Printf("writing file: %q", file)
|
|
||||||
|
|
||||||
fd, err := os.Open(file)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer fd.Close()
|
|
||||||
|
|
||||||
destFilename := strings.TrimPrefix(dest, "/")
|
|
||||||
hdr := &cpio.Header{
|
|
||||||
Name: destFilename,
|
|
||||||
Mode: cpio.FileMode(fileStat.Mode().Perm()),
|
|
||||||
Size: fileStat.Size(),
|
|
||||||
// Checksum: 1,
|
|
||||||
}
|
|
||||||
if err := archive.cpioWriter.WriteHeader(hdr); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err = io.Copy(archive.cpioWriter, fd); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
archive.Files[file] = true
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (archive *Archive) writeCompressed(path string, mode os.FileMode) error {
|
|
||||||
// TODO: support other compression formats, based on deviceinfo
|
|
||||||
fd, err := os.Create(path)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
gz, err := pgzip.NewWriterLevel(fd, flate.BestSpeed)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err = io.Copy(gz, archive.buf); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := gz.Close(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// call fsync just to be sure
|
|
||||||
if err := fd.Sync(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := os.Chmod(path, mode); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (archive *Archive) writeCpio() error {
|
|
||||||
// Write any dirs added explicitly
|
|
||||||
for dir := range archive.Dirs {
|
|
||||||
archive.addDir(dir)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write files and any missing parent dirs
|
|
||||||
for file, imported := range archive.Files {
|
|
||||||
if imported {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if err := archive.AddFile(file, file); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (archive *Archive) addDir(dir string) error {
|
|
||||||
if archive.Dirs[dir] {
|
|
||||||
// Already imported
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if dir == "/" {
|
|
||||||
dir = "."
|
|
||||||
}
|
|
||||||
|
|
||||||
subdirs := strings.Split(strings.TrimPrefix(dir, "/"), "/")
|
|
||||||
for i, subdir := range subdirs {
|
|
||||||
path := filepath.Join(strings.Join(subdirs[:i], "/"), subdir)
|
|
||||||
if archive.Dirs[path] {
|
|
||||||
// Subdir already imported
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
err := archive.cpioWriter.WriteHeader(&cpio.Header{
|
|
||||||
Name: path,
|
|
||||||
Mode: cpio.ModeDir | 0755,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
archive.Dirs[path] = true
|
|
||||||
// log.Print("wrote dir: ", path)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
@@ -14,30 +14,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type DeviceInfo struct {
|
type DeviceInfo struct {
|
||||||
AppendDtb string
|
InitfsCompression string
|
||||||
Arch string
|
InitfsExtraCompression string
|
||||||
BootimgAppendSEAndroidEnforce string
|
MesaDriver string
|
||||||
BootimgBlobpack string
|
ModulesInitfs string
|
||||||
BootimgDtbSecond string
|
UbootBoardname string
|
||||||
BootimgMtkMkimage string
|
|
||||||
BootimgPxa string
|
|
||||||
BootimgQcdt string
|
|
||||||
Dtb string
|
|
||||||
FlashKernelOnUpdate string
|
|
||||||
FlashOffsetBase string
|
|
||||||
FlashOffsetKernel string
|
|
||||||
FlashOffsetRamdisk string
|
|
||||||
FlashOffsetSecond string
|
|
||||||
FlashOffsetTags string
|
|
||||||
FlashPagesize string
|
|
||||||
GenerateBootimg string
|
|
||||||
GenerateLegacyUbootInitfs string
|
|
||||||
InitfsCompression string
|
|
||||||
KernelCmdline string
|
|
||||||
LegacyUbootLoadAddress string
|
|
||||||
MesaDriver string
|
|
||||||
MkinitfsPostprocess string
|
|
||||||
ModulesInitfs string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func ReadDeviceinfo(file string) (DeviceInfo, error) {
|
func ReadDeviceinfo(file string) (DeviceInfo, error) {
|
||||||
@@ -119,7 +100,10 @@ func nameToField(name string) string {
|
|||||||
if p == "deviceinfo" {
|
if p == "deviceinfo" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
field = field + strings.Title(p)
|
if len(p) < 1 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
field = field + strings.ToUpper(p[:1]) + p[1:]
|
||||||
}
|
}
|
||||||
|
|
||||||
return field
|
return field
|
||||||
|
@@ -21,6 +21,7 @@ func TestNameToField(t *testing.T) {
|
|||||||
{"deviceinfo_modules_initfs", "ModulesInitfs"},
|
{"deviceinfo_modules_initfs", "ModulesInitfs"},
|
||||||
{"modules_initfs", "ModulesInitfs"},
|
{"modules_initfs", "ModulesInitfs"},
|
||||||
{"deviceinfo_modules_initfs___", "ModulesInitfs"},
|
{"deviceinfo_modules_initfs___", "ModulesInitfs"},
|
||||||
|
{"deviceinfo_initfs_extra_compression", "InitfsExtraCompression"},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, table := range tables {
|
for _, table := range tables {
|
||||||
@@ -43,15 +44,9 @@ func TestUnmarshal(t *testing.T) {
|
|||||||
{"ModulesInitfs", "deviceinfo_modules_initfs=\"panfrost foo bar bazz\"\n", "panfrost foo bar bazz"},
|
{"ModulesInitfs", "deviceinfo_modules_initfs=\"panfrost foo bar bazz\"\n", "panfrost foo bar bazz"},
|
||||||
{"ModulesInitfs", "deviceinfo_modules_initfs=\"panfrost foo bar bazz\"", "panfrost foo bar bazz"},
|
{"ModulesInitfs", "deviceinfo_modules_initfs=\"panfrost foo bar bazz\"", "panfrost foo bar bazz"},
|
||||||
// line with multiple '='
|
// line with multiple '='
|
||||||
{"KernelCmdline",
|
{"InitfsCompression", "deviceinfo_initfs_compression=zstd:--foo=1 -T0 --bar=bazz", "zstd:--foo=1 -T0 --bar=bazz"},
|
||||||
"deviceinfo_kernel_cmdline=\"PMOS_NO_OUTPUT_REDIRECT fw_devlink=off nvme_core.default_ps_max_latency_us=5500 pcie_aspm.policy=performance\"\n",
|
|
||||||
"PMOS_NO_OUTPUT_REDIRECT fw_devlink=off nvme_core.default_ps_max_latency_us=5500 pcie_aspm.policy=performance"},
|
|
||||||
// empty option
|
// empty option
|
||||||
{"ModulesInitfs", "deviceinfo_modules_initfs=\"\"\n", ""},
|
{"ModulesInitfs", "deviceinfo_modules_initfs=\"\"\n", ""},
|
||||||
{"Dtb", "deviceinfo_dtb=\"freescale/imx8mq-librem5-r2 freescale/imx8mq-librem5-r3 freescale/imx8mq-librem5-r4\"\n",
|
|
||||||
"freescale/imx8mq-librem5-r2 freescale/imx8mq-librem5-r3 freescale/imx8mq-librem5-r4"},
|
|
||||||
// valid deviceinfo line, just not used in this module
|
|
||||||
{"", "deviceinfo_codename=\"pine64-pinebookpro\"", ""},
|
|
||||||
// line with comment at the end
|
// line with comment at the end
|
||||||
{"MesaDriver", "deviceinfo_mesa_driver=\"panfrost\" # this is a nice driver", "panfrost"},
|
{"MesaDriver", "deviceinfo_mesa_driver=\"panfrost\" # this is a nice driver", "panfrost"},
|
||||||
{"", "# this is a comment!\n", ""},
|
{"", "# this is a comment!\n", ""},
|
||||||
|
Reference in New Issue
Block a user