fix: user-handling logic
This commit is contained in:
parent
5c161f4481
commit
78dcb775a5
2 changed files with 9 additions and 8 deletions
|
|
@ -16,6 +16,7 @@ def update_cleanup() -> None:
|
|||
subprocess.run(
|
||||
["umount", "-l", "/var/cache/akshara/rootfs/var/cache/blendOS"],
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
)
|
||||
|
||||
subprocess.run(
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ def merge_passwd(new_rootfs) -> list:
|
|||
line.strip().split(":")[0]: line.strip() for line in f if line.strip()
|
||||
}
|
||||
|
||||
with open(f"{new_rootfs}/etc/passwd") as f:
|
||||
with open(f"{new_rootfs}/usr/etc/passwd") as f:
|
||||
new_rootfs_passwd_entries = {
|
||||
line.strip().split(":")[0]: line.strip() for line in f if line.strip()
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ def merge_passwd(new_rootfs) -> list:
|
|||
):
|
||||
new_passwd_entries.append(current_passwd_entries[user])
|
||||
|
||||
with open("/.new.etc/passwd", "w") as f:
|
||||
with open(f"{new_rootfs}/etc/passwd", "w") as f:
|
||||
for user in new_passwd_entries:
|
||||
f.write(user + "\n")
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ def merge_shadow(new_rootfs):
|
|||
line.strip().split(":")[0]: line.strip() for line in f if line.strip()
|
||||
}
|
||||
|
||||
with open(f"{new_rootfs}/etc/shadow") as f:
|
||||
with open(f"{new_rootfs}/usr/etc/shadow") as f:
|
||||
new_rootfs_shadow_entries = {
|
||||
line.strip().split(":")[0]: line.strip() for line in f if line.strip()
|
||||
}
|
||||
|
|
@ -79,7 +79,7 @@ def merge_shadow(new_rootfs):
|
|||
):
|
||||
new_shadow_entries.append(current_shadow_entries[user])
|
||||
|
||||
with open("/.new.etc/shadow", "w") as f:
|
||||
with open(f"{new_rootfs}/etc/shadow", "w") as f:
|
||||
for user in new_shadow_entries:
|
||||
f.write(user + "\n")
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ def merge_group(new_rootfs, new_passwd_entries):
|
|||
line.strip().split(":")[0]: line.strip() for line in f if line.strip()
|
||||
}
|
||||
|
||||
with open(f"{new_rootfs}/etc/group") as f:
|
||||
with open(f"{new_rootfs}/usr/etc/group") as f:
|
||||
new_rootfs_group_entries = {
|
||||
line.strip().split(":")[0]: line.strip() for line in f if line.strip()
|
||||
}
|
||||
|
|
@ -138,7 +138,7 @@ def merge_group(new_rootfs, new_passwd_entries):
|
|||
):
|
||||
new_group_entries.append(current_group_entries[group])
|
||||
|
||||
with open("/.new.etc/group", "w") as f:
|
||||
with open(f"{new_rootfs}/etc/group", "w") as f:
|
||||
for group in new_group_entries:
|
||||
f.write(group + "\n")
|
||||
|
||||
|
|
@ -165,7 +165,7 @@ def merge_gshadow(new_rootfs, new_passwd_entries):
|
|||
line.strip().split(":")[0]: line.strip() for line in f if line.strip()
|
||||
}
|
||||
|
||||
with open(f"{new_rootfs}/etc/gshadow") as f:
|
||||
with open(f"{new_rootfs}/usr/etc/gshadow") as f:
|
||||
new_rootfs_gshadow_entries = {
|
||||
line.strip().split(":")[0]: line.strip() for line in f if line.strip()
|
||||
}
|
||||
|
|
@ -204,6 +204,6 @@ def merge_gshadow(new_rootfs, new_passwd_entries):
|
|||
):
|
||||
new_gshadow_entries.append(current_gshadow_entries[group])
|
||||
|
||||
with open("/.new.etc/gshadow", "w") as f:
|
||||
with open(f"{new_rootfs}/etc/gshadow", "w") as f:
|
||||
for group in new_gshadow_entries:
|
||||
f.write(group + "\n")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue