10 : ${REPO=http://guvnor.distorted.org.uk/ftp/pub/mdw}
12 export PATH=/usr/local/bin:$HOME$sub/bin:/usr/bin:/usr/ccs/bin:/bin
14 ### Sort out command line
16 while [ $# -gt 0 ]; do
21 -*) echo >&2 "$0: bad option"; exit 1;;
27 ### Find out where I am
31 *) echo >&2 "$0: must be below $HOME"; exit 1;;
33 down=$(echo $here | sed "s#^$HOME/##")
35 ### Suss out how to print things
36 out=$(echo -n "foo"; echo "bar")
37 if [ "$out" = "foobar" ]; then
45 ### Create the necessary directories
46 echo "Creating directories..."
47 for i in bin lib/emacs src; do
49 if [ -d $HOME$sub/$i ]; then
50 echo " already exists."
58 ### Find out how to fetch things over the net
59 $echon "Finding URL fetcher:$echoc"
60 if curl >/dev/null 2>&1 --version || [ $? -eq 2 ]; then
63 elif wget >/dev/null 2>&1 --version; then
68 echo >&2 "$0: failed to find URL fetcher"
72 ### Install necessary things
73 echo "Installing useful scripts..."
75 for script in lesspipe.sh start-ssh-agent svnwrap; do
76 $echon " $script:$echoc"
78 for p in /bin /usr/bin /usr/local/bin $(echo $PATH | tr : ' '); do
79 if $false [ -x $p/$script ]; then
85 echo " already installed."
87 $echon " downloading$echoc"
88 $GETURL $HOME$sub/bin/$script $REPO/$script
89 chmod +x $HOME$sub/bin/$script
96 ### Install some more complicated programs
97 echo "Installing packages..."
99 mLib:2.0.3:mLib-config
102 [ "$xstuff" ] && systems="$systems
103 mgLib:1.1.0:mgLib-config
106 for system in $systems; do
107 set -- $(echo $system | tr : ' ')
108 sys=$1 ver=$2 prog=$3
109 $echon " $sys:$echoc"
110 if $false $prog >/dev/null 2>&1 --version; then
111 echo " already installed."
114 $echon " downloading$echoc"
116 rm -rf $sys-$ver.tar.gz $sys-$ver
117 $GETURL $sys-$ver.tar.gz $REPO/$sys-$ver.tar.gz
118 $echon " unpacking$echoc"
119 gzip -cd $sys-$ver.tar.gz | tar xf -
120 $echon " configuring$echoc"
124 ../configure --prefix=$HOME$sub >>buildlog 2>&1
125 $echon " building$echoc"
127 $echon " installing$echoc"
128 make install >>buildlog 2>&1
135 ### Symlink the various dotfiles into place
137 bash_profile bash_logout bashrc
140 cmucl-init.lisp clisprc.lisp sbclrc
142 [ "$xstuff" ] && dotfiles="$dotfiles xinitrc xsession Xdefaults"
144 echo "Installing dotfiles..."
145 for d in $dotfiles; do
147 rm -f "$HOME$sub/.$d"
148 ln -s $up$down/$d $HOME$sub/.$d
153 ### Set up the Emacs config
154 echo "Installing Emacs packages..."
155 for elib in make-regexp; do
156 $echon " $elib:$echoc"
157 if $false emacs >/dev/null 2>&1 --batch --eval '
158 (kill-emacs (condition-case nil
159 (progn (load-library "make-regexp") 0)
161 echo " already installed."
163 $echon " downloading$echoc"
164 $GETURL $HOME$sub/lib/emacs/make-regexp.el $REPO/make-regexp.el
165 $echon " compiling$echoc"
166 (cd $HOME$sub/lib/emacs;
167 emacs >/dev/null 2>&1 --batch \
168 --eval '(byte-compile-file "make-regexp.el")')
174 $echon "Setting up Emacs configuration:$echoc"
175 $echon " linking$echoc"
176 for link in dot-emacs.el:dot-emacs.el emacs-Makefile:Makefile; do
177 set -- $(echo $link | tr : ' ')
179 rm -f $HOME$sub/lib/emacs/$to
180 ln -s ../../$up$down/$from $HOME$sub/lib/emacs/$to
182 $echon " compiling$echoc"
183 make >/dev/null 2>&1 -C $HOME$sub/lib/emacs