@@ -815,8 +815,20 @@ static bool checkUnpartitionedSpace() {
815815 setRawSetting (" storageDevice" , osd);
816816 }
817817 }
818-
818+ std::string fs = " 0" ;
819+ if (FileExists (SD_CARD_DEVICE)) {
820+ fs = execAndReturn (" /usr/sbin/sfdisk -F " + SD_CARD_DEVICE + " | tail -n 1" );
821+ TrimWhiteSpace (fs);
822+ auto splits = split (fs, ' ' );
823+ fs = splits.back ();
824+ if (endsWith (fs, " G" )) {
825+ fs = fs.substr (0 , fs.size () - 1 );
826+ } else {
827+ fs = " 0" ;
828+ }
829+ }
819830 if (FileExists (" /boot/firmware/fpp_expand_rootfs" ) || FileExists (" /boot/fpp_expand_rootfs" )) {
831+ fs = " 0" ;
820832 std::string rootPart = execAndReturn (" /usr/bin/findmnt -n -o SOURCE /" );
821833 TrimWhiteSpace (rootPart);
822834 if (startsWith (rootPart, SD_CARD_DEVICE)) {
@@ -833,18 +845,6 @@ static bool checkUnpartitionedSpace() {
833845 unlink (" /boot/firmware/fpp_expand_rootfs" );
834846 unlink (" /boot/fpp_expand_rootfs" );
835847 }
836- std::string fs = " 0" ;
837- if (FileExists (SD_CARD_DEVICE)) {
838- fs = execAndReturn (" /usr/sbin/sfdisk -F " + SD_CARD_DEVICE + " | tail -n 1" );
839- TrimWhiteSpace (fs);
840- auto splits = split (fs, ' ' );
841- fs = splits.back ();
842- if (endsWith (fs, " G" )) {
843- fs = fs.substr (0 , fs.size () - 1 );
844- } else {
845- fs = " 0" ;
846- }
847- }
848848 std::string oldfs;
849849 getRawSetting (" UnpartitionedSpace" , oldfs);
850850 if (oldfs != fs) {
0 commit comments