Directories and executables files in an APEX have x bit set
Files under /bin and all directories in an APEX now have x (executable) bit set correctly. Bug: 117580281 Test: m apex.test, push it to /data/apex and reboot. adb shell ls -al /apex/com.android.example.apex@1 shows that the directories have x bit set Change-Id: I76e4188d86dc9cdf65e9f8e52be1981e25441a6e
This commit is contained in:
24
apex/apex.go
24
apex/apex.go
@@ -39,9 +39,10 @@ var (
|
|||||||
generateFsConfig = pctx.StaticRule("generateFsConfig", blueprint.RuleParams{
|
generateFsConfig = pctx.StaticRule("generateFsConfig", blueprint.RuleParams{
|
||||||
Command: `echo '/ 1000 1000 0644' > ${out} && ` +
|
Command: `echo '/ 1000 1000 0644' > ${out} && ` +
|
||||||
`echo '/manifest.json 1000 1000 0644' >> ${out} && ` +
|
`echo '/manifest.json 1000 1000 0644' >> ${out} && ` +
|
||||||
`echo ${paths} | tr ' ' '\n' | awk '{print "/"$$1 " 1000 1000 0644"}' >> ${out}`,
|
`echo ${ro_paths} | tr ' ' '\n' | awk '{print "/"$$1 " 1000 1000 0644"}' >> ${out} && ` +
|
||||||
|
`echo ${exec_paths} | tr ' ' '\n' | awk '{print "/"$$1 " 1000 1000 0755"}' >> ${out}`,
|
||||||
Description: "fs_config ${out}",
|
Description: "fs_config ${out}",
|
||||||
}, "paths")
|
}, "ro_paths", "exec_paths")
|
||||||
|
|
||||||
// TODO(b/113233103): make sure that file_contexts is sane, i.e., validate
|
// TODO(b/113233103): make sure that file_contexts is sane, i.e., validate
|
||||||
// against the binary policy using sefcontext_compiler -p <policy>.
|
// against the binary policy using sefcontext_compiler -p <policy>.
|
||||||
@@ -302,21 +303,28 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// files and dirs that will be created in apex
|
// files and dirs that will be created in apex
|
||||||
var pathsInApex []string
|
var readOnlyPaths []string
|
||||||
|
var executablePaths []string // this also includes dirs
|
||||||
for fileToCopy, dirInApex := range copyManifest {
|
for fileToCopy, dirInApex := range copyManifest {
|
||||||
pathInApex := filepath.Join(dirInApex, fileToCopy.Base())
|
pathInApex := filepath.Join(dirInApex, fileToCopy.Base())
|
||||||
pathsInApex = append(pathsInApex, pathInApex)
|
if dirInApex == "bin" {
|
||||||
if !android.InList(dirInApex, pathsInApex) {
|
executablePaths = append(executablePaths, pathInApex)
|
||||||
pathsInApex = append(pathsInApex, dirInApex)
|
} else {
|
||||||
|
readOnlyPaths = append(readOnlyPaths, pathInApex)
|
||||||
|
}
|
||||||
|
if !android.InList(dirInApex, executablePaths) {
|
||||||
|
executablePaths = append(executablePaths, dirInApex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sort.Strings(pathsInApex)
|
sort.Strings(readOnlyPaths)
|
||||||
|
sort.Strings(executablePaths)
|
||||||
cannedFsConfig := android.PathForModuleOut(ctx, "canned_fs_config")
|
cannedFsConfig := android.PathForModuleOut(ctx, "canned_fs_config")
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
||||||
Rule: generateFsConfig,
|
Rule: generateFsConfig,
|
||||||
Output: cannedFsConfig,
|
Output: cannedFsConfig,
|
||||||
Args: map[string]string{
|
Args: map[string]string{
|
||||||
"paths": strings.Join(pathsInApex, " "),
|
"ro_paths": strings.Join(readOnlyPaths, " "),
|
||||||
|
"exec_paths": strings.Join(executablePaths, " "),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user