add man page about hooks
This commit is contained in:
parent
9670abfc33
commit
149b88625d
3
Makefile
3
Makefile
@ -9,16 +9,19 @@ install:
|
|||||||
mkdir -p ${DESTDIR}${DATADIR}/tinyramfs \
|
mkdir -p ${DESTDIR}${DATADIR}/tinyramfs \
|
||||||
${DESTDIR}${MANDIR}/man5 \
|
${DESTDIR}${MANDIR}/man5 \
|
||||||
${DESTDIR}${MANDIR}/man8 \
|
${DESTDIR}${MANDIR}/man8 \
|
||||||
|
${DESTDIR}${MANDIR}/man7 \
|
||||||
${DESTDIR}${BINDIR}
|
${DESTDIR}${BINDIR}
|
||||||
cp -R hooks ${DESTDIR}${DATADIR}/tinyramfs
|
cp -R hooks ${DESTDIR}${DATADIR}/tinyramfs
|
||||||
cp device-helper ${DESTDIR}${DATADIR}/tinyramfs
|
cp device-helper ${DESTDIR}${DATADIR}/tinyramfs
|
||||||
cp init ${DESTDIR}${DATADIR}/tinyramfs
|
cp init ${DESTDIR}${DATADIR}/tinyramfs
|
||||||
cp tinyramfs ${DESTDIR}${BINDIR}/tinyramfs
|
cp tinyramfs ${DESTDIR}${BINDIR}/tinyramfs
|
||||||
cp docs/tinyramfs.8 ${DESTDIR}${MANDIR}/man8
|
cp docs/tinyramfs.8 ${DESTDIR}${MANDIR}/man8
|
||||||
|
cp docs/tinyramfs.hooks.7 ${DESTDIR}${MANDIR}/man7
|
||||||
cp docs/tinyramfs.config.5 ${DESTDIR}${MANDIR}/man5
|
cp docs/tinyramfs.config.5 ${DESTDIR}${MANDIR}/man5
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f ${DESTDIR}${BINDIR}/tinyramfs
|
rm -f ${DESTDIR}${BINDIR}/tinyramfs
|
||||||
rm -rf ${DESTDIR}${DATADIR}/tinyramfs
|
rm -rf ${DESTDIR}${DATADIR}/tinyramfs
|
||||||
rm -f ${DESTDIR}${MANDIR}/man8/tinyramfs.8
|
rm -f ${DESTDIR}${MANDIR}/man8/tinyramfs.8
|
||||||
|
rm -f ${DESTDIR}${MANDIR}/man7/tinyramfs.hooks.7
|
||||||
rm -f ${DESTDIR}${MANDIR}/man5/tinyramfs.config.5
|
rm -f ${DESTDIR}${MANDIR}/man5/tinyramfs.config.5
|
||||||
|
@ -133,9 +133,8 @@ you can simply prepend \#.
|
|||||||
If hook doesn't have options, then it's not yet documented or can be used
|
If hook doesn't have options, then it's not yet documented or can be used
|
||||||
"as is".
|
"as is".
|
||||||
|
|
||||||
; TODO tinyramfs.hooks(7)
|
More detailed information and how to write your own hooks described in
|
||||||
; More detailed information and how to write your own hooks described in
|
*tinyramfs.hooks*(7).
|
||||||
; *tinyramfs.hooks*(7).
|
|
||||||
|
|
||||||
# HOOKS OPTIONS
|
# HOOKS OPTIONS
|
||||||
|
|
||||||
|
170
docs/tinyramfs.hooks.7
Normal file
170
docs/tinyramfs.hooks.7
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
.\" Generated by scdoc 1.11.0
|
||||||
|
.\" Complete documentation for this program is not available as a GNU info page
|
||||||
|
.ie \n(.g .ds Aq \(aq
|
||||||
|
.el .ds Aq '
|
||||||
|
.nh
|
||||||
|
.ad l
|
||||||
|
.\" Begin generated content:
|
||||||
|
.TH "tinyramfs.hooks" "7" "2020-09-04"
|
||||||
|
.P
|
||||||
|
.SH NAME
|
||||||
|
.P
|
||||||
|
Tinyramfs - hooks and related stuff
|
||||||
|
.P
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.P
|
||||||
|
Hooks can be located in \fB/usr/share/tinyramfs/hooks\fR (system path) and
|
||||||
|
\fB/etc/tinyramfs/hooks\fR (user path).\& Tinyramfs also allows you to specify custom
|
||||||
|
location via \fB-H\fR option.\& See \fBtinyramfs\fR(8) for more information.\&
|
||||||
|
.P
|
||||||
|
Hooks provides a way to extend build and init process.\& Hooks must be written in
|
||||||
|
POSIX shell.\& Bashisms and other non-portable extensions are forbidden.\& In order
|
||||||
|
to write hooks you must know about hook structure.\&
|
||||||
|
.P
|
||||||
|
.RS 4
|
||||||
|
.ie n \{\
|
||||||
|
\h'-04'\(bu\h'+03'\c
|
||||||
|
.\}
|
||||||
|
.el \{\
|
||||||
|
.IP \(bu 4
|
||||||
|
.\}
|
||||||
|
<hook> - directory of hook scripts
|
||||||
|
.RS 4
|
||||||
|
.RE
|
||||||
|
.RS 4
|
||||||
|
.ie n \{\
|
||||||
|
\h'-04'\(bu\h'+03'\c
|
||||||
|
.\}
|
||||||
|
.el \{\
|
||||||
|
.IP \(bu 4
|
||||||
|
.\}
|
||||||
|
<hook> - invoked in build process.\&
|
||||||
|
.RE
|
||||||
|
.RS 4
|
||||||
|
.ie n \{\
|
||||||
|
\h'-04'\(bu\h'+03'\c
|
||||||
|
.\}
|
||||||
|
.el \{\
|
||||||
|
.IP \(bu 4
|
||||||
|
.\}
|
||||||
|
<hook>.\&init - invoked in init process.\&
|
||||||
|
.RE
|
||||||
|
.RS 4
|
||||||
|
.ie n \{\
|
||||||
|
\h'-04'\(bu\h'+03'\c
|
||||||
|
.\}
|
||||||
|
.el \{\
|
||||||
|
.IP \(bu 4
|
||||||
|
.\}
|
||||||
|
<hook>.\&init.\&late - invoked after root filesystem was mounted.\&
|
||||||
|
|
||||||
|
.RE
|
||||||
|
.P
|
||||||
|
.RE
|
||||||
|
.SS MAN PAGE SYNTAX
|
||||||
|
.P
|
||||||
|
.nf
|
||||||
|
.RS 4
|
||||||
|
- B: extension can be used in build process
|
||||||
|
- I: extension can be used in init process
|
||||||
|
- BI: extension can be used in both processes
|
||||||
|
.fi
|
||||||
|
.RE
|
||||||
|
.P
|
||||||
|
.SH EXTENSIONS
|
||||||
|
.P
|
||||||
|
Tinyramfs also provides some extensions and environment variables to easily
|
||||||
|
interact with build and init system.\&
|
||||||
|
.P
|
||||||
|
.SS BI: print <message>
|
||||||
|
.P
|
||||||
|
.RS 4
|
||||||
|
Print message to stdout.\&
|
||||||
|
.P
|
||||||
|
.RE
|
||||||
|
.SS BI: panic [message]
|
||||||
|
.P
|
||||||
|
.RS 4
|
||||||
|
If message was not specified, then tinyramfs will print default error
|
||||||
|
message.\& otherwise message will be printed.\&
|
||||||
|
.P
|
||||||
|
.RE
|
||||||
|
.SS B: copy_module <full path>
|
||||||
|
.P
|
||||||
|
.RS 4
|
||||||
|
Copy kernel module by path to tinyramfs working directory.\&
|
||||||
|
.P
|
||||||
|
.RE
|
||||||
|
.SS B: copy_binary <name or full path>
|
||||||
|
.P
|
||||||
|
.RS 4
|
||||||
|
If full path was specified and it's has executable bit, then it's will
|
||||||
|
be copied to /bin location of tinyramfs working directory.\&
|
||||||
|
.P
|
||||||
|
If name was specified, then tinyramfs will try to find command by name
|
||||||
|
in PATH.\& If it's success, command will be copied to /bin location of
|
||||||
|
tinyramfs working directory.\& Otherwise error message will appear.\&
|
||||||
|
.P
|
||||||
|
.RE
|
||||||
|
.SS B: copy_file <file> <destination> <mode> <strip>
|
||||||
|
.P
|
||||||
|
.RS 4
|
||||||
|
<file> must be full path to file.\&
|
||||||
|
.P
|
||||||
|
<destination> must be directory where <file> should be stored.\& Tinyramfs
|
||||||
|
will automatically create that directory if it doesn't exist already.\& Also
|
||||||
|
no need to prepend path of tinyramfs working directory.\&
|
||||||
|
.P
|
||||||
|
<mode> permissions in octal format.\&
|
||||||
|
.P
|
||||||
|
<strip> if was set to 1, then tinyramfs will attempt to run strip
|
||||||
|
on file.\& Tinyramfs will silently ignore errors if strip doesn't
|
||||||
|
exists or failed to strip binary.\&
|
||||||
|
.P
|
||||||
|
.RE
|
||||||
|
.SH VARIABLES
|
||||||
|
.P
|
||||||
|
.nf
|
||||||
|
.RS 4
|
||||||
|
- BI: debug - 1 if debug mode enabled
|
||||||
|
- I: break - breakpoint for debugging
|
||||||
|
- B: tmpdir - full path of tinyramfs working directory (initramfs rootfs in future)
|
||||||
|
- B: kernel - kernel version
|
||||||
|
- B: moddir - modules directory
|
||||||
|
- B: config - config location
|
||||||
|
- B: srcdir - directory of tinyramfs system files
|
||||||
|
- B: output - output path
|
||||||
|
- BI: see tinyramfs\&.config(5)
|
||||||
|
.fi
|
||||||
|
.RE
|
||||||
|
.P
|
||||||
|
.SH EXAMPLES
|
||||||
|
.P
|
||||||
|
This example will show how to handle soft dependencies of ext4 module.\&
|
||||||
|
Create \fB/etc/tinyramfs/hooks/ext4\fR directory and copy below scripts with
|
||||||
|
appropriate names to that directory.\& After that, prepend \fBext4\fR to \fBhooks\fR
|
||||||
|
option in tinyrams config.\&
|
||||||
|
.P
|
||||||
|
ext4
|
||||||
|
.P
|
||||||
|
.nf
|
||||||
|
.RS 4
|
||||||
|
print "Copying ext4 dependencies"
|
||||||
|
|
||||||
|
for _mod in crc32c libcrc32c; do
|
||||||
|
copy_module "$_mod"
|
||||||
|
done
|
||||||
|
.fi
|
||||||
|
.RE
|
||||||
|
.P
|
||||||
|
ext4.\&init
|
||||||
|
.P
|
||||||
|
.nf
|
||||||
|
.RS 4
|
||||||
|
modprobe -a crc32c libcrc32c
|
||||||
|
.fi
|
||||||
|
.RE
|
||||||
|
.P
|
||||||
|
.SH SEE ALSO
|
||||||
|
.P
|
||||||
|
\fBtinyramfs\fR(8) \fBtinyramfs.\&config\fR(5) \fBtinyramfs.\&cmdline\fR(7) \fBtinyramfs.\&hooks\fR(7)
|
110
docs/tinyramfs.hooks.7.scd
Normal file
110
docs/tinyramfs.hooks.7.scd
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
tinyramfs.hooks(7)
|
||||||
|
|
||||||
|
# NAME
|
||||||
|
|
||||||
|
Tinyramfs - hooks and related stuff
|
||||||
|
|
||||||
|
# DESCRIPTION
|
||||||
|
|
||||||
|
Hooks can be located in */usr/share/tinyramfs/hooks* (system path) and
|
||||||
|
*/etc/tinyramfs/hooks* (user path). Tinyramfs also allows you to specify custom
|
||||||
|
location via *-H* option. See *tinyramfs*(8) for more information.
|
||||||
|
|
||||||
|
Hooks provides a way to extend build and init process. Hooks must be written in
|
||||||
|
POSIX shell. Bashisms and other non-portable extensions are forbidden. In order
|
||||||
|
to write hooks you must know about hook structure.
|
||||||
|
|
||||||
|
- <hook> - directory of hook scripts
|
||||||
|
- <hook> - invoked in build process.
|
||||||
|
- <hook>.init - invoked in init process.
|
||||||
|
- <hook>.init.late - invoked after root filesystem was mounted.
|
||||||
|
|
||||||
|
## MAN PAGE SYNTAX
|
||||||
|
|
||||||
|
```
|
||||||
|
- B: extension can be used in build process
|
||||||
|
- I: extension can be used in init process
|
||||||
|
- BI: extension can be used in both processes
|
||||||
|
```
|
||||||
|
|
||||||
|
# EXTENSIONS
|
||||||
|
|
||||||
|
Tinyramfs also provides some extensions and environment variables to easily
|
||||||
|
interact with build and init system.
|
||||||
|
|
||||||
|
## BI: print <message>
|
||||||
|
|
||||||
|
Print message to stdout.
|
||||||
|
|
||||||
|
## BI: panic [message]
|
||||||
|
|
||||||
|
If message was not specified, then tinyramfs will print default error
|
||||||
|
message. otherwise message will be printed.
|
||||||
|
|
||||||
|
## B: copy_module <full path>
|
||||||
|
|
||||||
|
Copy kernel module by path to tinyramfs working directory.
|
||||||
|
|
||||||
|
## B: copy_binary <name or full path>
|
||||||
|
|
||||||
|
If full path was specified and it's has executable bit, then it's will
|
||||||
|
be copied to /bin location of tinyramfs working directory.
|
||||||
|
|
||||||
|
If name was specified, then tinyramfs will try to find command by name
|
||||||
|
in PATH. If it's success, command will be copied to /bin location of
|
||||||
|
tinyramfs working directory. Otherwise error message will appear.
|
||||||
|
|
||||||
|
## B: copy_file <file> <destination> <mode> <strip>
|
||||||
|
|
||||||
|
<file> must be full path to file.
|
||||||
|
|
||||||
|
<destination> must be directory where <file> should be stored. Tinyramfs
|
||||||
|
will automatically create that directory if it doesn't exist already. Also
|
||||||
|
no need to prepend path of tinyramfs working directory.
|
||||||
|
|
||||||
|
<mode> permissions in octal format.
|
||||||
|
|
||||||
|
<strip> if was set to 1, then tinyramfs will attempt to run strip
|
||||||
|
on file. Tinyramfs will silently ignore errors if strip doesn't
|
||||||
|
exists or failed to strip binary.
|
||||||
|
|
||||||
|
# VARIABLES
|
||||||
|
|
||||||
|
```
|
||||||
|
- BI: debug - 1 if debug mode enabled
|
||||||
|
- I: break - breakpoint for debugging
|
||||||
|
- B: tmpdir - full path of tinyramfs working directory (initramfs rootfs in future)
|
||||||
|
- B: kernel - kernel version
|
||||||
|
- B: moddir - modules directory
|
||||||
|
- B: config - config location
|
||||||
|
- B: srcdir - directory of tinyramfs system files
|
||||||
|
- B: output - output path
|
||||||
|
- BI: see tinyramfs.config(5)
|
||||||
|
```
|
||||||
|
|
||||||
|
# EXAMPLES
|
||||||
|
|
||||||
|
This example will show how to handle soft dependencies of ext4 module.
|
||||||
|
Create */etc/tinyramfs/hooks/ext4* directory and copy below scripts with
|
||||||
|
appropriate names to that directory. After that, prepend *ext4* to *hooks*
|
||||||
|
option in tinyrams config.
|
||||||
|
|
||||||
|
ext4
|
||||||
|
|
||||||
|
```
|
||||||
|
print "Copying ext4 dependencies"
|
||||||
|
|
||||||
|
for _mod in crc32c libcrc32c; do
|
||||||
|
copy_module "$_mod"
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
ext4.init
|
||||||
|
|
||||||
|
```
|
||||||
|
modprobe -a crc32c libcrc32c
|
||||||
|
```
|
||||||
|
|
||||||
|
# SEE ALSO
|
||||||
|
|
||||||
|
*tinyramfs*(8) *tinyramfs.config*(5) *tinyramfs.cmdline*(7) *tinyramfs.hooks*(7)
|
Loading…
Reference in New Issue
Block a user