diff --git a/installer/ogboot_installer.py b/installer/ogboot_installer.py index b864dc6..f1f63c8 100755 --- a/installer/ogboot_installer.py +++ b/installer/ogboot_installer.py @@ -214,6 +214,22 @@ def autoConfigure(): logger.info(f"OSVERSION: {OSVERSION}") # Configuración según la distribución OSDISTRIB +def add_sudoers_permissions(): + sudoers_entry = """ +ogboot ALL=(ALL) NOPASSWD: /opt/bin/oglivecli +ogboot ALL=(root) NOPASSWD: /usr/bin/mount, /usr/bin/umount, /usr/bin/cp, /usr/bin/chmod, /usr/bin/chown, /usr/bin/md5sum, /usr/bin/smbpasswd, /usr/bin/cat, /usr/bin/tee, /usr/bin/sed, /usr/bin/gzip, /usr/bin/lz4, /usr/bin/cpio, /usr/bin/find, /bin/tee, /usr/bin/dd, /usr/bin/mkfs.ext4, /usr/bin/rsync +ogboot ALL=(root) NOPASSWD: /opt/ogboot/lib/*.iso /mnt + """ + + sudoers_file = '/etc/sudoers.d/ogboot' + + try: + with open(sudoers_file, 'w') as file: + file.write(sudoers_entry) + print("Sudoers permissions for 'ogboot' added successfully.") + except IOError as e: + print(f"Failed to write to {sudoers_file}: {e}") + def downloadComposer(): global WORKDIR, INSTALL_OGBOOT_TARGET logger.info("Downloading composer.phar...") @@ -981,6 +997,7 @@ else: logger.info(f"ogBoot directory not found, create a symbolic link to the directory where the code is located {WORKDIR} To {os.path.dirname(PROGRAM_DIR)}") os.symlink(os.path.dirname(PROGRAM_DIR), f"{WORKDIR}/ogboot") +add_sudoers_permissions() logger.info("Creating ogBoot project.") og_core_create_user("ogboot")