system-builder 0.0.20 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/box +20 -15
- data/lib/system_builder/boot.rb +1 -1
- data/lib/system_builder/version.rb +1 -1
- metadata +4 -4
data/bin/box
CHANGED
@@ -66,24 +66,26 @@ class BoxCommand
|
|
66
66
|
target = (options[:target] or "/dev/sdb")
|
67
67
|
disk_image = (options[:image] or "dist/disk")
|
68
68
|
partition = "#{target}1"
|
69
|
+
tmpdir = "/tmp/dist"
|
69
70
|
|
71
|
+
sh "[ -d #{tmpdir} ]||mkdir #{tmpdir}"
|
70
72
|
if disk_image =~ /([a-z]+box)-(\d+-\d+)/
|
71
73
|
# like pigebox-20101014-1155
|
72
74
|
name = $1
|
73
75
|
release = $2
|
74
|
-
disk_image = "
|
76
|
+
disk_image = "#{tmpdir}/#{name}-#{release}.disk"
|
75
77
|
sh "ssh dev.dbx.tryphon.priv cat /var/lib/buildbot/dist/#{name}/#{name}-#{release}.disk.gz | gunzip -c > #{disk_image}" unless File.exist?(disk_image)
|
76
78
|
end
|
77
79
|
|
78
80
|
raise "Can't find #{disk_image}" unless File.exists?(disk_image)
|
79
81
|
|
80
|
-
if partition_mount = mounts.assoc(partition)
|
81
|
-
|
82
|
-
else
|
83
|
-
partition_mount_point = "/
|
82
|
+
#if partition_mount = mounts.assoc(partition)
|
83
|
+
# partition_mount_point = partition_mount[1]
|
84
|
+
#else
|
85
|
+
partition_mount_point = "#{tmpdir}/boot"
|
84
86
|
#sudo "mkdir #{partition_mount_point}" unless File.exist? partition_mount_point
|
85
87
|
#sudo "mount #{partition} #{partition_mount_point}"
|
86
|
-
end
|
88
|
+
#end
|
87
89
|
|
88
90
|
#unless File.exists? "#{partition_mount_point}/config.pp"
|
89
91
|
$stdout.write "Confirm you want install box image (#{disk_image}) in #{target} [y/N] :"
|
@@ -100,6 +102,8 @@ class BoxCommand
|
|
100
102
|
sh "echo ',,L,*' | sudo /sbin/sfdisk -f -uS #{target}"
|
101
103
|
sudo "mke2fs -j -L boot #{partition}"
|
102
104
|
|
105
|
+
sh "[ -d #{partition_mount_point} ]||mkdir #{partition_mount_point}"
|
106
|
+
|
103
107
|
puts "Copy files"
|
104
108
|
sudo "mount #{partition} #{partition_mount_point}"
|
105
109
|
mount_disk_image_fs(disk_image) do |dir|
|
@@ -108,19 +112,20 @@ class BoxCommand
|
|
108
112
|
sudo "umount #{partition_mount_point}"
|
109
113
|
|
110
114
|
puts "Install extlinux"
|
111
|
-
sudo "mount #{partition}
|
112
|
-
sudo "mount proc
|
113
|
-
sudo "mount -o bind /dev
|
115
|
+
sudo "mount #{partition} #{partition_mount_point}"
|
116
|
+
#sudo "mount proc #{partition_mount_point}/proc -t proc"
|
117
|
+
#sudo "mount -o bind /dev #{partition_mount_point}/dev"
|
114
118
|
|
115
119
|
begin
|
116
|
-
sudo "chroot
|
120
|
+
#sudo "chroot #{tmpdir} /usr/bin/extlinux --install /boot"
|
121
|
+
sudo "/usr/sbin/extlinux --install #{partition_mount_point}"
|
117
122
|
ensure
|
118
|
-
sudo "umount
|
119
|
-
sudo "umount
|
120
|
-
sudo "umount
|
123
|
+
#sudo "umount #{tmpdir}/proc"
|
124
|
+
#sudo "umount #{tmpdir}/dev"
|
125
|
+
sudo "umount #{partition_mount_point}"
|
121
126
|
end
|
122
127
|
|
123
|
-
sudo "dd if
|
128
|
+
sudo "dd if=/usr/lib/syslinux/mbr.bin of=#{target}"
|
124
129
|
end
|
125
130
|
|
126
131
|
def sh(command)
|
@@ -138,7 +143,7 @@ class BoxCommand
|
|
138
143
|
|
139
144
|
def mount_disk_image_fs(disk_image)
|
140
145
|
mount_dir = "/tmp/mount_boot_fs"
|
141
|
-
sh "mkdir -p
|
146
|
+
sh "[ -d #{mount_dir} ]||mkdir -p #{mount_dir}"
|
142
147
|
begin
|
143
148
|
sudo "mount -o loop,offset=#{64*512} #{disk_image} #{mount_dir}"
|
144
149
|
yield mount_dir
|
data/lib/system_builder/boot.rb
CHANGED
@@ -330,7 +330,7 @@ class SystemBuilder::DebianBoot
|
|
330
330
|
end
|
331
331
|
|
332
332
|
def sh(*arguments)
|
333
|
-
FileUtils::sudo "chroot #{image.expand_path('/')} sh -c \"LC_ALL=C #{arguments.join(' ')}\""
|
333
|
+
FileUtils::sudo "chroot #{image.expand_path('/')} sh -c \"export HOME=/root; LC_ALL=C #{arguments.join(' ')}\""
|
334
334
|
end
|
335
335
|
alias_method :sudo, :sh
|
336
336
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: system-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 53
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 21
|
10
|
+
version: 0.0.21
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Alban Peignier
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-05-
|
19
|
+
date: 2011-05-18 00:00:00 Z
|
20
20
|
dependencies: []
|
21
21
|
|
22
22
|
description: ""
|