diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index c6701b4e..412ab101 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -15,6 +15,7 @@ This comprehensive guide covers everything you need to know about developing wit - [Freezing to Debian Archive Snapshots](#freezing-to-debian-archive-snapshots) - [Testing for Reproducibility](#testing-for-reproducibility) - [Creating Debian Packages](#creating-debian-packages) +- [Custom Developer Files](#custom-developer-files) - [Debugging and Troubleshooting](#debugging-and-troubleshooting) ## Project Structure @@ -635,6 +636,30 @@ For systems without systemd v250+ or where Nix installation isn't feasible, you > Replace "btrfs" with your chosen storage driver 5. Run the desired `mkosi` command inside the shell Podman environment +## Custom Developer Files + +When building with the `devtools` profile, you can add your own custom files to the image without committing them to git. This is useful for adding personal SSH keys, configuration files, or debugging tools during development. + +### Adding Custom Files + +Place files in `mkosi.profiles/devtools/custom/` mirroring the filesystem structure you want: + +```bash +# Add your SSH authorized keys +mkdir -p mkosi.profiles/devtools/custom/root/.ssh +cp ~/.ssh/id_rsa.pub mkosi.profiles/devtools/custom/root/.ssh/authorized_keys + +# Add a custom configuration file +mkdir -p mkosi.profiles/devtools/custom/etc +echo "my_setting=value" > mkosi.profiles/devtools/custom/etc/myconfig.conf + +# Add a debugging script +mkdir -p mkosi.profiles/devtools/custom/usr/local/bin +cp my-debug-script.sh mkosi.profiles/devtools/custom/usr/local/bin/ +``` + +Files placed here will be copied into the image (like any other `ExtraTrees` directory) but will be ignored by git, so they won't be accidentally committed. + ## Debugging and Troubleshooting ### mkosi Debugging diff --git a/mkosi.profiles/devtools/custom/.gitignore b/mkosi.profiles/devtools/custom/.gitignore new file mode 100644 index 00000000..f5fc64d7 --- /dev/null +++ b/mkosi.profiles/devtools/custom/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory except .gitkeep and .gitignore +* +!.gitkeep +!.gitignore diff --git a/mkosi.profiles/devtools/custom/.gitkeep b/mkosi.profiles/devtools/custom/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/mkosi.profiles/devtools/mkosi.conf b/mkosi.profiles/devtools/mkosi.conf index c720603f..512ac25c 100644 --- a/mkosi.profiles/devtools/mkosi.conf +++ b/mkosi.profiles/devtools/mkosi.conf @@ -1,5 +1,6 @@ [Content] ExtraTrees=mkosi.extra + custom Packages=adjtimex apt diff --git a/mkosi.profiles/devtools/mkosi.postinst b/mkosi.profiles/devtools/mkosi.postinst index 5eca88d7..ac5a5f7a 100755 --- a/mkosi.profiles/devtools/mkosi.postinst +++ b/mkosi.profiles/devtools/mkosi.postinst @@ -7,6 +7,9 @@ HASH=$(mkosi-chroot openssl passwd -6 -salt salt "$PASSWORD") mkosi-chroot passwd -u root mkosi-chroot usermod -p "$HASH" root +# Remove git files in custom/ folder +mkosi-chroot rm /.gitignore /.gitkeep || true + if [ -f "$BUILDROOT/etc/default/dropbear" ]; then # Remove -s, -w, -g flags from dropbear args sed -i '/^DROPBEAR_EXTRA_ARGS=/s/-[swg] \?//g' "$BUILDROOT/etc/default/dropbear"