mirror of
https://github.com/SELinuxProject/selinux
synced 2025-03-01 07:50:38 +00:00
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 <plautrba@redhat.com>
This commit is contained in:
parent
1874317293
commit
3c3006f791
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user