Hotfix: Changed pacman database filename && Added missing logic for compressed directory
This commit is contained in:
parent
eb2b1edf29
commit
e07cdcfeb0
@ -12,7 +12,7 @@
|
|||||||
string result3 = Update.copyEverthingAfterUpdateToBackupLocation();
|
string result3 = Update.copyEverthingAfterUpdateToBackupLocation();
|
||||||
Console.WriteLine(result3);
|
Console.WriteLine(result3);
|
||||||
|
|
||||||
bool result4 = Update.zipAllContentInBackupLocation("after-backup.zip");
|
bool result4 = Update.zipAllContentInBackupLocation("post-backup.zip");
|
||||||
if (result4) {
|
if (result4) {
|
||||||
Console.WriteLine(result4);
|
Console.WriteLine(result4);
|
||||||
} else {
|
} else {
|
||||||
|
@ -111,7 +111,9 @@ public class Update {
|
|||||||
|
|
||||||
public static bool zipAllContentInBackupLocation(string finalZipName) {
|
public static bool zipAllContentInBackupLocation(string finalZipName) {
|
||||||
string targetPath = getHomePath() + "/backup/compressed/";
|
string targetPath = getHomePath() + "/backup/compressed/";
|
||||||
|
if (!Directory.Exists(targetPath)) {
|
||||||
Directory.CreateDirectory(targetPath);
|
Directory.CreateDirectory(targetPath);
|
||||||
|
}
|
||||||
|
|
||||||
string sourcePath = getHomePath() + "/backup/uncompressed/"; // Moved to /tmp
|
string sourcePath = getHomePath() + "/backup/uncompressed/"; // Moved to /tmp
|
||||||
string targetZip = getHomePath() + "/backup/compressed/" + finalZipName;
|
string targetZip = getHomePath() + "/backup/compressed/" + finalZipName;
|
||||||
@ -152,12 +154,12 @@ public class Update {
|
|||||||
|
|
||||||
public static bool zipPacmanDatabase() {
|
public static bool zipPacmanDatabase() {
|
||||||
string pacmanDatabaseLocation = "/var/lib/pacman/local/";
|
string pacmanDatabaseLocation = "/var/lib/pacman/local/";
|
||||||
string pacmanDatabaseZip = getHomePath() + "/backup/compressed/pacman_database.zip";
|
string pacmanDatabaseZip = getHomePath() + "/backup/compressed/pacman-database.zip";
|
||||||
|
|
||||||
if (!Directory.Exists("/tmp/backup/")) {
|
if (!Directory.Exists("/tmp/backup/")) {
|
||||||
Directory.CreateDirectory("/tmp/backup/");
|
Directory.CreateDirectory("/tmp/backup/");
|
||||||
}
|
}
|
||||||
string newPacmanDatabaseZip = "/tmp/backup/pacman_database.zip";
|
string newPacmanDatabaseZip = "/tmp/backup/pacman-database.zip";
|
||||||
File.Delete(newPacmanDatabaseZip); // Delete residual Pacman Database in tmp
|
File.Delete(newPacmanDatabaseZip); // Delete residual Pacman Database in tmp
|
||||||
ZipFile.CreateFromDirectory(pacmanDatabaseLocation, newPacmanDatabaseZip);
|
ZipFile.CreateFromDirectory(pacmanDatabaseLocation, newPacmanDatabaseZip);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user