Ejemplo n.º 1
0
    def steamcmd(self):
        steamcmd_dir = os.path.expanduser(self.config.get('dir', 'steamcmd'))
        steamcmd_dir_fs = FSCheck(steamcmd_dir, 'SteamCMD dir')

        #check if steamcmd dir exists
        if steamcmd_dir_fs.exists(error=False):
            print(
                '% exists. Remove it or change SteamCMD location in settings' %
                steamcmd_dir)
            exit(21)

        os.makedirs(steamcmd_dir)

        steamcmd_dir_fs.access('w')  #check for write access in dir

        print('Downloading SteamCMD archive')
        urlretrieve(self.steamcmd_url, steamcmd_dir + self.steamcmd_archive)

        print('Extracting SteamCMD atchive to %s' % steamcmd_dir)
        archive = tarfile.open(steamcmd_dir + self.steamcmd_archive)
        archive.extractall(steamcmd_dir)

        steamcmd_stat = os.stat(steamcmd_dir + '/steamcmd.sh')
        os.chmod(
            steamcmd_dir + '/steamcmd.sh',
            steamcmd_stat.st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)

        print('SteamCMD installed in %s' % steamcmd_dir)
        print('Remember that you need "lib32stdc++6" installed in your system')
Ejemplo n.º 2
0
    def __init__(self):
        self.config = Configuration()
        self.extra_required = ['net_port']

        self.servers = {}
        self.parameters = {}
        self.defaults = {}
        self.extra = {}
        self.loop = {}

        self._configure()

        self.filepath = os.path.expanduser(self.config.get('config', 'servers'))
        self.filename = os.path.basename(self.filepath)

        servers_file_dir = os.path.dirname(self.filepath)
        servers_file_dir_fs = FSCheck(servers_file_dir)

        if not servers_file_dir_fs.exists(error=False):
            os.makedirs(servers_file_dir)

        servers_file_fs = FSCheck(self.filepath)
        if not servers_file_fs.exists(error=False):
            open(self.servers_file, 'a').close()

        if not servers_file_fs.access('r'):
            print('Cannot open server list configuration for reading')
            exit(33)

        super(ServerConfig, self).__init__()
Ejemplo n.º 3
0
    def steamcmd(self):
        steamcmd_dir = os.path.expanduser(self.config.get('dir', 'steamcmd'))
        steamcmd_dir_fs = FSCheck(steamcmd_dir, 'SteamCMD dir')

        #check if steamcmd dir exists
        if steamcmd_dir_fs.exists(error=False):
            print('% exists. Remove it or change SteamCMD location in settings' % steamcmd_dir)
            exit(21)

        os.makedirs(steamcmd_dir)

        steamcmd_dir_fs.access('w') #check for write access in dir

        print('Downloading SteamCMD archive')
        urlretrieve(self.steamcmd_url, steamcmd_dir + self.steamcmd_archive)

        print('Extracting SteamCMD atchive to %s' % steamcmd_dir)
        archive = tarfile.open(steamcmd_dir + self.steamcmd_archive)
        archive.extractall(steamcmd_dir)

        steamcmd_stat = os.stat(steamcmd_dir + '/steamcmd.sh')
        os.chmod(steamcmd_dir + '/steamcmd.sh', steamcmd_stat.st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)

        print('SteamCMD installed in %s' % steamcmd_dir)
        print('Remember that you need "lib32stdc++6" installed in your system')
Ejemplo n.º 4
0
    def start(self):
        supervisor_executable = self.__config.get('supervisor', 'supervisor')
        supervisor_executable_fs = FSCheck(supervisor_executable)

        supervisor_executable_fs.exists()
        supervisor_executable_fs.access('x')

        return call([supervisor_executable, '-c', self.__config_file])
Ejemplo n.º 5
0
    def __steam_exists(self):
        steamcmd = os.path.expanduser(self.config.get('dir', 'steamcmd') + '/steamcmd.sh')

        steamcmd_fs = FSCheck(steamcmd, 'SteamCMD')

        steamcmd_fs.exists()
        steamcmd_fs.access('x')

        return steamcmd
Ejemplo n.º 6
0
    def ctl(self, args: list):
        args = list(args)

        ctl_executable = self.__config.get('supervisor', 'supervisorctl')
        ctl_executable_fs = FSCheck(ctl_executable)

        ctl_executable_fs.exists()
        ctl_executable_fs.access('x')

        call_args = [ctl_executable, '-c', self.__config_file] + args

        return call(call_args)
Ejemplo n.º 7
0
    def __init__(self):
        self.config = Configuration()
        self.extra_required = ['net_port']

        self.servers = {}
        self.parameters = {}
        self.defaults = {}
        self.extra = {}
        self.loop = {}

        self._configure()

        self.filepath = os.path.expanduser(self.config.get(
            'config', 'servers'))
        self.filename = os.path.basename(self.filepath)

        servers_file_dir = os.path.dirname(self.filepath)
        servers_file_dir_fs = FSCheck(servers_file_dir)

        if not servers_file_dir_fs.exists(error=False):
            os.makedirs(servers_file_dir)

        servers_file_fs = FSCheck(self.filepath)
        if not servers_file_fs.exists(error=False):
            open(self.servers_file, 'a').close()

        if not servers_file_fs.access('r'):
            print('Cannot open server list configuration for reading')
            exit(33)

        super(ServerConfig, self).__init__()
Ejemplo n.º 8
0
    def start(self):
        supervisor_executable = self.__config.get('supervisor', 'supervisor')
        supervisor_executable_fs = FSCheck(supervisor_executable)

        supervisor_executable_fs.exists()
        supervisor_executable_fs.access('x')

        return call([supervisor_executable, '-c', self.__config_file])
Ejemplo n.º 9
0
    def __steam_exists(self):
        steamcmd = os.path.expanduser(
            self.config.get('dir', 'steamcmd') + '/steamcmd.sh')

        steamcmd_fs = FSCheck(steamcmd, 'SteamCMD')

        steamcmd_fs.exists()
        steamcmd_fs.access('x')

        return steamcmd
Ejemplo n.º 10
0
    def ctl(self, args: list):
        args = list(args)

        ctl_executable = self.__config.get('supervisor', 'supervisorctl')
        ctl_executable_fs = FSCheck(ctl_executable)

        ctl_executable_fs.exists()
        ctl_executable_fs.access('x')

        call_args = [ctl_executable, '-c', self.__config_file] + args

        return call(call_args)
Ejemplo n.º 11
0
    except ImportError:
        return False
    else:
        return True

commands = [
    default.ManagerBaseController,
    version.VersionController,
    configure.ConfigureController,
    download.DownloadController,
    #download.DownloadWorkshopController,
]

config = Configuration()

supervisor_fs = FSCheck(config.get('supervisor', 'supervisor'))
supervisorctl_fs = FSCheck(config.get('supervisor', 'supervisorctl'))

if (
        supervisor_fs.exists(error=False) and supervisor_fs.access('x', error=False) and
        supervisorctl_fs.exists(error=False) and supervisorctl_fs.access('x', error=False)
   ):
    from qldsmanager.command import server
    from qldsmanager.command import supervisor

    commands.append(server.ServerController)
    commands.append(supervisor.SupervisorController)


if module_exists('zmq'):
    from qldsmanager.command import rcon
Ejemplo n.º 12
0
        return False
    else:
        return True


commands = [
    default.ManagerBaseController,
    version.VersionController,
    configure.ConfigureController,
    download.DownloadController,
    #download.DownloadWorkshopController,
]

config = Configuration()

supervisor_fs = FSCheck(config.get('supervisor', 'supervisor'))
supervisorctl_fs = FSCheck(config.get('supervisor', 'supervisorctl'))

if (supervisor_fs.exists(error=False)
        and supervisor_fs.access('x', error=False)
        and supervisorctl_fs.exists(error=False)
        and supervisorctl_fs.access('x', error=False)):
    from qldsmanager.command import server
    from qldsmanager.command import supervisor

    commands.append(server.ServerController)
    commands.append(supervisor.SupervisorController)

if module_exists('zmq'):
    from qldsmanager.command import rcon
    commands.append(rcon.RconController)