Commit 755ee6c9 authored by Philip Müller's avatar Philip Müller

* add pacman --root for livecd

parent 35fa1376
......@@ -28,3 +28,4 @@
#define MHWD_PM_CACHE_DIR "/var/cache/pacman/pkg"
#define MHWD_PM_CONFIG "/etc/pacman.conf"
#define MHWD_PM_ROOT "/"
......@@ -52,6 +52,7 @@ struct delete_ptr : public std::unary_function<bool,T> {
void mhwd::initData(mhwd::Data *data) {
data->environment.PMCachePath = MHWD_PM_CACHE_DIR;
data->environment.PMConfigPath = MHWD_PM_CONFIG;
data->environment.PMRootPath = MHWD_PM_ROOT;
data->environment.syncPackageManagerDatabase = true;
data->environment.messageFunc = NULL;
}
......@@ -1079,6 +1080,7 @@ bool mhwd::runScript(mhwd::Data *data, mhwd::Config *config, mhwd::Transaction::
cmd += " --cachedir \"" + data->environment.PMCachePath + "\"";
cmd += " --pmconfig \"" + data->environment.PMConfigPath + "\"";
cmd += " --root \"" + data->environment.PMRootPath + "\"";
cmd += " --config \"" + config->configPath + "\"";
cmd += " 2>&1";
......
......@@ -60,7 +60,7 @@ namespace mhwd {
struct Data {
struct Environment {
std::string PMCachePath, PMConfigPath;
std::string PMCachePath, PMConfigPath, PMRootPath;
bool syncPackageManagerDatabase;
void (*messageFunc)(mhwd::MESSAGETYPE, std::string);
};
......
......@@ -129,6 +129,7 @@ void printHelp() {
cout << " -a/--auto <usb/pci> <free/nonfree> <classid>\tauto install configs for classid" << endl;
cout << " --pmcachedir <path>\t\t\tset package manager cache path" << endl;
cout << " --pmconfig <path>\t\t\tset package manager config" << endl;
cout << " --pmroot <path>\t\t\tset package manager root" << endl;
cout << endl;
}
......@@ -561,6 +562,15 @@ int main (int argc, char *argv[])
data.environment.PMConfigPath = Vita::string(argv[++nArg]).trim("\"").trim();
}
else if (strcmp(argv[nArg], "--pmroot") == 0) {
if (nArg + 1 >= argc) {
printError("invalid use of option: --pmroot\n");
printHelp();
return 1;
}
data.environment.PMRootPath = Vita::string(argv[++nArg]).trim("\"").trim();
}
else if ((arguments & ARG_INSTALL) || (arguments & ARG_REMOVE)) {
bool found = false;
std::string name;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment