diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1b5ea51 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +__pycache__/ +*.pyc +*.egg-info/ +dist/ +build/ diff --git a/euri_mklive/distros/alpine.py b/euri_mklive/distros/alpine.py index 8ef7c1a..577f675 100644 --- a/euri_mklive/distros/alpine.py +++ b/euri_mklive/distros/alpine.py @@ -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]) diff --git a/euri_mklive/distros/arch.py b/euri_mklive/distros/arch.py index d0df1ca..28c1d21 100644 --- a/euri_mklive/distros/arch.py +++ b/euri_mklive/distros/arch.py @@ -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]) diff --git a/euri_mklive/distros/debian.py b/euri_mklive/distros/debian.py index e0a00e0..ab3bd8d 100644 --- a/euri_mklive/distros/debian.py +++ b/euri_mklive/distros/debian.py @@ -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]) diff --git a/euri_mklive/distros/fedora.py b/euri_mklive/distros/fedora.py index 4f395c5..98cde34 100644 --- a/euri_mklive/distros/fedora.py +++ b/euri_mklive/distros/fedora.py @@ -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]) diff --git a/euri_mklive/distros/void.py b/euri_mklive/distros/void.py index 16e2c29..0a258c5 100644 --- a/euri_mklive/distros/void.py +++ b/euri_mklive/distros/void.py @@ -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]) diff --git a/pyproject.toml b/pyproject.toml index 476a1de..59ae6c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ requires-python = ">=3.10" dependencies = ["pyyaml>=6", "click>=8"] [project.scripts] -euri-mklive = "euri_mklive.cli:main" +euri-mklive = "euri_mklive.cli:cli" [tool.setuptools.packages.find] include = ["euri_mklive*"]