10 [ -f setup-local ] && . setup-local
11 : ${REPO=http://guvnor.distorted.org.uk/ftp/pub/mdw/profile}
13 export PATH=/usr/local/bin:$HOME$sub/bin:/usr/bin:/usr/ccs/bin:/bin
15 ### Sort out command line
17 while [ $# -gt 0 ]; do
22 -*) echo >&2 "$0: bad option"; exit 1;;
28 ### Find out where I am
31 ### Suss out how to print things
32 out=$(echo -n "foo"; echo "bar")
33 if [ "$out" = "foobar" ]; then
41 ### Create the necessary directories
42 echo "Creating directories..."
43 for i in bin lib/emacs src; do
45 if [ -d $HOME$sub/$i ]; then
46 echo " already exists."
54 ### Find out how to fetch things over the net
55 $echon "Finding URL fetcher:$echoc"
56 if curl >/dev/null 2>&1 --version || [ $? -eq 2 ]; then
59 elif wget >/dev/null 2>&1 --version; then
64 echo >&2 "$0: failed to find URL fetcher"
68 ### Install necessary things
69 echo "Installing useful scripts..."
72 lesspipe.sh start-ssh-agent svnwrap"
73 [ "$xstuff" ] && scripts="$scripts
75 for script in $scripts; 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 ### Install global configuration
136 echo -n "Installing dotfile configuration:"
137 if [ -f $HOME$sub/.mdw.conf ]; then
138 echo " already installed."
140 cp mdw.conf $HOME$sub/.mdw.conf
144 ### Symlink the various dotfiles into place
146 bash_profile bash_logout bashrc inputrc
149 lisp-init.lisp:.cmucl-init.lisp
150 lisp-init.lisp:.sbclrc
151 lisp-init.lisp:.clisprc.lisp
152 dircolors screenrc cvsrc"
153 [ "$xstuff" ] && dotfiles="$dotfiles
154 xinitrc xsession Xdefaults vncrc vncsession
155 eterm-theme.cfg:.Eterm/themes/Eterm/theme.cfg
156 e-keybindings.cfg:.enlightenment/keybindings.cfg
157 evnc-keybindings.cfg:.enlightenment-vnc/keybindings.cfg
158 jue-peek.jpg:.enlightenment/backgrounds/jue-peek.jpg"
160 echo "Installing dotfiles..."
161 for d in $dotfiles; do
164 *:*) target=${d#*:} d=${d%%:*};;
169 ln -s $here/$d $ft.new
175 ### Set up the Emacs config
176 $echon "Finding a suitable emacs:$echoc"
178 for i in emacs21 emacs; do
179 if type -p >/dev/null $i; then
184 if [ $emacs = no ]; then
191 echo "Installing Emacs packages..."
196 for elib in $emacspkg; do
197 $echon " $elib:$echoc"
198 if $false $emacs >/dev/null 2>&1 --no-site-file --batch --eval '
200 (setq load-path (nconc load-path (list "~/lib/emacs")))
201 (kill-emacs (condition-case nil
202 (progn (load-library "'"$elib"'") 0)
204 echo " already installed."
206 $echon " downloading$echoc"
207 $GETURL $HOME$sub/lib/emacs/$elib.el $REPO/$elib.el
208 $echon " compiling$echoc"
209 (cd $HOME$sub/lib/emacs;
210 $emacs >/dev/null 2>&1 --no-site-file --batch \
211 --eval '(byte-compile-file "'"$elib.el"'")')
217 $echon "Setting up Emacs configuration:$echoc"
218 $echon " linking$echoc"
219 for link in dot-emacs.el:dot-emacs.el emacs-Makefile:Makefile; do
220 set -- $(echo $link | tr : ' ')
222 ln -s $here/$from $HOME$sub/lib/emacs/$to.new
223 mv $HOME$sub/lib/emacs/$to.new $HOME$sub/lib/emacs/$to
225 $echon " compiling$echoc"
226 make >/dev/null 2>&1 -C $HOME$sub/lib/emacs EMACS=$emacs