mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-26 15:02:50 +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:
@@ -21,7 +21,17 @@
|
||||
## Die Verzeichnisse "/", "/dev", "/proc", "/sys", "/mnt", "/tmp" k<>nnen nicht gesichert werden!!
|
||||
#------------------------------------------------------------------------------------------------
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
## vor der Sicherung aus dem neuen Image zu l<>schende Dateien/Verzeichnisse,
|
||||
## gekennzeichnet durch ein vorangestelltes ~
|
||||
# z.B.
|
||||
# ~/share/tuxbox/neutrino/themes/Classic.theme
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
#-------------
|
||||
## Sicherungen
|
||||
#-------------
|
||||
/etc/hostname
|
||||
/etc/hosts
|
||||
/etc/network
|
||||
@@ -30,6 +40,7 @@
|
||||
/var/etc
|
||||
/var/tuxbox/config
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------------------
|
||||
## von der Sicherung auszuschlie<69>ende Dateien, gekennzeichnet durch ein vorangestelltes -
|
||||
#----------------------------------------------------------------------------------------
|
||||
@@ -41,10 +52,3 @@
|
||||
-/var/tuxbox/config/satellites.xml
|
||||
-/var/tuxbox/config/settingsupdate.conf
|
||||
-/var/tuxbox/config/tobackup.conf
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
## nach der Sicherung aus dem neuen Image zu l<>schende Dateien/Verzeichnisse,
|
||||
## gekennzeichnet durch ein vorangestelltes ~
|
||||
# z.B.
|
||||
# ~/share/tuxbox/neutrino/themes/Classic.theme
|
||||
#----------------------------------------------------------------------------
|
||||
|
@@ -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