with-umask: New tool. DWISOTT.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 5 Apr 2015 09:53:38 +0000 (10:53 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 5 Apr 2015 09:53:38 +0000 (10:53 +0100)
Makefile.am
debian/control
debian/inst
with-umask [new file with mode: 0755]
with-umask.1 [new file with mode: 0644]

index 86027e8..2e70051 100644 (file)
@@ -178,6 +178,9 @@ hush.1: hush.1.in Makefile
        $(SUBST) $(srcdir)/hush.1.in >$@.new $(SUBSTITUTIONS) && \
                mv $@.new $@
 
+dist_bin_SCRIPTS       += with-umask
+dist_man_MANS          += with-umask.1
+
 ## bash scripts.
 if HAVE_BASH
 
index 612e813..b518388 100644 (file)
@@ -114,6 +114,11 @@ Architecture: all
 Section: utils
 Description: Captures stdin in a temporary file and runs a command.
 
+Package: with-umask
+Architecture: all
+Section: utils
+Description: Runs a command with a given umask.
+
 Package: create
 Architecture: all
 Section: utils
index e704da3..5e26960 100644 (file)
@@ -50,3 +50,5 @@ x86-model x86-model /usr/bin
 x86-model.1 x86-model /usr/share/man/man1
 hush hush /usr/bin
 hush.1 hush /usr/share/man/man1
+with-umask with-umask /usr/bin
+with-umask.1 with-umask /usr/share/man/man1
diff --git a/with-umask b/with-umask
new file mode 100755 (executable)
index 0000000..644cffb
--- /dev/null
@@ -0,0 +1,12 @@
+#! /bin/sh -e
+
+prog=${0##*/}
+usage="usage: $prog MASK CMD [ARGS ...]"
+case $1,$# in
+  -h,*) echo "$usage"; exit 0 ;;
+  -*) echo >&2 "unknown option \`$1'"; exit 1 ;;
+  ,0 | *,1) echo >&2 "$usage"; exit 1 ;;
+esac
+umask $1
+shift
+exec "$@"
diff --git a/with-umask.1 b/with-umask.1
new file mode 100644 (file)
index 0000000..c264331
--- /dev/null
@@ -0,0 +1,52 @@
+.de VS
+.sp 1
+.RS
+.nf
+.ft B
+..
+.de VE
+.ft R
+.fi
+.RE
+.sp 1
+..
+.TH with-umask 1 "5 April 2015" "Edgeware tools"
+.SH NAME
+with-umask \- run a command with a particular umask set
+.SH SYNOPSIS
+.B with-umask
+.I mode
+.I command
+.RI [ arguments ...]
+.SH DESCRIPTION
+The
+.B with-umask
+program sets its umask to
+.I mode
+and then executes
+.I command
+with the given
+.IR arguments .
+.PP
+The
+.I mode
+may be either a literal mask written in octal, where set bits correspond
+to mode bits to be forced clear when creating files, or a symbolic mode
+in
+.BR chmod (1)
+style listing the mode bits to be preserved.  (Other forms may be
+acceptable:
+.B with-umask
+is currently a shell script, and uses
+.BR /bin/sh 's
+.B umask
+built-in to do its work.)
+.PP
+Command line options:
+.TP
+.B "\-h"
+Show very brief help, and exit.
+.SH BUGS
+None known.
+.SH AUTHOR
+Mark Wooding <mdw@distorted.org.uk>