Skip to content

Commit

Permalink
xx-apt: print-source-file flag
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max committed Jan 10, 2024
1 parent dd94c5c commit d0af07f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ ARG TARGETPLATFORM
RUN xx-apt-get install -y libc6-dev zlib1g-dev
```

> [!NOTE]
> `xx-apt --print-source-file` can be used to print the path of the main [Apt sources configuration file](https://manpages.debian.org/bookworm/apt/sources.list.5.en.html)
Installing two meta-libraries, `xx-c-essentials`, `xx-cxx-essentials` is also allowed that expand the minimum necessary packages for either base image.

## `xx-verify` - Verifying compilation results
Expand Down
9 changes: 9 additions & 0 deletions src/test-apt.bats
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,12 @@ load 'assert'
run apt show wget-notexist
assert_failure
}

@test "print-source-file" {
run xx-apt --print-source-file
assert_success
assert_output --partial "/etc/apt/sources.list"

run test -e "$(xx-apt --print-source-file)"
assert_success
}
14 changes: 14 additions & 0 deletions src/xx-apt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ exitnolinux() {
fi
}

n=$#
for a in "$@"; do
if [ $# = $n ]; then set --; fi
case "$a" in
"--print-source-file")
aptsourcesfile
exit 0
;;
*)
set -- "$@" "$a"
;;
esac
done

# these are not supported yet
case "${TARGETARCH}" in
mips*)
Expand Down

0 comments on commit d0af07f

Please sign in to comment.