1#!/bin/sh -e
2
3umask 022
4test -d package || sh -cx '! : Wrong working directory.'
5test -d src || sh -cx '! : Wrong working directory.'
6
7here=`env - PATH=$PATH pwd`
8
9mkdir -p compile command
10test -r compile/home || echo $here >compile/home
11test -h compile/src || ln -s $here/src compile/src
12
13echo 'Linking ./src/* into ./compile...'
14for i in `ls src`; do
15  test -h compile/$i || ln -s src/$i compile/$i
16done
17
18echo 'Compiling everything in ./compile...'
19sh -cx 'cd compile && exec make'
20
21echo 'Copying commands into ./command...'
22for i in `cat package/commands`; do
23  sh -cx ": $i"
24  rm -f command/$i'{new}'
25  cp -p compile/$i command/$i'{new}'
26  mv -f command/$i'{new}' command/$i
27done
28