This file is indexed.

/usr/bin/byobu is in byobu 5.87-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
#!/bin/sh -e
#
#    byobu - wrapper script
#    Copyright (C) 2008-2009 Canonical Ltd.
#    Copyright (C) 2008-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.co>
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, version 3 of the License.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

VERSION=5.87
PKG="byobu"

# All sorts of things go wrong if you don't own your $HOME dir.
# This happens under sudo, if you don't use the -H option; Byobu will
# create a bunch of files in your $HOME which will be owned by root.
if [ ! -O "$HOME" ]; then
	echo "Cannot run $PKG because [$USER] does not own [$HOME]" 1>&2
	if [ -n "$SUDO_USER" ]; then
		echo "To run $PKG under sudo, you MUST use 'sudo -H'" 1>&2
	fi
	exit 1
fi

# Source local byobu config
if [ -r "$HOME/.byoburc" ]; then
	# Ensure that this configuration is usable
	. "$HOME/.byoburc" || mv -f "$HOME/.byoburc".orig
fi
if [ -z "${BYOBU_PREFIX}" ]; then
	# Find and export the installation location prefix
	greadlink -f . >/dev/null 2>&1 && export BYOBU_READLINK="greadlink" || export BYOBU_READLINK="readlink"
	prefix="$(dirname $(dirname $($BYOBU_READLINK -f $0)))"
	if [ "$prefix" != "/usr" ]; then
		echo "export BYOBU_PREFIX='$prefix'" >> "$HOME/.byoburc"
		. "$HOME/.byoburc"
	fi
fi
export BYOBU_CHARMAP=$(locale charmap)
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

# Override backend if we can determine intentions from argv[0]
[ -r "$HOME/.$PKG/backend" ] && . "$HOME/.$PKG/backend"
case "$0" in
	*byobu-screen) BYOBU_BACKEND="screen" ;;
	*byobu-tmux) BYOBU_BACKEND="tmux" ;;
esac

# At this point, we're sure BYOBU_BACKEND is properly defined
export BYOBU_BACKEND

# Store the parent tty
export BYOBU_TTY=$(tty)

# Get the default window name
[ -n "$BYOBU_WINDOW_NAME" ] || BYOBU_WINDOW_NAME=-

# Add a version argument for debugging purposes
if [ "$#" = "1" ]; then
	case "$1" in
		-v|--version)
			echo "$PKG version $VERSION"
			if $BYOBU_TEST bash >/dev/null 2>&1; then
				# Check ulimits
				u=$(bash -c "ulimit -n")
				[ "$u" = "unlimited" ] || [ $u -ge 15 ] || echo "WARNING: ulimit -n is too low" 1>&2
				u=$(bash -c "ulimit -u")
				[ "$u" = "unlimited" ] || [ $u -ge 1600 ] || echo "WARNING: ulimit -u is too low" 1>&2
			fi
			exec $BYOBU_BACKEND $BYOBU_ARG_VERSION
			exit 0
		;;
	esac
fi

# Check if we're being autolaunched, and this user explicitly does not want it.
if [ "$0" = "/etc/profile.d/Z98-$PKG.sh" ] && [ -r "$BYOBU_CONFIG_DIR/disable-autolaunch" ]; then
	exit 0
fi

# Sanitize the environment
byobu-janitor --force

# Set the window title
[ -r "$BYOBU_CONFIG_DIR/statusrc" ] && . "$BYOBU_CONFIG_DIR/statusrc"
. $BYOBU_PREFIX/lib/$PKG/ip_address
[ -n "$BYOBU_NO_TITLE" ] || printf "\033]0;${USER}@$(hostname) ($(__ip_address t)) - ${PKG}\007"

# Drop a symlink to the ssh socket in $HOME, since we can ensure that exists
if [ -S "$SSH_AUTH_SOCK" ] && [ ! -h "$SSH_AUTH_SOCK" ]; then
	ln -sf "$SSH_AUTH_SOCK" "$BYOBU_CONFIG_DIR/.ssh-agent"
	export SSH_AUTH_SOCK="$BYOBU_CONFIG_DIR/.ssh-agent"
fi

case $BYOBU_BACKEND in
	tmux)
		# Use 256 colors if possible
		if $BYOBU_TEST tput >/dev/null; then
			if [ "$(tput colors 2>/dev/null || echo 0)" = "256" ] || [ "$COLORTERM" = "gnome-terminal" ] || [ "$TERM" = "xterm" ] || [ "$TERM" = "xterm-256color" ]; then
				[ -z "$SCREEN_TERM" ] && SCREEN_TERM="-2"
			fi
		fi
		BYOBU_PROFILE="-f $BYOBU_PREFIX/share/$PKG/profiles/tmuxrc"
		DEFAULT_WINDOW="new-session -n $BYOBU_WINDOW_NAME ${BYOBU_PREFIX}/bin/byobu-shell"
		sessions=$($BYOBU_BACKEND list-sessions 2>/dev/null) || true
		CUSTOM_WINDOW_SET=0
		if [ -s "$BYOBU_CONFIG_DIR/windows.tmux.$BYOBU_WINDOWS" ]; then
			CUSTOM_WINDOW_SET=1
			BYOBU_WINDOWS="$BYOBU_CONFIG_DIR/windows.tmux.$BYOBU_WINDOWS"
		elif [ -s "$BYOBU_CONFIG_DIR/windows.tmux" ]; then
			CUSTOM_WINDOW_SET=1
			BYOBU_WINDOWS="$BYOBU_CONFIG_DIR/windows.tmux"
		fi
	;;
	screen)
		# Allow override of default window list, with BYOBU_WINDOWS environment variable
		CUSTOM_WINDOW_SET=0
		if [ -s "$BYOBU_WINDOWS" ]; then
			CUSTOM_WINDOW_SET=1
		elif [ -s "$BYOBU_CONFIG_DIR/windows.$BYOBU_WINDOWS" ]; then
			CUSTOM_WINDOW_SET=1
			BYOBU_WINDOWS="$BYOBU_CONFIG_DIR/windows.$BYOBU_WINDOWS"
		elif [ "$#" = "0" ]; then
			BYOBU_WINDOWS="$BYOBU_CONFIG_DIR/windows"
		else
			BYOBU_WINDOWS="/dev/null"
		fi
		export BYOBU_WINDOWS
		# Launch shell, unless the user has default windows set to launch
		uncommented_lines < "$BYOBU_WINDOWS" && DEFAULT_WINDOW= || DEFAULT_WINDOW="${BYOBU_PREFIX}/bin/byobu-shell"
		# Check if our terminfo supports 256 colors
		if $BYOBU_TEST tput >/dev/null; then
			if [ "$(tput colors 2>/dev/null || echo 0)" = "256" ]; then
				SCREEN_TERM="-T screen-256color"
			fi
		fi
		# Some users want to maintain separate configurations
		# if they use both GNU Screen and byobu on the same system
		if [ -r "$BYOBU_CONFIG_DIR/.screenrc" ]; then
			BYOBU_PROFILE="-c $BYOBU_PREFIX/share/$PKG/profiles/byoburc"
		else
			BYOBU_PROFILE="-c $BYOBU_PREFIX/share/$PKG/profiles/screenrc"
		fi
		BYOBU_SESSION_NAME="-S $PKG"
		# Zero out $BYOBU_SESSION_NAME if user has specified a session name
		for i in "$@"; do
			case $i in
				-*r*|-*d*|-*D*|-*S*|-ls|-list)
					BYOBU_SESSION_NAME=
				;;
			esac
		done
		sessions=$($BYOBU_BACKEND -wipe 2>/dev/null) || true
	;;
esac

# Save session info
[ -n "$DBUS_SESSION_BUS_ADDRESS" ] && printf "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS\n" > "$BYOBU_RUN_DIR/sockets"
[ -n "$SESSION_MANAGER" ] && printf "SESSION_MANAGER=$SESSION_MANAGER\n" >> "$BYOBU_RUN_DIR/sockets"

# Now let's execute the backend!
if [ "$#" = "0" ]; then
	if [ "$CUSTOM_WINDOW_SET" = "1" ]; then
		# Start new custom window set session
		case $BYOBU_BACKEND in
			tmux)
				exec tmux $SCREEN_TERM $BYOBU_PROFILE $(cat "$BYOBU_WINDOWS")
			;;
			screen)
				exec screen $SCREEN_TERM $BYOBU_SESSION_NAME $BYOBU_PROFILE
			;;
		esac
	else
		case "$sessions" in
			*\(*\)*)
				# Select and attach to an existing session
				exec byobu-select-session
			;;
			*)
				# Start new default session
				case $BYOBU_BACKEND in
					tmux)
						exec tmux $SCREEN_TERM $BYOBU_PROFILE $DEFAULT_WINDOW
					;;
					screen)
						exec screen $SCREEN_TERM $BYOBU_SESSION_NAME $BYOBU_PROFILE $DEFAULT_WINDOW
					;;
				esac
			;;
		esac
	fi
else
	# Launch with command line args
	case $BYOBU_BACKEND in
		tmux)
			exec $BYOBU_BACKEND $SCREEN_TERM $BYOBU_PROFILE "$@"
		;;
		screen)
			exec $BYOBU_BACKEND $SCREEN_TERM $BYOBU_SESSION_NAME $BYOBU_PROFILE "$@"
		;;
	esac
fi

# vi: syntax=sh ts=4 noexpandtab