271. SystemFilesCopy

Functionality for copying files from another systems

271.1. Authors

  • Lukas Ocilka <locilka@suse.cz>

271.2. Summary of Module Globals

List of Global Functions

  • CopyFilesToSystem - Proceeds the copying of all files in inst-sys (that were copied from another partition before) to the directory.

  • CopyFilesToTemp - Mounts the partition and proceeds the copying files from that partition to the inst-sys.

  • CreateDirectoryIfMissing - Checks whether the directory exists and creates it if it is missing If the path exists but it is not a directory, it tries to create another directory and returns its name. 'nil' is returned when everythig fails.

  • GetCopySystemFiles - Returns list of copy_files definitions

  • GetUseControlFileDef - Sets whether copy_files from control file should be used

  • SaveInstSysContent - Function reads <globals><save_instsys_content /></globals> from control file and copies all content from inst-sys to the just installed system.

  • SetCopySystemFiles - Sets new rules which files will be copied during installation.

  • SetUseControlFileDef - Sets whether to use copy_files from control file

List of Global Variables

    271.3. Global Functions

    271.3.1. CopyFilesToSystem

    Proceeds the copying of all files in inst-sys (that were copied from another partition before) to the directory.

    Function parameters

    • string extract_to_dir

    Return value

    • boolean

    271.3.2. CopyFilesToTemp

    Mounts the partition and proceeds the copying files from that partition to the inst-sys.

    Function parameters

    • string partition

    • list <string> filenames

    • string copy_to

    Return value

    • boolean

    copy_to   == "/root/" (where to copy it to the installed system)

    271.3.3. CreateDirectoryIfMissing

    Checks whether the directory exists and creates it if it is missing If the path exists but it is not a directory, it tries to create another directory and returns its name. 'nil' is returned when everythig fails.

    Function parameters

    • string create_directory

    Return value

    • string

    271.3.4. GetCopySystemFiles

    Returns list of copy_files definitions

    Return value

    • list <map>

    See also:

    • SetCopySystemFiles for more info

    271.3.5. GetUseControlFileDef

    Sets whether copy_files from control file should be used

    Return value

    • boolean - whether to use them

    See also:

    • SetUseControlFileDef

    271.3.6. SaveInstSysContent

    Function reads <globals><save_instsys_content /></globals> from control file and copies all content from inst-sys to the just installed system.

    Return value

    • boolean

     <globals>
         <save_instsys_content config:type="list">
             <save_instsys_item>
                 <instsys_directory>/root/</instsys_directory>
                 <system_directory>/root/inst-sys/</system_directory>
             </save_instsys_item>
         </save_instsys_content>
     </globals>

    271.3.7. SetCopySystemFiles

    Sets new rules which files will be copied during installation.

    Function parameters

    • list <map> new_copy_files

    Return value

    • void

        [
            "copy_to_dir" : (string) "system_directory_to_copy_to",
            "mandatory_files" : (list <string>) [ list of mandatory files ],
            "optional_files" : (list <string>) [ list of optional files ],
        ]
    

    Example 138. 

        SetCopySystemFiles ([
            $["copy_to_dir":"/root/backup", "mandatory_files":["/etc/passwd", "/etc/shadow"]]
            $["copy_to_dir":"/root/backup", "mandatory_files":["/etc/ssh/ssh_host_dsa_key"], "optional_files":["/etc/ssh/ssh_host_rsa_key.pub"]]
        ])


    See also:

    • FATE #305019: configure the files to copy from a previous installation

    271.3.8. SetUseControlFileDef

    Sets whether to use copy_files from control file

    Function parameters

    • boolean new_value

    Return value

    • void

    See also:

    • GetUseControlFileDef

    271.4. Global Variables

    271.5. Module Requirements

    271.5.1. Module Imports

    • Directory
    • FileUtils
    • InstData
    • Installation
    • ProductFeatures
    • Stage
    • String

    271.5.2. Module Includes