# -*- tcl -*-
# --------------------------------------------------
# (C) 1997	Andreas Kupries <a.kupries@westend.com>
#
# @comment	library of 'makedist', transport of
# @comment	generated package to intended destination.
#
# CVS:	$Id: trans_dev,v 1.3 1998/06/02 16:59:14 aku Exp $
# --------------------------------------------------

proc ::makedist::plugin::transport::Tar2Device {module builddir device} {
    # @c The <a module> archives and any supporting files are transfered from
    # @c the <a builddir> to the specified <a device>, via the 'tar' command.
    # @c This has to be reachable via PATH.
    #
    # @d Usage of 'tar' creates a dependency on unix.

    set here [pwd]
    cd $builddir

    set fail [catch {
	# Do a little preparation first, by moving everything into single
	# directory and renaming the supporting files to their final names

	cd sup.$module
	foreach f [glob *] {
	    file rename -force $f ${module}.$f
	}

	cd ..
	eval file rename -force [glob ${module}*] sup.$module

	cd sup.$module
	exec tar cf $device [glob *]
    } msg]	;# {}

    cd $here

    if {$fail} {
	Log warning $msg
    }
    return
}



::makedist::transporter tape "To tape /dev/rmt0" {
    # @see <p ::makedist::plugin::transport::Tar2Device>

    Tar2Device $module $builddir /dev/rmt0
    return
}



::makedist::transporter floppy "To floppy /dev/fd0" {
    # @see <p ::makedist::plugin::transport::Tar2Device>

    Tar2Device $module $builddir /dev/fd0
    return
}
