summaryrefslogtreecommitdiff
path: root/Rexfile
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-09 18:43:59 +0300
committerPaul Buetow <paul@buetow.org>2026-06-09 18:43:59 +0300
commita4429106c07a23d1e5e26ee2ac413dd7f8df3901 (patch)
treee0a715c7fa73db13f02224b27a6a6fc59cb60a52 /Rexfile
parentb99470d3429a239f1c5aecaac30133cd01ac7f8f (diff)
home_tmux_rocky: fix hostname detection for Rex compatibilityHEADmaster
Diffstat (limited to 'Rexfile')
-rw-r--r--Rexfile37
1 files changed, 22 insertions, 15 deletions
diff --git a/Rexfile b/Rexfile
index 2672d0d..cdb6091 100644
--- a/Rexfile
+++ b/Rexfile
@@ -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' );
}
};