diff --git a/doc/mkinitfs.1.scd b/doc/mkinitfs.1.scd index 4aebc85..17586ef 100644 --- a/doc/mkinitfs.1.scd +++ b/doc/mkinitfs.1.scd @@ -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 diff --git a/internal/filelist/hookdirs/hookdirs.go b/internal/filelist/hookdirs/hookdirs.go index 15eadbe..cbb61f6 100644 --- a/internal/filelist/hookdirs/hookdirs.go +++ b/internal/filelist/hookdirs/hookdirs.go @@ -6,6 +6,7 @@ import ( "log" "os" "path/filepath" + "strings" "gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/filelist" ) @@ -44,7 +45,7 @@ func (h *HookDirs) List() (*filelist.FileList, error) { s := bufio.NewScanner(f) for s.Scan() { dir := s.Text() - if len(dir) == 0 { + if len(dir) == 0 || strings.HasPrefix(dir, "#") { continue } diff --git a/internal/filelist/hookfiles/hookfiles.go b/internal/filelist/hookfiles/hookfiles.go index 748ffe7..0ad7a17 100644 --- a/internal/filelist/hookfiles/hookfiles.go +++ b/internal/filelist/hookfiles/hookfiles.go @@ -59,7 +59,7 @@ func slurpFiles(fd io.Reader) (*filelist.FileList, error) { s := bufio.NewScanner(fd) for s.Scan() { line := s.Text() - if len(line) == 0 { + if len(line) == 0 || strings.HasPrefix(line, "#") { continue } diff --git a/internal/filelist/modules/modules.go b/internal/filelist/modules/modules.go index 4fa51f7..850c152 100644 --- a/internal/filelist/modules/modules.go +++ b/internal/filelist/modules/modules.go @@ -95,10 +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 { + if len(line) == 0 || strings.HasPrefix(line, "#") { continue } - dir, file := filepath.Split(line) if file == "" { // item is a directory @@ -199,7 +198,7 @@ func getModuleDeps(modName string, modulesDep io.Reader) ([]string, error) { s := bufio.NewScanner(modulesDep) for s.Scan() { line := s.Text() - if len(line) == 0 { + if len(line) == 0 || strings.HasPrefix(line, "#") { continue }