Utilities
|
|
|
|
#!/php/php -q
<? /*
package_exe.php Copyright (C) 2002 by Mukunda Modell
url: http://www.20after4.net
email: mukunda@20after4.net
You are free to use this script however you see fit, however, you must keep this notice intact and you must agree to the following disclaimer:
Disclaimer:
this script is provided as is and without any warrenty,
not even the implied warrenties of merchantability or
fitness for a particular purpose.
I explicitly disclaim responsibility for this script
including any damages that might result from your use or
misuse of the script.
Usage:
create a new file and paste this source code into it.
Then make the file executable and run the program from
the linux shell:
/path/to/this/script.php /path/to/exe /path/to/archive
exe is an executable file that you want to package.
archive is the name of a tar file that will be created.
once your archive is created you can copy the tar file to
another machine and execute a command similar to this one to extract the archive:
cd /
tar -xvkf /path/to/archive.tar
(note: the -xvkf is important: the k prevents tar from overwriting and files that already exist)
*/ if (empty($argv[1]) || empty($argv[2]))
{
echo "Usage:n----------npackage_exe executableFile archiveFilen----------nThe result is a tar archiveFile containing";
echo " executableFilenand the sharedlibraries that it needs (according to ldd)nn";
}
else
{
$list = shell_exec("ldd $argv[1]");
$arr = explode("=>", $list);
$files = $argv[1];
Echo "Finding shared library dependencies for $filesn------------------------------------------------n";
for ($i = 0; $i < count($arr); $i++)
{
$lib = explode("(", $arr[$i+1]);
$lib = trim($lib[0]);
echo $lib . "n";
$files = $files . " " . $lib;
}
passthru( "tar -cvhf $argv[2] $files");
} ?>
|
|
|
Usage Example
|
create a new file and paste this source code into it.
Then make the file executable and run the program from
the linux shell:
/path/to/this/script.php /path/to/exe /path/to/archive
exe is an executable file that you want to package.
archive is the name of a tar file that will be created.
once your archive is created you can copy the tar file to
another machine and execute a command similar to this one to extract the archive:
|
|
|
Rate This Script
|
|
|
|