Require a vendor_ prefix for users/groups in /vendor/etc/{passwd,group}
Bug: 79528966
Test: successful build with vendor_ prefixed users/groups
Test: expected build failure when not using vendor_ prefixed users/groups
Merged-In: If006c70178aa5bdcc9521a06ef8df2500f70bbb9
Change-Id: If006c70178aa5bdcc9521a06ef8df2500f70bbb9
(cherry picked from commit 2d197a1e19
)
This commit is contained in:
parent
00e17fa8b4
commit
5a3fd15548
2 changed files with 16 additions and 5 deletions
|
@ -254,7 +254,7 @@ LOCAL_EXPORT_C_INCLUDE_DEPS := $(my_gen_oem_aid)
|
||||||
include $(BUILD_HEADER_LIBRARY)
|
include $(BUILD_HEADER_LIBRARY)
|
||||||
|
|
||||||
##################################
|
##################################
|
||||||
# Generate the system/etc/passwd text file for the target
|
# Generate the vendor/etc/passwd text file for the target
|
||||||
# This file may be empty if no AIDs are defined in
|
# This file may be empty if no AIDs are defined in
|
||||||
# TARGET_FS_CONFIG_GEN files.
|
# TARGET_FS_CONFIG_GEN files.
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
@ -270,10 +270,10 @@ $(LOCAL_BUILT_MODULE): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN)
|
||||||
$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(system_android_filesystem_config)
|
$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(system_android_filesystem_config)
|
||||||
$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_GEN) $(system_android_filesystem_config)
|
$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_GEN) $(system_android_filesystem_config)
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(hide) $< passwd --aid-header=$(PRIVATE_ANDROID_FS_HDR) $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@
|
$(hide) $< passwd --required-prefix=vendor_ --aid-header=$(PRIVATE_ANDROID_FS_HDR) $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@
|
||||||
|
|
||||||
##################################
|
##################################
|
||||||
# Generate the system/etc/group text file for the target
|
# Generate the vendor/etc/group text file for the target
|
||||||
# This file may be empty if no AIDs are defined in
|
# This file may be empty if no AIDs are defined in
|
||||||
# TARGET_FS_CONFIG_GEN files.
|
# TARGET_FS_CONFIG_GEN files.
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
@ -289,7 +289,7 @@ $(LOCAL_BUILT_MODULE): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN)
|
||||||
$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(system_android_filesystem_config)
|
$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(system_android_filesystem_config)
|
||||||
$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_GEN) $(system_android_filesystem_config)
|
$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_GEN) $(system_android_filesystem_config)
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(hide) $< group --aid-header=$(PRIVATE_ANDROID_FS_HDR) $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@
|
$(hide) $< group --required-prefix=vendor_ --aid-header=$(PRIVATE_ANDROID_FS_HDR) $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@
|
||||||
|
|
||||||
system_android_filesystem_config :=
|
system_android_filesystem_config :=
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -1235,12 +1235,19 @@ class PasswdGen(BaseGenerator):
|
||||||
help='An android_filesystem_config.h file'
|
help='An android_filesystem_config.h file'
|
||||||
'to parse AIDs and OEM Ranges from')
|
'to parse AIDs and OEM Ranges from')
|
||||||
|
|
||||||
|
opt_group.add_argument(
|
||||||
|
'--required-prefix',
|
||||||
|
required=False,
|
||||||
|
help='A prefix that the names are required to contain.')
|
||||||
|
|
||||||
def __call__(self, args):
|
def __call__(self, args):
|
||||||
|
|
||||||
hdr_parser = AIDHeaderParser(args['aid_header'])
|
hdr_parser = AIDHeaderParser(args['aid_header'])
|
||||||
|
|
||||||
parser = FSConfigFileParser(args['fsconfig'], hdr_parser.oem_ranges)
|
parser = FSConfigFileParser(args['fsconfig'], hdr_parser.oem_ranges)
|
||||||
|
|
||||||
|
required_prefix = args['required_prefix']
|
||||||
|
|
||||||
aids = parser.aids
|
aids = parser.aids
|
||||||
|
|
||||||
# nothing to do if no aids defined
|
# nothing to do if no aids defined
|
||||||
|
@ -1250,7 +1257,11 @@ class PasswdGen(BaseGenerator):
|
||||||
print PasswdGen._GENERATED
|
print PasswdGen._GENERATED
|
||||||
|
|
||||||
for aid in aids:
|
for aid in aids:
|
||||||
|
if required_prefix is None or aid.friendly.startswith(required_prefix):
|
||||||
self._print_formatted_line(aid)
|
self._print_formatted_line(aid)
|
||||||
|
else:
|
||||||
|
sys.exit("%s: AID '%s' must start with '%s'" %
|
||||||
|
(args['fsconfig'], aid.friendly, required_prefix))
|
||||||
|
|
||||||
def _print_formatted_line(self, aid):
|
def _print_formatted_line(self, aid):
|
||||||
"""Prints the aid to stdout in the passwd format. Internal use only.
|
"""Prints the aid to stdout in the passwd format. Internal use only.
|
||||||
|
|
Loading…
Reference in a new issue