From 236d8125f35d68d4277d4e40d71fbb384750ed94 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Tue, 5 Nov 2013 21:32:48 +0100 Subject: [PATCH] */rc: Move umask code from zsh/rc to shell/rc. Also load shell/rc in bash/rc. --- bash/rc | 1 + shell/rc | 25 +++++++++++++++++++++++++ zsh/rc | 7 +++---- 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 shell/rc diff --git a/bash/rc b/bash/rc index 948dbe4..3dfadbb 100644 --- a/bash/rc +++ b/bash/rc @@ -41,6 +41,7 @@ set -o vi source_config ~/.shell/aliases +source_config ~/.shell/rc source_config ~/.bash/rc.local diff --git a/shell/rc b/shell/rc new file mode 100644 index 0000000..175ed9a --- /dev/null +++ b/shell/rc @@ -0,0 +1,25 @@ +# Shell configuration file. + +# Copyright (C) 2013 Simon Ruderich +# +# This file is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Normal umask for root (readable by all users). +if test "`id -u`" -eq 0; then + umask 022 +# Restricted umask for normal users (readable only by me). +else + umask 077 +fi diff --git a/zsh/rc b/zsh/rc index 91d1f5d..2d7331c 100644 --- a/zsh/rc +++ b/zsh/rc @@ -50,10 +50,9 @@ zshrc_resolve_fg_to_resumed_job_name() { # MISCELLANEOUS SETTINGS -# Be paranoid, new files are readable/writable by me only, but not as root. -if [[ $UID -ne 0 ]]; then - umask 077 -fi +# Load general shell setup commands. NOTE: Expand this when publishing the +# config. +source_config ~/.shell/rc # Disable beeps. setopt nobeep -- 2.43.2