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
30 ### Suss out how to print things
31 out
=$
(echo -n
"foo"; echo "bar")
32 if [ "$out" = "foobar" ]; then
40 ### Create the necessary directories
41 echo "Creating directories..."
42 for i
in bin lib
/emacs src
; do
44 if [ -d
$HOME$sub/$i ]; then
45 echo " already exists."
53 ### Find out how to fetch things over the net
54 $echon "Finding URL fetcher:$echoc"
55 if curl
>/dev
/null
2>&1 --version ||
[ $?
-eq
2 ]; then
58 elif wget
>/dev
/null
2>&1 --version
; then
63 echo >&2 "$0: failed to find URL fetcher"
67 ### Install necessary things
68 echo "Installing useful scripts..."
70 for script in lesspipe.sh start-ssh-agent svnwrap
; do
71 $echon " $script:$echoc"
73 for p
in /bin
/usr
/bin
/usr
/local/bin $
(echo $PATH |
tr : ' '); do
74 if $false [ -x
$p/$script ]; then
80 echo " already installed."
82 $echon " downloading$echoc"
83 $GETURL $HOME$sub/bin
/$script $REPO/$script
84 chmod +x
$HOME$sub/bin
/$script
91 ### Install some more complicated programs
92 echo "Installing packages..."
94 mLib:2.0.3:mLib-config
97 [ "$xstuff" ] && systems
="$systems
98 mgLib:1.1.0:mgLib-config
101 for system
in $systems; do
102 set -- $
(echo $system |
tr : ' ')
103 sys
=$1 ver
=$2 prog
=$3
104 $echon " $sys:$echoc"
105 if $false $prog >/dev
/null
2>&1 --version
; then
106 echo " already installed."
109 $echon " downloading$echoc"
111 rm -rf
$sys-$ver.
tar.gz
$sys-$ver
112 $GETURL $sys-$ver.
tar.gz
$REPO/$sys-$ver.
tar.gz
113 $echon " unpacking$echoc"
114 gzip -cd $sys-$ver.
tar.gz |
tar xf
-
115 $echon " configuring$echoc"
119 ..
/configure
--prefix
=$HOME$sub >>buildlog
2>&1
120 $echon " building$echoc"
122 $echon " installing$echoc"
123 make install >>buildlog
2>&1
130 ### Install global configuration
131 echo -n
"Installing dotfile configuration:"
132 if [ -f
$HOME$sub/.mdw.conf
]; then
133 echo " already installed."
135 cp mdw.conf
$HOME$sub/.mdw.conf
139 ### Symlink the various dotfiles into place
141 bash_profile bash_logout bashrc
144 lisp-init.lisp:.cmucl-init.lisp
145 lisp-init.lisp:.sbclrc
146 lisp-init.lisp:.clisprc.lisp
147 dircolors screenrc cvsrc"
148 [ "$xstuff" ] && dotfiles
="$dotfiles
149 xinitrc xsession Xdefaults
150 eterm-theme.cfg:.Eterm/themes/Eterm/theme.cfg
151 e-keybindings.cfg:.enlightenment/keybindings.cfg
152 jue-peek.jpg:.enlightenment/backgrounds/jue-peek.jpg"
154 echo "Installing dotfiles..."
155 for d
in $dotfiles; do
158 *:*) target
=${d#*:} d
=${d%%:*};;
163 ln -s
$here/$d $ft.new
169 ### Set up the Emacs config
170 $echon "Finding a suitable emacs:$echoc"
172 for i
in emacs21 emacs
; do
173 if type -p
>/dev
/null
$i; then
178 if [ $emacs = no
]; then
185 echo "Installing Emacs packages..."
186 for elib
in make-regexp
; do
187 $echon " $elib:$echoc"
188 if $false $emacs >/dev
/null
2>&1 --no-site-file
--batch --eval '
189 (setq load-path (nconc load-path (list "~/lib/emacs")))
190 (kill-emacs (condition-case nil
191 (progn (load-library "make-regexp") 0)
193 echo " already installed."
195 $echon " downloading$echoc"
196 $GETURL $HOME$sub/lib
/emacs
/make-regexp.el
$REPO/make-regexp.el
197 $echon " compiling$echoc"
198 (cd $HOME$sub/lib
/emacs
;
199 $emacs >/dev
/null
2>&1 --no-site-file
--batch \
200 --eval '(byte-compile-file "make-regexp.el")')
206 $echon "Setting up Emacs configuration:$echoc"
207 $echon " linking$echoc"
208 for link
in dot-emacs.el
:dot-emacs.el emacs-Makefile
:Makefile
; do
209 set -- $
(echo $link |
tr : ' ')
211 ln -s
$here/$from $HOME$sub/lib
/emacs
/$to.new
212 mv $HOME$sub/lib
/emacs
/$to.new
$HOME$sub/lib
/emacs
/$to
214 $echon " compiling$echoc"
215 make >/dev
/null
2>&1 -C
$HOME$sub/lib
/emacs EMACS
=$emacs