Created
March 27, 2010 05:38
-
-
Save kassah/345751 to your computer and use it in GitHub Desktop.
Script that grabs 32bit libs from xorg-edgers that match your 64bit libs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
$pkgs = array( | |
"libdrm2", | |
"libdrm-intel1", | |
"libgl1-mesa-dri", | |
"libgl1-mesa-glx", | |
"libglu1-mesa" | |
); | |
$targetextract = "/"; | |
function getver($package) { | |
$stuff = `dpkg-query -p ${package}`; | |
$stuff = explode("\n",$stuff); | |
foreach ($stuff as $line) { | |
$line = explode(" ", $line); | |
if ($line[0] == "Version:") { | |
$version = $line[1]; | |
} | |
} | |
return $version; | |
} | |
function pkgfile($package) { | |
$version = getver($package); | |
return "${package}_${version}_i386.deb"; | |
} | |
function pkgurl($package) { | |
return "https://launchpad.net/~xorg-edgers/+archive/ppa/+files/".pkgfile($package); | |
} | |
function echoexec($cmd) { | |
echo $cmd."\n"; | |
passthru($cmd); | |
} | |
foreach ($pkgs as $pkg) { | |
$file = pkgfile($pkg); | |
echoexec("wget ".pkgurl($pkg)); | |
echoexec("ar xv ".$file); | |
if (file_exists("data.tar.gz")) { | |
echoexec("tar -zxvf data.tar.gz"); | |
echoexec("rm data.tar.gz"); | |
} | |
if (file_exists("data.tar.lzma")) { | |
echoexec("tar --lzma -xvf data.tar.lzma"); | |
echoexec("rm data.tar.lzma"); | |
} | |
echoexec("rm control.tar.gz"); | |
echoexec("rm debian-binary"); | |
echoexec("rm ".$file); | |
} | |
echoexec("mv usr/lib usr/lib32"); | |
echoexec("mv lib lib32"); | |
echoexec("tar -cvf data.tar lib32 usr/lib32"); | |
echoexec("rm -r lib32 usr"); | |
echoexec("tar -xvf data.tar -C ".$targetextract); | |
echoexec("rm data.tar"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment