]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Merge remote-tracking branch 'smcv/umask-keywords'
authorJoey Hess <joey@kitenet.net>
Sun, 27 Nov 2011 22:33:04 +0000 (18:33 -0400)
committerJoey Hess <joey@kitenet.net>
Sun, 27 Nov 2011 22:33:04 +0000 (18:33 -0400)
IkiWiki.pm

index 637d56c7302b95d350651cc3516738a739a43df9..59fefc69933e49768e6c36d2b389f61d0fc68b6a 100644 (file)
@@ -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->() });