semanage_migrate_store: add -r <root> option for migrating inside chroots
PATCH 1/1 semanage_migrate_store: add -r <root> option for migrating inside chroots
-r, --root
Set an alternative root for the migration (default: /)
Signed-off-by Petr Lautrbach <[email protected]>
---
In Fedora, we used this option in early phase of adopting 2.4 userspace to migrate SELinux modules in buildroots during build time. We don't use it anymore, but it might be useful for some other deployments.
libsemanage/utils/semanage_migrate_store | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
libsemanage/utils/semanage_migrate_store +8 -2
@@ -180,7 +180,7 @@ def rebuild_policy(): def oldroot_path(): - return "/etc/selinux" + return "%s/etc/selinux" % ROOT def oldstore_path(store): return "%s/%s/modules/active" % (oldroot_path(), store)
@@ -192,7 +192,7 @@ def disabledmodules_path(store): return "%s/disabled" % newmodules_path(store) def newroot_path(): - return PATH + return "%s%s" % (ROOT, PATH) def newstore_path(store): return "%s/%s/active" % (newroot_path(), store)
@@ -219,6 +219,8 @@ if __name__ == "__main__": help="Disable rebuilding policy after migration (default: no)") parser.add_option("-P", "--path", dest="path", help="Set path for the policy store (default: /var/lib/selinux)") + parser.add_option("-r", "--root", dest="root", + help="Set an alternative root for the migration (default: /)") (options, args) = parser.parse_args()
@@ -231,6 +233,10 @@ if __name__ == "__main__": if PATH is None: PATH = "/var/lib/selinux" + ROOT = options.root + if ROOT is None: + ROOT = "" + # List of paths that go in the active 'root' TOPPATHS = [ "commit_num",
Signature · 1 line
2.4.6
Stephen Smalley
AppliedQuoted 4 lines · Petr Lautrbach
-r, --root
Set an alternative root for the migration (default: /)Signed-off-by Petr Lautrbach <[email protected]>
Thanks, applied.
Quoted 52 lines
---
In Fedora, we used this option in early phase of adopting 2.4 userspace to migrate SELinux modules in buildroots during build time. We don't use it anymore, but it might be useful for some other deployments.
libsemanage/utils/semanage_migrate_store | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)libsemanage/utils/semanage_migrate_store +8
-2@@ -180,7 +180,7 @@ def rebuild_policy(): def oldroot_path(): - return "/etc/selinux" + return "%s/etc/selinux" % ROOT def oldstore_path(store): return "%s/%s/modules/active" % (oldroot_path(), store)@@ -192,7 +192,7 @@ def disabledmodules_path(store): return "%s/disabled" % newmodules_path(store) def newroot_path(): - return PATH + return "%s%s" % (ROOT, PATH) def newstore_path(store): return "%s/%s/active" % (newroot_path(), store)@@ -219,6 +219,8 @@ if __name__ == "__main__": help="Disable rebuilding policy after migration (default: no)") parser.add_option("-P", "--path", dest="path", help="Set path for the policy store (default: /var/lib/selinux)") + parser.add_option("-r", "--root", dest="root", + help="Set an alternative root for the migration (default: /)") (options, args) = parser.parse_args()@@ -231,6 +233,10 @@ if __name__ == "__main__": if PATH is None: PATH = "/var/lib/selinux" + ROOT = options.root + if ROOT is None: + ROOT = "" + # List of paths that go in the active 'root' TOPPATHS = [ "commit_num",