Skip to content

Commit

Permalink
Add download protocol hints to readme (#238)
Browse files Browse the repository at this point in the history
* Fix spelling and add codespell hook

* Add download protocol hints to readme
  • Loading branch information
dbast committed Oct 30, 2022
1 parent 355c7cf commit e89b867
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ repos:
hooks:
- id: go-fmt
#- id: golangci-lint
- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
hooks:
- id: codespell
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ This plugin allows you to build or extend ARM system image. It operates in two m
* resize - uses already existing image but resize given partition (ie. root)

Plugin mimics standard image creation process, such as:
* builing base empty image (dd)
* building base empty image (dd)
* partitioning (sgdisk / sfdisk)
* filesystem creation (mkfs.type)
* partition mapping (losetup)
Expand Down Expand Up @@ -59,7 +59,7 @@ go build
sudo packer build boards/odroid-u3/archlinuxarm.json
```
## Run in Docker
This method is primarily for macOS users where is no native way to use qemu-user-static, loop mount Linux specifc filesystems and install all above mentioned Linux specific tools (or Linux users, who do not want to setup packer and all the tools).
This method is primarily for macOS users where is no native way to use qemu-user-static, loop mount Linux specific filesystems and install all above mentioned Linux specific tools (or Linux users, who do not want to setup packer and all the tools).

The container is a multi-arch container (linux/amd64 or linux/arm64), that can be used on Intel (x86_64) or Apple M1 (arm64) Macs and also on Linux machines running linux (x86_64 or aarch64) kernels.

Expand Down Expand Up @@ -118,6 +118,8 @@ Describes the remote file that is going to be used as base image or rootfs archi
"file_target_extension": "tar.gz",
```

Downloads of the `file_urls` are done with the help of `github.com/hashicorp/go-getter`, which supports various protocols: local files, http(s) and various others, see https://github.com/hashicorp/go-getter#supported-protocols-and-detectors). Downloading via more protocols can be done by using other tools (curl, wget, rclone, ...) before running packer and referencing the downloaded files as local file in `file_urls`.

The `file_unarchive_cmd` is optional and should be used if the standard golang archiver can't handle the archive format.

Raw images format (`.img` or `.iso`) can be used by defining the `file_target_extension` appropriately.
Expand Down Expand Up @@ -195,7 +197,7 @@ rootfs archive instead of image:
```

## Resizing image
Currently resizing is only limited to expanding single `ext{2,3,4}` partition with `resize2fs`. This is often requested feature where already built image is given and we need to expand the main partition to accomodate changes made in provisioner step (ie. installing packages).
Currently resizing is only limited to expanding single `ext{2,3,4}` partition with `resize2fs`. This is often requested feature where already built image is given and we need to expand the main partition to accommodate changes made in provisioner step (ie. installing packages).

To resize a partition you need to set `image_build_method` to `resize` mode and set selected partition size to `0`, for example:
```
Expand Down
2 changes: 1 addition & 1 deletion builder/step_expand_partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func findExpandablePartition(config *Config) (int, error) {

if len(partitions) > 1 {
return 0, fmt.Errorf(
"found %d resizable partions (%v), but we can expand only one",
"found %d resizable partitions (%v), but we can expand only one",
len(partitions), partitions,
)
}
Expand Down
2 changes: 1 addition & 1 deletion builder/step_setup_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func checkBinfmtMisc(srcPath string) (string, error) {

if fields[0] == "interpreter" {
fieldStat, _ := os.Stat(fields[1])
// os.SameFile allows also comparing of sym- and relativ symlinks.
// os.SameFile allows also comparing of sym- and relative symlinks.
if os.SameFile(fieldStat, srcPathStat) {
return pth, nil
}
Expand Down

0 comments on commit e89b867

Please sign in to comment.