commit 841bc65a7f56c069ee71045e0e2259a3775d2e3a
parent 534d5ed2080d64901c0102fcd8d837f5c2ae9d03
Author: leitner <leitner>
Date: Tue, 4 Sep 2007 14:36:33 +0000
when serdo is run without arguments, and a file called "script"
exists in the current working directory, executes that (to save a
few inodes for the "params" files
Diffstat:
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/CHANGES b/CHANGES
@@ -1,3 +1,8 @@
+0.11:
+ when serdo is run without arguments, and a file called "script"
+ exists in the current working directory, executes that (to save a
+ few inodes for the "params" files
+
0.10:
add sample script for /etc/minit/ctrlaltdel/run as
control/ctrlaltdel-run (Florian Westphal)
diff --git a/serdo.8 b/serdo.8
@@ -20,6 +20,10 @@ serdo is very limited by design, but it is nice to have if you just want
to run a few ifconfig, ip, route commands in sequence. serdo will
return the exit code of the last command it ran, 0 if none were given.
+If no file name is given, but a file called "script" exists in the
+current working directory, serdo will execute that file. This saves a
+few inodes in a typical /etc/minit tree.
+
.SH AUTHOR
minit was written by Felix von Leitner and can be downloaded from
.I http://www.fefe.de/minit/
diff --git a/serdo.c b/serdo.c
@@ -145,9 +145,15 @@ int batch(char* s) {
}
int main(int argc,char* argv[],char* env[]) {
+ static char* fakeargv[]={0,"script",0};
int r;
(void)argc;
- if (argc<2) die(1,"usage: serdo [-c] filename");
+ if (argc<2) {
+ if (!access("script",O_RDONLY))
+ argv=fakeargv;
+ else
+ die(1,"usage: serdo [-c] filename");
+ }
errmsg_iam("serdo");
for (envc=0; envc<MAXENV && env[envc]; ++envc) envp[envc]=env[envc];
envp[envc]=0;