YaST2 Developers Documentation: Installation

Installation

modules/SystemFilesCopy.ycp
Functionality for copying files from another systems
  • Lukas Ocilka

This module has an unstable interface.

Functionality for copying files from any not-mounted systems to inst-sys and from inst-sys to just-installed system.

Imports

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

Structures

Global Functions

Local Variables

Local Functions

local copy_files_to_installed_system -> list <list <string> >

Structure [

     [ archive_name, copy_to ],
     [ "/tmp/archive_001.tgz", "/etc" ],
 ]
global CreateDirectoryIfMissing (string create_directory) -> string

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.

Parameters:
create_directory
local Initialize () -> boolean

Sets and creates a temporary directory for files to lay in inst-sys until they're copied to the installed system. Sets and creates a temporary directory that is used for mounting partitions when copying files from them.

global CopyFilesToTemp (string partition, list <string> filenames, string copy_to) -> boolean

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

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


   
Parameters:
partition
filenames
copy_to
global CopyFilesToSystem (string extract_to_dir) -> boolean

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

Parameters:
extract_to_dir (Installation::destdir for initial stage of installation)
global SaveInstSysContent () -> boolean

Function reads from control file and copies all content from inst-sys to the just installed system.

This function needs to be called in the inst-sys (first stage) just before the disk is unmounted.

FATE #301937

Structure

 <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>
global GetUseControlFileDef () -> boolean

Sets whether copy_files from control file should be used

Return value:
whether to use them
See
SetUseControlFileDef
global SetUseControlFileDef (boolean new_value) -> void

Sets whether to use copy_files from control file

Parameters:
new_value
See
GetUseControlFileDef
global GetCopySystemFiles () -> list <map>

Returns list of copy_files definitions

See
SetCopySystemFiles for more info
global SetCopySystemFiles (list <map> new_copy_files) -> void

Sets new rules which files will be copied during installation.

Structure

    [
        "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 ],
    ]
Parameters:
new_copy_files
Example

    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
FATE #305019: configure the files to copy from a previous installation