summaryrefslogtreecommitdiff
path: root/include/bootstrap
blob: 3935909608db7b820bd853b3e1c3c63d847885a0 (plain)
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
#!/usr/bin/env zsh
# bootstrap - populate a home with the most necessary scripts
# After running this, other packages can be installed using 'pkg'

typeset -i rcempty=0
typeset PKG_ROOT

if [[ -n $1 ]] {
	PKG_ROOT=$1
} else {
	echo "Usage: ./bootstrap PKG_ROOT"
	exit 100
}

# zsh keeps complaining about not having a configuration,
# so let's be kind and give it an empty one.
if ! [[ -e ~/.zshrc ]] {
	rcempty=1
	touch ~/.zshrc
}

# Make basic dirctories
mkdir -p ~/bin
mkdir -p ~/packages/.collected/man/man{1..8}

if ! which git &> /dev/null; then
	echo "git not found. Sorry."
	exit 200
fi

cd ~/packages
echo "fetching core..."
git clone $PKG_ROOT/core

cd core || exit 1
echo "PKG_ROOT='$PKG_ROOT'" > ~/.pkg.conf
bin/checklinks
bin/pkg eval populate_collected core
bin/pkg eval exec_hook core post-add

(( rcempty )) && rm ~/.zshrc