Skip to content

Commit

Permalink
upon factory reset operation we make sure to force the PARTUUID to
Browse files Browse the repository at this point in the history
"0xDEEDBEEF" under all circumstances even if no repartitioning is
necessary. This should fix cases where due to certain misconfigurations
the PARTUUID changes and thus misbehaviour might result. Thus, a factory
reset operation now also resets the PARTUUID and not only reformats
userfs. This refs https://homematic-forum.de/forum/viewtopic.php?f=65&t=62833
  • Loading branch information
jens-maus committed Nov 23, 2020
1 parent 6bcdac2 commit 7d0bbec
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -32,11 +32,12 @@ check_factory_reset() {
# use resizepart to resize the /usr/local partition to the maximum size of
# the disk
parted -s ${DEV} resizepart ${PARTNUM} 100%

# force PARTUUID to 0xDEEDBEEF (because parted changes partuuid)
echo -en '\xEF\xBE\xED\xDE' | dd of=${DEV} conv=notrunc bs=1 seek=$((0x1B8)) 2>/dev/null
fi

# force PARTUUID to 0xDEEDBEEF (because parted changes partuuid) even
# if no repartitioning was performed.
echo -en '\xEF\xBE\xED\xDE' | dd of=${DEV} conv=notrunc bs=1 seek=$((0x1B8)) 2>/dev/null

# we create a clean ext4 partition now
mkfs.ext4 -F -L userfs "${DEVNAME}"
tune2fs -c 0 -i 0 "${DEVNAME}"
Expand Down

0 comments on commit 7d0bbec

Please sign in to comment.