aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki.pm
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2011-11-27 14:14:47 +0000
committerSimon McVittie <smcv@debian.org>2011-11-27 14:14:47 +0000
commit3df7d143469d8d659a9a70cae24b71ddcb73f70e (patch)
treebe50a3745bf90649656f13b26c3ed8e506addf5f /IkiWiki.pm
parentbe0aaa6dcd346b83b23ed723ed1ef0127ca8312a (diff)
downloadikiwiki-3df7d143469d8d659a9a70cae24b71ddcb73f70e.tar
ikiwiki-3df7d143469d8d659a9a70cae24b71ddcb73f70e.tar.gz
Support private, group, public as values for umask
These are equivalent to octal 077, 027 and 022, but easier to get from YAML. Signed-off-by: Simon McVittie <smcv@debian.org>
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r--IkiWiki.pm24
1 files changed, 20 insertions, 4 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 637d56c73..59fefc699 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -305,9 +305,9 @@ sub getsetup () {
rebuild => 0,
},
umask => {
- type => "integer",
- example => "022",
- description => "force ikiwiki to use a particular umask",
+ type => "string",
+ example => "public",
+ description => "force ikiwiki to use a particular umask (keywords public, group or private, or a number)",
advanced => 1,
safe => 0, # paranoia
rebuild => 0,
@@ -587,7 +587,23 @@ sub checkconfig () {
unless exists $config{wikistatedir} && defined $config{wikistatedir};
if (defined $config{umask}) {
- umask(possibly_foolish_untaint($config{umask}));
+ my $u = possibly_foolish_untaint($config{umask});
+
+ if ($u =~ m/^\d+$/) {
+ umask($u);
+ }
+ elsif ($u eq 'private') {
+ umask(077);
+ }
+ elsif ($u eq 'group') {
+ umask(027);
+ }
+ elsif ($u eq 'public') {
+ umask(022);
+ }
+ else {
+ error(sprintf(gettext("unsupported umask setting %s"), $u));
+ }
}
run_hooks(checkconfig => sub { shift->() });