mirror of
https://github.com/lennyhans/systemd-to-openrc.git
synced 2026-03-10 04:41:09 +00:00
Add working module based clone from original openrc-run generator
See http://openrc.run/ This able to split the same working piece as a node and browser module
This commit is contained in:
parent
1163906176
commit
331d7980be
3 changed files with 129 additions and 13 deletions
22
magic.js
22
magic.js
|
|
@ -270,17 +270,10 @@ function generateReload(unit) {
|
|||
}
|
||||
|
||||
|
||||
function convert(event) {
|
||||
event.preventDefault();
|
||||
var raw = document.getElementById('unit').value;
|
||||
export function convert(raw) {
|
||||
var parsed = parseINIString(raw);
|
||||
var validated = validate(parsed);
|
||||
if (validated !== null) {
|
||||
document.getElementById('error').innerHTML = validated;
|
||||
return;
|
||||
} else {
|
||||
document.getElementById('error').innerHTML = '';
|
||||
}
|
||||
|
||||
console.log(parsed);
|
||||
|
||||
var result = '#!/sbin/openrc-run\n\nname=$RC_SVCNAME\ndescription="' + parsed.Unit.Description + '"\n';
|
||||
|
|
@ -311,9 +304,12 @@ function convert(event) {
|
|||
result += generateStop(parsed);
|
||||
result += generateReload(parsed);
|
||||
|
||||
document.getElementById('openrc').innerText = result;
|
||||
var response = {
|
||||
validated,
|
||||
parsed,
|
||||
result
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
document.getElementById('convert').addEventListener('click', convert);
|
||||
});
|
||||
// This does not run a function like the default
|
||||
Loading…
Add table
Add a link
Reference in a new issue