I’ve implemented a similar process using files in a networked folder. I would either create a custom callback (QFileSystemWatcher for example) and add the USB’s directory to the listener, or use one of the existing kernels/libraries which does this for you. Inotify appears to be a good place to start looking.
Modification in /etc/udev/scripts/mount.sh
In “automount” add test
“if file exists on USB then:
– save into /tmp/magic_file location of update file
– systemctl start x_update”
a) user put USB memory
b) udev call /etc/udev/scripts/mount.sh and “save update location in /tmp/magic_file” and start update service
c) update service call /home/userr/updateXTERM.sh and read location from /tmp/magic_file and kill old version , update files, start new version
On my sdcard from my embedded linux I created two partitions, one for the main Qt application and one with a specific update GUI application.
On my master partition, I have my main application where I have a button for performing the master partition switching.
After that, my application reinitializes the operating system and the update partition is accessed.
At this point, I connect the pendrive and linux mounts to the specific path.
Now my update application can access the mounted path and update the Qt program.
Once the update is complete, the application changes the master partition again and reboots the operating system by accessing the updated Qt application.
NOTE: My update application mounts the main partition in a folder I set. This way I can access the file system stored on that partition.
Anyway, but this was the way I did it.
There may be a better way to do it, and I would love to know it.