Commit 946b39b0 authored by claes's avatar claes

New distributor window

parent 60ddd53d
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "co_time.h" #include "co_time.h"
#include "rt_load.h" #include "rt_load.h"
wb_pkg::wb_pkg( char *nodelist) wb_pkg::wb_pkg( char *nodelist, bool distribute)
{ {
if ( nodelist) { if ( nodelist) {
char node_str[32][20]; char node_str[32][20];
...@@ -32,7 +32,7 @@ wb_pkg::wb_pkg( char *nodelist) ...@@ -32,7 +32,7 @@ wb_pkg::wb_pkg( char *nodelist)
readConfig(); readConfig();
fetchFiles(); fetchFiles( distribute);
} }
void wb_pkg::readConfig() void wb_pkg::readConfig()
...@@ -250,7 +250,7 @@ pkg_node& wb_pkg::getNode( char *name) ...@@ -250,7 +250,7 @@ pkg_node& wb_pkg::getNode( char *name)
throw wb_error_str("No such node"); throw wb_error_str("No such node");
} }
void pkg_node::fetchFiles() void pkg_node::fetchFiles( bool distribute)
{ {
char dev[80]; char dev[80];
char dir[80]; char dir[80];
...@@ -327,16 +327,19 @@ void pkg_node::fetchFiles() ...@@ -327,16 +327,19 @@ void pkg_node::fetchFiles()
of << of <<
"#mv $pwrp_tmp/pkg_unpack.sh $pwrp_tmp/pkg_build" << endl << "#mv $pwrp_tmp/pkg_unpack.sh $pwrp_tmp/pkg_build" << endl <<
"cd $pwrp_tmp" << endl << "cd $pwrp_tmp" << endl <<
"tar -czf $pwrp_load/" << pkg_name << " pwr_pkg.dat pkg_unpack.sh pkg_build" << endl << "tar -czf $pwrp_load/" << pkg_name << " pwr_pkg.dat pkg_unpack.sh pkg_build" << endl;
"cd $pwrp_load" << endl <<
"ftp -vin " << m_name << " << EOF &>$pwrp_tmp/ftp_" << m_name << ".log" << endl << if ( distribute)
"user pwrp pwrp" << endl << of <<
"binary" << endl << "cd $pwrp_load" << endl <<
"put " << pkg_name << endl << "ftp -vin " << m_name << " << EOF &>$pwrp_tmp/ftp_" << m_name << ".log" << endl <<
"quit" << endl << "user pwrp pwrp" << endl <<
"EOF" << endl << "binary" << endl <<
"rsh -l pwrp " << m_name << " \\$pwr_exe/pwr_pkg.sh -i " << pkg_name << endl; "put " << pkg_name << endl <<
"quit" << endl <<
"EOF" << endl <<
"rsh -l pwrp " << m_name << " \\$pwr_exe/pwr_pkg.sh -i " << pkg_name << endl;
of.close(); of.close();
// Create a script that unpackes the archive and moves files to the target directories // Create a script that unpackes the archive and moves files to the target directories
...@@ -403,6 +406,37 @@ void pkg_node::fetchFiles() ...@@ -403,6 +406,37 @@ void pkg_node::fetchFiles()
} }
void wb_pkg::copyPackage( char *pkg_name)
{
char pack_fname[200];
char node_name[80];
char *s;
// Extract node name from package name
strcpy( node_name, &pkg_name[9]);
if ( (s = strrchr( node_name, '_')))
*s = 0;
dcli_translate_filename( pack_fname, "$pwrp_tmp/pkg_pack.sh");
ofstream of( pack_fname);
of <<
"cd $pwrp_load" << endl <<
"ftp -vin " << node_name << " << EOF &>$pwrp_tmp/ftp_" << node_name << ".log" << endl <<
"user pwrp pwrp" << endl <<
"binary" << endl <<
"put " << pkg_name << endl <<
"quit" << endl <<
"EOF" << endl <<
"rsh -l pwrp " << node_name << " \\$pwr_exe/pwr_pkg.sh -i " << pkg_name << endl;
of.close();
// Execute the pack file
char cmd[200];
sprintf( cmd, "source %s", pack_fname);
system( cmd);
}
void pkg_pattern::fetchFiles() void pkg_pattern::fetchFiles()
{ {
char found_file[200]; char found_file[200];
......
...@@ -25,6 +25,7 @@ class pkg_file { ...@@ -25,6 +25,7 @@ class pkg_file {
char *source() { return m_source;} char *source() { return m_source;}
char *target() { return m_target;} char *target() { return m_target;}
pwr_tTime date() { return m_date;} pwr_tTime date() { return m_date;}
}; };
class pkg_pattern { class pkg_pattern {
...@@ -82,7 +83,7 @@ class pkg_node { ...@@ -82,7 +83,7 @@ class pkg_node {
void push_back( pkg_pattern& pattern) { void push_back( pkg_pattern& pattern) {
m_pattern.push_back( pattern); m_pattern.push_back( pattern);
} }
void fetchFiles(); void fetchFiles( bool distribute);
}; };
class wb_pkg { class wb_pkg {
...@@ -93,11 +94,13 @@ class wb_pkg { ...@@ -93,11 +94,13 @@ class wb_pkg {
void readConfig(); void readConfig();
public: public:
wb_pkg( char *nodelist); wb_pkg( char *nodelist, bool distribute = true);
pkg_node& getNode( char *name); pkg_node& getNode( char *name);
void fetchFiles() { void fetchFiles( bool distribute) {
for ( int i = 0; i < (int)m_nodelist.size(); i++) m_nodelist[i].fetchFiles(); for ( int i = 0; i < (int)m_nodelist.size(); i++) m_nodelist[i].fetchFiles( distribute);
} }
static void copyPackage( char *pkg_name);
}; };
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment