Adding drivers at the end of an restore.



  • Hey There,

    I have to say this is the third time I have used this project for deployment situations and its fantastic.

    I have an odd request, I would like to add a custom some script to copy driver files from a directory on my fog server to my xp image once its restored to the machine.

    I understand that you can mount the init.gz image and modify it, I am thinking that adding a bit of code to the “fog” script in /bin will do but at what point should I add this? for the most part my images are single partition.

    Also any suggestions on what I should write as well would be great I can write a vb script file but first time with bash script, basically would like to copy a folder full of drivers say /mnt/drivers to ~c:\sysprep\drivers, anything basic will do I’m sure I can modify it to suit :)

    There may even be an easier way of doing this but I dont know it :p

    Cheers



  • Hi

    I created this page some time ago

    [url]http://www.fogproject.org/wiki/index.php?title=Working_device_drivers_snapins[/url]

    I’m used to deploy device drivers as snapins. most device drivers have a installer able to run silently. However, some drivers need to run when a user is logged on. Some of them (sometimes realtek hdaudio or ac97 depending on the computer, or some ATI video drivers) are a bit ugly and don’t run well silently.

    Have a look, that’s quite nice :)

    Now I’m using .cmd files as snapins, and they start my device driver from a SMB share. This is easier to maintain and troubleshoot. No more need to create a sfx with 7z :)



  • Here is a solution that I currently use. I added an extra host option in the database. Similar to kernel options but called it scripts. Here I can add different scripts to different hosts or groups. That information is then appended to the bootimage in a variable called hostScripts. I created a new nfs share called scripts. In here are all of the different bash or shell scripts that can be ran after a host has imaged and before it checks out. Here is the function I call from my boot image.

    if [ ! “$hostScripts” = “” ]; then
    runScripts
    fi

    function runScripts()
    {
    mkdir /scripts
    mount -o nolock,proto=tcp “$serverIP:/scripts” /scripts 2>/dev/mntscripts
    echo "Running Script(s)"
    sleep 1

    scriptCount=$(grep -o “,” <<<"$hostScripts" | wc -l)
    scriptCount=$(( $scriptCount + 1 ))
    echo “> Found $scriptCount Script(s)“
    sleep 1
    i=1
    while [ $i -le $scriptCount ]
    do
    scriptArray[i]=$(echo $hostScripts | cut -d”,” -f$i)
    echo "> Running ${scriptArray[i]}"
    sleep 1
    cd /scripts
    ./${scriptArray[i]} $hd
    i=$(( $i + 1 ))
    sleep 1
    done
    }

    So if hostA had hostScripts=script1,script2,script3 set for it. It would run all 3 scripts that are stored on the server.
    I know this has a lot info missing but this is a general idea of how you could do it.[/i][/i][/i]



  • Had some time today, added this to my fog script

    [CODE] if [ “$type” == “down” ];
    then
    # Windows XP
    if [ “$osid” == “1” ]; then
    echo “”;
    echo " * Copying driver files";
    echo “”;
    ntfs-3g -o force,rw $part /ntfs
    mkdir -p /ntfs/sysprep/drivers
    cp -R -f /images/drivers/* /ntfs/sysprep/drivers
    umount /ntfs;
    fi
    fi[/CODE]

    It seems to work well, will probably expand on this in the future, might even send through page for your wiki with what I’m doing for deploying images.


Log in to reply
 

368
Online

39.3k
Users

11.0k
Topics

104.4k
Posts

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.