forked from cromer/pamac-classic
auto run pacman-db-upgrade if needed
This commit is contained in:
parent
7c2aa35931
commit
a58abd083f
@ -137,6 +137,14 @@ class AlpmConfig {
|
|||||||
public Alpm.Handle? get_handle () {
|
public Alpm.Handle? get_handle () {
|
||||||
Alpm.Errno error;
|
Alpm.Errno error;
|
||||||
Alpm.Handle? handle = new Alpm.Handle (rootdir, dbpath, out error);
|
Alpm.Handle? 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);
|
||||||
|
} catch (SpawnError e) {
|
||||||
|
stdout.printf ("Error: %s\n", e.message);
|
||||||
|
}
|
||||||
|
handle = new Alpm.Handle (rootdir, dbpath, out error);
|
||||||
|
}
|
||||||
if (handle == null) {
|
if (handle == null) {
|
||||||
stderr.printf ("Failed to initialize alpm library" + " (%s)\n".printf (Alpm.strerror (error)));
|
stderr.printf ("Failed to initialize alpm library" + " (%s)\n".printf (Alpm.strerror (error)));
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user