(self)
Set runc executable and related variables
Set runc executable and related variables
Set runc executable and related variables
def select_runc(self):
        """Set runc executable and related variables"""
        self.executable = Config.conf['use_runc_executable']
        if self.executable != "UDOCKER" and not self.executable:
            self.executable = FileUtil("runc").find_exec()

        if self.executable != "UDOCKER" and not self.executable:
            self.executable = FileUtil("crun").find_exec()

        if self.executable == "UDOCKER" or not self.executable:
            self.executable = ""
            arch = HostInfo().arch()
            image_list = []
            eng = ["runc", "crun"]
            if "cgroup2" in FileUtil("/proc/filesystems").getdata('r'):
                eng = ["crun", "runc"]

            if arch == "amd64":
                image_list = [eng[0]+"-x86_64", eng[0],
                              eng[1]+"-x86_64", eng[1]]
            elif arch == "i386":
                image_list = [eng[0]+"-x86", eng[0], eng[1]+"-x86", eng[1]]
            elif arch == "arm64":
                image_list = [eng[0]+"-arm64", eng[0], eng[1]+"-arm64", eng[1]]
            elif arch == "arm":
                image_list = [eng[0]+"-arm", eng[0], eng[1]+"-arm", eng[1]]

            f_util = FileUtil(self.localrepo.bindir)
            self.executable = f_util.find_file_in_dir(image_list)

        if not os.path.exists(self.executable):
            Msg().err("Error: runc/crun executable not found")
            sys.exit(1)
        if "crun" in os.path.basename(self.executable):
            self.engine_type = "crun"
        elif "runc" in os.path.basename(self.executable):
            self.engine_type = "runc"
def select_runc ( self ) : self . executable = Config . conf [ 'use_runc_executable' ] if self . executable != "UDOCKER" and not self . executable : self . executable = FileUtil ( "runc" ) . find_exec ( ) if self . executable != "UDOCKER" and not self . executable : self . executable = FileUtil ( "crun" ) . find_exec ( ) if self . executable == "UDOCKER" or not self . executable : self . executable = "" arch = HostInfo ( ) . arch ( ) image_list = [ ] eng = [ "runc" , "crun" ] if "cgroup2" in FileUtil ( "/proc/filesystems" ) . getdata ( 'r' ) : eng = [ "crun" , "runc" ] if arch == "amd64" : image_list = [ eng [ 0 ] + "-x86_64" , eng [ 0 ] , eng [ 1 ] + "-x86_64" , eng [ 1 ] ] elif arch == "i386" : image_list = [ eng [ 0 ] + "-x86" , eng [ 0 ] , eng [ 1 ] + "-x86" , eng [ 1 ] ] elif arch == "arm64" : image_list = [ eng [ 0 ] + "-arm64" , eng [ 0 ] , eng [ 1 ] + "-arm64" , eng [ 1 ] ] elif arch == "arm" : image_list = [ eng [ 0 ] + "-arm" , eng [ 0 ] , eng [ 1 ] + "-arm" , eng [ 1 ] ] f_util = FileUtil ( self . localrepo . bindir ) self . executable = f_util . find_file_in_dir ( image_list ) if not os . path . exists ( self . executable ) : Msg ( ) . err ( "Error: runc/crun executable not found" ) sys . exit ( 1 ) if "crun" in os . path . basename ( self . executable ) : self . engine_type = "crun" elif "runc" in os . path . basename ( self . executable ) : self . engine_type = "runc"