enhance config-services script a bit
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -237,7 +237,7 @@ class Action
|
|||||||
}
|
}
|
||||||
} while (! empty($sysservice));
|
} while (! empty($sysservice));
|
||||||
// add 'cron' as fixed part (doesn't hurt if it exists)
|
// add 'cron' as fixed part (doesn't hurt if it exists)
|
||||||
if (!in_array('cron', $_daemons_config[$si])) {
|
if (! in_array('cron', $_daemons_config[$si])) {
|
||||||
$_daemons_config[$si][] = 'cron';
|
$_daemons_config[$si][] = 'cron';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -256,6 +256,10 @@ class Action
|
|||||||
echo PHP_EOL;
|
echo PHP_EOL;
|
||||||
CmdLineHandler::printsucc("You can now apply this config running:" . PHP_EOL . "php " . __FILE__ . " --froxlor-dir=" . dirname(dirname(__DIR__)) . " --apply=" . $output);
|
CmdLineHandler::printsucc("You can now apply this config running:" . PHP_EOL . "php " . __FILE__ . " --froxlor-dir=" . dirname(dirname(__DIR__)) . " --apply=" . $output);
|
||||||
echo PHP_EOL;
|
echo PHP_EOL;
|
||||||
|
$proceed = CmdLineHandler::getYesNo("Do you want to apply the config now? [y/N]", 0);
|
||||||
|
if ($proceed) {
|
||||||
|
passthru("php " . __FILE__ . " --froxlor-dir=" . dirname(dirname(__DIR__)) . " --apply=" . $output);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getCompleteDistroName($cparser)
|
private function getCompleteDistroName($cparser)
|
||||||
|
|||||||
@@ -169,6 +169,35 @@ abstract class CmdLineHandler
|
|||||||
return mb_strtolower($result);
|
return mb_strtolower($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getYesNo($prompt = "#", $default = null)
|
||||||
|
{
|
||||||
|
$value = null;
|
||||||
|
$_v = null;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
$_v = self::getInput($prompt);
|
||||||
|
|
||||||
|
if (strtolower($_v) == 'y' || strtolower($_v) == 'yes') {
|
||||||
|
$value = 1;
|
||||||
|
break;
|
||||||
|
} elseif (strtolower($_v) == 'n' || strtolower($_v) == 'no') {
|
||||||
|
$value = 0;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
if ($_v == '' && $default != null) {
|
||||||
|
$value = $default;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
echo "Sorry, response " . $_v . " not understood. Please enter 'yes' or 'no'\n";
|
||||||
|
$value = null;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
public static function println($msg = "")
|
public static function println($msg = "")
|
||||||
{
|
{
|
||||||
print $msg . PHP_EOL;
|
print $msg . PHP_EOL;
|
||||||
|
|||||||
Reference in New Issue
Block a user