Post install script not running
-
Hello,
So I’m using FOG to deploy an Ubuntu image, of course the image I’m deploying is not ‘syspreped’, that means it already has some specific settings (like users etc …) belonging to the machine I captured it from, this is because it is not possible to sysprep an Ubuntu image like in Windows, and also it is harder because FOG Client does not support Ubuntu.
So to solve this problem, I tried writing a post download scriptfog.dothings
I saved it to/images/postdownloadscripts
so it could run after the image is deployed to the new machine and try to get rid of some of these specific settings, the script looks like this:#!/bin/bash apt update apt upgrade apt install --force-yes whois traceroute ntpdate net-tools sysstat iptables ethtool ufw --force-yes disable apt purge --force-yes ufw timedatectl set-timezone Europe/Berlin cd /etc/systemd/ rm -f timesyncd.conf killall -u FogMaster && deluser --remove-home -f FogMaster
I’m trying to do some simple things like installing some packages, resetting the time zone, and deleting a user called
FogMaster
from the deployed image and its home directory.
The script is not working, I’m getting a bunch ofcommand not founds
errors when the post download script tries to run.
Here is how myfog.postdownload
looks like:#!/bin/bash # This file serves as a starting point to call your custom postimaging scripts. ## <SCRIPTNAME> should be changed to the script you're planning to use. ## Syntax of post download scripts are #. ${postdownpath}<SCRIPTNAME> . ${postdownpath}/fog.dothings
-
@anisgh The problem you have is perspective. When you do things in a FOG Post install script your script is running in the context of FOS Linux, not ubuntu. You need to use the FOG Postinstall script to drop the files or leave settings behind so that your first run program in the target OS will find the values and use them. Just like if your target OS is windows, FOS Linux can not change the target OS internal settings.
So to give you a guide, you can either run that script and power off ubuntu just before you capture with FOG, or run that script on first boot up of ubuntu after the computer has been cloned. The post install script can not run it directly because it can not interact with the target OS at that level.
-
@george1421 said in Post install script not running:
You need to use the FOG Postinstall script to drop the files or leave settings behind so that your first run program in the target OS will find the values and use them. Just like if your target OS is windows, FOS Linux can not change the target OS internal settings.
That is surely one way of doing it but there is another way. You could mount the newly imaged drive and
chroot
into it to to those things on the destination Linux OS.