Commit eab989b1 authored by claes's avatar claes

Set owner root of plc, and improved error handling

parent fe1b0cb4
...@@ -318,6 +318,7 @@ void pkg_node::fetchFiles( bool distribute) ...@@ -318,6 +318,7 @@ void pkg_node::fetchFiles( bool distribute)
// Put all files in a single list // Put all files in a single list
for ( int i = 0; i < (int)m_pattern.size(); i++) { for ( int i = 0; i < (int)m_pattern.size(); i++) {
for ( int j = 0; j < (int)m_pattern[i].m_filelist.size(); j++) { for ( int j = 0; j < (int)m_pattern[i].m_filelist.size(); j++) {
try {
pkg_file f = m_pattern[i].m_filelist[j]; pkg_file f = m_pattern[i].m_filelist[j];
dcli_parse_filename( f.m_source, dev, dir, file, type, &version); dcli_parse_filename( f.m_source, dev, dir, file, type, &version);
...@@ -339,6 +340,10 @@ void pkg_node::fetchFiles( bool distribute) ...@@ -339,6 +340,10 @@ void pkg_node::fetchFiles( bool distribute)
} }
m_filelist.push_back( f); m_filelist.push_back( f);
} catch ( wb_error &e) {
MsgWindow::message( 'W', e.what().c_str(), msgw_ePop_No);
m_warnings++;
}
} }
} }
...@@ -426,6 +431,16 @@ void pkg_node::fetchFiles( bool distribute) ...@@ -426,6 +431,16 @@ void pkg_node::fetchFiles( bool distribute)
"mv pwr_pkg.dat $pwrp_load" << endl << "mv pwr_pkg.dat $pwrp_load" << endl <<
"rm -r /tmp/pkg_build" << endl; "rm -r /tmp/pkg_build" << endl;
// Change owner to root of plc, to make modification of thread prio possible
ofu <<
"nname=`eval uname -n`" << endl <<
"tst=`eval sudo -l | grep \" ALL\"`" << endl <<
"if [ \"$tst\" != \"\" ]; then" << endl <<
" sudo chown root $pwrp_exe/plc_$nname_*" << endl <<
" sudo chmod g+w $pwrp_exe/plc_$nname_*" << endl <<
" sudo chmod u+s $pwrp_exe/plc_$nname_*" << endl <<
"fi" << endl;
ofu.close(); ofu.close();
// Create a data file with description and all installed files // Create a data file with description and all installed files
...@@ -546,8 +561,12 @@ void pkg_pattern::fetchFiles() ...@@ -546,8 +561,12 @@ void pkg_pattern::fetchFiles()
strcat( file_target, file); strcat( file_target, file);
strcat( file_target, type); strcat( file_target, type);
} }
try {
pkg_file file( found_file, file_target); pkg_file file( found_file, file_target);
m_filelist.push_back( file); m_filelist.push_back( file);
} catch ( wb_error &e) {
MsgWindow::message( 'W', e.what().c_str(), msgw_ePop_Yes);
}
break; break;
} }
} }
...@@ -572,8 +591,12 @@ void pkg_pattern::fetchFiles() ...@@ -572,8 +591,12 @@ void pkg_pattern::fetchFiles()
strcat( file_target, file); strcat( file_target, file);
strcat( file_target, type); strcat( file_target, type);
} }
try {
pkg_file file( found_file, file_target); pkg_file file( found_file, file_target);
m_filelist.push_back( file); m_filelist.push_back( file);
} catch ( wb_error &e) {
MsgWindow::message( 'W', e.what().c_str(), msgw_ePop_Yes);
}
sts = dcli_search_file( m_source, found_file, DCLI_DIR_SEARCH_NEXT); sts = dcli_search_file( m_source, found_file, DCLI_DIR_SEARCH_NEXT);
} }
...@@ -598,8 +621,11 @@ pkg_file::pkg_file( char *source, char *target) ...@@ -598,8 +621,11 @@ pkg_file::pkg_file( char *source, char *target)
struct stat info; struct stat info;
int sts = stat( source, &info); int sts = stat( source, &info);
if ( sts == -1) if ( sts == -1) {
throw wb_error_str("Source file doesn't exist"); char msg[256];
sprintf( msg, "Source file doesn't exist: %s", source);
throw wb_error_str(msg);
}
m_date.tv_sec = info.st_ctime; m_date.tv_sec = info.st_ctime;
m_date.tv_nsec = 0; m_date.tv_nsec = 0;
......
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