5 ###--------------------------------------------------------------------------
13 : ${REPO=http://ftp.distorted.org.uk/ftp/pub/mdw/profile}
15 export PATH=/usr/local/bin:$HOME$sub/bin:/usr/bin:/usr/ccs/bin:/bin
17 ###--------------------------------------------------------------------------
18 ### Sort out command line.
21 while [ $# -gt 0 ]; do
26 -*) echo >&2 "$0: bad option"; exit 1;;
32 ###--------------------------------------------------------------------------
33 ### Environment autoconfiguration.
35 ## Find out where I am
38 ## Suss out how to print things
39 out=$(echo -n "foo"; echo "bar")
40 if [ "$out" = "foobar" ]; then
48 ## Find out how to fetch things over the net
49 $echon "Finding URL fetcher:$echoc"
50 if curl >/dev/null 2>&1 --version || [ $? -eq 2 ]; then
53 elif wget >/dev/null 2>&1 --version; then
58 echo >&2 "$0: failed to find URL fetcher"
62 ###--------------------------------------------------------------------------
63 ### Create the necessary directories.
65 echo "Creating directories..."
66 for i in bin lib/emacs src; do
68 if [ -d $HOME$sub/$i ]; then
69 echo " already exists."
77 ###--------------------------------------------------------------------------
78 ### Install necessary things.
80 echo "Installing useful scripts..."
83 lesspipe.sh start-ssh-agent svnwrap"
84 for script in $scripts; do
85 $echon " $script:$echoc"
87 for p in /bin /usr/bin /usr/local/bin $(echo $PATH | tr : ' '); do
88 if $false [ -x $p/$script ]; then
94 echo " already installed."
96 $echon " downloading$echoc"
97 $GETURL $HOME$sub/bin/$script $REPO/$script
98 chmod +x $HOME$sub/bin/$script
105 ###--------------------------------------------------------------------------
106 ### Install some more complicated programs.
108 echo "Installing packages..."
113 [ "$xstuff" ] && systems="$systems
116 for system in $systems; do
117 set -- $(echo $system | tr : ' ')
118 sys=$1 ver=$2 prog=$3
119 $echon " $sys:$echoc"
120 if $false $prog >/dev/null 2>&1 --version; then
121 echo " already installed."
124 $echon " downloading$echoc"
126 rm -rf $sys-$ver.tar.gz $sys-$ver
127 $GETURL $sys-$ver.tar.gz $REPO/$sys-$ver.tar.gz
128 $echon " unpacking$echoc"
129 gzip -cd $sys-$ver.tar.gz | tar xf -
130 $echon " configuring$echoc"
134 ../configure --prefix=$HOME$sub >>buildlog 2>&1
135 $echon " building$echoc"
137 $echon " installing$echoc"
138 make install >>buildlog 2>&1
145 ###--------------------------------------------------------------------------
146 ### Install global configuration.
148 echo -n "Installing dotfile configuration:"
149 if [ -f $HOME$sub/.mdw.conf ]; then
150 echo " already installed."
152 cp mdw.conf $HOME$sub/.mdw.conf
156 ## Symlink the various dotfiles into place
158 bash_profile bash_logout bashrc inputrc bash_completion
167 lisp-init.lisp:.cmucl-init.lisp
168 lisp-init.lisp:.sbclrc
169 lisp-init.lisp:.clisprc.lisp
170 lisp-init.lisp:.eclrc
171 dircolors colordiffrc screenrc cvsrc indent.pro"
172 [ "$xstuff" ] && dotfiles="$dotfiles
173 xinitrc xsession Xdefaults vncrc vncsession
174 putty-defaults:.putty/sessions/Default%20Settings
175 eterm-theme.cfg:.Eterm/themes/Eterm/theme.cfg
176 e-keybindings.cfg:.enlightenment/keybindings.cfg
177 evnc-keybindings.cfg:.enlightenment-vnc/keybindings.cfg
178 e16-bindings:.e16/bindings.cfg
179 e16-config:.e16/e_config--1.0.cfg
180 jue-peek.jpg:.enlightenment/backgrounds/jue-peek.jpg
181 jue-peek.jpg:.e16/backgrounds/jue-peek.jpg"
182 echo "Installing dotfiles..."
183 for d in $dotfiles; do
186 *:*) target=${d#*:} d=${d%%:*};;
191 ln -s $here/$d $ft.new
197 ###--------------------------------------------------------------------------
198 ### Process the Git configuration.
200 echo -n "Installing Git configuration:"
203 ### generated by $here/setup; do not edit!\
205 /@releasekey@/ s::$(./mdw-conf release-key 481334C2):g
206 /@gitignore@/ s::$(./mdw-conf gitignore $here/gitignore):g
207 " gitconfig >$HOME/.gitconfig.new
208 mv $HOME/.gitconfig.new $HOME/.gitconfig
211 ###--------------------------------------------------------------------------
212 ### Install useful scripts included in this package.
219 [ "$xstuff" ] && scripts="$scripts
222 echo "Installing scripts..."
223 mkdir -p $HOME$sub/bin
224 for s in $scripts; do
226 ln -s $here/$s $ft.new
232 ###--------------------------------------------------------------------------
233 ### Set up the Emacs config.
235 $echon "Finding a suitable emacs:$echoc"
237 for i in emacs22 emacs21 emacs; do
238 if type -p >/dev/null $i; then
243 if [ $emacs = no ]; then
250 echo "Installing Emacs packages..."
253 git git-blame vc-git stgit
255 for elib in $emacspkg; do
256 $echon " $elib:$echoc"
257 if $false $emacs >/dev/null 2>&1 --no-site-file --batch --eval '
259 (setq load-path (nconc load-path (list "~/lib/emacs")))
260 (kill-emacs (condition-case nil
261 (progn (load-library "'"$elib"'") 0)
263 echo " already installed."
265 $echon " downloading$echoc"
266 $GETURL $HOME$sub/lib/emacs/$elib.el $REPO/$elib.el
267 $echon " compiling$echoc"
268 (cd $HOME$sub/lib/emacs;
269 $emacs >/dev/null 2>&1 --no-site-file --batch \
270 --eval '(byte-compile-file "'"$elib.el"'")')
276 $echon "Setting up Emacs configuration:$echoc"
277 $echon " linking$echoc"
278 for link in dot-emacs.el:dot-emacs.el emacs-Makefile:Makefile; do
279 set -- $(echo $link | tr : ' ')
281 ln -s $here/$from $HOME$sub/lib/emacs/$to.new
282 mv $HOME$sub/lib/emacs/$to.new $HOME$sub/lib/emacs/$to
284 $echon " compiling$echoc"
285 make >/dev/null 2>&1 -C $HOME$sub/lib/emacs EMACS=$emacs
288 ###----- That's all, folks --------------------------------------------------