Skip to content

Commit

Permalink
shellcheck and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelzw committed Nov 27, 2024
1 parent 833e179 commit 35df7c0
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 4 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ env/
environment.yml
environment
environment.tar
environment.tar.zst
environment.tar.zstd
environment.sh
pixi-pack.json
unpack/

Expand Down
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,9 @@ repos:
entry: pixi run -e lint taplo format
language: system
types: [toml]
# shellcheck
- id: shellcheck
name: shellcheck
entry: pixi run -e lint shellcheck
language: system
types: [shell]
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,38 @@ pixi-pack pack --platform win-64
> [!NOTE]
> You can only `unpack` a pack on a system that has the same platform as the pack was created for.
### Self-extracting binaries

You can create a self-extracting binary that contains the packed environment and a script that unpacks the environment.
This can be useful if you want to distribute the environment to users that don't have `pixi-pack` installed.

```bash
# unix
$ pixi-pack pack --create-executable
$ ls
environment.sh
$ ./environment.sh
$ ls
env/
activate.sh
environment.sh
```

```powershell
# windows
PS > pixi-pack pack --create-executable
PS > ls
environment.ps1
PS > .\environment.ps1
PS > ls
env/
activate.sh
environment.ps1
```

> [!TIP]
> The produced executable is a simple shell script that contains both the `pixi-pack` binary as well as the packed environment.
### Inject additional packages

You can inject additional packages into the environment that are not specified in `pixi.lock` by using the `--inject` flag:
Expand Down
108 changes: 108 additions & 0 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ prettier = "*"
taplo = "*"
pre-commit-hooks = "*"
typos = "*"
shellcheck = "*"
[feature.lint.tasks]
pre-commit-install = "pre-commit install"
pre-commit-run = "pre-commit run -a"
Expand Down
5 changes: 3 additions & 2 deletions src/header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,17 @@ fi

archive_begin=$((archive_begin + 2))
archive_end=$((archive_end - 1))
pixi_pack_start=$(($archive_end + 2))
pixi_pack_start=$((archive_end + 2))

sed -n "$archive_begin,${archive_end}p" "$0" | base64 -d > "$TEMPDIR/archive.tar"
sed -n "$pixi_pack_start,\$p" "$0" | base64 -d > "$TEMPDIR/pixi-pack"

chmod +x "$TEMPDIR/pixi-pack"

"$TEMPDIR/pixi-pack" unpack $@ "$TEMPDIR/archive.tar"
"$TEMPDIR/pixi-pack" unpack "$@" "$TEMPDIR/archive.tar"

rm -rf "$TEMPDIR"

exit 0
# shellcheck disable=SC2317
@@END_HEADER@@

0 comments on commit 35df7c0

Please sign in to comment.