diff --git a/utils/aa-mergeprof b/utils/aa-mergeprof index 0c36f0405..f606c3e78 100755 --- a/utils/aa-mergeprof +++ b/utils/aa-mergeprof @@ -101,36 +101,10 @@ def act(user_file, base_file, merging_profile): #Get rid of common/superfluous stuff mergeprofiles.clear_common() -# if not args.auto: - if 1 == 1: # workaround to avoid lots of whitespace changes - mergeprofiles.ask_merge_questions() - - q = aaui.PromptQuestion() - q.title = _('Changed Local Profiles') - q.explanation = _('The following local profiles were changed. Would you like to save them?') - q.functions = ['CMD_SAVE_CHANGES', 'CMD_VIEW_CHANGES', 'CMD_ABORT', 'CMD_IGNORE_ENTRY'] - q.default = 'CMD_VIEW_CHANGES' - q.options = [merging_profile] - q.selected = 0 - - ans = '' - arg = None - programs = list(mergeprofiles.user.aa.keys()) - program = programs[0] - while ans != 'CMD_SAVE_CHANGES': - ans, arg = q.promptUser() - if ans == 'CMD_SAVE_CHANGES': - apparmor.aa.write_profile_ui_feedback(program) - apparmor.aa.reload_base(program) - elif ans == 'CMD_VIEW_CHANGES': - for program in programs: - apparmor.aa.original_aa[program] = apparmor.aa.deepcopy(apparmor.aa.aa[program]) - #oldprofile = apparmor.serialize_profile(apparmor.original_aa[program], program, {}) - newprofile = apparmor.aa.serialize_profile(mergeprofiles.user.aa[program], program, {}) - aaui.UI_Changes(mergeprofiles.user.filename, newprofile, comments=True) - elif ans == 'CMD_IGNORE_ENTRY': - break + mergeprofiles.ask_merge_questions() + apparmor.aa.changed[merging_profile] = True # force asking to save the profile + apparmor.aa.save_profiles(True) class Merge(object): def __init__(self, user, base): diff --git a/utils/apparmor/aa.py b/utils/apparmor/aa.py index 4df14f80d..46520cd6b 100644 --- a/utils/apparmor/aa.py +++ b/utils/apparmor/aa.py @@ -1501,7 +1501,7 @@ def do_logprof_pass(logmark=''): save_profiles() -def save_profiles(): +def save_profiles(is_mergeprof=False): # Ensure the changed profiles are actual active profiles for prof_name in changed.keys(): if not aa.get(prof_name, False): @@ -1516,6 +1516,8 @@ def save_profiles(): q.title = 'Changed Local Profiles' q.explanation = _('The following local profiles were changed. Would you like to save them?') q.functions = ['CMD_SAVE_CHANGES', 'CMD_SAVE_SELECTED', 'CMD_VIEW_CHANGES', 'CMD_VIEW_CHANGES_CLEAN', 'CMD_ABORT'] + if is_mergeprof: + q.functions = ['CMD_SAVE_CHANGES', 'CMD_VIEW_CHANGES', 'CMD_ABORT', 'CMD_IGNORE_ENTRY'] q.default = 'CMD_VIEW_CHANGES' q.selected = 0 ans = '' @@ -1555,6 +1557,9 @@ def save_profiles(): aaui.UI_Changes(oldprofile, newprofile) + elif ans == 'CMD_IGNORE_ENTRY': + changed.pop(options[arg]) + for profile_name in sorted(changed.keys()): write_profile_ui_feedback(profile_name) reload_base(profile_name)