You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1017 B
36 lines
1017 B
#!/usr/bin/php
|
|
<?php
|
|
function run_command( $CMD ){
|
|
$FD = @popen( $CMD, "r" );
|
|
if( $FD ){
|
|
while (($buffer = fgets( $FD ) ) !== false ){
|
|
echo $buffer;
|
|
};
|
|
if( !feof( $FD ) ){
|
|
echo "Error: unexpected fgets() failure\n";
|
|
}
|
|
pclose($FD);
|
|
};
|
|
};
|
|
if( isset( $argv[1] ) ){
|
|
if( $argv[1] != '/srv' && $argv[1] != '/srv/' ){
|
|
$L="tar -cvjf /srv/tmp/upgrade.tar.bz2 --absolute-names -C {$argv[1]} .";
|
|
run_command( $L );
|
|
$MD5 = md5_file( '/srv/tmp/upgrade.tar.bz2' );
|
|
chdir( './pp_cc' );
|
|
$L = trim(`/usr/bin/php create_backup_cert.php {$MD5}`);
|
|
echo "Cert: {$L}\n";
|
|
copy( $L ,'/srv/tmp/manifest.crt' );
|
|
unlink( $L );
|
|
$L="tar -cvjf /srv/package.tar.bz2 --absolute-names -C /srv/tmp .";
|
|
run_command( $L );
|
|
unlink( '/srv/tmp/'.$L );
|
|
unlink( '/srv/tmp/upgrade.tar.bz2' );
|
|
} else {
|
|
echo "It's a bad idea to create package of your own [/srv] folder\n";
|
|
};
|
|
} else {
|
|
echo "Usage {$argv[0]} [path_to_a_tree]\n";
|
|
};
|
|
|
|
?>
|