File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,12 +44,20 @@ if [ $# -eq 0 ]
4444then # Interactive shell
4545 if [ $( which tmux) ]
4646 then # with tmux installed
47- tmux new-session -s halium-adb -d ' adb shell'
47+ TARGET=" halium-adb-$( cat /dev/urandom | tr -dc ' a-zA-Z0-9' | fold -w 8 | head -n 1) "
48+ if [ $TMUX ]
49+ then # create new window if we are in a tmux session
50+ tmux new-window -n $TARGET -d ' adb shell'
51+ SWITCH=' select-window'
52+ else # create a new tmux session if none exists
53+ tmux new-session -s $TARGET -d ' adb shell'
54+ SWITCH=' attach-session'
55+ let LINES-=1
56+ fi
4857 sleep 1
49- let LINES-=1
50- tmux send-keys -t halium-adb " export LINES=${LINES} ; export COLUMNS=${COLUMNS} " $' \n '
51- tmux send-keys -t halium-adb " ${CHROOT} /bin/bash; exit" $' \n '
52- tmux attach -t halium-adb
58+ tmux send-keys -t $TARGET " export LINES=${LINES} ; export COLUMNS=${COLUMNS} " $' \n '
59+ tmux send-keys -t $TARGET " ${CHROOT} /bin/bash; exit" $' \n '
60+ tmux $SWITCH -t $TARGET
5361 else # without tmux installed
5462 echo ' To automatically get an interactive chroot session, install'
5563 echo ' The program "tmux". To enter the chroot environment run:'
You can’t perform that action at this time.
0 commit comments