File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,29 @@ def manifest_package(file)
42
42
end
43
43
list
44
44
end
45
+
46
+ def can_install ( pkgs )
47
+ ignores = [ ]
48
+ Libexec . each_line ( "apt-get install #{ pkgs . join ( " " ) } 2>&1" ) do |line |
49
+ err_pre = "E: Unable to locate package "
50
+ if line . include? ( err_pre )
51
+ pkg = line . chomp . delete_prefix ( err_pre )
52
+ ignores . push ( pkg )
53
+ end
54
+ end
55
+ return pkgs if ignores . empty?
56
+
57
+ pkgs -= ignores
58
+ can_install ( pkgs )
59
+ end
60
+
61
+ def can_from_file ( file )
62
+ pkgs = [ ]
63
+ IO . readlines ( file ) . each do |line |
64
+ pkgs . push ( line . chomp )
65
+ end
66
+ can_install ( pkgs )
67
+ end
45
68
end
46
69
end
47
70
end
Original file line number Diff line number Diff line change @@ -40,4 +40,7 @@ class MyClass
40
40
desktop = live_desktop_pkgs - base_pkg
41
41
42
42
# puts server
43
- puts desktop
43
+ # puts desktop
44
+
45
+ puts u . can_install ( desktop )
46
+ # puts u.can_from_file("install.txt")
You can’t perform that action at this time.
0 commit comments