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

« back to all changes in this revision

Viewing changes to usr/lib/byobu/include/dirs

  • 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
 
2
#
 
3
#    dirs: some dirs needed by all library status scripts
 
4
#
 
5
#    Copyright (C) 2011 Dustin Kirkland
 
6
#
 
7
#    Authors: Dustin Kirkland <kirkland@ubuntu.com>
 
8
#
 
9
#    This program is free software: you can redistribute it and/or modify
 
10
#    it under the terms of the GNU General Public License as published by
 
11
#    the Free Software Foundation, version 3 of the License.
 
12
#
 
13
#    This program is distributed in the hope that it will be useful,
 
14
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
#    GNU General Public License for more details.
 
17
#
 
18
#    You should have received a copy of the GNU General Public License
 
19
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
20
 
 
21
PKG="byobu"
 
22
 
 
23
# Some users build and install byobu themselves, rather than from a distro
 
24
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
 
25
[ -n "$BYOBU_PREFIX" ] || BYOBU_PREFIX="/usr"
 
26
 
 
27
# Create and export the user configuration directory
 
28
if [ -d "$BYOBU_CONFIG_DIR" ]; then
 
29
        export BYOBU_CONFIG_DIR="$BYOBU_CONFIG_DIR"
 
30
elif [ -d "$XDG_CONFIG_HOME" ]; then
 
31
        # Use XDG, as some users insist on such nonsense :-)
 
32
        export BYOBU_CONFIG_DIR="$XDG_CONFIG_HOME/$PKG"
 
33
elif [ -d "$HOME/.local/share/$PKG" ]; then
 
34
        # Use XDG common directory, if it exists
 
35
        export BYOBU_CONFIG_DIR="$HOME/.local/share/$PKG"
 
36
else
 
37
        # And to default to good old classic config dir location!
 
38
        export BYOBU_CONFIG_DIR="$HOME/.$PKG"
 
39
fi
 
40
[ -d "$BYOBU_CONFIG_DIR" ] || mkdir -p "$BYOBU_CONFIG_DIR"
 
41
 
 
42
# Grab the global, then local socket directory
 
43
[ -r "/etc/$PKG/socketdir" ] && . "/etc/$PKG/socketdir"
 
44
[ -r "$BYOBU_CONFIG_DIR/socketdir" ] && . "$BYOBU_CONFIG_DIR/socketdir"
 
45
 
 
46
# Create and export the runtime cache directory
 
47
if [ -w /dev/shm ]; then
 
48
        # Use shm for performance, if possible
 
49
        for i in /dev/shm/$PKG-$USER-*; do
 
50
                if [ -d "$i" ] && [ -O "$i" ]; then
 
51
                        export BYOBU_RUN_DIR="$i"
 
52
                        break
 
53
                fi
 
54
        done
 
55
        # Still empty, make a new one
 
56
        if [ ! -d "$BYOBU_RUN_DIR" ] || [ ! -O "$BYOBU_RUN_DIR" ]; then
 
57
                export BYOBU_RUN_DIR=$(mktemp -d /dev/shm/$PKG-$USER-XXXXXXXX)
 
58
        fi
 
59
else
 
60
        # For distros that don't have a /dev/shm, use local disk
 
61
        if [ -d "$XDG_CACHE_HOME" ]; then
 
62
                # Use XDG, as some users insist on such nonsense :-)
 
63
                export BYOBU_RUN_DIR="$XDG_CACHE_HOME/$PKG"
 
64
        else
 
65
                # But if not, we'll use a cache directory
 
66
                export BYOBU_RUN_DIR="$HOME/.cache/$PKG"
 
67
        fi
 
68
fi