@@ -79,13 +79,13 @@ func shrinkFilesystems(imageLoopDevice string, verityHashPartition *imagecustomi
7979 }
8080
8181 // Check the file system with e2fsck
82- err = shell .ExecuteLive (true /*squashErrors*/ , "sudo" , " e2fsck" , "-fy" , partitionLoopDevice )
82+ err = shell .ExecuteLive (true /*squashErrors*/ , "e2fsck" , "-fy" , partitionLoopDevice )
8383 if err != nil {
8484 return fmt .Errorf ("failed to check %s with e2fsck:\n %w" , partitionLoopDevice , err )
8585 }
8686
8787 // Shrink the file system with resize2fs -M
88- stdout , stderr , err := shell .Execute ("sudo" , " resize2fs" , "-M" , partitionLoopDevice )
88+ stdout , stderr , err := shell .Execute ("resize2fs" , "-M" , partitionLoopDevice )
8989 if err != nil {
9090 return fmt .Errorf ("failed to resize %s with resize2fs:\n %v" , partitionLoopDevice , stderr )
9191 }
@@ -103,7 +103,7 @@ func shrinkFilesystems(imageLoopDevice string, verityHashPartition *imagecustomi
103103 }
104104
105105 // Resize the partition with parted resizepart
106- _ , stderr , err = shell .ExecuteWithStdin ("yes" /*stdin*/ , "sudo" , " parted" , "---pretend-input-tty" ,
106+ _ , stderr , err = shell .ExecuteWithStdin ("yes" /*stdin*/ , "parted" , "---pretend-input-tty" ,
107107 imageLoopDevice , "resizepart" , strconv .Itoa (partitionNumber ), end )
108108 if err != nil {
109109 return fmt .Errorf ("failed to resizepart %s with parted:\n %v" , partitionLoopDevice , stderr )
@@ -121,7 +121,7 @@ func shrinkFilesystems(imageLoopDevice string, verityHashPartition *imagecustomi
121121// Get the start sectors of all partitions.
122122// Ideally, we would use 'lsblk --output START' here. But that is only available in util-linux v2.38+.
123123func getStartSectors (imageLoopDevice string , partitionCount int ) (partitionStarts map [string ]int , err error ) {
124- stdout , stderr , err := shell .Execute ("sudo" , " fdisk" , "--list" , imageLoopDevice )
124+ stdout , stderr , err := shell .Execute ("fdisk" , "--list" , imageLoopDevice )
125125 if err != nil {
126126 return nil , fmt .Errorf ("fdisk failed to list partitions:\n %v" , stderr )
127127 }
0 commit comments