YaST2 Developers Documentation: Backup module

Backup module

Backup.ycp
  • Ladislav Slezak

This module has an unstable interface.

This module is for internal use only.

Main file for backup module

Imports

  • FileUtils
  • Nfs
  • Popup
  • Progress
  • Report
  • Service
  • String

Includes

  • backup/functions.ycp

Global Functions

global GetCapacity (list<map<string,any> > media, symbol m) -> integer

Return capacity of required medium

Parameters:
media Medium descriptions
m Identification of required medium
Return value:
Size of medium in bytes
global get_search_script_parameters () -> string

Return backup_search.pl script parameters according to state of variables

Return value:
String with command line parameters
global PrepareBackup () -> boolean

Pre-backup function - mount NFS share if required

Return value:
true on success
global PostBackup () -> boolean

Post-backup function - unmount mounted NFS share

Return value:
true on success
global get_archive_script_parameters (string file_list, string file_comment) -> string

Return backup_search.pl script parameters according to state of variables

Parameters:
file_list Where is list of files to backup stored
file_comment Where is comment stored
Return value:
String with command line parameters
global ExcludeNodevFS () -> void

Exclude file systems without device

global WriteProfile (list<string> volumes) -> map

Write autoinstallation profile to file autoinst.xml to the same directory as archive

Parameters:
volumes list of created archives (it is written to the XML profile as restoration source)
Return value:
map $[ "result" : boolean (true on success), "profile" : string (profile file name) ]
global ReadCronSetting (string filename) -> map

Parse cron file

Parameters:
filename File to parse
Return value:
parsed values: $["auto":boolean, "day":integer, "hour":integer, "minute":integer, "weekday":integer, "every":symbol] or empty map if parse error occured
global ReadCronSettings () -> void

Parse all /etc/cron.d/yast2-backup-* files and update profiles

global ReadBackupProfiles () -> boolean

Read backup profiles from file, do not set any global settings, just

Return value:
true if there are some profiles available
See
backup_profiles. The profiles are stored in hardcoded place (configuration_filename variable).
global CreateCronSetting (string profilename) -> string

Create cron file content for selected profile.

Parameters:
profilename Name of the profile
Return value:
Cron content or empty string if profile has disabled automatic start
global WriteCronSettings () -> void

Write cron settings from profiles to /etc/cron.d/yast2-backup-* files

global WriteBackupProfiles () -> boolean

Write the backup profiles to a file - hardcoded configuration_filename.

Return value:
true if the write operation was successful.
global StoreSettingsToBackupProfile (string profile_name) -> void

Take the current profile information and store it into a given profile. If the profile already exists, it will be overwritten.

Parameters:
profile_name name of a profile to be stored into
global RestoreSettingsFromBackupProfile (string profile_name) -> boolean

Restore the global settings from a given backup profile.

Parameters:
profile_name name of a profile to be used
Return value:
If the name of the profile cannot be found, return false, otherwise return true.
global RestoreDefaultSettings () -> void

Restore the default global settings.

global BackupProfileNames () -> list<string>

Get a sorted list of profile names currently available.

Return value:
the list of strings (possibly empty).
global CreateCronDescription (string profilename) -> string

Create description of automatic backup.

Parameters:
profilename Name of the profile
Return value:
description string or empty string if profile has disabled automatic start
global BackupProfileDescriptions () -> list<term>

Helper function to extract the list of currently available profiles

Return value:
List of item used in the table widget
global RemoveBackupProfile (string profile_name, boolean remove_cronfile) -> boolean

Remove given profile.

Parameters:
profile_name name of a profile to be removed
remove_cronfile
Return value:
If the name of the profile cannot be found, return false, otherwise return true.
global RemovableDevices (boolean only_writable) -> map

Try to detect all removable devices present in the system

Parameters:
only_writable return only writable devices (e.g. exclude CD-ROMs)
Return value:
Removable devices info
global ReadInstallablePackages () -> void

Read all packages available on the installation sources

global DetectedMountPoints () -> map

Returns detected mount points

Return value:
detected mount points
global GetLocalArchiveName () -> string

Returns local archive name (required if NFS target is used)

Return value:
local archive name
global MapFilesToString () -> map

Writes file using the .backup.file_append SCR agent. This file is accepted by backup_archive.pl script. Used global variables: selected_files, backup_files.

Return value:
with keys "sel_files" (integer - number of selected files), "sel_packages" (integer: number of selected packages), "ret_file_list_stored" (boolean: whether the filelist has been completely stored)
See
Backup module specification
global RemoveOldSingleArchives (string name, integer max) -> map

Remove and/or rename old existing single archives

Parameters:
name Archive name
max Maximum count of existing archives
Return value:
result
global RemoveOldMultiArchives (string name, integer max) -> map

Remove and/or rename old existing multivolume archives

Parameters:
name Archive name
max Maximum count of existing archives
Return value:
result
global RemoveOldArchives (string name, integer max, boolean multivolume) -> map

Remove and/or rename old existing archives

Parameters:
name Archive name
max Maximum count of existing archives
multivolume Is archive archive multivolume?
Return value:
result