Merge pull request 'SystemD Fix' (#3) from dev into master
Reviewed-on: https://git.pooper.social/verita84/picluster/pulls/3
This commit is contained in:
commit
bcfec7f9c7
@ -388,7 +388,7 @@ app.post('/run', (req, res) => {
|
||||
});
|
||||
|
||||
function systemd(data) {
|
||||
const systemd = ["[Unit]", "Description=Container", "After=podman.service", "[Service]", "Type=oneshot", "RemainAfterExit=yes", "Environment=\"NAME=", "Environment=\"ARGUMENTS=", "ExecStartPre=/bin/sh -c \"/usr/bin/podman rm -f ${NAME}; exit 0;\"", "ExecStartPre=/bin/sh -c \"/usr/bin/podman build -t ${NAME} /docker/${NAME}; exit 0;\"", "ExecStart=/bin/sh -c \"podman run -d --name ${NAME} ${ARGUMENTS} localhost/${NAME}; exit 0;\"", "ExecStart=/bin/sh -c \"systemctl restart firewalld.service; exit 0;\"", "ExecStart=/bin/sh -c \"podman network reload -a; exit 0;\"", "ExecStop=/usr/bin/podman rm -f ${NAME}\"", "[Install]", "WantedBy=multi-user.target"];
|
||||
const systemd = ["[Unit]", "Description=Container", "After=podman.service", "[Service]", "Type=oneshot", "RemainAfterExit=yes", "Environment=\"NAME=", "ExecStartPre=/bin/sh -c \"/usr/bin/podman rm -f ${NAME}; exit 0;\"", "ExecStartPre=/bin/sh -c \"/usr/bin/podman build -t ${NAME} /docker/${NAME}; exit 0;\"", "podman run", "ExecStart=/bin/sh -c \"systemctl restart firewalld.service; exit 0;\"", "ExecStart=/bin/sh -c \"podman network reload -a; exit 0;\"", "ExecStop=/usr/bin/podman rm -f ${NAME}\"", "[Install]", "WantedBy=multi-user.target"];
|
||||
var container_name = data.split(' ');
|
||||
var name = container_name[container_name.length - 1];
|
||||
|
||||
@ -407,11 +407,10 @@ function systemd(data) {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
} else if (unit_file.indexOf('ARGUMENTS') > -1) {
|
||||
|
||||
} else if (unit_file.indexOf('podman run') > -1) {
|
||||
final_arguments = data.split(';');
|
||||
final_line = final_arguments[1].split(name);
|
||||
end_line = 'Environment=\"ARGUMENTS="' + final_line[1] + '"';
|
||||
final_line = final_arguments[0].split(name);
|
||||
end_line = 'ExecStart=/bin/sh -c \"' + final_line + ';exit 0;\"';
|
||||
fs.appendFile('/etc/systemd/system/picluster-' + name + '.service', end_line + '\n', err => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
|
Loading…
Reference in New Issue
Block a user