prosodyctl
branch0.11
changeset 10614 b9a054ad38e7
parent 10612 87003b937672
child 10615 c10511380c0f
child 11533 10bea0941bab
equal deleted inserted replaced
10612:87003b937672 10614:b9a054ad38e7
    67 local configmanager = require "core.configmanager";
    67 local configmanager = require "core.configmanager";
    68 local modulemanager = require "core.modulemanager"
    68 local modulemanager = require "core.modulemanager"
    69 local prosodyctl = require "util.prosodyctl"
    69 local prosodyctl = require "util.prosodyctl"
    70 local socket = require "socket"
    70 local socket = require "socket"
    71 local dependencies = require "util.dependencies";
    71 local dependencies = require "util.dependencies";
       
    72 local lfs = dependencies.softreq "lfs";
    72 
    73 
    73 -----------------------
    74 -----------------------
    74 
    75 
    75 local show_message, show_warning = prosodyctl.show_message, prosodyctl.show_warning;
    76 local show_message, show_warning = prosodyctl.show_message, prosodyctl.show_warning;
    76 local show_usage = prosodyctl.show_usage;
    77 local show_usage = prosodyctl.show_usage;
   196 
   197 
   197 	show_message(error_messages[msg])
   198 	show_message(error_messages[msg])
   198 	return 1;
   199 	return 1;
   199 end
   200 end
   200 
   201 
   201 local function service_command_warning(command)
   202 local function service_command_warning(service_command)
   202 	if prosody.installed and configmanager.get("*", "prosodyctl_service_warnings") ~= false then
   203 	if prosody.installed and configmanager.get("*", "prosodyctl_service_warnings") ~= false then
   203 		show_warning("WARNING: Use of prosodyctl start/stop/restart/reload is not recommended");
   204 		show_warning("WARNING: Use of prosodyctl start/stop/restart/reload is not recommended");
   204 		show_warning("         if Prosody is managed by an init system - use that directly instead.");
   205 		show_warning("         if Prosody is managed by an init system - use that directly instead.");
       
   206 		lfs = lfs or require
   205 		if lfs.attributes("/etc/systemd") then
   207 		if lfs.attributes("/etc/systemd") then
   206 			show_warning("         e.g. systemctl %s prosody", command);
   208 			show_warning("         e.g. systemctl %s prosody", service_command);
   207 		elseif lfs.attributes("/etc/init.d/prosody") then
   209 		elseif lfs.attributes("/etc/init.d/prosody") then
   208 			show_warning("         e.g. /etc/init.d/prosody %s", command);
   210 			show_warning("         e.g. /etc/init.d/prosody %s", service_command);
   209 		end
   211 		end
   210 		show_warning("");
   212 		show_warning("");
   211 	end
   213 	end
   212 end
   214 end
   213 
   215 
   510 	show_message(error_messages[msg])
   512 	show_message(error_messages[msg])
   511 	return 1;
   513 	return 1;
   512 end
   514 end
   513 
   515 
   514 local openssl;
   516 local openssl;
   515 local lfs;
       
   516 
   517 
   517 local cert_commands = {};
   518 local cert_commands = {};
   518 
   519 
   519 -- If a file already exists, ask if the user wants to use it or replace it
   520 -- If a file already exists, ask if the user wants to use it or replace it
   520 -- Backups the old file if replaced
   521 -- Backups the old file if replaced