10 : ${REPO=http://ftp.distorted.org.uk/ftp/pub/mdw/profile}
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..."
71 lesspipe.sh start-ssh-agent svnwrap movemail-hack"
72 [ "$xstuff" ] && scripts="$scripts
74 for script in $scripts; do
75 $echon " $script:$echoc"
77 for p in /bin /usr/bin /usr/local/bin $(echo $PATH | tr : ' '); do
78 if $false [ -x $p/$script ]; then
84 echo " already installed."
86 $echon " downloading$echoc"
87 $GETURL $HOME$sub/bin/$script $REPO/$script
88 chmod +x $HOME$sub/bin/$script
95 ### Install some more complicated programs
96 echo "Installing packages..."
98 mLib:2.0.3:mLib-config
101 [ "$xstuff" ] && systems="$systems
102 mgLib:1.1.0:mgLib-config
105 for system in $systems; do
106 set -- $(echo $system | tr : ' ')
107 sys=$1 ver=$2 prog=$3
108 $echon " $sys:$echoc"
109 if $false $prog >/dev/null 2>&1 --version; then
110 echo " already installed."
113 $echon " downloading$echoc"
115 rm -rf $sys-$ver.tar.gz $sys-$ver
116 $GETURL $sys-$ver.tar.gz $REPO/$sys-$ver.tar.gz
117 $echon " unpacking$echoc"
118 gzip -cd $sys-$ver.tar.gz | tar xf -
119 $echon " configuring$echoc"
123 ../configure --prefix=$HOME$sub >>buildlog 2>&1
124 $echon " building$echoc"
126 $echon " installing$echoc"
127 make install >>buildlog 2>&1
134 ### Install global configuration
135 echo -n "Installing dotfile configuration:"
136 if [ -f $HOME$sub/.mdw.conf ]; then
137 echo " already installed."
139 cp mdw.conf $HOME$sub/.mdw.conf
143 ### Symlink the various dotfiles into place
145 bash_profile bash_logout bashrc inputrc bash_completion
150 lisp-init.lisp:.cmucl-init.lisp
151 lisp-init.lisp:.sbclrc
152 lisp-init.lisp:.clisprc.lisp
153 lisp-init.lisp:.eclrc
154 dircolors colordiffrc screenrc cvsrc indent.pro"
155 [ "$xstuff" ] && dotfiles="$dotfiles
156 xinitrc xsession Xdefaults vncrc vncsession
157 putty-defaults:.putty/sessions/Default%20Settings
158 e-keybindings.cfg:.enlightenment/keybindings.cfg
159 evnc-keybindings.cfg:.enlightenment-vnc/keybindings.cfg
160 jue-peek.jpg:.enlightenment/backgrounds/jue-peek.jpg"
161 echo "Installing dotfiles..."
162 for d in $dotfiles; do
165 *:*) target=${d#*:} d=${d%%:*};;
170 ln -s $here/$d $ft.new
176 ### Install useful scripts included in this package
179 echo "Installing scripts..."
180 mkdir -p $HOME$sub/bin
181 for s in $scripts; do
183 ln -s $here/$s $ft.new
189 ### Set up the Emacs config
190 $echon "Finding a suitable emacs:$echoc"
192 for i in emacs21 emacs; do
193 if type -p >/dev/null $i; then
198 if [ $emacs = no ]; then
205 echo "Installing Emacs packages..."
208 git git-blame vc-git stgit
210 for elib in $emacspkg; do
211 $echon " $elib:$echoc"
212 if $false $emacs >/dev/null 2>&1 --no-site-file --batch --eval '
214 (setq load-path (nconc load-path (list "~/lib/emacs")))
215 (kill-emacs (condition-case nil
216 (progn (load-library "'"$elib"'") 0)
218 echo " already installed."
220 $echon " downloading$echoc"
221 $GETURL $HOME$sub/lib/emacs/$elib.el $REPO/$elib.el
222 $echon " compiling$echoc"
223 (cd $HOME$sub/lib/emacs;
224 $emacs >/dev/null 2>&1 --no-site-file --batch \
225 --eval '(byte-compile-file "'"$elib.el"'")')
231 $echon "Setting up Emacs configuration:$echoc"
232 $echon " linking$echoc"
233 for link in dot-emacs.el:dot-emacs.el emacs-Makefile:Makefile; do
234 set -- $(echo $link | tr : ' ')
236 ln -s $here/$from $HOME$sub/lib/emacs/$to.new
237 mv $HOME$sub/lib/emacs/$to.new $HOME$sub/lib/emacs/$to
239 $echon " compiling$echoc"
240 make >/dev/null 2>&1 -C $HOME$sub/lib/emacs EMACS=$emacs