~ubuntu-branches/debian/wheezy/byobu/wheezy

« back to all changes in this revision

Viewing changes to usr/bin/byobu-select-backend

  • Committer: Package Import Robot
  • Author(s): Alexander Chernyakhovsky
  • Date: 2012-01-11 19:37:34 UTC
  • mfrom: (0.5.3) (0.1.162 precise)
  • Revision ID: package-import@ubuntu.com-20120111193734-89083z97py39gj05
Tags: 5.2-1
* Syncing from Ubuntu. Remaining changes:
  - Switch to dh short syntax
  - Added a substvar ${perl:Depends} dependency into debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh -e
 
2
#
 
3
#    byobu-select-backend
 
4
#    Copyright (C) 2011 Dustin Kirkland
 
5
#
 
6
#    Authors: Dustin Kirkland <kirkland@ubuntu.com>
 
7
#
 
8
#    This program is free software: you can redistribute it and/or modify
 
9
#    it under the terms of the GNU General Public License as published by
 
10
#    the Free Software Foundation, version 3 of the License.
 
11
#
 
12
#    This program is distributed in the hope that it will be useful,
 
13
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
#    GNU General Public License for more details.
 
16
#
 
17
#    You should have received a copy of the GNU General Public License
 
18
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
 
 
20
 
 
21
PKG="byobu"
 
22
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
 
23
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
 
24
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
 
25
 
 
26
usage () {
 
27
        cat <<EOT
 
28
Usage: $0 [screen|tmux]
 
29
 
 
30
    Without any parameters, it runs interactively.
 
31
EOT
 
32
        exit 1
 
33
}
 
34
 
 
35
prompt() {
 
36
        local choice
 
37
        echo
 
38
        echo "Select the byobu backend:"
 
39
        echo "  1. tmux"
 
40
        echo "  2. screen"
 
41
        echo
 
42
        printf "Choose 1-2 [1]: "
 
43
        choice=$(head -n1)
 
44
        case $choice in
 
45
                1|"") _RET="tmux" ;;
 
46
                2) _RET="screen" ;;
 
47
                *) prompt ;;
 
48
        esac
 
49
}
 
50
 
 
51
case $1 in
 
52
        "")
 
53
                prompt
 
54
                choice="$_RET"
 
55
        ;;
 
56
        screen|tmux)
 
57
                choice="$1"
 
58
        ;;
 
59
        *)
 
60
                usage
 
61
        ;;
 
62
esac
 
63
echo "BYOBU_BACKEND=$choice" > "$BYOBU_CONFIG_DIR/backend"