Changing the filecopy process

  • Hello,
    I have almost completed my setup and it is working as it should.
    I am currently using the filecopy feature to move a directory of drivers to the PC after deployment where I then use a powershell script to check the model and install the correct drivers.
    There is one problem with this: The driver directory has to be copied in full, with drivers for all models, which gives 12 GB extra spread over a large number of files. This takes quite a while.
    I was thinking that if the filecopy could check the model and then just copy that specific directory for that specific machine, it could cut down the time severely.
    I know a little about what to do:
    The model name for Lenovo laptops is located in /sys/devices/virtual/dmi/id/product_version (for many other models it would probably be located at /sys/devices/virtual/dmi/id/product_name )
    This gives me the string "ThinkPad T460s". The Driver directory would only contain the "T460s" part though, so I would separate the string and only copy the directory that contains the remaining string.

    The first part I think I can do with this:
    computer_model=$('cat /sys/devices/virtual/dmi/id/product_version')
    IFS=',' read -a model <<< "$computer_model"

    I can also copy a folder containing a specific string, but I am stumped as to how I can combine it with CD's filecopy process.
    How do I check if one of the folders in the filecopy is called "Drivers" and then how can I make it skip that single directory and launch my own code?

    As you can tell I am very new to Bash scripting (and Linux in general), so I appreciate any help you can give me.

  • Why don't you just add the file / folder to clonedeploy by each model directory instead of the full driver directory. Then you can make multiple image profiles and only assign the correct drivers to that image profile. Then assign the correct image profile to the correct computers.

  • I know that is an option and one I have considered.
    However the option of detecting a model and do it dynamically is important for us, since we are few people with a lot of users and a lot of models. The ability to push out files based on computer model would be very valuable for us, not just for drivers, but potentially other files.
    I know that this is maybe outside the scope of what you are willing to support and outside the scope of how CD was intended, which is completely okay.
    We are just glad that there are people like you who make this kind of software.

  • Ok, there is nothing built in currently that is going to handle this. You can't combine this with the current file copy process. You would need to scratch the built in file copy method and do it entirely with a custom script. Otherwise you would need to modify the core scripts, but when an update is released your changes would be overwritten.

    So if you ran a custom script, a high level overview
    mount the correct partition
    [code]ntfs-3g -o force,rw,remove_hiberfile /dev/sda2 /mnt/ntfs[/code]
    [code]model=get the model from dmi using your script from earlier[/code]

    copy the correct folder
    [code]cp -R /storage/resources/drivers/$model /mnt/ntfs/Windows/$whatever[/code]

    I still think the image profiles would work well. Computers can be in multiple groups. Create a group for each computer model, put all those computers in the group, assign the correct profile to that group. Done.