timp87

netbsd ensure

Aug 17th, 2015
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.86 KB | None | 0 0
  1. timp@timbsd:~/mygithub/Rex % git diff
  2. diff --git a/lib/Rex/Service/NetBSD.pm b/lib/Rex/Service/NetBSD.pm
  3. index 958adf2..a47aa44 100644
  4. --- a/lib/Rex/Service/NetBSD.pm
  5. +++ b/lib/Rex/Service/NetBSD.pm
  6. @@ -44,11 +44,16 @@ sub ensure {
  7.  
  8.    if ( $what =~ /^stop/ ) {
  9.      $self->stop( $service, $options );
  10. -    delete_lines_matching "/etc/rc.conf", matching => qr/${service}=YES/;
  11. +    #rm -rf /etc/rc.conf.d/$service;
  12. +    delete_lines_matching "/etc/rc.conf",
  13. +      matching => qr/\s*${service}="?((?i)YES)"?/;
  14.    }
  15.    elsif ( $what =~ /^start/ || $what =~ m/^run/ ) {
  16.      $self->start( $service, $options );
  17. -    append_if_no_such_line "/etc/rc.conf", "${service}=YES\n";
  18. +    #rm -rf /etc/rc.conf.d/$service;
  19. +    append_or_amend_line "/etc/rc.conf",
  20. +      line => "${service}=YES",
  21. +      regexp => qr/^\s*${service}="?((?i)YES|NO)"?/;
  22.    }
  23.  
  24.    return 1;
Advertisement
Add Comment
Please, Sign In to add comment