diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-09 18:43:59 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-09 18:43:59 +0300 |
| commit | a4429106c07a23d1e5e26ee2ac413dd7f8df3901 (patch) | |
| tree | e0a715c7fa73db13f02224b27a6a6fc59cb60a52 /Rexfile | |
| parent | b99470d3429a239f1c5aecaac30133cd01ac7f8f (diff) | |
Diffstat (limited to 'Rexfile')
| -rw-r--r-- | Rexfile | 37 |
1 files changed, 22 insertions, 15 deletions
@@ -295,25 +295,32 @@ task 'home_tmux', sub { desc 'Install tmux rocky overrides (C-g prefix for nested tmux)'; task 'home_tmux_rocky', sub { - if ( $^O eq 'linux' && (hostname() // '') =~ /rocky/ ) { - my $conf = "$HOME/.config/tmux/tmux.local.conf"; - my $line = "source-file ~/.config/tmux/tmux.rocky.conf"; - - if ( -f $conf ) { - my $content = do { local $/; open my $fh, '<', $conf or die $!; <$fh> }; - if ( $content !~ /\Q$line\E/ ) { - Rex::Logger::info("Appending tmux.rocky.conf source to $conf"); - open my $fh, '>>', $conf or die $!; - print $fh "\n$line\n"; - close $fh; - } - else { - Rex::Logger::info("tmux.rocky.conf already sourced in $conf"); + if ( $^O eq 'linux' ) { + my $hostname = `hostname 2>/dev/null` // ''; + chomp $hostname; + if ( $hostname =~ /rocky/ ) { + my $conf = "$HOME/.config/tmux/tmux.local.conf"; + my $line = "source-file ~/.config/tmux/tmux.rocky.conf"; + + if ( -f $conf ) { + my $content = do { local $/; open my $fh, '<', $conf or die $!; <$fh> }; + if ( $content !~ /\Q$line\E/ ) { + Rex::Logger::info("Appending tmux.rocky.conf source to $conf"); + open my $fh, '>>', $conf or die $!; + print $fh "\n$line\n"; + close $fh; + } + else { + Rex::Logger::info("tmux.rocky.conf already sourced in $conf"); + } } } + else { + Rex::Logger::info( 'Skipping tmux rocky overrides (not on rocky)', 'warn' ); + } } else { - Rex::Logger::info( 'Skipping tmux rocky overrides (not on rocky)', 'warn' ); + Rex::Logger::info( 'Skipping tmux rocky overrides (not on linux)', 'warn' ); } }; |
