# copy method

/^var target / {
         target = $3
        }

/^var srcdir / {
         srcdir = $3
        }

/^var cmddir / {
         cmddir = $3
        }

/^var mandir / {
         mandir = $3
}

/^var mancp / {
         mancp = $3
}

/^var instarch / {
         instarch = $3
}

/^systemid / {
         sysid = $2
        }


/^dir / { 
         rawdir = sprintf($2, instarch)
         destdir = target "/" rawdir
         print "printm InstallingDir " rawdir
         print "if [ ! -d " destdir " ]; then"
	 print "   mkdir " destdir
         print "fi"
       }

# dirmsg is obsolete

/^dirmsg / {
         next
       }

/^source / {
        rawsource = srcdir "/" $2
        source = sprintf(rawsource, instarch);
       }

/^file / {
        srcfile = source "/" $2
        print "cp " srcfile " " destdir
       }

/^command / {
        if (instarch != ""){
        print $3 " " instarch " " $2}
        else {print $3 " " sysid " " $2}
        cfile="$sysid/$2"
        ccfile=cmddir "/" $2
        if (cmddir != "") {
           print "cp " destdir "/" $2 " " ccfile
           print "printm CommandFile " ccfile
        }
       }

/^script / {
        print $2 " " destdir
       }

/^manpage / {
        if ( mancp == "" ) {
            print "cp " destdir "/" $2 " " mandir
        } else {
            print mancp " " destdir "/" $2 " " mandir
        }
       }

/^untar / {
        rawdir = sprintf($2,instarch);
        print "( cd " target "; tar xf " source "/" rawdir ")"
       }

/^obsoletefile / {
	print "rm -f " destdir "/" $2
       }

/^obsoletedir / {
	print "rmdir " $2
       }
