• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Post install script not running

Scheduled Pinned Locked Moved
General
3
3
666
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A
    anisgh
    last edited by Feb 27, 2022, 12:49 PM

    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 script fog.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 of command not founds errors when the post download script tries to run.
    Here is how my fog.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
    
    G 1 Reply Last reply Feb 27, 2022, 1:47 PM Reply Quote 0
    • G
      george1421 Moderator @anisgh
      last edited by Feb 27, 2022, 1:47 PM

      @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.

      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

      1 Reply Last reply Reply Quote 1
      • S
        Sebastian Roth Moderator
        last edited by Feb 27, 2022, 6:04 PM

        @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.

        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        1 / 1
        • First post
          3/3
          Last post

        159

        Online

        12.0k

        Users

        17.3k

        Topics

        155.2k

        Posts
        Copyright © 2012-2024 FOG Project