YaST2 Developers Documentation: SCR System agent functions | ![]() |
![]() |
SCR System agent functions
Runs a bash command. The command is stated as string. The map variables can be used to give initial environment definitions to the target. The keys have to be strings, the values can be of any type. If you use string values, the strings may _not_ contain single quotes. Escape them with double backqoute, if you need them. This is subject to change. The return value will be either an integer with the exitcode of the shell script or a map: $[ Example: Execute (.target.bash, "/bin/touch $FILE ; exit 5", $["FILE":"/somedir/somefile"]) -> 5Example: Execute (.target.bash_output, "/bin/touch $FILE ; exit 5", $["FILE":"/somedir/somefile"]) -> $[ "exit" : 5, "stdout" : "", "stderr" : ""]
Note: Function has only one used within YaST2 and is subject to sudden change or removal.
Opens a binary file and reads its contents into a single byteblock.
Write a byteblock into a file.
Reset the given printer (trigger ioctl) The return value is true or false, depending of the success
Reads a directory. Returns a list of strings, one string for each file contained in the directory path is pointing to. The entries '.' and '..' are NOT returned. Returns nil and doesn't log an error, if path does not point to a readable directory. If a default value is given, this is returned if path isn't accessible. Example: Read (.target.dir, "/proc/self") -> [ "cmdline", "cwd", "environ", ... ]
Load module in target system. The return value is true or false, depending of the success. Example: Execute (.target.insmod, "a_module", "an option")
Kill process with signal (SIGTERM if not specified). The return value is true or false, depending of the success. Example: Execute (.target.kill, 1, 9)
Return a map with file information (see stat(2)). If the file does not exist return an empty map.
Creates a directory and all its parents, if necessary. All created elements will have mode 0755 if mode is omitted. The return value is true or false, depending of the success, ie if the directory exists afterwards. Example: Execute (.target.mkdir, "/var/adm/mount")
Load module in target system. The return value is true or false, depending of the success. Example: Execute (.target.modprobe, "a_module", "an option")
Mounts a (block) device at a mountpoint. If logfile is given, the stderr of the mount cmd will be appended to this file The return value is true or false, depending of the success Example: Execute (.target.mount, ["/dev/fd0", "/floppy"], "-t msdos")Example: Execute (.target.mount, ["/dev/fd0", "/floppy", "/var/log/y2mountlog"], "-t msdos")
.passwd can be used to set or modify the encrypted password of an already existing user in /etc/passwd and /etc/shadow. This call returns true on success and false, if it fails. Example: Write (.target.passwd.root, crypt (a_passwd))
Remove a file. The return value is true or false depending on the success. Example: Execute (.target.remove, "/tmp/xyz")
return current size of file returns -1 if the file does not exist
Mounts a SMB share at a mountpoint. if logfile is given, the stderr of the mount cmd will be appended to this file The return value is true or false, depending of the success Example: Execute (.target.smbmount, ["//windows/crap", "/crap"], "-o guest")Example: Execute (.target.smbmount, ["//smb/share", "/smbshare", "/var/log/y2mountlog"])
Return a map with file information (see stat(2)). If the file does not exist return an empty map.
Opens an Ascii file and reads the contents to a single string. Newlines are preserved. Example: Read (.target.string, "/some/file") -> "a contents"
Writes the string value into a file. If the file already exists, the existing file is overwritten. The return value is true, if the file has been written successfully.
Creates a symbolic link named newpath which contains the string oldpath. Symbolic links are interpreted at run-time as if the con tents of the link had been substituted into the path being followed to find a file or directory. The return value is true or false, depending of the success. Example: Execute (.target.symlink, "/lib/YaST2", "Y2")
Returns the content of the symbolic link filename. If the filename does not exist or is no symbolic link, nil is returned and an error logged. Example: Read (.target.symlink, "/var/X11R6/bin/X")
Returns the (instance specific) directory for storing temporary files. The directory (and its contents) will be removed by the SystemAgent destructor (usually when yast2 exits) Example: Read (.target.tmpdir) -> "/some/temp/dir"
Unmounts a (block) device at a mountpoint. The return value is true or false, depending of the success. Example: Execute (.target.umount, "/floppy")
Opens a file that must be in YCP syntax and contain exactly one value, parses that file and returns the parsed value. Returns default, if the file didn't exist, was not readable or did not contain a valid YCP value. The purpose of this function is to load data located in ydatadir. The data may also be located in any of the paths in source/core/liby2/src/pathsearch.cc appended by "data/". The filename must be relative to one of those paths. A warning in the log is omitted if a default value is given.
Opens a file that must be in YCP syntax and contain exactly one value, parses that file and returns the parsed value. Returns 'default', if the file didn't exist, was not readable or didn't not contain a valid YCP value. A warning in the log is omitted if a default value is given.
Opens a file for writing and prints the value value in YCP syntax to that file. Returns true, if the file has been written, false otherwise. The newly created file gets the mode 0644 minus umask. Furthermore any missing directory in the pathname filename is created automatically.
Opens a file for writing and prints the value value in YCP syntax to that file. Returns true, if the file has been written, false otherwise. The newly created file gets the mode mode minus umask. Furthermore any missing directory in the pathname filename is created automatically. |
YaST2 Developers Documentation: SCR System agent functions | ![]() |