diff options
author | James Meyer <james.meyer@operamail.com> | 2012-12-12 01:40:28 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2012-12-12 01:40:28 (GMT) |
commit | e75d8cc349ec60a4cd6e5aa10c1257157db1868c (patch) | |
tree | ca3257906684049e37174450883fbf1da3d8af99 /abs | |
parent | 6c0027e31a9509aea391c45385221373250506cf (diff) | |
download | linhes_pkgbuild-e75d8cc349ec60a4cd6e5aa10c1257157db1868c.zip linhes_pkgbuild-e75d8cc349ec60a4cd6e5aa10c1257157db1868c.tar.gz linhes_pkgbuild-e75d8cc349ec60a4cd6e5aa10c1257157db1868c.tar.bz2 |
LinHES-config: add plymouth_config.py to the package
This program is called by xconfig.sh to determine which video driver to include in the initrd for KMS to work.
For this version if X uses an intel driver then i915 is included in the initrd, any things else defaults to vesa.
if plymouth_config detects that no changes are needed, it will quit without running mkinitcpio.
refs #832
Diffstat (limited to 'abs')
-rwxr-xr-x | abs/core/LinHES-config/PKGBUILD | 13 | ||||
-rwxr-xr-x | abs/core/LinHES-config/plymouth_config.py | 191 | ||||
-rwxr-xr-x | abs/core/LinHES-config/xconfig.sh | 6 |
3 files changed, 205 insertions, 5 deletions
diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD index e5b1120..649cc5a 100755 --- a/abs/core/LinHES-config/PKGBUILD +++ b/abs/core/LinHES-config/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-config pkgver=2.3 -pkgrel=194 +pkgrel=195 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev LinHes-config ) pkgdesc="Install and configure your system" depends=('bc' 'libstatgrab' 'mysql-python' 'expect' 'curl' 'dnsutils' 'parted' @@ -51,7 +51,8 @@ source=(mv_install.py 09_mythvantge_runit_grub mythvantage.cfg config-sudo.rules hdhr.conf blacklist_nouveau.conf blacklist_pcspkr.conf - print_xorg_res.py backend_control.sh ) + print_xorg_res.py backend_control.sh + plymouth_config.py ) backup=(etc/mythvantage.cfg) install=config.install @@ -103,6 +104,7 @@ build() { install -m 0755 mv_locale.py $MVDIR/bin/ install -m 0755 systemconfig.py $MVDIR/bin/ install -m 0755 print_xorg_res.py $MVDIR/bin/ + install -m 0755 plymouth_config.py $MVDIR/bin/ install -m 0755 backend_control.sh $MVDIR/bin/ install -m 0755 mythvantage.cfg $startdir/pkg/etc/ @@ -129,7 +131,7 @@ build() { } md5sums=('26e20dba8d1bea96a07131ef945fd2f7' '3f6855b7bb860a44f96a972c2e80f497' - '17677b9e25b8fe3511ad3a139ed91eea' + 'aaeb581275433649ff74e05da5e61a78' '2596460462cf6c889cf8f95485537b20' '985891a43f7c4c983eb2a362162f1a0f' 'fda01259a4bc74d83c9092d338bd247a' @@ -138,7 +140,7 @@ md5sums=('26e20dba8d1bea96a07131ef945fd2f7' '408688e3bcb2cefe512f9a89863137c8' '2a7f3b34e522acfd08283b86c8926aba' '157906733642835bd7a3ff4e32771c8e' - '689b01f7636e09b2f9657c6ce6006ee7' + '31c01f0d5be8ded8a3c24224ee37841a' 'b02bc06fc6623bf6473175165578e1d5' 'a6faa20d905e2fd92ce79acab044b759' '8ba06c2ce6129371548cc360ccca27f8' @@ -172,4 +174,5 @@ md5sums=('26e20dba8d1bea96a07131ef945fd2f7' '6ec39b010c0ed8901ea896c7e153d330' '3866086e6af5e3528a66eff492f2f4dd' 'c9279fa095af624ee3d9bc75d3328360' - '02cf69074d2bbacef05fa3e451af9af3') + '02cf69074d2bbacef05fa3e451af9af3' + '85d15efc55074a94c58d44542ea1dd13') diff --git a/abs/core/LinHES-config/plymouth_config.py b/abs/core/LinHES-config/plymouth_config.py new file mode 100755 index 0000000..7c7546d --- /dev/null +++ b/abs/core/LinHES-config/plymouth_config.py @@ -0,0 +1,191 @@ +#!/usr/bin/python2 +# -*- coding: utf-8 -*- + +__author__ = "James Meyer" +__date__ = "Dec 11th 2012" + + +import subprocess + + +class plymouth_driver(): + def __init__(self): + self.videocard = self.find_video_card() + self.old_conf = self.read_mkinit() + self.set_old_hook(self.old_conf) + + + def getvc(self): + return self.videocard + + def get_old_hooks(self): + return self.old_hooks + + def get_old_modules(self): + return self.old_modules + + def get_new_hooks(self): + return self.new_hooks + + def get_new_modules(self): + return self.new_modules + + + def set_old_hook(self,conf): + self.old_hooks, self.old_modules = self.find_hooks_modules(conf) + + def find_video_card(self): + videocard="" + conf_file="/etc/X11/xorg.conf.d/20-automv.conf" + lines=[] + try: + f=open(conf_file,'r') + lines=f.readlines() + f.close() + except: + print " find_video_card: couldn't read in %s" %conf_file + videocard = "unknown" + + for line in lines: + parsed=line.split() + if parsed[0].strip() == "Driver": + videocard = parsed[1].strip('''"''') + break + + return videocard + + def read_mkinit(self): + conf_file="/etc/mkinitcpio.conf" + old_conf=[] + try: + f=open(conf_file,'r') + old_conf=f.readlines() + except: + print " plymouth_config: couldn't read %s" %conf_file + sys.exit(1) + return old_conf + + def find_hooks_modules(self,conf_list): + for line in conf_list: + if line.startswith('HOOKS='): + hooks=line.split('''"''')[1].split() + if line.startswith('MODULES='): + modules=line.split('''"''')[1].split() + return hooks,modules + + def add_hooks(self,add_hooks, hooks): + new_hooks = hooks + for i in add_hooks: + if not i in (new_hooks): + new_hooks.append(i) + return new_hooks + + def remove_hooks(self,remove_hooks, hooks): + for i in remove_hooks: + try: + while True: + hooks.remove(i) + except: + pass + + return hooks + + def add_modules(self, add_modules, modules): + new_modules = modules + for i in add_modules: + if not i in (new_modules): + new_modules.append(i) + return new_modules + + + def remove_modules(self,remove_modules, modules): + for i in remove_modules: + try: + while True: + modules.remove(i) + except: + pass + return modules + + def create_new_hooks_modules(self): + new_hooks = list(self.old_hooks) + new_modules = list(self.old_modules) + + add_hooks=[] + remove_hooks=[] + remove_modules=[] + add_modules=[] + + if self.videocard == "intel": + add_modules = ['i915'] + remove_hooks = ['v86d'] + else: + #add_modules = ['nfs','jm'] + remove_modules = ['i915'] + add_hooks = ['v86d'] + + new_hooks = self.add_hooks(add_hooks , new_hooks) + new_hooks = self.remove_hooks(remove_hooks, new_hooks) + new_modules = self.add_modules(add_modules, new_modules) + new_modules = self.remove_modules(remove_modules, new_modules) + + self.new_hooks = new_hooks + self.new_modules = new_modules + + def compare_hooks_modules(self): + h = cmp( self.old_hooks,self.new_hooks) + m = cmp( self.old_modules,self.new_modules) + if h == 0 and m == 0: + return True + else: + return False + + def create_newmkinitcpio(self): + if self.compare_hooks_modules() == True: + print " plymouth_config: no changes made" + + return False + else: + conf_file="/etc/mkinitcpio.conf" + try: + f=open(conf_file,'w') + for line in self.old_conf: + new_line=line + if line.startswith('HOOKS='): + new_line = 'HOOKS="%s"' %(" ".join(self.new_hooks)) + if line.startswith('MODULES='): + new_line = 'MODULES="%s"'%(" ".join(self.new_modules)) + f.write(new_line) + f.write("\n") + f.close() + except: + print " plymouth_config: couldn't write %s" %conf_file + return False + + return True + + def run_mkinitcpio(self): + print " plymouth_config: Running mkinitcpio " + subprocess.call(["/usr/bin/mkinitcpio", "-p" , "linux"]) + + +def go(): + p = plymouth_driver() + vc = p.getvc() + print " plymouth_config: found videocard %s" %vc + p.create_new_hooks_modules() + #print p.get_old_hooks() + #print p.get_new_hooks() + #print "==" + #print p.get_old_modules() + #print p.get_new_modules() + + if p.create_newmkinitcpio() == True: + p.run_mkinitcpio() + + + + +if __name__ == '__main__': + go() + diff --git a/abs/core/LinHES-config/xconfig.sh b/abs/core/LinHES-config/xconfig.sh index 504da81..2a83506 100755 --- a/abs/core/LinHES-config/xconfig.sh +++ b/abs/core/LinHES-config/xconfig.sh @@ -218,6 +218,12 @@ function setupX { ;; esac + #configure the ramdisk for kms + if [ x$RUNP != "x1" ] + then + echo "Running plymouth_config" + plymouth_config.py >> $LOGFILE 2>&1 + fi fi } |