mvallim / live-custom-ubuntu-from-scratch

(Yes, the project is still alive 😃) This procedure shows how to create a bootable and installable Ubuntu Live (along with the automatic hardware detection and configuration) from scratch.
https://mvallim.github.io/live-custom-ubuntu-from-scratch/
GNU General Public License v3.0
397 stars 186 forks source link

Copy extra files to chroot environment #34

Open dangoncalves opened 3 years ago

dangoncalves commented 3 years ago

Is your feature request related to a problem? Please describe. To build my live iso, I need to copy some files to the chroot environment. Currently we can't do that with the script.

Describe the solution you'd like It could be useful if all files inside a specific directory where copied to the chroot environment.

Describe alternatives you've considered Maintaining a list with the files to copy can be considered but will be less useful.

Additional context I'm willing to work on this contribution.

kgilmer commented 3 years ago

Do you need to copy files only to the root of the chroot environment?

dangoncalves commented 3 years ago

I need to copy them anywhere in the chroot environment and then I can process them inside the customize_image function. In my case, it's a deb package that I need to install to the image.

mvallim commented 3 years ago

Is your feature request related to a problem? Please describe. To build my live iso, I need to copy some files to the chroot environment. Currently we can't do that with the script.

Describe the solution you'd like It could be useful if all files inside a specific directory where copied to the chroot environment.

Describe alternatives you've considered Maintaining a list with the files to copy can be considered but will be less useful.

Additional context I'm willing to work on this contribution.

Hi @dangoncalves,

Please go ahead, with your contribution.

Thanks for all,

kgilmer commented 3 years ago

Hi @dangoncalves , in case it hasn't already occurred to you, another approach would be to host the debian packages in a PPA or debian repository rather than manually installing them on the target image. In this way, you'll be able to provide updates to those packages in the future. The steps are to add the repo to the live host apt configuration and then use apt to install the packages. Here is an example: https://github.com/regolith-linux/regolith-ubuntu-iso-builder/blob/master/scripts/config-focal_standard.sh#L66

asharrem commented 3 years ago

Hi @kgilmer & @dangoncalves , I often copy files to the chroot during & after the build script process. Method 1: build.sh - After the [run_chroot] process, the script will usually pause waiting for sudo password before running [build_iso]. At this point you can copy files to the chroot. Note copying requires sudo privileges. Method 2: build-sh build_iso After first run of build.sh -, copy files to existing chroot (sudo required), then run build.sh build_iso. Or build.sh run_chroot after copying files will allow you to use your config.sh to install your copied files, followed by build-sh build_iso to regenerate the iso.

In the case of installing an offline .deb I copy the deb as above and use a preseed to install it during install.

ubiquity ubiquity/success_command string \
  in-target dpkg -i /etc/skel/Downloads/nxwitness-client*.deb;

I have a modified [build_iso] function to include generating a preseed. I hope I have helped & understood what you are trying to achieve.

dangoncalves commented 3 years ago

Hi,

I opened this PR to reflect what I exepected.

While the workaround provided by @asharrem works, feel free to close the PR if you think it's irrelevant.