-
In order to explore and understand the usage of custom phase scripts, I pared down the example script on the Wiki (https://github.com/gitbls/sdm/wiki/Example:-Custom-Phase-script). I removed everything except some basic logging with the intent of incrementally adding back in my desired customizations. Here is my script ('.txt' added to file name as Github wouldn't accept '.sh' type). When I ran sdm --customize with a --cscript switch the customization failed in all three phases with a message saying "/bin/bash^M: bad interpreter: No such file or directory". Here is what I think are the relevant parts of the customization attempt (I can provide a full log if needed):
I notice that there is a double-/ in the '> Run Custom Phase Script '/mnt/sdm//usr/local/sdm/sdm-Custom-Phase-script.sh' Phase 0' and following line which looks odd to me. This doesn't appear in the Phase 1 and post-install steps. Is /bin/bash not able to be found for some reason? I checked both on the image (via sdm --explore) and the Linux Mint 21 computer on which I'm running sdm and can see /bin/bash. Might this be somehow due to my running sdm on Linux Mint? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Nope, really simple. "/bin/bash^M: bad interpreter: No such file or directory" tells me that you edited this file on Windows, and the file has Windows line endings on it rather than Linux line endings. Use dos2unix on Mint to convert the line endings and it will work fine. There are many ways to fix the line endings. dos2unix on Mint will do it. If you don't like that, a quick search for: convert windows file to linux will give you 88M or so web sites telling you how to do it. 🤣 I personally use EditPad Lite on Windows, and make sure that the file is in Linux format when I save it, or more often than not, I just do all the editing on Linux. The double slash is a buglet, but doesn't hurt anything. Bash nicely treats '//' as '/'. But will have a look at it. |
Beta Was this translation helpful? Give feedback.
-
Yep, that's it. LF vs CRLF. By the way, I've decided for myself that I'm using a plugin instead of a custom phase script. They are effectively the same in terms of the structure, etc, but plugins have a few advantages that I like:
Converting a custom phase script to a plugin is really simple. In fact, you can simply use a proper custom phase script as a plugin. Changes are only required if you want it to accept arguments or if you're OCD (like I am) about the logging. That said, I have no intention of removing custom phase scripts, so you can customize your image either way. |
Beta Was this translation helpful? Give feedback.
Nope, really simple. "/bin/bash^M: bad interpreter: No such file or directory" tells me that you edited this file on Windows, and the file has Windows line endings on it rather than Linux line endings. Use dos2unix on Mint to convert the line endings and it will work fine.
There are many ways to fix the line endings. dos2unix on Mint will do it. If you don't like that, a quick search for: convert windows file to linux will give you 88M or so web sites telling you how to do it. 🤣 I personally use EditPad Lite on Windows, and make sure that the file is in Linux format when I save it, or more often than not, I just do all the editing on Linux.
The double slash is a buglet, but doesn't hurt a…