How to get installation type (local USB storage or HTTP) in wrapup.sh during TEZI

We are preparing our IMX6ULL modules either over LAN (using HTTP server), or thru USB. I’d like to automate part of the process by including a script in the installation folder, so this script knows whether to use "‘cp” or “curl” to pull additional files.

How can one detect in wrapup.sh whether image came from local USB drive or LAN? Flashing over LAN does not exclude non-TEZI USB storage to be connected.

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


Detecting Installation Source in wrapup.sh

The Toradex Easy Installer wrapup.sh script is executed after successful installation(1). When the image is loaded from removable media (SD/USB), the media is mounted at /run/media/src(1).

Detection Strategy

You can check if /run/media/src is mounted to determine the installation source:

if mountpoint -q /run/media/src; then
    # Image came from local media (USB/SD)
    # Use cp commands
else
    # Image came from network (HTTP)
    # Use curl commands
fi

(1)

Important Considerations for Removable Media

If your wrapup.sh script is located on removable media (USB/SD), note that such media is mounted in read-only mode by default(1).

If you need to write to the media, you must remount it first:

mount -o remount,rw /run/media/src

# Write operations here

exit 0

(1)

Additional Notes

  • The wrapup script executes in the Toradex Easy Installer (TEZI) environment where the root filesystem is a RAMFS, meaning any data written to it will be lost after reboot(2)
  • To write data that persists after installation, you need to mount the target filesystem that was installed to the module’s flash memory(2)
  • If you plan to auto-reboot after writing to removable media, make sure to sync your data before reboot to avoid data corruption(1)

This approach allows your script to automatically detect whether the installation came from local storage or network and adjust its behavior accordingly.

Best regards,
Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Why not try using curl first and, if the file is unavailable, copy it from the local media?

Hi Alex, thank you for the idea. One more question: Immediately after TEZI’ing , “# /sbin/reboot” does nothing, but TEZI run over VNC manages to reboot the target. What’s the secret command?

reboot -f