#!/usr/bin/env python

import sys
import commands

# checkinstall script creation

platform = commands.getoutput('uname -s')
architecture = commands.getoutput('uname -p')

fp=open("checkinstall","w")
fp.write("#!/bin/sh\n")
fp.write("\nexpected_platform=SunOS\n")
if platform == "SunOS" and architecture == "i386":
	fp.write("expected_architecture=i386\n")
elif platform == "SunOS" and architecture == "sparc":
	fp.write("expected_architecture=sparc\n")

fp.write("platform=`uname -s`\n")
fp.write("architecture=`uname -p`\n\n")

fp.write("if [ ${platform} -eq  ${expected_platform} ]; then\n")
fp.write("\tif [ ${architecture} -eq ${expected_architecture} ]; then\n")
fp.write("\t\techo \"Checkinstall complete\"\n")
fp.write("\telse\n")
fp.write("\t\techo \"This is not Solaris $architecture machine\"\n")
fp.write("\t\texit 1\n")
fp.write("\tfi\n")
fp.write("else\n")
fp.write("\techo \"This is not Solaris machine\"\n")
fp.write("\texit 1\n")
fp.write("fi\n")
fp.write("exit 0\n")

fp.close()


