Beispiel #1
0
function lxshell_tar($dir, $zipname, $filelist)
{
    $ret = lxshell_zip_core("tar", $dir, $zipname, $filelist);
    return $ret;
}
Beispiel #2
0
function do_zip_to_fileserv($type, $arg)
{
    lxfile_mkdir("__path_serverfile/tmp");
    lxfile_unix_chown_rec("__path_serverfile", "lxlabs");
    $basebase = basename($arg[0]);
    $base = basename(ltempnam("__path_serverfile/tmp", $basebase));
    /*
    	// Create the pass file now itself so that it isn't unwittingly created again.
    
    	if ($type === 'zip') {
    		$vd = $arg[0];
    		$list = $arg[1];
    		dprint("zipping $vd: " . implode(" ", $list) . " \n");
    		$ret = lxshell_zip($vd, "__path_serverfile/tmp/$base.tmp", $list);
    		lrename("__path_serverfile/tmp/$base.tmp", "__path_serverfile/tmp/$base");
    	} else if ($type === 'tgz') {
    		$vd = $arg[0];
    		$list = $arg[1];
    		dprint("tarring $vd: " . implode(" ", $list) . " \n");
    		$ret = lxshell_tgz($vd, "__path_serverfile/tmp/$base.tmp", $list);
    		lrename("__path_serverfile/tmp/$base.tmp", "__path_serverfile/tmp/$base");
    	} else if ($type === 'tar') {
    		$vd = $arg[0];
    		$list = $arg[1];
    		dprint("tarring $vd: " . implode(" ", $list) . " \n");
    		$ret = lxshell_tar($vd, "__path_serverfile/tmp/$base.tmp", $list);
    		lrename("__path_serverfile/tmp/$base.tmp", "__path_serverfile/tmp/$base");
    	}
    
    	if ($ret) {
    		throw new lxException("could_not_zip_dir", '', $vd);
    	}
    */
    $vd = $arg[0];
    $list = $arg[1];
    if ($type === 'zip') {
        dprint("zipping {$vd}: " . implode(" ", $list) . " \n");
    } else {
        if ($type === 'tgz') {
            dprint("tarring {$vd}: " . implode(" ", $list) . " \n");
        } else {
            if ($type === 'tar') {
                dprint("tarring {$vd}: " . implode(" ", $list) . " \n");
            }
        }
    }
    $ret = lxshell_zip_core($type, $vd, "__path_serverfile/tmp/{$base}.tmp", $list);
    if ($ret) {
        throw new lxException("could_not_zip_dir", '', $vd);
    }
    lrename("__path_serverfile/tmp/{$base}.tmp", "__path_serverfile/tmp/{$base}");
    return "__path_serverfile/tmp/{$base}";
}