alpine-make-rootfs
alpine-make-rootfs copied to clipboard
Example from README does not work
The README contains the following example:
sudo ./alpine-make-rootfs \ # (1)
--branch v3.8 \ # (2)
--packages 'ruby ruby-bigdecimal sqlite' \ # (3)
--timezone 'Europe/Prague' \ # (4)
--script-chroot \ # (5)
example-$(date +%Y%m%d).tar.gz - <<'SHELL' # (6)
# Copy some file from the repository root to the rootfs.
install -D -m 755 examples/hello_world.rb /app/hello_world.rb
# Install some dev packages and gem mailcatcher.
apk add --no-progress -t .make build-base ruby-dev sqlite-dev
gem install --no-document mailcatcher
# Clean-up dev packages. (7)
apk del --no-progress .make
SHELL
I cannot get something like this to work, and here is what I think is happening: when reading the script from stdin, it gets written to a temporary file and the SCRIPT
variable gets set to the path of that file: https://github.com/alpinelinux/alpine-make-rootfs/blob/8516728e3d09a4ba1049340cdeaa29a4b7373ad3/alpine-make-rootfs#L335-L337
When chrooting, whatever directory the SCRIPT
is in (so, in this case, the temp directory, likely /tmp
) gets mounted into the chroot's /mnt
: https://github.com/alpinelinux/alpine-make-rootfs/blob/8516728e3d09a4ba1049340cdeaa29a4b7373ad3/alpine-make-rootfs#L430 However, the temp directory obviously does not contain the files from the repo, so stuff like the install ...
will not work.
I am not sure if I am missing something here? I was also wondering if #1 was potentially related, but it is a little... sparse on details :wink:
When using an actual file as script, everything works as expected. But of course only as long as that script is in the same directory as the files I want to copy. I suppose this is mainly a documentation issue? Also, I wanted to make sure I am not mistaken about anything. Any hints would be much appreciated, I'd even volunteer for a PR once I know the desired state of this.
:wave: just wanted to point out that this was not actually fixed with the referenced commit (thanks for merging, though :cat: )