from ubiquity import misc, plugin, validation import os import inspect NAME = 'lliurexOldHardware' AFTER = 'console_setup' BEFORE = 'usersetup' WEIGHT = 12 class PageGtk(plugin.PluginUI): plugin_title = 'lliurex/oldHardware' def __init__(self, controller, *args, **kwargs): from gi.repository import Gio, Gtk self.resolver = Gio.Resolver.get_default() self.controller = controller builder = Gtk.Builder() self.controller.add_builder(builder) builder.add_from_file(os.path.join( os.environ['UBIQUITY_GLADE'], 'UbiLliureXOldHardware.ui')) builder.connect_signals(self) self.page = builder.get_object('UbiLliureXOldHardware') self.nvidiaLegacy = builder.get_object('cb_nvidia_legacy') self.plugin_widgets = self.page class Page(plugin.Plugin): def ok_handler(self): list_packages = [] if self.ui.nvidiaLegacy.get_active(): ''' try: os.system("mkdir -p /target/etc/apt/apt.conf.d/") f = open("/target/etc/apt/apt.conf.d/20auto-upgrades-lliurex","w") f.write('APT::Periodic::Update-Package-Lists "1";\n') f.write('APT::Periodic::Unattended-Upgrade "1";\n') f.close() except Exception as e: pass ''' self.preseed_bool('lliurex/oldHardware/selection', 'true') else: self.preseed_bool('lliurex/oldHardware/selection', 'false') plugin.Plugin.ok_handler(self) class Install(plugin.InstallPlugin): def install(self, target, progress, *args, **kwargs): progress.info('lliurex/oldHardware') if self.db.get('lliurex/oldHardware/selection'): os.system("mkdir -p /var/lib/ubiquity/") f = open("/var/lib/ubiquity/apt-installed","a") f.write('audacious\n') f.close() return plugin.InstallPlugin.install(self, target, progress, *args, **kwargs)