Add support for user not willing to overwrite config file
It's a good practice to let a already existent configuration file untouched, letting the user to decide if the new tool should or not overwrite. This patch adds this option via a command line flag specific to the "install" option: $ ./nipe.pl install -f ... [.] Overwriting system Tor's config file [.] .configs/fedora-torrc -> /etc/tor/torrc Otherwise, he's notified about the possibility to use one of the configuration files present in the project's home dir. $ ./nipe.pl install ... [.] Refer to our custom Tor config files in project home NOTE: It can be further enhanced in future version of the tool.master
parent
fb800ded74
commit
7bc34e8467
|
@ -9,6 +9,7 @@ sub new {
|
|||
\r\tCommand Description
|
||||
\r\t------- -----------
|
||||
\r\tinstall Install dependencies
|
||||
\r\t -f Overwrite Tor config file in /etc/tor/torrc
|
||||
\r\tstart Start routing
|
||||
\r\tstop Stop routing
|
||||
\r\trestart Restart the Nipe process
|
||||
|
|
|
@ -5,6 +5,8 @@ package Nipe::Install;
|
|||
use Nipe::Device;
|
||||
|
||||
sub new {
|
||||
shift; # ignore class name
|
||||
my $force_cfg = shift;
|
||||
my $operationalSystem = Nipe::Device -> getSystem();
|
||||
|
||||
if ($operationalSystem eq "debian") {
|
||||
|
@ -23,8 +25,16 @@ sub new {
|
|||
system ("sudo pacman -S tor iptables");
|
||||
}
|
||||
|
||||
system ("sudo cp .configs/$operationalSystem-torrc /etc/tor/torrc");
|
||||
system ("sudo chmod 644 /etc/tor/torrc");
|
||||
if (defined($force_cfg)) {
|
||||
print "[.] Overwriting system Tor's config file\n";
|
||||
print "[.] .configs/$operationalSystem-torrc -> /etc/tor/torrc\n";
|
||||
system ("sudo cp .configs/$operationalSystem-torrc /etc/tor/torrc");
|
||||
system ("sudo chmod 644 /etc/tor/torrc");
|
||||
}
|
||||
|
||||
else {
|
||||
print "[.] Refer to our custom Tor config files in project home\n";
|
||||
}
|
||||
|
||||
if (-e "/etc/init.d/tor") {
|
||||
system ("sudo /etc/init.d/tor stop > /dev/null");
|
||||
|
|
Loading…
Reference in New Issue