# Kbtv deinstall script, version 1.2.4 import os, commands, buildprefs, installprefs KLDSTAT = "kldstat" KLDUNLOAD = "kldunload" KLDXREF = "kldxref" KLDDIR = "/boot/modules" SAA_KO = "saa.ko" PWC_KO = "pwc.ko" fd = open("PLIST", "r") p = fd.read() fd.close() plist = p.split("\n")[:-1] for item in plist: try: os.remove(item) except OSError, IOError: print "Can't remove", item if buildprefs.WITH_PWC and not installprefs.FROMPORT: if commands.getoutput(KLDSTAT + " | grep " + PWC_KO + " awk '{ print $5 }'") == PWC_KO: print KLDUNLOAD, PWC_KO print commands.getoutput(KLDUNLOAD + " " + PWC_KO) print KLDXREF, KLDDIR print commands.getoutput(KLDXREF + " " + KLDDIR) if buildprefs.WITH_SAA: if commands.getoutput(KLDSTAT + " | grep " + SAA_KO + " awk '{ print $5 }'") == SAA_KO: print KLDUNLOAD, SAA_KO print commands.getoutput(KLDUNLOAD + " " + SAA_KO) print KLDXREF, KLDDIR print commands.getoutput(KLDXREF + " " + KLDDIR) try: os.removedirs(os.path.join(installprefs.APPDIR, "pics")) except OSError, IOError: print "Can't remove directory", installprefs.APPDIR