(self, cmdp)
return self.STATUS_OK
setup: change container execution settings
        setup [options] <container-id>
        --execmode=<mode>       :select execution mode from below
        --force                 :force setup change
        --purge                 :clean mountpoints and files created by udocker
        --fixperm               :attempt to fix file permissions
        --nvidia                :add NVIDIA libraries and binaries
                                 (nvidia support is EXPERIMENTAL)

        <mode> is one of the following execution modes:
        P1: proot accelerated mode using seccomp filtering (default)
        P2: proot accelerated mode disabled
        F1: fakechroot starting executables via direct loader invocation
        F2: like F1 plus protected environment and modified ld.so
        F3: fakechroot plus patching of elf headers in binaries and libs
        F4: like F3 plus support for newly created executables via
            dynamic patching of elf headers in binaries and libs
        R1: runc using rootless namespaces, requires recent kernel
            with user namespace support enabled
        R2: proot with root emulation running on top of runc to avoid
            most of the errors related to change of uid or gid
        R3: same as R2 but with proot accelerated mode disabled
        S1: singularity, requires a local installation of singularity,
            if singularity is available in the PATH udocker will use
            it to execute the container
setup: change container execution settings
        setup [options] <container-id>
        --execmode=<mode>       :select execution mode from below
        --force                 :force setup change
        --purge                 :clean mountpoints and files created by udocker
        --fixperm               :attempt to fix file permissions
        --nvidia                :add NVIDIA libraries and binaries
                                 (nvidia support is EXPERIMENTAL)
setup : change container execution settings setup [ options ] <container - id > -- execmode = <mode > : select execution mode from below -- force : force setup change -- purge : clean mountpoints and files created by udocker -- fixperm : attempt to fix file permissions -- nvidia : add NVIDIA libraries and binaries ( nvidia support is EXPERIMENTAL )
def do_setup(self, cmdp):
        """
        setup: change container execution settings
        setup [options] <container-id>
        --execmode=<mode>       :select execution mode from below
        --force                 :force setup change
        --purge                 :clean mountpoints and files created by udocker
        --fixperm               :attempt to fix file permissions
        --nvidia                :add NVIDIA libraries and binaries
                                 (nvidia support is EXPERIMENTAL)

        <mode> is one of the following execution modes:
        P1: proot accelerated mode using seccomp filtering (default)
        P2: proot accelerated mode disabled
        F1: fakechroot starting executables via direct loader invocation
        F2: like F1 plus protected environment and modified ld.so
        F3: fakechroot plus patching of elf headers in binaries and libs
        F4: like F3 plus support for newly created executables via
            dynamic patching of elf headers in binaries and libs
        R1: runc using rootless namespaces, requires recent kernel
            with user namespace support enabled
        R2: proot with root emulation running on top of runc to avoid
            most of the errors related to change of uid or gid
        R3: same as R2 but with proot accelerated mode disabled
        S1: singularity, requires a local installation of singularity,
            if singularity is available in the PATH udocker will use
            it to execute the container
        """
        container_id = cmdp.get("P1")
        xmode = cmdp.get("--execmode=")
        force = cmdp.get("--force")
        nvidia = cmdp.get("--nvidia")
        purge = cmdp.get("--purge")
        fixperm = cmdp.get("--fixperm")
        if cmdp.missing_options():               # syntax error
            return self.STATUS_ERROR

        container_dir = self.localrepo.cd_container(container_id)
        if not container_dir:
            Msg().err("Error: invalid container id")
            return self.STATUS_ERROR

        if xmode and self.localrepo.isprotected_container(container_id):
            Msg().err("Error: container is protected")
            return self.STATUS_ERROR

        if purge:
            FileBind(self.localrepo, container_id).restore(force)
            MountPoint(self.localrepo, container_id).restore()

        if fixperm:
            Unshare().namespace_exec(lambda: FileUtil(container_dir +
                                                      "/ROOT").rchown())
            FileUtil(container_dir + "/ROOT").rchmod()

        nvidia_mode = NvidiaMode(self.localrepo, container_id)
        if nvidia:
            nvidia_mode.set_mode(force)

        exec_mode = ExecutionMode(self.localrepo, container_id)
        if xmode:
            if exec_mode.set_mode(xmode.upper(), force):
                return self.STATUS_OK
            return self.STATUS_ERROR

        if xmode or not (xmode or force or nvidia or purge or fixperm):
            Msg().out("execmode: %s" % (exec_mode.get_mode()))
            Msg().out("nvidiamode: %s" % (nvidia_mode.get_mode()))

        return self.STATUS_OK
def do_setup ( self , cmdp ) : container_id = cmdp . get ( "P1" ) xmode = cmdp . get ( "--execmode=" ) force = cmdp . get ( "--force" ) nvidia = cmdp . get ( "--nvidia" ) purge = cmdp . get ( "--purge" ) fixperm = cmdp . get ( "--fixperm" ) if cmdp . missing_options ( ) : # syntax error return self . STATUS_ERROR container_dir = self . localrepo . cd_container ( container_id ) if not container_dir : Msg ( ) . err ( "Error: invalid container id" ) return self . STATUS_ERROR if xmode and self . localrepo . isprotected_container ( container_id ) : Msg ( ) . err ( "Error: container is protected" ) return self . STATUS_ERROR if purge : FileBind ( self . localrepo , container_id ) . restore ( force ) MountPoint ( self . localrepo , container_id ) . restore ( ) if fixperm : Unshare ( ) . namespace_exec ( lambda : FileUtil ( container_dir + "/ROOT" ) . rchown ( ) ) FileUtil ( container_dir + "/ROOT" ) . rchmod ( ) nvidia_mode = NvidiaMode ( self . localrepo , container_id ) if nvidia : nvidia_mode . set_mode ( force ) exec_mode = ExecutionMode ( self . localrepo , container_id ) if xmode : if exec_mode . set_mode ( xmode . upper ( ) , force ) : return self . STATUS_OK return self . STATUS_ERROR if xmode or not ( xmode or force or nvidia or purge or fixperm ) : Msg ( ) . out ( "execmode: %s" % ( exec_mode . get_mode ( ) ) ) Msg ( ) . out ( "nvidiamode: %s" % ( nvidia_mode . get_mode ( ) ) ) return self . STATUS_OK