Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
2ec78bfcfc | ||
|
fedf55b573 | ||
|
30681d2f0a | ||
|
74de5f9798 |
@@ -80,8 +80,8 @@ func main() {
|
||||
defer func() {
|
||||
e := os.RemoveAll(workDir)
|
||||
if e != nil && err == nil {
|
||||
err = e
|
||||
retCode = 1
|
||||
log.Println(e)
|
||||
log.Println("unable to remove temporary work directory")
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -108,7 +108,12 @@ func main() {
|
||||
modules.New(strings.Fields(devinfo.ModulesInitfs), "/usr/share/mkinitfs/modules"),
|
||||
modules.New([]string{}, "/etc/mkinitfs/modules"),
|
||||
})
|
||||
initramfsAr.AddItems(initfs)
|
||||
if err := initramfsAr.AddItems(initfs); err != nil {
|
||||
log.Println(err)
|
||||
log.Println("failed to generate: ", "initramfs")
|
||||
retCode = 1
|
||||
return
|
||||
}
|
||||
if err := initramfsAr.Write(filepath.Join(workDir, "initramfs"), os.FileMode(0644)); err != nil {
|
||||
log.Println(err)
|
||||
log.Println("failed to generate: ", "initramfs")
|
||||
@@ -136,7 +141,12 @@ func main() {
|
||||
modules.New([]string{}, "/etc/mkinitfs/modules-extra"),
|
||||
osksdl.New(devinfo.MesaDriver),
|
||||
})
|
||||
initramfsExtraAr.AddItemsExclude(initfsExtra, initfs)
|
||||
if err := initramfsExtraAr.AddItemsExclude(initfsExtra, initfs); err != nil {
|
||||
log.Println(err)
|
||||
log.Println("failed to generate: ", "initramfs-extra")
|
||||
retCode = 1
|
||||
return
|
||||
}
|
||||
if err := initramfsExtraAr.Write(filepath.Join(workDir, "initramfs-extra"), os.FileMode(0644)); err != nil {
|
||||
log.Println(err)
|
||||
log.Println("failed to generate: ", "initramfs-extra")
|
||||
|
@@ -100,6 +100,9 @@ create/manage. mkinitfs reads configuration from */usr/share/mkinitfs* first, an
|
||||
path(s) under the relevant directory in */etc/mkinitfs*, and changing
|
||||
the destination path.
|
||||
|
||||
Any lines in these files that start with *#* are considered comments, and
|
||||
skipped.
|
||||
|
||||
## /usr/share/mkinitfs/hooks, /etc/mkinitfs/hooks
|
||||
## /usr/share/mkinitfs/hooks-extra*, /etc/mkinitfs/hooks-extra
|
||||
|
||||
@@ -121,12 +124,18 @@ create/manage. mkinitfs reads configuration from */usr/share/mkinitfs* first, an
|
||||
Modules are installed in the initramfs archive under the same path they
|
||||
exist on the system where mkinitfs is executed.
|
||||
|
||||
Any lines in these files that start with *#* are considered comments, and
|
||||
skipped.
|
||||
|
||||
## /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.
|
||||
|
||||
Any lines in these files that start with *#* are considered comments, and
|
||||
skipped.
|
||||
|
||||
# BOOT-DEPLOY
|
||||
|
||||
After generating archives, mkinitfs will execute *boot-deploy*, using *$PATH* to
|
||||
|
@@ -6,6 +6,7 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/filelist"
|
||||
)
|
||||
@@ -44,6 +45,10 @@ func (h *HookDirs) List() (*filelist.FileList, error) {
|
||||
s := bufio.NewScanner(f)
|
||||
for s.Scan() {
|
||||
dir := s.Text()
|
||||
if len(dir) == 0 || strings.HasPrefix(dir, "#") {
|
||||
continue
|
||||
}
|
||||
|
||||
files.Add(dir, dir)
|
||||
}
|
||||
}
|
||||
|
@@ -58,7 +58,12 @@ func slurpFiles(fd io.Reader) (*filelist.FileList, error) {
|
||||
|
||||
s := bufio.NewScanner(fd)
|
||||
for s.Scan() {
|
||||
src, dest, has_dest := strings.Cut(s.Text(), ":")
|
||||
line := s.Text()
|
||||
if len(line) == 0 || strings.HasPrefix(line, "#") {
|
||||
continue
|
||||
}
|
||||
|
||||
src, dest, has_dest := strings.Cut(line, ":")
|
||||
|
||||
fFiles, err := misc.GetFiles([]string{src}, true)
|
||||
if err != nil {
|
||||
|
@@ -95,6 +95,9 @@ func slurpModules(fd io.Reader, modDir string) (*filelist.FileList, error) {
|
||||
s := bufio.NewScanner(fd)
|
||||
for s.Scan() {
|
||||
line := s.Text()
|
||||
if len(line) == 0 || strings.HasPrefix(line, "#") {
|
||||
continue
|
||||
}
|
||||
dir, file := filepath.Split(line)
|
||||
if file == "" {
|
||||
// item is a directory
|
||||
@@ -194,7 +197,12 @@ func getModuleDeps(modName string, modulesDep io.Reader) ([]string, error) {
|
||||
|
||||
s := bufio.NewScanner(modulesDep)
|
||||
for s.Scan() {
|
||||
fields := strings.Fields(s.Text())
|
||||
line := s.Text()
|
||||
if len(line) == 0 || strings.HasPrefix(line, "#") {
|
||||
continue
|
||||
}
|
||||
|
||||
fields := strings.Fields(line)
|
||||
if len(fields) == 0 {
|
||||
continue
|
||||
}
|
||||
|
Reference in New Issue
Block a user