bbd9b1fccbbdc284f33ece70997a007623fdacf7
[dosdemo] / tools / scripts / instdfs
1 #!/bin/sh
2
3 # NOTES:
4 # source: svn co https://svn.code.sf.net/p/etherdfs/code
5 #
6 # on DOS: etherdfs <server MAC addr> C-Z
7 # on GNU/Linux: sudo ethersrv-linux eth0 /etherdfs
8 #
9 # /etherdfs is a mount point for a FAT16 image, fstab entry:
10 #   /home/nuclear/code/dos/etherdfs.img /etherdfs msdos loop,fmask=0113,dmask=0002,gid=6 0 0
11
12 destdir=/etherdfs/dosdemo
13 rev=false
14 have_dest_arg=false
15
16 for arg in "$@"; do
17         case "$arg" in
18         -r)
19                 rev=true
20                 ;;
21
22         -*)
23                 echo "invalid option: $arg"
24                 exit 1
25                 ;;
26
27         *)
28                 if $have_dest_arg; then
29                         echo "unexpected argument: $arg"
30                         exit 1
31                 fi
32                 destdir=$arg
33                 have_dest_arg=true
34                 ;;
35         esac
36 done
37
38 if $rev; then
39         cwd=`pwd`
40         cd $destdir
41         destdir=$cwd
42 else
43         mkdir -p $destdir/data
44         cp demo.exe $destdir
45         rm -f $destdir/data/*
46         cp data/* $destdir/data/
47 fi
48
49 findsrc()
50 {
51         find . -name '*.c' -o -name '*.h' -o -name '*.asm' -o -name '*.inc' \
52                 -o -name '*.inl' -o -name Makefile.dj | sed 's/\.\///'
53 }
54 for i in `findsrc`; do
55         dir=`dirname $i`
56         mkdir -p $destdir/$dir
57         cp $i $destdir/$i
58 done