infogulch | Hi! | 20:27 |
---|---|---|
infogulch | I found that $USER is not set in a runcmd script, but whoami says root. What kind of shell environment should I expect in a runcmd script? | 20:29 |
bitfehler | infogulch: no shell at all, I would say. the command gets run straight out of cloud-init | 20:32 |
bitfehler | you could of course run "bash -c 'command you actuallly want'" | 20:32 |
bitfehler | but that may or may not make sense. what are you trying to achieve? | 20:33 |
infogulch | Well i'm using the second mode. From the docs: "If the item is a string, it will be written to a file and interpreted using sh." | 20:33 |
infogulch | I'm writing it as: runcmd: |\n[shell commands....] | 20:33 |
infogulch | which i guess is basically equivalent to "sh -c 'commands...'" | 20:34 |
bitfehler | oh right. also, apparently $USER is not set by the shell, but even before it on regular login: https://unix.stackexchange.com/questions/76354/who-sets-user-and-username-environment-variables | 20:35 |
bitfehler | which you don't have (a login) | 20:36 |
infogulch | Ah ok that explains it | 20:36 |
infogulch | Hmm that makes me wonder what else I'm missing | 20:36 |
bitfehler | so i suppose everything you can find in the POSIX shell standard should work | 20:36 |
infogulch | Ok. I guess I'm not intimately familiar with the posix shell standard | 20:39 |
infogulch | Thank you! | 20:41 |
Odd_Bloke | infogulch: I haven't done this myself, but if you run `env > /tmp/env` in a runcmd, you should get an idea of what you can expect. | 20:46 |
infogulch | That's a good idea thank you | 20:47 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!