-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·72 lines (60 loc) · 1.33 KB
/
install.sh
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
#!/bin/bash
. shellib/bash_colors.sh
set -e
#
# Determine the profile dir
#
WDR=`which $0`
WDR=`dirname $WDR`
PROFILE_DIR=$WDR/profiles
INSTALL_PREFIX=${INSTALL_PREFIX:-~}
clr_green "Going to install into $INSTALL_PREFIX"
#
# Install the actual stuff
#
install() {
PROFILE_NAME=$1
MODULE_NAME=$2
DST_MODULE_NAME=$3
DST=$INSTALL_PREFIX/$DST_MODULE_NAME
SRC=$PROFILE_DIR/$PROFILE_NAME/$MODULE_NAME
if ! [ -e "$SRC" ] ; then
clr_red "Skipping $MODULE_NAME from $PROFILE_NAME : not present"
return
fi
clr_brown "Installing $DST_MODULE_NAME from $PROFILE_NAME"
if [ -d $SRC ] ; then
mkdir -p $DST
`which cp` -s -r -f $SRC/* $DST/
else
`which cp` -s -f $SRC $DST
fi
}
install_profile() {
local name=$1
clr_green "== Installing profile $name =="
. profiles/$name/profile.info
for module in $DOTMODULES ; do
install $name $module .$module
done
for module in $MODULES ; do
install $name $module $module
done
for module in $PREFIXED_DOTMODULES ; do
install $name $module .$module.${NAME_PREFIX}
done
for module in $PREFIXED_MODULES ; do
install $name $module $module.${NAME_PREFIX}
done
}
if [ -z "$1" ] ; then
install_profile "base"
install_profile "zsh"
install_profile "bash"
else
install_profile "$1"
fi
mkdir -p ~/.vim_backup
echo
clr_green "Success"
echo