Switch label detection for non-resizable NTFS partitions to partition flag based detection

This commit is contained in:
Quazz
2018-12-12 12:19:39 +01:00
parent cd06167e9d
commit cd643f2c4e
3 changed files with 11 additions and 12 deletions

13
Buildroot/board/FOG/FOS/rootfs_overlay/bin/fog.upload Executable file → Normal file
View File

@@ -57,6 +57,7 @@ beginUpload() {
dots "Getting Windows/Linux Partition Count"
countPartTypes "$hd" "ntfs" "ntfscnt"
countPartTypes "$hd" "extfs" "extfscnt"
countPartTypes "$hd" "*" "partscnt"
if [[ $ntfscnt -eq 0 && $extfscnt -eq 0 ]]; then
echo "Failed"
debugPause
@@ -68,6 +69,8 @@ beginUpload() {
debugPause
echo " * EXTFS Partition count of: $extfscnt"
debugPause
echo " * Total Partition count of: $partscnt"
debugPause
case $osid in
[4-7]|9|50|51)
echo " * Setting up any additional fixed parts"
@@ -75,7 +78,7 @@ beginUpload() {
for part in $parts; do
getPartitionNumber "$part"
fsTypeSetting "$part"
getPartitionLabel "$part"
#getPartitionLabel "$part"
[[ $fstype != ntfs ]] && continue
dots "Mounting partition ($part)"
if [[ ! -d /bcdstore ]]; then
@@ -103,9 +106,11 @@ beginUpload() {
;;
esac
umount /bcdstore >/dev/null 2>&1
if [[ $label =~ [Rr][EeÉé][Ss][Ee][Rr][Vv][EeÉé][Dd]? || $label =~ [Rr][Ee][Cc][Oo][Vv][Ee][Rr][Yy] ]]; then
echo " * New fixed partition for ($part) added."
fixed_size_partitions="$fixed_size_partitions:$part_number"
if [[ $partscnt -gt 1 ]]; then
if [[ $(parted -l "$hd" | grep boot | awk '{print $1}') -eq $part_number || $(parted -l "$hd" | grep msftres | awk '{print $1}') -eq $part_number || $(parted -l "$hd" | grep hidden | awk '{print $1}') -eq $part_number ]]; then
echo " * New fixed partition for ($part) added."
fixed_size_partitions="$fixed_size_partitions:$part_number"
fi
fi
done
;;

View File

@@ -483,14 +483,13 @@ shrinkPartition() {
local part_block_size=0
case $fstype in
ntfs)
local label=$(getPartitionLabel "$part")
if [[ $label =~ [Rr][Ee][Cc][Oo][Vv][Ee][Rr][Yy] ]]; then
if [[ $(parted -l "$hd" | grep msftres | awk '{print $1}') -eq $part_number ]]; then
echo "$(cat "$imagePath/d1.fixed_size_partitions" | tr -d \\0):${part_number}" > "$imagePath/d1.fixed_size_partitions"
echo " * Not shrinking ($part) recovery partition"
debugPause
return
fi
if [[ $label =~ [Rr][EeÉé][Ss][Ee][Rr][Vv][EeÉé][Dd]? ]]; then
if [[ $(parted -l "$hd" | grep boot | awk '{print $1}') -eq $part_number || $(parted -l "$hd" | grep hidden | awk '{print $1}') -eq $part_number ]]; then
echo "$(cat "$imagePath/d1.fixed_size_partitions" | tr -d \\0):${part_number}" > "$imagePath/d1.fixed_size_partitions"
echo " * Not shrinking ($part) reserved partitions"
debugPause

View File

@@ -525,11 +525,6 @@ processSfdisk() {
# process with external awk script
[[ -r $data ]] && /usr/share/fog/lib/procsfdisk.awk $awkArgs $data $orig || /usr/share/fog/lib/procsfdisk.awk $awkArgs $orig
}
getPartitionLabel() {
local part="$1"
[[ -z $part ]] && handleError "No part passed (${FUNCNAME[0]})\n Args Passed: $*"
label=$(blkid -po udev $part | awk -F= /FS_LABEL=/'{print $2}')
}
#
# GPT Functions below
#