|
@@ -13,7 +13,7 @@ public static int main(string[] args) {
|
|
|
|
|
|
var verb = args[1];
|
|
|
|
|
|
- if(verb != "remove" && verb != "acquire") {
|
|
|
+ if(verb != "remove" && verb != "acquire" && verb != "install") {
|
|
|
if(args.length < 3) {
|
|
|
usage();
|
|
|
return 255;
|
|
@@ -40,6 +40,17 @@ public static int main(string[] args) {
|
|
|
}
|
|
|
|
|
|
if(verb == "install") {
|
|
|
+ if(build_path == null) {
|
|
|
+ var dir = File.new_build_filename("/tmp", Uuid.string_random());
|
|
|
+ try {
|
|
|
+ dir.make_directory();
|
|
|
+ }
|
|
|
+ catch(Error e) {
|
|
|
+ printerr(@"Could not create temporary build directory, try specifying one instead: $(e.message)\n");
|
|
|
+ return 255;
|
|
|
+ }
|
|
|
+ build_path = dir.get_path();
|
|
|
+ }
|
|
|
return install();
|
|
|
}
|
|
|
|
|
@@ -135,9 +146,23 @@ private int install() {
|
|
|
var path = paths.get_suggested_path(resource.key);
|
|
|
printerr(@"Installing $(resource.key) to $path...");
|
|
|
try {
|
|
|
- var src = File.new_build_filename(build_path, resource.value);
|
|
|
- var dest = File.new_for_path(path);
|
|
|
- src.copy(dest, FileCopyFlags.OVERWRITE);
|
|
|
+ if(resource.value.file_type == Usm.ManifestFileType.REGULAR) {
|
|
|
+ var src = File.new_build_filename(build_path, resource.value.path);
|
|
|
+ var dest = File.new_for_path(path);
|
|
|
+ src.copy(dest, FileCopyFlags.OVERWRITE);
|
|
|
+ }
|
|
|
+ else if(resource.value.file_type == Usm.ManifestFileType.DIRECTORY) {
|
|
|
+ var dest = File.new_for_path(path);
|
|
|
+ dest.make_directory();
|
|
|
+ }
|
|
|
+ else if(resource.value.file_type == Usm.ManifestFileType.SYMBOLIC_LINK) {
|
|
|
+ var dest = File.new_for_path(path);
|
|
|
+ dest.make_symbolic_link(resource.value.path);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ printerr(@" File type not implemented\n");
|
|
|
+ return 250;
|
|
|
+ }
|
|
|
}
|
|
|
catch(Error e) {
|
|
|
printerr(@" $(e.message)\n");
|