mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 00:11:08 +02:00
Software Update with apply the settings (Part13)
- Delete files from image, before apply settings
Origin commit data
------------------
Branch: ni/coolstream
Commit: 158a8ba4ce
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2012-12-19 (Wed, 19 Dec 2012)
Origin message was:
------------------
* Software Update with apply the settings (Part13)
- Delete files from image, before apply settings
------------------
This commit was generated by Migit
This commit is contained in:
@@ -506,6 +506,7 @@ bool CExtUpdate::readBackupList(const std::string & dstPath)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
static struct stat FileInfo;
|
||||
vector<std::string>::iterator it;
|
||||
|
||||
f1 = fopen(backupList.c_str(), "r");
|
||||
if (f1 == NULL) {
|
||||
@@ -582,8 +583,30 @@ bool CExtUpdate::readBackupList(const std::string & dstPath)
|
||||
}
|
||||
fclose(f1);
|
||||
|
||||
// read DeleteList
|
||||
for(it = deleteList.begin(); it != deleteList.end(); ++it) {
|
||||
line = *it;
|
||||
if (lstat(line.c_str(), &FileInfo) != -1) {
|
||||
if ((line.find("*") != std::string::npos) || (line.find("?") != std::string::npos)) {
|
||||
// Wildcards
|
||||
WRITE_UPDATE_LOG("delete file list: %s\n", line.c_str());
|
||||
deleteFileList(line.c_str());
|
||||
}
|
||||
else if (S_ISREG(FileInfo.st_mode)) {
|
||||
// File
|
||||
WRITE_UPDATE_LOG("delete file: %s\n", line.c_str());
|
||||
unlink(line.c_str());
|
||||
}
|
||||
else if (S_ISDIR(FileInfo.st_mode)){
|
||||
// Directory
|
||||
WRITE_UPDATE_LOG("delete directory: %s\n", line.c_str());
|
||||
FileHelpers->removeDir(line.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
sync();
|
||||
|
||||
// read copyList
|
||||
vector<std::string>::iterator it;
|
||||
for(it = copyList.begin(); it != copyList.end(); ++it) {
|
||||
line = *it;
|
||||
line = trim(line);
|
||||
@@ -628,28 +651,6 @@ bool CExtUpdate::readBackupList(const std::string & dstPath)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// read DeleteList
|
||||
for(it = deleteList.begin(); it != deleteList.end(); ++it) {
|
||||
line = *it;
|
||||
if (lstat(line.c_str(), &FileInfo) != -1) {
|
||||
if ((line.find("*") != std::string::npos) || (line.find("?") != std::string::npos)) {
|
||||
// Wildcards
|
||||
WRITE_UPDATE_LOG("delete file list: %s\n", line.c_str());
|
||||
deleteFileList(line.c_str());
|
||||
}
|
||||
else if (S_ISREG(FileInfo.st_mode)) {
|
||||
// File
|
||||
WRITE_UPDATE_LOG("delete file: %s\n", line.c_str());
|
||||
unlink(line.c_str());
|
||||
}
|
||||
else if (S_ISDIR(FileInfo.st_mode)){
|
||||
// Directory
|
||||
WRITE_UPDATE_LOG("delete directory: %s\n", line.c_str());
|
||||
FileHelpers->removeDir(line.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
sync();
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user