|
1 | 1 |  |
2 | 2 |
|
3 | | -# pycpio |
| 3 | +# PyCPIO |
4 | 4 |
|
5 | | -A library for working with CPIO files using python |
| 5 | +A library for creating CPIO files in Python. |
6 | 6 |
|
7 | | -In active development |
| 7 | +Currently, the library only supports the New ASCII format, and xz compression |
| 8 | + |
| 9 | +This library is primary designed for use in [ugrd](https://github.com/desultory/ugrd) to create CPIO archives for use in initramfs. |
| 10 | + |
| 11 | +## Usage |
| 12 | + |
| 13 | +``` |
| 14 | + -h, --help show this help message and exit |
| 15 | + -d, --debug enable debug mode (level 10) |
| 16 | + -dd, --trace enable trace debug mode (level 5) |
| 17 | + -v, --version print the version and exit |
| 18 | + --log-file LOG_FILE set the path to the log file |
| 19 | + --log-level LOG_LEVEL |
| 20 | + set the log level |
| 21 | + --log-time enable log timestamps |
| 22 | + --no-log-color disable log color |
| 23 | + -i INPUT, --input INPUT |
| 24 | + input file |
| 25 | + -a APPEND, --append APPEND |
| 26 | + append to archive |
| 27 | + --recursive RECURSIVE |
| 28 | + append to archive recursively |
| 29 | + --relative RELATIVE append to archive relative to this path |
| 30 | + --absolute allow absolute paths |
| 31 | + --reproducible Set mtime to 0, start inodes at 0 |
| 32 | + --rm RM, --delete RM delete from archive |
| 33 | + -n NAME, --name NAME Name/path override for append |
| 34 | + -s SYMLINK, --symlink SYMLINK |
| 35 | + create symlink |
| 36 | + -c CHARDEV, --chardev CHARDEV |
| 37 | + create character device |
| 38 | + --major MAJOR major number for character/block device |
| 39 | + --minor MINOR minor number for character/block device |
| 40 | + -u UID, --set-owner UID |
| 41 | + set UID on all files |
| 42 | + -g GID, --set-group GID |
| 43 | + set GID on all files |
| 44 | + -m MODE, --set-mode MODE |
| 45 | + set mode on all files |
| 46 | + -z COMPRESS, --compress COMPRESS |
| 47 | + compression type |
| 48 | + -o OUTPUT, --output OUTPUT |
| 49 | + output file |
| 50 | + -l, --list list CPIO contents |
| 51 | + -p, --print print CPIO contents |
| 52 | + ``` |
| 53 | + |
| 54 | +# Structure |
| 55 | + |
| 56 | +- `pycpio.header.cpioheader`: The class which represents a CPIO header |
| 57 | + * Can be initialized from args for header fields, or bytes representing a header |
| 58 | + * header types are defined in `pycpio.header.headers` (only the new ascii format is supported) |
| 59 | +- `pycpio.cpio.data`: The class which represents a CPIO data block |
| 60 | + * Each CPIO object must have a header. |
| 61 | + * Currently the follwing subtypes are supported: |
| 62 | + - `file` : A regular file, or hardlink. |
| 63 | + - `dir` : A directory |
| 64 | + - `symlink` : A symbolic link |
| 65 | + - `chardev` : A character device |
| 66 | + * CPIO objects are collected in a `pycpio.cpio.archive` object |
| 67 | + - The archive handles duplication, inode generation, name normalization, and other collection related tasks |
| 68 | + * All CPIO object types can be initialized from args, bytes, or a file path |
0 commit comments