From aef4c4ae706483964aaa7569dff7fb9458552ab8 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Wed, 7 Jan 2009 21:58:00 +0000 Subject: Modified chrony to add online/offline buttons to startstop. part 1 git-svn-id: svn://svn.alpinelinux.org/acf/chrony/trunk@1669 ab2d0c66-481e-0410-8bed-d214d4d58bed --- chrony-model.lua | 24 ++++++++++++++++++++++++ chrony-startstop-html.lsp | 1 - 2 files changed, 24 insertions(+), 1 deletion(-) delete mode 120000 chrony-startstop-html.lsp diff --git a/chrony-model.lua b/chrony-model.lua index 517efa4..269b96c 100644 --- a/chrony-model.lua +++ b/chrony-model.lua @@ -53,6 +53,30 @@ end -- PUBLIC FUNCTIONS function startstop_service(action) + local lower = action:lower() + if lower == "online" or lower == "offline" then + local retval = cfe({ label="Start/Stop result" }) + -- try to find the password + local config = get_config() + if config.value.keyfile.value == "" then + retval.errtxt = "No key file defined" + elseif config.value.commandkey.value == "" then + retval.errtxt = "No command key defined" + else + local content = fs.read_file(config.value.keyfile.value) or "" + local password = string.match("\n"..content, "\n"..config.value.commandkey.value.."%s+(%S+)") + if not password then + retval.errtxt = "Could not find password in key file" + else + local cmd = path.."chronyc <