Add the ability to copy other files and directories to the disk image

This commit is contained in:
Jeremy Rand 2017-08-30 23:35:49 -04:00
parent cf342915b0
commit 2c981080c2
3 changed files with 50 additions and 4 deletions

View File

@ -55,6 +55,21 @@ ASMFLAGS+=
# Add any arguments you want passed to the linker to this variable:
LDFLAGS+=
# If you want to copy one or more files or directories to the target disk
# image, add the root directory to this variable. Any directories under
# the source directory which don't exist in the target disk image will be
# created. All files will be copied from the source to the target using
# the same path from the source.
#
# For example, if you set COPYDIRS to dir and in your project you have
# the following files:
# dir/System/mySystemFile
# dir/newDir/anotherFile
# Then, during the copy phase, mySystemFile will be copied into the System
# folder and a folder newDir will be created and anotherFile will be copied
# into there.
COPYDIRS=
# By default, the build expects that you have GSplus in the path:
# /Applications/GSplus.app/Contents/MacOS/gsplus
# If you have it in a different location, specify that here.

View File

@ -5,15 +5,23 @@ MOUNTDIR=/tmp/a2gs_mount.$$
TMPDISKIMAGE=/tmp/a2gs_diskimage_$$.2mg
TEMPLATEDISKIMAGE=make/system601.2mg
if [ $# != 3 ]
if [ $# -lt 3 ]
then
echo USAGE: $0 diskimage file directory
exit 1
fi
DISKIMAGE="$1"
FILE="$2"
DEST="${MOUNTDIR}/$3"
shift
FILE="$1"
shift
DISKIMAGEDEST="$1"
shift
DEST="${MOUNTDIR}/${DISKIMAGEDEST}"
COPYDIRS=$*
cleanupAndExit()
{
@ -58,6 +66,29 @@ then
cleanupAndExit
fi
OLDDIR=`pwd`
for COPYDIR in $COPYDIRS
do
cd "$COPYDIR"
if [ $? != 0 ]
then
echo Unable to find $COPYDIR
cleanupAndExit
fi
find . -print | while read FILEORDIR
do
if [ -d "$FILEORDIR" ]
then
mkdir -p "${MOUNTDIR}/$FILEORDIR"
elif [ -f "$FILEORDIR" ]
then
cp "$FILEORDIR" "${MOUNTDIR}/$FILEORDIR"
fi
done
cd "$OLDDIR"
done
umount "$MOUNTDIR"
if [ $? != 0 ]
then

View File

@ -123,7 +123,7 @@ $(PGM): $(REZ_OBJS)
endif
$(DISKIMAGE): $(PGM)
make/createDiskImage "$(DISKIMAGE)" "$(PGM)" "$(DISKIMAGEDEST)"
make/createDiskImage "$(DISKIMAGE)" "$(PGM)" "$(DISKIMAGEDEST)" $(COPYDIRS)
execute: $(EXECTARGET)