nub 0.0.86 → 0.0.87
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nub/pacman.rb +22 -19
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cdb80d8114aa0ed667633afab685c21bb64bdbc904d01c2eab545c9b77dccf5
|
4
|
+
data.tar.gz: a29253c340ab74854c13035ed17f03c902690b438cc0c6e1314abc4746b697d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2169fa40613694bfd24a6e81ccf043fa6491fd5904d7c48bf7fb1be2a5bb1a5ed78b466972fa81a1de8b3fca41a55e54678313c79c87b239d3181a941a8da40
|
7
|
+
data.tar.gz: 852f5eadcfa7dd9474b1556ce03a2c140865899143caec85ed53aff9395f2efba70b968404322c999c1cbe8de2730f62c3853fad4fb0d09535798ba95a0140f4
|
data/lib/nub/pacman.rb
CHANGED
@@ -38,7 +38,8 @@ module Pacman
|
|
38
38
|
# @param arch [String] capturing the pacman target architecture e.g. x86_64
|
39
39
|
# @param sysroot [String] path to the system root to use
|
40
40
|
# @param env [Hash] of environment variables to set for session
|
41
|
-
|
41
|
+
# @param clean [Bool] true triggers a clean overwrite
|
42
|
+
def init(path, config, mirrors, arch:'x86_64', sysroot:nil, env:nil, clean:false)
|
42
43
|
mirrors = [mirrors] if mirrors.is_a?(String)
|
43
44
|
self.path = path
|
44
45
|
self.arch = arch
|
@@ -51,24 +52,26 @@ module Pacman
|
|
51
52
|
Log.die("pacman config '#{config}' doesn't exist") unless File.exist?(config)
|
52
53
|
|
53
54
|
# Copy in pacman files for use in target
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
55
|
+
if clean || !File.exist?(self.config)
|
56
|
+
FileUtils.rm_rf(File.join(path, '.'))
|
57
|
+
FileUtils.mkdir_p(File.join(self.path, 'db'))
|
58
|
+
FileUtils.mkdir_p(self.sysroot) if self.sysroot && !Dir.exist?(self.sysroot)
|
59
|
+
FileUtils.cp(config, path, preserve: true)
|
60
|
+
FileUtils.cp(mirrors, path, preserve: true)
|
61
|
+
|
62
|
+
# Update the given pacman config file to use the given path
|
63
|
+
FileUtils.replace(self.config, /(Architecture = ).*/, "\\1#{self.arch}")
|
64
|
+
FileUtils.replace(self.config, /#(DBPath\s+= ).*/, "\\1#{File.join(self.path, 'db')}")
|
65
|
+
FileUtils.replace(self.config, /#(CacheDir\s+= ).*/, "\\1#{File.join(self.path, 'cache')}")
|
66
|
+
FileUtils.replace(self.config, /#(LogFile\s+= ).*/, "\\1#{File.join(self.path, 'pacman.log')}")
|
67
|
+
FileUtils.replace(self.config, /#(GPGDir\s+= ).*/, "\\1#{File.join(self.path, 'gnupg')}")
|
68
|
+
FileUtils.replace(self.config, /#(HookDir\s+= ).*/, "\\1#{File.join(self.path, 'hooks')}")
|
69
|
+
FileUtils.replace(self.config, /.*(\/.*mirrorlist).*/, "Include = #{self.path}\\1")
|
70
|
+
|
71
|
+
# Initialize pacman keyring
|
72
|
+
Sys.exec("pacman-key --config #{self.config} --init")
|
73
|
+
Sys.exec("pacman-key --config #{self.config} --populate #{repos * ' '}")
|
74
|
+
end
|
72
75
|
end
|
73
76
|
|
74
77
|
# Update the pacman database
|