ACC SHELL
/**
* File: key_manager.ycp
*
* Author: Ladislav Slezak <lslezak@novell.com>
*
* Purpose: Manages GPG keys in the package manager
*
* $Id: key_manager.ycp 57028 2009-04-29 10:58:09Z lslezak $
*/
{
textdomain "packager";
import "PackageCallbacks";
import "Wizard";
import "Label";
import "Report";
import "CommandLine";
import "Popup";
import "PackageLock";
import "KeyManager";
import "Installation";
import "Sequencer";
include "packager/key_manager_dialogs.ycp";
symbol Read()
{
if (!PackageLock::Connect(false)["connected"]:false)
{
// SW management is already in use, access denied
// the yast module cannot be started
Wizard::CloseDialog ();
return `abort;
}
// init the target - read the keys
if (!Pkg::TargetInitialize(Installation::destdir))
{
y2error("The target cannot be initialized, aborting...");
return `abort;
}
// read the current keys
if (!KeyManager::Read())
{
y2error("The key configuration cannot be read, aborting...");
return `abort;
}
return `next;
}
symbol Write()
{
return KeyManager::Write() ? `next : `abort;
}
// main function - start the workflow
symbol Main()
{
Wizard::CreateDialog();
Wizard::SetDesktopIcon("security");
// dialog caption
Wizard::SetContents(_("Initializing..."), `Empty (), "", false, true);
map<string,any> aliases = $[
"read" : ``(Read()),
"edit" : ``(RunGPGKeyMgmt(true)),
"write" : ``(Write())
];
map sequence = $[
"ws_start" : "read",
"read" : $[
`next : "edit"
],
"edit" : $[
`abort : `abort,
`next : "write",
],
"write" : $[
`next : `next,
`abort : `abort,
],
];
y2milestone ("Starting the key management sequence");
symbol ret = Sequencer::Run (aliases, sequence);
Wizard::CloseDialog ();
return ret;
}
map cmdline_description = $[
"id" : "key_mgmgt",
"guihandler" : Main
];
return CommandLine::Run(cmdline_description);
}
ACC SHELL 2018