This commit is contained in:
guinux
2017-07-29 16:35:04 +02:00
parent b64b603e82
commit d661c573f9
36 changed files with 1979 additions and 2527 deletions

View File

@@ -51,7 +51,7 @@ class AlpmConfig {
string? arch;
double deltaratio;
int usesyslog;
int checkspace;
public int checkspace;
GLib.List<string> cachedirs;
GLib.List<string> hookdirs;
GLib.List<string> ignoregroups;
@@ -134,9 +134,22 @@ class AlpmConfig {
}
}
public Alpm.Handle? get_handle (bool files_db = false) {
Alpm.Errno error;
Alpm.Handle? handle = new Alpm.Handle (rootdir, dbpath, out error);
public Alpm.Handle? get_handle (bool files_db = false, bool tmp_db = false) {
Alpm.Errno error = 0;
Alpm.Handle? handle = null;
if (tmp_db) {
string tmp_dbpath = "/tmp/pamac-checkdbs-%s".printf (Environment.get_user_name ());
try {
Process.spawn_command_line_sync ("mkdir -p %s".printf (tmp_dbpath));
Process.spawn_command_line_sync ("ln -sf %s/local %s".printf (dbpath, tmp_dbpath));
Process.spawn_command_line_sync ("cp -au %s/sync %s".printf (dbpath, tmp_dbpath));
handle = new Alpm.Handle (rootdir, tmp_dbpath, out error);
} catch (SpawnError e) {
stderr.printf ("SpawnError: %s\n", e.message);
}
} else {
handle = new Alpm.Handle (rootdir, dbpath, out error);
}
if (error == Alpm.Errno.DB_VERSION) {
try {
Process.spawn_command_line_sync ("pacman-db-upgrade", null, null, null);
@@ -153,7 +166,9 @@ class AlpmConfig {
if (files_db) {
handle.dbext = ".files";
}
handle.logfile = logfile;
if (!tmp_db) {
handle.logfile = logfile;
}
handle.gpgdir = gpgdir;
handle.arch = arch;
handle.deltaratio = deltaratio;