-
Notifications
You must be signed in to change notification settings - Fork 1
/
buildconfig
68 lines (58 loc) · 1.47 KB
/
buildconfig
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
export LC_ALL=C
export DEBIAN_FRONTEND=noninteractive
DEFAULT_RUBY_GEMS='rake rack'
if perl -v >/dev/null 2>/dev/null; then
RESET=`perl -e 'print("\e[0m")'`
BOLD=`perl -e 'print("\e[1m")'`
YELLOW=`perl -e 'print("\e[33m")'`
BLUE_BG=`perl -e 'print("\e[44m")'`
elif python -V >/dev/null 2>/dev/null; then
RESET=`echo 'import sys; sys.stdout.write("\033[0m")' | python`
BOLD=`echo 'import sys; sys.stdout.write("\033[1m")' | python`
YELLOW=`echo 'import sys; sys.stdout.write("\033[33m")' | python`
BLUE_BG=`echo 'import sys; sys.stdout.write("\033[44m")' | python`
else
RESET=
BOLD=
YELLOW=
BLUE_BG=
fi
function minimal_apt_get_install()
{
if [[ ! -e /var/lib/apt/lists/lock ]]; then
apt-get update
fi
apt-get install -y --no-install-recommends "$@"
}
function apt_add_ppa()
{
add-apt-repository -y $1
apt-get update
}
function cleanup_apt()
{
run apt-get -y clean
run rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/log/dpkg.log /var/log/apt/*
}
function header()
{
local title="$1"
echo "${BLUE_BG}${YELLOW}${BOLD}${title}${RESET}"
echo "------------------------------------------"
}
function run()
{
echo "+ $@"
"$@"
}
function create_rvm_wrapper_script()
{
local name="$1"
local rvm_id="$2"
local command="$3"
rm -f "/usr/bin/$name"
echo "+ Creating /usr/bin/$name"
echo '#!/bin/sh' >> "/usr/bin/$name"
echo exec "/usr/local/rvm/wrappers/$rvm_id/$command" '"$@"' >> "/usr/bin/$name"
chmod +x "/usr/bin/$name"
}