Rolling FOG out to US Site
-
@george1421 Thanks for that. I get a couple of errors at the beginning, and it doesn’t copy over the Setup.cmd file (quite possibly because of said errors).
Edit: I’ve noticed the errors I received were because I had copied the file across using Windows, so it couldn’t run the script correctly. I’ll try again now.
-
@RobTitian16 when you get to the point where you “need” to debug your post install script. I have some helpful hints you can use.
-
@george1421 I wonder if the syntax of the {print} command is incorrect. I’m getting the following:
Also, as a note, there were a couple of issues with no spaces in the lines with [[! - one I had added the space (to be like [[ ! ) it was working.
-
@RobTitian16 OK I have a few minutes between meetings this am, let me take a look for the print command and for the copy command its possible that you don’t have the complete path created (especially if you never specifically used the setupcomplete.cmd file).
-
@george1421 p.s. I’m not using the unattend.xml at the moment so those lines can be ignored.
-
@RobTitian16 OK is see what happened. I was being lazy and just grabbed your code (which was wrong) when I consolidated the script.
the correct code is this
myip=`ip route get 8.8.8.8 | awk 'NR==1 {print $NF}' | cut -d "." -f1-2`;
Note right after myip= that is a back tick not a single quote.
-
myip=`ip route get 8.8.8.8 | awk 'NR==1 {print $NF}' | cut -d "." -f1-2`;
I’d recommend as:
myip=$(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}' | cut -d "." -f1-2)
-
@Tom-Elliott said in Rolling FOG out to US Site:
I’d recommend as:
myip=$(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}' | cut -d "." -f1-2)
Sweet, I learned something new today.
-
@RobTitian16 You found the other issue I mentioned that the code copied out of the forums sometimes misses spaces that need to be in there.
For example this code
[[_! -d /ntfs_]] && mkdir -p /ntfs #REPLACE _ WITH SPACES
gets converted into
[[! -d /ntfs ]] && mkdir -p /ntfs
note the missing space after the second left bracket. That is why I included the text file (which I may not have fixed every occurrence when I was quickly hacking it up.)
-
Might be helpful if you’re going to use bash scripts to make sure there’s no mistakes in it.
-
@george1421 Yep, I remembered it from last time.
I did download the file and transfer it to my FOG Server, which is when I had to use dos2linux to convert it as it was giving some unusual errors.
Apparently it really doesn’t like:$sitelocal = "en-GB"; $uilang = "en-US";
As I’m getting this error:
-
@RobTitian16 nuts, that’s what happens when you do crud too stuff too fast while doing your real job.
Remove the leading dollar sign “$” from each variable, that should not be there on a set action.
As for the hint part I alluded to before… crud back in a minute.
-
@george1421 haha, I thought that but just wanted to confirm before fiddling
-
@george1421 OK here is the hint.
- If you schedule a debug deploy to your target computer.
- Then pxe boot your target computer. After a few enter key presses you will be dropped to a linux command prompt.
- From here you can enter
fog
and single step through the deployment tasks until you get to your postinstall script. If you script bombs out you can then work on editing your post install script. BUT what I recommend is to do step 4 and on. - Get the ip address of your target computer using
ip addr show
- Set roo’s password with
passwd
you can set it to anything you want. - Now from a windows or linux computer use putty to connect to your target computer.
- At the command prompt key in
fog
to single step through the installation process.
Putty gives you the ability to copy, cut and paste as you edit the post install script.
-
@george1421 Thanks!
Not sure why, but it’s still not copying the SetupComplete.cmd… I wonder if it’s because I made it on the FOG Server itself by just typing: “sudo vi SetupComplete.cmd” and then filling in the file with what I needed for the msi installer. -
@RobTitian16 What you need to confirm is does the entire target path exist?
If I had to bet, I would say this path exists on the target computer c:\windows\setup and thats it. If that is the case you need to create the scripts folder in c:\windows\setup folder.
Also remember I said CASE is important. /ntfs/windows/setup/scripts is not the same as /ntfs/Windows/Setup/Scripts as it would be in the windows OS it self, you are still running linux here.
If you single step through a fog deploy like I posted and run into that error, press ctrl-C to blow out of the script. Then you can inspect the /ntfs path to ensure everything is as you would expect it. It helps with debugging greatly.
Don’t give up here, you are doing some pretty complex stuff with FOG, but will end up with a sweet solution when it all comes together.
-
@george1421 Thanks, George. Definitely not going to give up here - if anything I’m actually craving more understanding of the coding, etc. which I’ll hopefully gain in time
So I’d have to create this folder structure inside the image first? Can I not do it through the script whilst it’s in FOS? -
@RobTitian16 you can do anything structure wise in the post install script. So if you know that you need to create the scripts folder then just issue this command.
md /ntfs/Windows/Setup/Scripts
just before the copy command. But again you need to know exactly what your target system has. -
@RobTitian16 In my setup I will quick patch a target system between image captures. So if I need to update the unattend.xml between image captures or update the setupcomplete.cmd file I can do that via a post install script. Then the next time we capture the image we integrate the “patches” we’ve been doing in the post install script. It works out pretty well.
-
@george1421 Thanks for the help so far
The SetupComplete.cmd doesn’t seem to be working still - when running it through an elevated command prompt, it says: “the installation package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor…”