forked from Bumblebee-Project/Bumblebee-old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·95 lines (76 loc) · 3.03 KB
/
install
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
#!/bin/bash
# Copyright (C) 2011 Bumblebee Project
#
# This file is part of Bumblebee.
#
# Bumblebee 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, either version 3 of the License, or
# (at your option) any later version.
#
# Bumblebee 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 Bumblebee. If not, see <http://www.gnu.org/licenses/>.
unset BASH_VERSINFO 2>/dev/null
if ! [ $BASH_VERSINFO -ge 4 ] 2>/dev/null; then
echo "You're not using bash or have an outdated one. Please run:"
echo " sudo ./install"
exit 1
fi
# Arg 1 (required): filename relative to stage/
# Arg 2: Header text to be displayed before executing the action
# Arg 3: space-separated groups for which the stage applies
install_step() {
local stage include_group group
[ -n "$2" ] && echo "== $2 =="
for stage in "${SKIP_STAGES[@]}"; do
if [[ $stage == "$1" ]]; then
echo "(skipped)"
return
fi
done
# check if there is a need to restrict installer to certain groups
while [ -n "${INCLUDE_GROUPS[*]}" ]; do
# check if the stage is within a group that is allowed to run
for include_group in "${INCLUDE_GROUPS[@]}"; do
for group in $3; do
# the stage should be executed
[[ $group == $include_group ]] && break 3
done
done
# not allowed to run
echo "(skipped)"
return
done
# try a customized step first
for stage in "$BUILDDIR/stages/$1" "stages/$1"; do
# Only run a step if it exists
if [ -f "$stage" ]; then
. "$stage"
break
fi
done
}
# definition of tools (like $LSPCI) as well as command options parsing and
# options like installation path. It's a special case as it needs to be able to
# access the commandline options, therefore do not use install_step
source stages/setvars
install_step checkprivileges "" precheck
install_step builddir "" build
install_step determinedistro "" "precheck build install postconfig"
# optional distro-specific variables, like paths
install_step "$DISTRO/setvars" "" "precheck build install postconfig"
install_step detectoldversion "" precheck
install_step welcome
install_step "$DISTRO/checkdependencies" "Checking dependencies" precheck
install_step uninstall "Removing previous version"
install_step buildfiles "Building files" build
install_step copyfiles "Installing Bumblebee" install
install_step createuninstaller "Creating uninstaller" installuninst
install_step configure "Detecting hardware & Configuring" postconfig
install_step "$DISTRO/configure" "" postconfig
install_step finish