mirror of
https://github.com/troglobit/finit.git
synced 2026-11-03 13:28:27 +00:00
initctl: add companion delete command
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
4c2bbf7d93
commit
49582c70c5
3 files changed
+27
-1
No files matched your search
+23
@@ -322,6 +322,29 @@ int serv_creat(char *arg)
|
||||
return fclose(fp);
|
||||
}
|
||||
|
||||
int serv_delete(char *arg)
|
||||
{
|
||||
char buf[256];
|
||||
char *fn;
|
||||
|
||||
if (!arg || !arg[0])
|
||||
errx(1, "missing argument to delete");
|
||||
|
||||
fn = conf(buf, sizeof(buf), arg, 0);
|
||||
if (!fn)
|
||||
errx(1, FINIT_RCSD " missing on system.");
|
||||
|
||||
if (!fexist(fn))
|
||||
errx(1, "Cannot find %s", fn);
|
||||
|
||||
if (yorn("Remove %s and any enabled symlink (y/N)? ", fn)) {
|
||||
serv_disable(arg);
|
||||
remove(fn);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Local Variables:
|
||||
* indent-tabs-mode: t
|
||||
|
||||
Reference in new issue
Block a user