Skip to content
This repository has been archived by the owner on Jun 8, 2024. It is now read-only.

Commit

Permalink
Generate sha256 file per #35
Browse files Browse the repository at this point in the history
  • Loading branch information
jernst committed Oct 14, 2023
1 parent 2fdd04e commit 0e9f589
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions vendor_perl/UBOS/Macrobuild/BasicTasks/CreateContainer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ sub runImpl {
my $deviceclass = $self->getProperty( 'deviceclass' );
my $installCheckSignatures = $self->getPropertyOrDefault( 'installCheckSignatures', 'always' );
my $runCheckSignatures = $self->getPropertyOrDefault( 'runCheckSignatures', 'always' );
my $genSha256 = $self->getPropertyOrDefault( 'genSha256', 1 );
my $deviceConfig = $self->getProperty( 'deviceConfig' );

my $errors = 0;
Expand Down Expand Up @@ -116,7 +117,15 @@ sub runImpl {
if( UBOS::Utils::myexec( "sudo tar -c -f '$tarfile' -C '$dir' .", undef, \$out, \$out )) {
error( 'tar failed:', $out );
++$errors;
} elsif( $genSha256 ) {
if( $UBOS::Utils::myexec( "sha256 '$tarfile' > '$tarfile.sha256'" )) {
error( 'sha256 failed' );
++$errors;

} elsif( UBOS::Utils::myexec( "sudo chown \$(id -u -n):\$(id -g -n) '$tarfile{,.sha256}'" )) {
error( 'chown failed' );
++$errors;
}
} else {
if( UBOS::Utils::myexec( "sudo chown \$(id -u -n):\$(id -g -n) '$tarfile'" )) {
error( 'chown failed' );
Expand Down

0 comments on commit 0e9f589

Please sign in to comment.