fix: syntax errors in all backends, wrong import path, entry point
- fix f-string escape bug in all 5 backends (user password handling) - fix void.py import: from ..dinit (not .dinit — dinit.py is at package root) - fix pyproject.toml entry point: cli:cli not cli:main - add .gitignore for __pycache__
This commit is contained in:
@@ -47,7 +47,8 @@ class Alpine(Distro):
|
||||
shell = user.get("shell", "/bin/bash")
|
||||
self._run_chroot(rootfs, ["adduser", "-D", "-s", shell, name])
|
||||
if "password" in user:
|
||||
self._run_chroot(rootfs, ["bash", "-c", f"echo '{name}:{user[\"password\"]}' | chpasswd"])
|
||||
pw = user["password"]
|
||||
self._run_chroot(rootfs, ["bash", "-c", f"echo '{name}:{pw}' | chpasswd"])
|
||||
for group in user.get("groups", []):
|
||||
self._run_chroot(rootfs, ["adduser", name, group])
|
||||
|
||||
|
||||
@@ -50,7 +50,8 @@ class Arch(Distro):
|
||||
shell = user.get("shell", "/bin/bash")
|
||||
self._run_chroot(rootfs, ["useradd", "-m", "-s", shell, name])
|
||||
if "password" in user:
|
||||
self._run_chroot(rootfs, ["bash", "-c", f"echo '{name}:{user[\"password\"]}' | chpasswd"])
|
||||
pw = user["password"]
|
||||
self._run_chroot(rootfs, ["bash", "-c", f"echo '{name}:{pw}' | chpasswd"])
|
||||
for group in user.get("groups", []):
|
||||
self._run_chroot(rootfs, ["usermod", "-aG", group, name])
|
||||
|
||||
|
||||
@@ -53,7 +53,8 @@ class Debian(Distro):
|
||||
shell = user.get("shell", "/bin/bash")
|
||||
self._run_chroot(rootfs, ["useradd", "-m", "-s", shell, name])
|
||||
if "password" in user:
|
||||
self._run_chroot(rootfs, ["bash", "-c", f"echo '{name}:{user[\"password\"]}' | chpasswd"])
|
||||
pw = user["password"]
|
||||
self._run_chroot(rootfs, ["bash", "-c", f"echo '{name}:{pw}' | chpasswd"])
|
||||
for group in user.get("groups", []):
|
||||
self._run_chroot(rootfs, ["usermod", "-aG", group, name])
|
||||
|
||||
|
||||
@@ -49,7 +49,8 @@ class Fedora(Distro):
|
||||
shell = user.get("shell", "/bin/bash")
|
||||
self._run_chroot(rootfs, ["useradd", "-m", "-s", shell, name])
|
||||
if "password" in user:
|
||||
self._run_chroot(rootfs, ["bash", "-c", f"echo '{name}:{user[\"password\"]}' | chpasswd"])
|
||||
pw = user["password"]
|
||||
self._run_chroot(rootfs, ["bash", "-c", f"echo '{name}:{pw}' | chpasswd"])
|
||||
for group in user.get("groups", []):
|
||||
self._run_chroot(rootfs, ["usermod", "-aG", group, name])
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
from pathlib import Path
|
||||
|
||||
from .base import Distro
|
||||
from .dinit import install_all
|
||||
from ..dinit import install_all
|
||||
|
||||
|
||||
class Void(Distro):
|
||||
@@ -53,7 +53,8 @@ class Void(Distro):
|
||||
shell = user.get("shell", "/bin/bash")
|
||||
self._run_chroot(rootfs, ["useradd", "-m", "-s", shell, name])
|
||||
if "password" in user:
|
||||
self._run_chroot(rootfs, ["bash", "-c", f"echo '{name}:{user[\"password\"]}' | chpasswd"])
|
||||
pw = user["password"]
|
||||
self._run_chroot(rootfs, ["bash", "-c", f"echo '{name}:{pw}' | chpasswd"])
|
||||
for group in user.get("groups", []):
|
||||
self._run_chroot(rootfs, ["usermod", "-aG", group, name])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user