Skip to content

Commit

Permalink
use chattr if root
Browse files Browse the repository at this point in the history
  • Loading branch information
BFergerson committed Feb 10, 2022
1 parent b159aa0 commit e3a5d70
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ tasks.register<Exec>("restrictDeletionOfJsonMappers") {
}
}
if (Os.isFamily(Os.FAMILY_UNIX)) {
commandLine("chmod", "a-w", "$buildDir/generated/source/kapt/main/META-INF/vertx")
if (System.getProperty("user.name") == "root") {
commandLine("chattr", "+i", "$buildDir/generated/source/kapt/main/META-INF/vertx")
} else {
commandLine("chmod", "a-w", "$buildDir/generated/source/kapt/main/META-INF/vertx")
}
} else {
executable("cmd.exe")
args("/C") //no-op
Expand All @@ -115,7 +119,11 @@ tasks.register<Exec>("unrestrictDeletionOfJsonMappers") {
mustRunAfter("compileKotlinJvm")
if (Os.isFamily(Os.FAMILY_UNIX)) {
if (file("$buildDir/generated/source/kapt/main/META-INF/vertx").exists()) {
commandLine("chmod", "a+w", "$buildDir/generated/source/kapt/main/META-INF/vertx")
if (System.getProperty("user.name") == "root") {
commandLine("chattr", "-i", "$buildDir/generated/source/kapt/main/META-INF/vertx")
} else {
commandLine("chmod", "a+w", "$buildDir/generated/source/kapt/main/META-INF/vertx")
}
} else {
commandLine("true") //no-op
}
Expand Down

0 comments on commit e3a5d70

Please sign in to comment.