forked from 0x20h/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall
More file actions
executable file
·68 lines (53 loc) · 1011 Bytes
/
install
File metadata and controls
executable file
·68 lines (53 loc) · 1011 Bytes
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
#!/bin/sh
info() { echo "\033[1;32m$1\033[0m"; }
title() { echo "\033[1;34m$1\033[0m"; }
warn() { echo "\033[1;31m$1\033[0m"; }
FILTER=${1:-"*"}
pin() {
local pin=""
if [ ! -f $BASE/pins ]; then
warn "$BASE/pins missing"
return 1
fi
p=$(grep "$1" $BASE/pins | cut -d ' ' -f 2)
if [ -z "$p" ]; then
return 1
fi
echo $p
return 0
}
dependencies() {
local deps=""
title "Fetching dependencies"
title "---------------------"
for s in install.d/$FILTER; do
. $s
for r in $(depends); do
deps="$deps $r"
done;
done
deps=$(echo $deps | tr " " "\n" | sort | uniq | xargs)
if [ -z "$deps" ]; then
info "No dependencies found..."
else
info "Collected: '$deps', installing..."
sudo apt-get install $deps
fi
}
BASE=$(readlink -f $(dirname $0))
cd $BASE
dependencies
if [ ! -d ~/bin ]; then
mkdir ~/bin
fi
if [ ! -d $BASE/git ]; then
mkdir $BASE/git
fi
REPOS=$BASE/git
title "Installing"
for s in install.d/$FILTER; do
info "$s::install()"
. $s
install
cd $BASE
done