-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap
More file actions
executable file
·73 lines (62 loc) · 1.89 KB
/
Copy pathbootstrap
File metadata and controls
executable file
·73 lines (62 loc) · 1.89 KB
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
#!/bin/bash
# Ensure we are just below the home directory
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
if [[ "$(readlink -f $here/..)" != "$(readlink -f $HOME)" ]]; then
echo "Error: bootstrap expects itself to be one level below \$HOME" 1>&2
exit 1
fi
cd $here
# Warn on incompatible shell version
if [[ ${BASH_VERSION%%.*} -lt 4 ]]; then
echo "Error: requires bash 4+, this is ${BASH_VERSION}" 1>&2
exit 1
fi
# Error on missing required commands
for cmd in m4 stow; do
if ! command -v $cmd &>/dev/null; then
echo "Error: command unavailable: $cmd" 1>&2
exit 1
fi
done
# Warn on missing commands
for cmd in ack perl python3 stow xrdb xprop xset xsetroot xdotool xdpyinfo; do
if ! command -v $cmd &>/dev/null; then
echo "Warning: command unavailable: $cmd" 1>&2
fi
done
# Warn on missing libraries
# Python 3
if command -v python3 &>/dev/null; then
for module in argparse collections dns getch glob json math operator os psutil pycron re requests requests_toolbelt shutil socket stat sys xml xrp; do
if ! python3 -c "import $module" &>/dev/null; then
echo "Warning: python3 module unavailable: $module" 1>&2
fi
done
fi
# Perl
if command -v perl &>/dev/null; then
for module in Cwd File::Next File::stat Term::ANSIColor; do
if ! perl -e "use $module;" &>/dev/null; then
echo "Warning: perl module unavailable: $module" 1>&2
fi
done
fi
# i3
if command -v i3 &>/dev/null; then
mkdir -p ${I3_HOME:-~/.i3}/bin &>/dev/null
${STOW:-stow} i3
(cd ${I3_HOME:-~/.i3} && make) &>/dev/null
touch ${I3_HOME:-~/.i3}/i3blocks.conf
fi
# bash
if grep "bash" /proc/$PPID/comm &>/dev/null; then
${STOW:-stow} bash
fi
# bin
mkdir -p ~/bin &>/dev/null
${STOW:-stow} bin
# vim
if command -v vim &>/dev/null; then
mkdir -p ~/.vim/colors &>/dev/null
${STOW:-stow} vim
fi