Comment 4 for bug 2006752

Revision history for this message
Luke Tidd (lukeisgreat) wrote :

I have a lot of installs to manage, so I wrote some python that generates my USER-DATA. At the beginning of my early and late commands, I create a log dir. I have a list of scripts for early and late install from a template that, similar to the script you posted, writes it's output to the log files and can better handle errors, etc. Each of these scripts are base64 encoded by my python script then written as a set of commands to USER-DATA something like:

```
late-commands:
  - mkdir -p /target/var/log/installer/custom /installer /target/installer
  - echo Running test.sh
  - printf 'IyEvYmluL2Jhc2gKClNDUklQVD0iJChiYXNlbmFtZSAiJHswfSIpIgpMT0dfRElSPScvdmFyL2xvZy9pbnN0YWxlci9jdXN0b20nCkxPRz0iJHtMT0dfRElSfS8ke1NDUklQVH0iCgpmdW5jdGlvbiBsb2coKSB7CiAgcHJpbnRmICclcyAlczogJXNcbicgIiRTQ1JJUFQiICIkKGRhdGUgJyslWSVtJWQgJUglTSVTJykiICIkMSIgPiAiJExPRyIKfQoKZG9fc29tZXRoaW5nIDI+JjEgfCB3aGlsZSByZWFkIGxpbmU7IGRvIGxvZyAiJGxpbmUiOyBkb25lCg==' > /installer/test.sh.b64
  - base64 -d < /installer/test.sh.b64 > /target/installer/test.sh
  - curtin in-target --target /target -- /installer/test.sh
```