forked from neopragma/docgen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevinit
executable file
·64 lines (55 loc) · 1.71 KB
/
devinit
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
#!/bin/bash
# devinit
# Set up the development environment for docgen.
# (assumes bash)
declare -a debian_pkg
debian_pkg[${#debian_pkg[@]}]='git' # version control client
debian_pkg[${#debian_pkg[@]}]='build-essential' # build dependencies
debian_pkg[${#debian_pkg[@]}]="linux-headers-$(uname -r)"
debian_pkg[${#debian_pkg[@]}]='ruby'
debian_pkg[${#debian_pkg[@]}]='ruby-dev'
debian_pkg[${#debian_pkg[@]}]='sqlite3' # database for docgen
debian_pkg[${#debian_pkg[@]}]='inputenc' # kramdown LaTeX output
debian_pkg[${#debian_pkg[@]}]='fontenc'
debian_pkg[${#debian_pkg[@]}]='listings'
debian_pkg[${#debian_pkg[@]}]='hyperref'
function identify_os {
THIS_OS=
if [[ "$OSTYPE" == "linux-gnu" ]]; then
THIS_OS='Linux'
identify_linux_package_manager
else
'Unsupported OS'
# elif [[ "$OSTYPE" == "darwin"* ]]; then
# echo 'OSX detected'
# elif [[ "$OSTYPE" == "cygwin" ]]; then
# echo 'Cygwin detected'
# elif [[ "$OSTYPE" == "msys" ]]; then
# echo 'Mingw32 detected'
# elif [[ "$OSTYPE" == "freebsd"* ]]; then
# echo 'FreeBSD detected'
# else
# echo 'OS not identified'
fi
}
function identify_linux_package_manager {
if [[ $(which apt) ]]; then
PKG_MGR='apt'
elif [[ $(which yum) ]]; then
PKG_MGR='yum'
fi
}
function install_packages {
echo '' > devinit.log
identify_os
for name in "${debian_pkg[@]}"
do
if [[ -n "$(dpkg -l | grep ${name})" ]]; then
echo "package ${name} is installed...skipping install" >> devinit.log
else
echo "installing package ${name}" >> devinit.log
sudo apt install -y "$name" &>> devinit.log
fi
done
}
install_packages