Beispiel #1
0
 def _install_server(self):
     """Install server binaries."""
     logger.info("Installing server binaries")
     src = path_join(self.dest, "root.server", AFS_SRV_BIN_DIR)
     copy_files(src, AFS_SRV_BIN_DIR, force=self.force)
     self._install_shared_libs(path_join(self.dest, 'lib'), AFS_SRV_LIB_DIR)
     self._install_workstation_binaries() # rxdebug is in the ws directory.
     self._install_server_rc()
     self.installed['server'] = True
     logger.info("Servers installed.")
Beispiel #2
0
 def _install_workstation_binaries(self):
     """Install workstation binaries from a Transarc-style distribution."""
     if self.installed['ws']:
         logger.debug("Skipping workstation files install; already done.")
     else:
         for d in ('bin', 'etc', 'include', 'man'):
             src = path_join(self.dest, d)
             dst = path_join(AFS_WS_DIR, d)
             copy_files(src, dst, force=self.force)
         self.installed['ws'] = True
     src = path_join(self.dest, 'lib')
     dst = path_join(AFS_WS_DIR, 'lib')
     self._install_shared_libs(src, dst)
Beispiel #3
0
    def _install_server_rc(self):
        """Install a server init script.

        The Transarc-style distributions provide a single init script which
        optionally starts the bosserver. This is an historical relic left over
        from the pre-namei fileserver days. Instead, install a simple, separate
        init script to start and stop the bosserver.

        Does not configure the system to run the init script automatically on
        reboot.
        """
        text = afsutil.resources['openafs-server.init']
        dst = "/etc/init.d/openafs-server"
        if os.path.exists(dst) and not self.force:
            raise AssertionError("Refusing to overwrite '%s'.", dst)
        with open(dst, 'w') as f:
            f.write(text)
        os.chmod(dst, 0755)
        mkdirp("/var/lock/subsys/")  # needed by the init script
        # Set the bosserver command line options.
        dst = path_join(SYSCONFIG, "openafs-server")
        logger.info("Writing bosserver startup options to file '%s'." % (dst))
        mkdirp(os.path.dirname(dst))
        with open(dst, 'w') as f:
            f.write('BOSSERVER_OPTIONS="%s"\n' % (self.options.get('bosserver', '')))
Beispiel #4
0
 def _install_openafs_ko(self, kmod):
     """Install the openafs.ko file and run depmod."""
     release = os.uname()[2]
     src = kmod
     dst = path_join("/lib/modules", release, "extra/openafs/openafs.ko")
     logger.info("Installing kernel module from '%s' to '%s'.", src, dst)
     mkdirp(os.path.dirname(dst))
     shutil.copy2(src, dst)
     sh('/sbin/depmod', '-a')
Beispiel #5
0
 def install_kmod(self, kmod):
     """Install the kernel module by filename."""
     if os.path.basename(kmod) == 'openafs.ko':
         self._install_openafs_ko(kmod)
     elif os.path.basename(kmod).startswith('libafs'):
         src = kmod
         dst = path_join(AFS_KERNEL_DIR, 'modload')
         logger.info("Installing kernel module from '%s' to '%s'.", src, dst)
         shutil.copy2(src, dst)
     else:
         raise ValueError("Unknown kernel module name: %s" % (kmod))
Beispiel #6
0
 def _install_client(self):
     """Install client binaries."""
     logger.info("Installing client binaries")
     src = path_join(self.dest, "root.client", AFS_KERNEL_DIR)
     copy_files(src, AFS_KERNEL_DIR, force=self.force) # also installs libafs.ko
     self._install_workstation_binaries() # including libs, unless already installed
     self.client_setup.install_driver(self.dest)
     self.client_setup.install_init_script(self.dest, self.options.get('afsd', ''))
     mkdirp(AFS_MOUNT_DIR)
     mkdirp(AFS_CACHE_DIR)
     self.installed['client'] = True
     logger.info("Client installed.")
Beispiel #7
0
 def install_driver(self, dest, force=False):
     #
     # If available, install the openafs.ko to a path loadable by modprobe.
     # Use the openafs configure option --with-linux-kernel-packaging to build
     # openafs.ko instead of libafs${version}.ko
     #
     # Note: libafs${version}.ko was already installed by copying all the files from
     #       dest/root.client/usr/vice/etc to /usr/vice/etc.
     #
     release = os.uname()[2]
     kmod = path_join(dest, "root.client", "lib/modules", release, "extra/openafs/openafs.ko")
     if os.path.exists(kmod):
         self._install_openafs_ko(kmod)
Beispiel #8
0
    def install_init_script(self, dest, afsd_options):
        """Install a client init script on linux.

        Does not configure the system to run the init script automatically on
        reboot.
        """
        # Install the init script.
        mkdirp("/var/lock/subsys/")
        text = afsutil.resources['openafs-client-linux.init']
        dst = "/etc/init.d/openafs-client"
        logger.info("Installing client init script from to '%s'.", dst)
        with open(dst, 'w') as f:
            f.write(text)
        os.chmod(dst, 0755)
        # Set afsd options.
        dst = path_join(SYSCONFIG, "openafs-client")
        logger.info("Writing afsd startup options to file '%s'." % (dst))
        mkdirp(os.path.dirname(dst))
        with open(dst, 'w') as f:
            f.write('AFSD_OPTIONS="%s"\n' % (afsd_options))
Beispiel #9
0
    def install_init_script(self, dest, afsd_options):
        """Install a client init script on solaris.

        Does not configure the system to run the init script automatically on
        reboot.  Changes the init script to avoid starting the bosserver
        by default."""
        osrel = os.uname()[2]
        text = afsutil.resources['openafs-client-solaris-%s.init' % (osrel)]
        dst = "/etc/init.d/openafs-client"
        logger.info("Installing client init script to '%s'.", dst)
        with open(dst, 'w') as f:
            f.write(text)
        os.chmod(dst, 0755)
        # Set afsd options.
        config = '/usr/vice/etc/config'
        dst = path_join(config, 'afsd.options')
        logger.info("Writing afsd startup options to file '%s'." % (dst))
        mkdirp(os.path.dirname(dst))
        with open(dst, 'w') as f:
            f.write(afsd_options) # Not sourced.
Beispiel #10
0
 def _check_dest(self, dest):
     """Verify the dest directory looks sane."""
     directory_should_exist(dest)
     directory_should_exist(path_join(dest, 'root.server'))
     directory_should_exist(path_join(dest, 'root.client'))
     directory_should_exist(path_join(dest, 'lib'))
Beispiel #11
0
 def install_driver(self, dest):
     afs = "libafs64.o"
     kmod = path_join(dest, "root.client", AFS_KERNEL_DIR, "modload", afs)
     self.install_kmod(kmod)
Beispiel #12
0
 def remove_driver(self):
     release = os.uname()[2]
     src = path_join("/lib/modules", release, "extra/openafs/openafs.ko")
     if os.path.exists(src):
         remove_file(src)