#!/usr/bin/env sh # Determine extroot partition UUID=$(uci show fstab.extroot.uuid | sed -e 's/fstab\.extroot\.uuid\=//g' -e "s/\'//g") # Check if currently mounted `/overlay` is, indeed, the extroot partition if ! block info | grep -qE "$UUID.*/overlay"; then exit 127 fi # Now that we know it is, take the backup and output it at `/overlay/sysupgrade-backup.tar.gz` sysupgrade -b /overlay/sysupgrade-backup.tar.gz # Exit gracefully exit 0