parent
c1b1b75295
commit
f181aff783
|
@ -1,5 +1,10 @@
|
||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
## [0.5.10] - 06/02/2025
|
||||||
|
|
||||||
|
### **Cambios principales**
|
||||||
|
1. Cambia el home del usuario opengnsys como `/opt/opengnsys`
|
||||||
|
|
||||||
## [0.5.9] - 03/02/2025
|
## [0.5.9] - 03/02/2025
|
||||||
|
|
||||||
### **Cambios principales**
|
### **Cambios principales**
|
||||||
|
|
|
@ -207,13 +207,28 @@ opengnsys ALL=(root) NOPASSWD: __OGBOOT_TARGET__/lib/*.iso /mnt
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
print(f"Failed to write to {sudoers_file}: {e}")
|
print(f"Failed to write to {sudoers_file}: {e}")
|
||||||
|
|
||||||
|
|
||||||
def og_core_create_user(u):
|
def og_core_create_user(u):
|
||||||
try:
|
try:
|
||||||
pwd.getpwnam(u)
|
user_info = pwd.getpwnam(u)
|
||||||
logger.warning(f"User {u} already exists")
|
current_home = user_info.pw_dir
|
||||||
|
logger.info(f"User {u} already exists with home {current_home}")
|
||||||
|
|
||||||
|
if u == "opengnsys" and current_home != "/opt/opengnsys":
|
||||||
|
logger.info(f"Updating home directory for user {u} to /opt/opengnsys")
|
||||||
|
|
||||||
|
subprocess.run(["usermod", "-d", "/opt/opengnsys", "-m", u], check=True)
|
||||||
|
logger.info(f"User {u} home changed successfully to /opt/opengnsys")
|
||||||
|
else:
|
||||||
|
logger.info(f"User {u} already has the correct home directory.")
|
||||||
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
subprocess.run(["useradd", "--create-home", u, "--shell", "/bin/bash"])
|
# El usuario no existe, crearlo con el home correcto, si es opengnsys le ponemos su home_dir como opt/opengnsys
|
||||||
logger.info(f"User {u} created successfully.")
|
# Si no es opengnsys le creamos el home en /home/<usuario>
|
||||||
|
home_dir = "/opt/opengnsys" if u == "opengnsys" else f"/home/{u}"
|
||||||
|
logger.info(f"Creating user {u} with home {home_dir}")
|
||||||
|
subprocess.run(["useradd", "--create-home", "-d", home_dir, "--shell", "/bin/bash", u], check=True)
|
||||||
|
logger.info(f"User {u} created successfully with home {home_dir}")
|
||||||
|
|
||||||
def og_boot_create_dirs():
|
def og_boot_create_dirs():
|
||||||
if os.path.exists(INSTALL_OGBOOT_TARGET):
|
if os.path.exists(INSTALL_OGBOOT_TARGET):
|
||||||
|
|
Loading…
Reference in New Issue