diff --git a/installPlugin.py b/installPlugin.py index cec8ff3..d0e1e74 100644 --- a/installPlugin.py +++ b/installPlugin.py @@ -55,18 +55,25 @@ status = False if os.geteuid() == 0: status = pluginObj.copyFiles(os.getcwd()) if status == True: - sanefp = open('/etc/sane.d/dll.conf', "r+") - contents = sanefp.read() - if "hp2000S1" in contents: - pass - else: + # Debian uses /etc/sane.d/dll.d directory, try this first + try: + sanefp = open('/etc/sane.d/dll.d/hplip-plugin', "w") sanefp.write("hp2000S1\n") - - if "hpgt2500" in contents: - pass - else: sanefp.write("hpgt2500\n") - sanefp.close() + sanefp.close + except: # Fallback to SANE default + sanefp = open('/etc/sane.d/dll.conf', "r+") + contents = sanefp.read() + if "hp2000S1" in contents: + pass + else: + sanefp.write("hp2000S1\n") + + if "hpgt2500" in contents: + pass + else: + sanefp.write("hpgt2500\n") + sanefp.close() sys.exit(0) else: sys.exit(1)