YaST2 Developers Documentation: Restore module

Restore module

modules/Restore.ycp
Data for configuration of restore, input and output functions.

This module has an unstable interface.

Representation of the configuration of restore. Input and output routines.

Imports

  • Bootloader
  • Label
  • Message
  • Mode
  • Package
  • Popup
  • Progress
  • Report
  • Service
  • String
  • Summary
  • URL

Global Variables

Global Functions

Local Functions

global runbootloader -> boolean

Run lilo after files are restored

global runSuSEconfig -> boolean

Run SuSEconfig after files are restored

global restoreRPMdb -> boolean

Rewrite RPM db - unapack /var/lib/rpm/* files from backup if present

global Modified () -> boolean

Return modified flag

Return value:
true if modified
global IsMultiVolume () -> boolean

Selected archive has more parts

Return value:
boolen True if archive have more than one part.
global GetArchiveDate () -> string

Return date when backup archive was created. Date is stored in archive in file info/date.

Return value:
Date
global GetInputName () -> string

Return name of backup archive

Return value:
Input name file name
global GetArchiveName () -> string

Return name of backup archive

Return value:
File name
global GetArchiveComment () -> string

Return user comment stored in archive. Comment is stored in file info/comment.

Return value:
Archive comment
global GetArchiveHostname () -> string

Return host name of machine on which backup archive was created. Host name is stored in archive in file info/hostname.

Return value:
Host name
global GetArchiveInstalledPackages () -> map<string,string>

Return map with packages installed at backup time (form is $["package name" : "version"]).

Return value:
Installed packages at backup time
global GetArchiveFiles () -> list

Return list of files in the backup archive

Return value:
Files in the archive
global ReadActualInstalledPackages () -> map<string,string>

Read installed packages.

Return value:
Map $[ "packagename" : "version" ]
global GetActualInstalledPackages () -> map<string,string>

Return installed packages. Result is cached in Restore module, so only first use takes long time

Return value:
Map $[ "packagename" : "version" ]
global GetMissingPackages () -> map<string, map<string, string> >

Return missing packages (packages which were installed at backup time, but at restore time they are not installed)

Return value:
Map $[ "packagename" : $[ "ver" : "version", "descr" : "Short description of the package"]], key description is present only if decription exists
global GetExtraPackages () -> map<string,map<string,string> >

Return extra packages (packages which are installed at restore time, but at restore time they are installed)

Return value:
Map $[ "packagename" : $[ "ver" : "version", "descr" : "Short description of the package"]], key description is present only if decription exists
global GetMismatchedPackages () -> map<string, map <string, string> >

Return packages which have different version at backup archive and in system

Return value:
Map $[ "packagename" : $[ "inst": "installed version", "ver" : "version at backup time, "descr" : "Short description of the package"]], key description is present only if decription exists
global GetSelectedPackages () -> map<string, map>

Returns selected packages (even partially).

Return value:
Map with same keys as map returned by GetArchiveInfo()
global ClearInstalledPackagesCache () -> void

Clear cache of installed packages. Next use of GetActualInstalledPackages() function will reread installed packages.

global Umount () -> void

Umount mounted file system.

local mountNFS (string server, string file) -> map

Access to file on NFS server

Parameters:
server Name or IP adress of NFS server
file File on the server
Return value:
$[ "mounted" : boolena (true on success), "mountpoint" : string (mount point) , "file" : string (file name), "server_dir" : string (directory on the server) ]
local mountCD (integer cdindex) -> map

Access to file on CD

Parameters:
cdindex Index of CD drive (in list SCR::Read(.probe.cdrom))
Return value:
$[ "mounted" : boolena (true on success), "mpoint" : string (mount point) ]
local mountFloppy (integer fdindex) -> map

Access to file on floppy

Parameters:
fdindex Index of floppy drive (in list SCR::Read(.probe.floppy))
Return value:
$[ "mounted" : boolena (true on success), "mpoint" : string (mount point) ]
local mountDevice (string device) -> map

Mount device

Parameters:
device Device file name (e.g. /dev/cdrom, /dev/sda...)
Return value:
Map $[ "mounted" : boolean (true on success), "mpoint" : string (mount point where device was mounted) ];
global MountInput (string input) -> map

Mount input source

Parameters:
input File in URl-like syntax
Return value:
Map $[ "success" : boolean (true on success), "mpoint" : string (mount point), "file" : string (file name on the local system) ];
local CheckVolume (string filename, integer num) -> map

Check if volume number in archive is equal to expected volume number

Parameters:
filename Volume file name
num Number of volume
Return value:
Map $[ "success" : boolean (true on success), "lastvolume" : boolean (true if archive is last volume) ]
local CopyVolume (string filename, integer num) -> map

Copy volume to the local temporary directory

Parameters:
filename Source file
num Number of volume
Return value:
Map $[ "success" : boolean (true on success), "file" : string (file name in the temporary directory) ]
local AddVolume (string file) -> map

Add next volume - check volume, copy volume to the temp. dir.

Parameters:
file File name of volume
Return value:
Map $[ "success" : boolean (true on success), "lastvolume" : boolean (true if archive is last volume) ]
global SetRestoreSelection (string pkgname, map selection) -> void

Change restore selection of package.

Parameters:
pkgname
selection New restore selection for package, map $[ "sel_type" : "X", "sel_file" : ["files"] ]
global SetSelectionProperty (map<string,map> settings) -> void

Set selection in _auto client and display properties of archive

Parameters:
settings Restoration selection
global Read (string input) -> boolean

Read contents of archive

Parameters:
input File name of backup archive. File on NFS server is 'nfs://server:/dir/file.tar', local file: 'file:///dir/file.tar' (prefix is file://, directory is /dir)
Return value:
True if archive was succesfully read, otherwise false (file does not exist, not tar archive, broken archive, archive not created by Backup module, ...)
global Set (map settings) -> void

Set settings

Parameters:
settings Map with settings: start lilo, run SuSEconfig, restore RPM db
global Import (map settings) -> boolean

Get all restore settings - for use by autoinstallation

Parameters:
settings The YCP structure to be imported
Return value:
True on success
global Export () -> map

Dump the restore settings to a single map - for use by autoinstallation.

Return value:
Dumped settings (later acceptable by Import ())
global GetArchiveInfo () -> map<string, map<string, any> >

Return restore configuration

Return value:
Map $[ "packagename" : $["vers" : "version", "files" : ["files in the archive"], "prefix" : "installprefix", "descr" : "Short description", "sel_type" : "X", "sel_file" : ["selected files to restore"] ] ], possible values for "sel_type" key are: "X" - restore all files from archive, " " - do not restore this package, "P" - partial restore, restore only selected files at "sel_file" key. Package name "" means files not owned by any package.
global TotalPackagesToRestore () -> integer

Return number of packages which will be restored from archive

Return value:
Total selected packages
global TotalFilesToRestore () -> integer

Return number of files which will be unpacked from archive

Return value:
Total selected files
global ActivateBootloader () -> boolean

Activate boot loader configuration if requested. Uses variable Restore::runbootloader

Return value:
true on success
global Write (block<boolean> abort, symbol progress, string targetdir) -> map

Restore files from archive

Parameters:
abort This block is periodically evaluated, if it evaluates to true restoration will be aborted. It should be something like ``{return UI::PollInput () == `abort;} if UI exists or ``{ return false; } if there is no UI (abort will not be possible).
progress Id of progress bar or nil.
targetdir Directory to which files from archive will be upacked
Return value:
Map $[ "aborted" : boolean, "restored" : [ "restored file" ], "failed" : [ "failed file" ] ]
global ReadNextVolume (string input) -> map

Read next volume of multi volume archive

Parameters:
input Archive name in URL-like syntax
Return value:
Map $[ "success" : boolean (true on success), "lastvolume" : boolean (true if archive is last volume) ]
global TestAllVolumes () -> boolean

Test all volumes together

Return value:
True: all volumes are OK, false: an error occured
global ResetArchiveSelection () -> void

Clear all archive settings

global ResetAll () -> void

Clear all settings (archive and list of installed packages)

local RemoveShortCut (string scut) -> string

Remove shortcut mark from string

Parameters:
scut string with shortcut mark (&)
Return value:
result
local yesno (boolean b) -> string

Convert boolean value to translated "yes" or "no" string

Parameters:
b input value
Return value:
translated Yes/No string
global Summary () -> string

Create restore configuration summary. Used in autoinstallation restore module configuration.

Return value:
rich text summary