1
1
#!/usr/bin/env python
2
2
# -*- coding: utf-8 -*-
4
# (c) Copyright 2003-2009 Hewlett-Packard Development Company, L.P.
4
# (c) Copyright 2003-2014 Hewlett-Packard Development Company, L.P.
6
6
# This program is free software; you can redistribute it and/or modify
7
7
# it under the terms of the GNU General Public License as published by
17
17
# along with this program; if not, write to the Free Software
18
18
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
# Author: Don Welch, Amarnath Chitumalla
32
32
from core_install import *
34
34
def start_systray():
35
tui.title("RE-STARTING HP_SYSTRAY")
35
36
path = utils.which('hp-systray')
37
38
path = os.path.join(path, 'hp-systray')
92
93
log.note("Defaults for each question are maked with a '*'. Press <enter> to accept the default.")
95
if not core.distro_name in ("ubuntu","debian","suse","fedora"):
96
log.error("Auto installation is not supported for '%s' distro so all dependencies may not be installed. \nPlease install manually as mentioned in 'http://hplipopensource.com/hplip-web/install/manual/index.html' web-site"% core.distro_name)
97
ok, choice = tui.enter_choice("\nPress 'y' If you still want to continue auto installation. Press 'n' to quit auto instalation(y=yes, n=no*): ",['y','n'],'n')
98
if not ok or choice =='n':
99
log.info("Installation exit")
95
103
tui.title("INSTALLATION MODE")
128
# HPLIP vs. HPIJS INSTALLATION
132
#tui.title("INSTALL TYPE")
133
#log.info("For most users, it is recommended to install HPLIP with full support (scanning, faxing, toolbox, etc).")
134
#log.info("For servers or minimal installations, you can also install print support only (HPIJS only).")
136
#ok, choice = tui.enter_choice("\nInstall full hplip support (recommended) or print-only support (f=full hplip support*, p=printing only support, q=quit) ?",
138
#if not ok: sys.exit(0)
140
#core.selected_component = 'hpijs'
142
#log.debug(core.selected_component)
143
139
core.selected_component = 'hplip'
151
147
if core.selected_component == 'hplip':
152
148
log.info("This installer will install HPLIP version %s on your computer." % core.version_public)
153
#core.hpijs_build = False
155
#log.info("This installer will install HPIJS version %s on your computer." % core.version_public)
156
#core.hpijs_build = True
158
150
log.info("Please close any running package management systems now (YaST, Adept, Synaptic, Up2date, etc).")
165
## if os.getenv('DISPLAY'):
166
## tui.title("VIEW RELEASE NOTES")
167
## log.info("Release notes from this version are available as a web (HTML) document.")
168
## log.info("The release notes file will be shown in a separate web browser window.")
170
## ok, ans = tui.enter_yes_no("\nWould you like to view the release notes for this version of HPLIP", 'n')
173
## log.info("Displaying release notes in a browser window...")
174
## core.show_release_notes_in_browser()
179
153
# For testing, mark all dependencies missing
331
306
# SELECT OPTIONS TO INSTALL
337
310
tui.title("SELECT HPLIP OPTIONS")
338
311
log.info("You can select which HPLIP options to enable. Some options require extra dependencies.")
340
313
num_opt_missing = core.select_options(option_question_callback)
343
#ok, enable_par = tui.enter_yes_no("Would you like to enable support for parallel (LPT:) connected printers?", 'n')
344
#if not ok: sys.exit(0)
346
#core.selected_options['parallel'] = enable_par
349
#log.info("Parallel support enabled.")
351
316
enable_par = False
352
317
core.selected_options['parallel'] = False
493
455
core.selected_options[opt] = False
500
log.debug("Dependencies to install: %s" % depends_to_install)
459
log.debug("Dependencies to install: %s hplip_present:%s" % (depends_to_install, core.hplip_present))
502
461
if core.distro_version_supported and \
503
462
(depends_to_install or core.hplip_present) and \
537
496
# CHECK FOR ACTIVE NETWORK CONNECTION
540
498
if not assume_network:
541
499
tui.title("CHECKING FOR NETWORK CONNECTION")
543
501
if not core.check_network_connection():
544
log.error("\nThe network appears to be unreachable. Installation cannot complete without access to")
545
log.error("distribution repositories. Please check the network and try again.")
502
log.error("The network appears to be unreachable. Installation may not resolve all dependencies without access to distribution repositories.")
503
ok, choice = tui.enter_choice("Do you want to continue installation without network?. Press 'y' for YES. Press 'n' for NO (y=yes*, n=no) : ",['y', 'n'], 'y')
504
if not ok or choice == 'n':
505
log.info("Please connect network and try again")
508
log.debug("Continuing installation without network")
548
510
log.info("Network connection present.")
669
#if core.hpoj_present and core.selected_component == 'hplip' and core.distro_version_supported:
670
#log.error("HPOJ is installed and/or running. HPLIP is not compatible with HPOJ.")
672
#hpoj_remove_cmd = core.get_distro_data('hpoj_remove_cmd')
678
#ok, answer = tui.enter_yes_no("\nWould you like to have this installer attempt to uninstall HPOJ")
680
#if not ok: sys.exit(0)
683
#failed = core.remove_hpoj(progress_callback)
686
#log.error("HPOJ removal failed. Please manually stop/remove/uninstall HPOJ and then re-run this installer.")
689
#log.error("Please stop/remove/uninstall HPOJ and then re-run this installer.")
693
#log.error("Please stop/remove/uninstall HPOJ and then re-run this installer.")
701
632
if core.hplip_present and core.selected_component == 'hplip' and core.distro_version_supported:
703
log.warn("A previous install of HPLIP is installed and/or running.")
633
path = utils.which('hp-uninstall')
634
ok, choice = tui.enter_choice("HPLIP-%s exists, this may conflict with the new one being installed.\nDo you want to ('i'= Remove and Install, 'o'= Overwrite*, 'q'= Quit)? :"%(prev_hplip_version),['i','o','q'],'o')
635
if not ok or choice=='q':
636
log.error("User Exit")
639
# log.info("Uninstalling existing HPLIP-%s"%prev_hplip_version)
640
sts =core.uninstall(NON_INTERACTIVE_MODE)
705
hplip_remove_cmd = core.get_distro_data('hplip_remove_cmd')
643
log.warn("Failed to uninstall existing HPLIP-%s. This installation will overwrite on existing HPLIP" %prev_hplip_version)
710
ok, answer = tui.enter_yes_no("\nWould you like to have this installer attempt to uninstall the previously installed HPLIP")
711
if not ok: sys.exit(0)
714
failed = core.remove_hplip(progress_callback)
717
log.error("The previously installed version of HPLIP may conflict with the new one being installed.")
718
log.error("It is recommended that you quit this installer, and manually remove HPLIP before continuing.")
722
log.warn("HPLIP removal failed. The previous install may have been installed using a tarball or this installer.")
723
log.warn("Continuing to run installer - this installation should overwrite the previous one.")
645
log.debug("HPLIP-%s is uninstalled successfully." %prev_hplip_version)
730
650
tui.title("RUNNING POST-PACKAGE COMMANDS")
731
651
core.run_post_depend(progress_callback)
866
tui.title("RE-STARTING HP_SYSTRAY")
869
# Restart or re-plugin if necessary (always True in 2.7.9+)
783
tui.title("HPLIP UPDATE NOTIFICATION")
784
ok, choice = tui.enter_choice("Do you want to check for HPLIP updates?. (y=yes*, n=no) : ",['y', 'n'], 'y')
785
if not ok or choice != 'y':
786
user_conf.set('upgrade', 'notify_upgrade', 'false')
788
user_conf.set('upgrade', 'notify_upgrade', 'true')
790
user_conf.set('upgrade','last_upgraded_time',str(int(time.time())))
791
user_conf.set('upgrade','pending_upgrade_time','0')
870
794
if core.selected_component == 'hplip':
871
795
tui.title("RESTART OR RE-PLUG IS REQUIRED")
879
803
ok, choice = tui.enter_choice("Restart or re-plug in your printer (r=restart, p=re-plug in*, i=ignore/continue, q=quit) : ",
880
804
['r', 'p', 'i'], 'p')
882
if not ok: sys.exit(0)
884
810
if choice == 'r':
886
812
log.note("IMPORTANT! Make sure to save all work in all open applications before restarting!")
888
814
ok, ans = tui.enter_yes_no(log.bold("Restart now"), 'n')
889
if not ok: sys.exit(0)
891
819
ok = core.restart()
893
821
log.error("Restart failed. Please restart using the system menu.")
897
826
elif choice == 'p': # 'p'
898
827
if not tui.continue_prompt("Please unplug and re-plugin your printer now. "):
909
839
install_printer = True
911
841
ok, install_printer = tui.enter_yes_no("Would you like to setup a printer now")
912
if not ok: sys.exit(0)
914
846
if install_printer:
915
847
log.info("Please make sure your printer is connected and powered on at this time.")
916
848
if not core.run_hp_setup():
917
849
log.error("hp-setup failed. Please run hp-setup manually.")
919
852
except KeyboardInterrupt:
921
854
log.error("Aborted.")