-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathsetup.sh
executable file
·110 lines (93 loc) · 2.61 KB
/
setup.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/sh
###
### Configuration section
###
### This script is for giving people a basic set of dot files using the
### '...' system. If you want to use your own custom versions of things,
### it should be enough to simply change the following variables.
###
DOTDOTDOT_SOFTWARE_REPO='git://github.com/ingydotnet/....git'
DOT_FILES_REPO='git://github.com/ingydotnet/dotdotdot.git'
DOT_SOURCE_ALIAS=dotdotdot
###
###
### Start of the install script:
###
echo 'This script will install and configure a basic ... setup.'
echo 'Many of your dot files will be overwritten, but everything will be'
echo 'backed up first, and can be easily restored with `... restore`.'
echo ''
echo 'Press Control-C to quit'
read -p 'Press Enter to install' x
# Initialize variables
DOT=$HOME/...
CONF=$DOT/conf
SRC=$DOT/src/$DOT_SOURCE_ALIAS
GIT=`which git`
PERL=`which perl`
CPIO=`which cpio`
# System sanity checks
if [ -z "$GIT" ]; then
echo "Error: 'git' not installed."
echo ''
echo "You don't absolutely need git for '...' but this script requires it."
exit
fi
if [ -z "$PERL" ]; then
echo "Error: 'perl' not installed. Cannot continue."
exit
fi
if [ -z "$CPIO" ]; then
echo "Error: 'cpio' not installed. Cannot continue."
exit
fi
# Check if already setup.
if [ -f $CONF ]; then
echo ''
echo 'This script is only intended for new ... quick installs.'
echo "$CONF already exists."
echo 'Cannot continue.'
echo ''
echo "If you really want to run this, remove $CONF"
exit
fi
if [ -e $SRC ]; then
echo ''
echo "$SRC already exists."
echo 'Cannot continue.'
echo ''
echo "If you really want to run this, remove $SRC"
exit
fi
# Check for bash.
BASH=`perl -e 'print "OK" if shift =~ /bash/' $SHELL`
if [ "$BASH" != "OK" ]; then
echo ''
echo "This script has only been tested for the 'bash' shell."
echo 'Are you sure you want to continue?'
echo ''
echo 'Press Control-C to quit'
read -p 'Press Enter to install' x
fi
# If ... is not installed, get that first.
if [ ! -e $DOT ]; then
$GIT clone $DOTDOTDOT_SOFTWARE_REPO $DOT || exit
fi
# Get a dot files repository
$GIT clone $DOT_FILES_REPO $SRC || exit
# Set up the conf file.
echo 'dot_paths:' > $CONF
echo '- path: dotdotdot' >> $CONF
if [ -n "$DOTDOTDOT_METHOD" ]; then
echo "install_method: $DOTDOTDOT_METHOD" >> $CONF
fi
# Run the ... installation!
$DOT/bin/... install || exit
# Say Goodbye...
echo ''
echo '... is now installed on your system. Please restart (or exec) your shell.'
echo 'Run "... help" to get more information.'
echo "Also read $DOT/README for full details."
echo ''
echo 'Enjoy!'
echo ''