#!/bin/sh
#
# Run this from inside a freshly unpacked VICE tarball to move all of
# the unredistributable ROMs to a vice-roms directory.

ROMDIR=`basename \`pwd\` | sed 's/vice-/vice-roms-/'`
ROMLIST=`/debian/maint/vice/genromlist`

if [ ! -d ../$ROMDIR/data ] ; then
  install -d -m 0755 ../$ROMDIR/data ;
fi

for ROM in $ROMLIST ; do
  if [ ! -d ../$ROMDIR/`dirname $ROM` ] ; then
    install -d -m 0755 ../$ROMDIR/`dirname $ROM` ;
  fi

  if [ -s $ROM ] ; then
    install -m 0644 $ROM ../$ROMDIR/`dirname $ROM`/ ;
    cat /dev/null > $ROM ;
  fi
done
