From 942a4e5cd2062f2b1b18521c6e529165dc34632d Mon Sep 17 00:00:00 2001 From: Francois Marier Date: Sat, 29 Aug 2020 11:32:31 -0700 Subject: [PATCH] Add /usr/local/etc/safe-rm.conf as an alternative config file (bug #1893500) --- Changes | 3 +++ README | 4 ++-- safe-rm | 7 +++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Changes b/Changes index 35a2e0e..3a492fc 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,6 @@ +0.13 (UNRELEASED) + - Add /usr/local/etc/safe-rm.conf as alternative config file (bug #1893500). + 0.12 (2014-11-03) - Remove unnecessary dependency on Env diff --git a/README b/README index 91ae928..9b4df4e 100644 --- a/README +++ b/README @@ -23,8 +23,8 @@ Once you have installed safe-rm on your system (see INSTALL), you will need to fill the system-wide or user-specific blacklists with the paths that you'd like to protect against accidental deletion. -The system-wide blacklist lives in /etc/safe-rm.conf and you should probably add -paths like these: +The system-wide blacklist lives in /etc/safe-rm.conf (or /usr/local/etc/safe-rm.conf) +and you should probably add paths like these: / /etc diff --git a/safe-rm b/safe-rm index b9a855d..6fb2761 100755 --- a/safe-rm +++ b/safe-rm @@ -10,6 +10,7 @@ my $homedir = $ENV{HOME} || q{}; my $LEGACY_CONFIG_FILE = "$homedir/.safe-rm"; my $USER_CONFIG_FILE = ($ENV{XDG_CONFIG_HOME} || "$homedir/.config") . "/safe-rm"; my $GLOBAL_CONFIG_FILE = '/etc/safe-rm.conf'; +my $GLOBAL_LOCAL_CONFIG_FILE = '/usr/local/etc/safe-rm.conf'; my %default_protected_dirs = ( '/bin' => 1, @@ -64,6 +65,7 @@ sub read_config_file { } read_config_file($GLOBAL_CONFIG_FILE); +read_config_file($GLOBAL_LOCAL_CONFIG_FILE); read_config_file($LEGACY_CONFIG_FILE); read_config_file($USER_CONFIG_FILE); @@ -152,13 +154,14 @@ You could create the following symbolic link: Protected paths can be set both at the site and user levels. -Both of these configuration files can contain a list of important files +All of these configuration files can contain a list of important files or directories (one per line): /etc/safe-rm.conf + /usr/local/etc/safe-rm.conf ~/.config/safe-rm -If both of these are empty, a default list of important paths will be +If all of these are empty, a default list of important paths will be used. =for stopword Wildcards -- 2.11.4.GIT