Revert a modified file in /volumio

Hi

Could somebody please review the following commands for potential problems. They revert a modified file in /volumio, and are based on commands from volumio updater restorevolumio, but resync the filesystem by remounting the root volume. They are intended to be run on a working system without requiring a reboot, and I have been using them while Volumio is running without noticing problems.

# create a temporary directory
tmp_dir=$(mktemp -d -t mpd_oled-XXXXXXXXXX)

# mount the upper filesystem
mount /dev/mmcblk0p3 "$tmp_dir"

# remove the changed mpd.conf template file (should warn if not present)
rm "$tmp_dir/dyn/volumio/app/plugins/music_service/mpd/mpd.conf.tmpl"

# tidy up
umount "$tmp_dir"
rmdir "$tmp_dir"

# syncronise and put the file system back in good order
sync
mount -o remount /

Thanks

Adrian.

You are deleting a file from the overlay filesystem dynamic folder, which is not supposed to be accessed directly!
I strongly advise not to do this.

Hi gkkpch

Thanks for commenting on the script. I haven’t received any reports of issues relating to the script, but I share your concern about the potential for issues.

A similar technique is used by Volumio. It restores the whole volumio directory by deleting a it from the overlay filesystem dynamic folder (the code is in /volumio/update-helper.js).

You can see the same technique, using remount, being recommended here

Adrian.

I’m aware of the fact that you can, still not recommending it and that is basically what you were asking for: our opinion.
But of course, nothing is stopping you from doing it.
As long as you know what and why you are deleting from a dyn folder you are probably safe.