in installer/InstallBuilder/unittests/ib_unittests.py [0:0]
def GetScriptAsString(script_type):
script_string = ""
if PACKAGE_TYPE == "RPM":
if script_type == "Preinstall":
script_section = "%pre"
elif script_type == "Postinstall":
script_section = "%post"
elif script_type == "Preuninstall":
script_section = "%preun"
elif script_type == "Postuninstall":
script_section = "%postun"
else:
error("Unsupported script section: " + script_type)
lines = ReadLines("./intermediate/rpm.spec")
state = None
for line in lines:
if len(line) > 0 and line[0] == "%":
state = line
continue
if state == script_section:
script_string += line + "\n"
elif PACKAGE_TYPE == "DPKG":
if script_type == "Preinstall":
script_filename = "preinst"
elif script_type == "Postinstall":
script_filename = "postinst"
elif script_type == "Preuninstall":
script_filename = "prerm"
elif script_type == "Postuninstall":
script_filename = "postrm"
else:
error("Unsupported script section: " + script_type)
lines = ReadLines("./staging/DEBIAN/" + script_filename)
for line in lines:
script_string += line + "\n"
elif PACKAGE_TYPE == "LPP":
if script_type == "Preinstall":
script_filename = "dummytest.rte.pre_i"
elif script_type == "Postinstall":
script_filename = "dummytest.rte.config"
elif script_type == "Preuninstall":
script_filename = "dummytest.rte.unconfig"
else:
error("Unsupported script section: " + script_type)
lines = ReadLines("./intermediate/lpp-tmp/" + script_filename)
for line in lines:
script_string += line + "\n"
elif PACKAGE_TYPE == "DEPOT":
if script_type == "Preinstall":
script_filename = "preinstall.sh"
elif script_type == "Postinstall":
script_filename = "configure.sh"
elif script_type == "Preuninstall":
script_filename = "unconfigure.sh"
elif script_type == "Postuninstall":
script_filename = "postremove.sh"
else:
error("Unsupported script section: " + script_type)
lines = ReadLines("./intermediate/pkg-tmp/" + script_filename)
for line in lines:
script_string += line + "\n"
elif PACKAGE_TYPE == "PKG":
if script_type == "Preinstall":
script_filename = "preinstall"
elif script_type == "Postinstall":
script_filename = "postinstall"
elif script_type == "Preuninstall":
script_filename = "preremove"
elif script_type == "Postuninstall":
script_filename = "postremove"
else:
error("Unsupported script section: " + script_type)
lines = ReadLines("./intermediate/pkg-tmp/MSFTdummytest/install/" + script_filename)
for line in lines:
script_string += line + "\n"
return script_string