Skip to content

Instantly share code, notes, and snippets.

@andrewbunday
Created July 6, 2011 10:41
Show Gist options
  • Save andrewbunday/1066978 to your computer and use it in GitHub Desktop.
Save andrewbunday/1066978 to your computer and use it in GitHub Desktop.
Replacing Jockey-text with a few short lines of simplified python
#!/usr/bin/env python
import apt
import subprocess
#import fnctrl <-- filelock on modprobe blacklists...
#import XKit.xutils <-- xorg.conf file editing
driver = "nvidia-current"
xorg_conf_path = "/etc/X11/xorg.conf"
apt.apt_pkg.Config.Set('DPkg::options::','--force-confnew')
c = apt.Cache()
c[driver].markInstall()
c.commit()
#dunno if this is really required...
subprocess.call(['/sbin/modprobe', driver])
#could possibly need to handle removing module name from blacklists
#in /etc/modprobe.d/*
#optional rebind. Primarily used for firmware driver updates.
## We can either try to edit the xorg.conf file ourselves...
#xorg_conf = XKit.xutils.XUtils(xorg_conf_path)
#org_conf.setDriver('Device', self.xorg_driver, device)
# or let nvidia do the hard work.
subprocess.call(['nvidia-xconfig'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment