summaryrefslogtreecommitdiff
path: root/include/bootstrap
blob: e2d7e171b6e513471e4374fa80bf533945c9ddad (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
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env zsh
# bootstrap - populate a home with the most necessary scripts
# After running this, other packages can be installed using 'pkg'

HG=hg

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

# Make basic dirctories
mkdir -p ~/bin
mkdir -p ~/lib
mkdir -p ~/packages/.collected/{bin,doc,man/man{1..8},etc,include}
mkdir -p ~/var/tmp/incoming

if ( ! which python &> /dev/null ) {
	echo "No Python found. Sorry."
	exit 200
}

if ( ! which hg &> /dev/null) {
	echo 'Mercurial not found, installing...'
	cd ~/packages
	ssh derf.homelinux.org 'tar cz -C ~/var/packages_root .mercurial-bin' | tar xz
	HG="$HOME/packages/.mercurial-bin/mercurial-1.0.1/hg"
}

cd ~/packages
echo "fetching core"
$HG clone ssh://derf.homelinux.org/var/packages_root/core

cd core
bin/checklinks
for i in bin/*(*); {
	ln -s ../packages/core/$i $HOME/$i
}

if ([ -d $HOME/packages/.mercurial-bin ]) {
	cd ~/packages/.mercurial-bin
	~/bin/checklinks
}

[ "$RCEMPTY" = yes ] && rm $HOME/.zshrc

PATH=$HOME/bin:$PATH

rehash

pkg add zsh