YaST2 Developers Documentation: yast2

yast2

modules/FileChanges.ycp
Detect if a configuratil file was changed
  • Jiri Srain
  • Support routines for detecting changes of configuration files being done
  • externally (not by YaST) to prevent the changes from being lost because
  • of YaST not handling the configuration files correctly (eg. removing
  • comments in some cases, changing order of options,...)
  • Warns user if such change is detected.
  • Usage:
  • Before reading the configuration file:
  • call boolean CheckFiles (list) with all files. If any of them
  • is detected to be changed, YaST asks a popup for you.
  • alternatively use boolean FileChanged (string) for each file (does not
  • ask any question, immediatelly returns status of the file
  • After writing the configuraiton file:
  • call void StoreFileCheckSum (string) for each file to store recent
  • checksum. YaST will use this checksum next time checking.

This module has an unstable interface.

Imports

  • Directory
  • Label
  • Mode
  • Popup

Global Functions

Local Functions

local ReadSettings () -> void

Read the data file containing file checksums

local WriteSettings () -> void

Write the data file containing checksums

local ComputeFileChecksum (string file) -> string

Compute the checksum of a file

Parameters:
file string the file to compute checksum of
Return value:
the checksum
local FileChangedFromPackage (string file) -> boolean

Check if file was modified compared to the one distributed with the RPM package

Parameters:
file string the file to check
Return value:
true of was changed
global FileChanged (string file) -> boolean

Check if a file was modified externally (without YaST)

Parameters:
file string boolean the file to check
Return value:
true if was changed externally
global StoreFileCheckSum (string file) -> void

Store checksum of a file to the store

Parameters:
file string filename to compute and store
global CheckFiles (list<string> files) -> boolean

Check files if any of them were changed Issue a question whether to continue if some were chaned

Parameters:
files a list of files to check
Return value:
true if either none was changed or user agreed to continue