Skip to content

Commit

Permalink
[MASSEMBLY-791] - overrideUmask option to ensure permissions in packa…
Browse files Browse the repository at this point in the history
…ged archive match expected ones.
  • Loading branch information
mabrarov committed Jul 5, 2023
1 parent d607c75 commit 583c538
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,12 @@ public interface AssemblerConfigurationSource {
* @return Override group name.
*/
String getOverrideGroupName();

/**
* @return Mask which is applied to permissions of files/directories before they are put into assembly.
* If {@code null} then the mask is not explicitly configured and remains implementation-specific.
*/
default Integer getOverrideUmask() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,10 @@ protected Archiver createArchiver(
if (StringUtils.isNotBlank(configSource.getOverrideGroupName())) {
archiver.setOverrideGroupName(StringUtils.trim(configSource.getOverrideGroupName()));
}
final Integer overrideUmask = configSource.getOverrideUmask();
if (overrideUmask != null) {
archiver.setUmask(overrideUmask);
}

return archiver;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,13 @@ public abstract class AbstractAssemblyMojo extends AbstractMojo implements Assem
@Parameter
private String overrideGroupName;

/**
* Override of mask which is applied to permissions of files/directories before they are put into assembly.
* If {@code null} then the mask is not explicitly configured and remains implementation-specific.
*/
@Parameter
private Integer overrideUmask;

public static FixedStringSearchInterpolator mainProjectInterpolator(MavenProject mainProject) {
if (mainProject != null) {
// 5
Expand Down Expand Up @@ -879,4 +886,9 @@ public Integer getOverrideGid() {
public String getOverrideGroupName() {
return this.overrideGroupName;
}

@Override
public Integer getOverrideUmask() {
return this.overrideUmask;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -451,4 +451,9 @@ public Integer getOverrideGid() {
public String getOverrideGroupName() {
return "root";
}

@Override
public Integer getOverrideUmask() {
return null;
}
}

0 comments on commit 583c538

Please sign in to comment.