mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
Compare commits
1258 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0c642c156 | ||
|
|
3f44e09cb5 | ||
|
|
38410afc5a | ||
|
|
f631770974 | ||
|
|
5c76af3a95 | ||
|
|
023128a0eb | ||
|
|
915908fcdd | ||
|
|
178bc878e1 | ||
|
|
c60dc40fe4 | ||
|
|
1a9a8ab48f | ||
|
|
ee0e56f43e | ||
|
|
6739073757 | ||
|
|
7af3602f5f | ||
|
|
e754add14c | ||
|
|
75bf5cfebf | ||
|
|
04769ad507 | ||
|
|
e7fa7f4d16 | ||
|
|
97ea81eb21 | ||
|
|
45afcdb307 | ||
|
|
1ea1646e6f | ||
|
|
d81c577eff | ||
|
|
53e45c8280 | ||
|
|
78d452e9a6 | ||
|
|
5ee193433a | ||
|
|
c90b0eff98 | ||
|
|
cc1888a497 | ||
|
|
3712249f96 | ||
|
|
02b5f00b2b | ||
|
|
91450b5f9a | ||
|
|
9186438937 | ||
|
|
c7b0457c32 | ||
|
|
9024551245 | ||
|
|
2d9f69db61 | ||
|
|
98cd329323 | ||
|
|
acce28e887 | ||
|
|
59596810b0 | ||
|
|
64f93b36de | ||
|
|
793a5677cb | ||
|
|
c032130226 | ||
|
|
6a1061663f | ||
|
|
f013b15fa1 | ||
|
|
544d6b25e3 | ||
|
|
fb41ce252f | ||
|
|
edacd479fa | ||
|
|
4b2e9c9264 | ||
|
|
50aca447ea | ||
|
|
299e3153ee | ||
|
|
300b357eb9 | ||
|
|
63ec023f19 | ||
|
|
7a8addb485 | ||
|
|
e982c0a2f5 | ||
|
|
55795e652e | ||
|
|
133ae6a34b | ||
|
|
e906d30c62 | ||
|
|
f459fe47f8 | ||
|
|
7147d41564 | ||
|
|
e9294668b4 | ||
|
|
b3a106cefc | ||
|
|
4dd6e4328c | ||
|
|
c76912cd77 | ||
|
|
f526fe1766 | ||
|
|
4339b55d10 | ||
|
|
d669db7ff0 | ||
|
|
663012c5ff | ||
|
|
6db81dc72e | ||
|
|
e3ac293e86 | ||
|
|
01551e5462 | ||
|
|
dfe97b352d | ||
|
|
96eab7cc00 | ||
|
|
ab801c2657 | ||
|
|
92206e8d09 | ||
|
|
2f3fb2420e | ||
|
|
af9e9299bf | ||
|
|
91b5e7fb37 | ||
|
|
ade0f1a97d | ||
|
|
681c88ef5d | ||
|
|
7e2576a74a | ||
|
|
154bfb7dd4 | ||
|
|
cd10f6f4db | ||
|
|
2035a75d66 | ||
|
|
004bf7c3db | ||
|
|
2dca9d7194 | ||
|
|
a4800e2d4f | ||
|
|
3ffdddbedf | ||
|
|
50486232db | ||
|
|
5280e3031b | ||
|
|
8d14abb0df | ||
|
|
5b9ac57d4e | ||
|
|
20ad6becd8 | ||
|
|
e9d908929f | ||
|
|
7113aee0b4 | ||
|
|
bb4e882d61 | ||
|
|
b25e8da6d6 | ||
|
|
4b73e0be29 | ||
|
|
3b746ee796 | ||
|
|
984b024c5a | ||
|
|
124f20a1ca | ||
|
|
9ac076c269 | ||
|
|
2191b9ae40 | ||
|
|
e4c9212a8e | ||
|
|
42e445f986 | ||
|
|
eb4e356bc3 | ||
|
|
12e0e3fb09 | ||
|
|
2f85affefb | ||
|
|
276cde033c | ||
|
|
2937c03595 | ||
|
|
76c20d761b | ||
|
|
f114e28cc8 | ||
|
|
8b34855684 | ||
|
|
0520aa3c42 | ||
|
|
10c849ed1c | ||
|
|
cede5316b0 | ||
|
|
2add5c9295 | ||
|
|
dd5959cd88 | ||
|
|
99840550d5 | ||
|
|
b3ab3b452a | ||
|
|
3f46a92ed5 | ||
|
|
f59a404568 | ||
|
|
7330ccd288 | ||
|
|
d4450c6590 | ||
|
|
0e18bccb64 | ||
|
|
2f3a3e308a | ||
|
|
2a76aa22c7 | ||
|
|
5b89dd4aa1 | ||
|
|
d6e5a6546a | ||
|
|
a29777c111 | ||
|
|
356e6a6504 | ||
|
|
3b69792cd5 | ||
|
|
dfaf417fef | ||
|
|
1e24b88270 | ||
|
|
9a4bfb386e | ||
|
|
18c93ac61f | ||
|
|
b68a99b8e2 | ||
|
|
6611d45ab7 | ||
|
|
bbac0beab9 | ||
|
|
feaf871856 | ||
|
|
ad82de35b7 | ||
|
|
3cce894f1b | ||
|
|
24a315507d | ||
|
|
13b79aacca | ||
|
|
54fb09e052 | ||
|
|
34da8850bb | ||
|
|
61306130f8 | ||
|
|
fc733cf943 | ||
|
|
cb49299c13 | ||
|
|
f08ef9778b | ||
|
|
b816f29ada | ||
|
|
a3e5bc7bfa | ||
|
|
356a749bba | ||
|
|
49e6ba51e3 | ||
|
|
862da5dd79 | ||
|
|
8b977d152a | ||
|
|
70e660a157 | ||
|
|
fd63d89644 | ||
|
|
d8499c428a | ||
|
|
2bc223b6b2 | ||
|
|
b812a0d459 | ||
|
|
ec6f9ee542 | ||
|
|
c9f98011fc | ||
|
|
d9008e141c | ||
|
|
ec0d0e0f62 | ||
|
|
56928b5381 | ||
|
|
9c7497a1eb | ||
|
|
9aa13e0574 | ||
|
|
cff95392f5 | ||
|
|
596de56a43 | ||
|
|
234c380128 | ||
|
|
d0b62bd500 | ||
|
|
cc15877f07 | ||
|
|
7e7017957e | ||
|
|
6238cc84f6 | ||
|
|
22d182dbcb | ||
|
|
fb4dd1b55a | ||
|
|
ceaa1ef0b8 | ||
|
|
dd554d94ad | ||
|
|
b08d8e15bb | ||
|
|
e8e0d98ef8 | ||
|
|
5d22ee8760 | ||
|
|
2224372016 | ||
|
|
6e77422800 | ||
|
|
f3484ff3b4 | ||
|
|
1df6905c80 | ||
|
|
c80dcc2da6 | ||
|
|
04041f23d0 | ||
|
|
a010ab5147 | ||
|
|
f7ca38b728 | ||
|
|
5b49f8de27 | ||
|
|
c64214f2a4 | ||
|
|
aec2e2edbf | ||
|
|
a43f5e57a8 | ||
|
|
17c2698617 | ||
|
|
7820aaf1f3 | ||
|
|
dc0ec4db21 | ||
|
|
11f116f21e | ||
|
|
4bea0548c7 | ||
|
|
fdd4d75b85 | ||
|
|
2eeaea6423 | ||
|
|
ff76d1abdb | ||
|
|
da85de8a42 | ||
|
|
7d0d159bed | ||
|
|
ff738d1480 | ||
|
|
92e1864913 | ||
|
|
aada08a91c | ||
|
|
b4fea7592f | ||
|
|
802c7f7376 | ||
|
|
d8a8894cb2 | ||
|
|
46304e9389 | ||
|
|
c245b55707 | ||
|
|
db0307b7e3 | ||
|
|
237e1d41d7 | ||
|
|
494c18802b | ||
|
|
34a3ad9e2d | ||
|
|
0f8db6185f | ||
|
|
9f1bcbca55 | ||
|
|
29003cf67f | ||
|
|
b2baaa0029 | ||
|
|
b3d979c349 | ||
|
|
57956ce790 | ||
|
|
ae897e055a | ||
|
|
74d9fdf56f | ||
|
|
5c53b32669 | ||
|
|
89b65b9779 | ||
|
|
4fc44a0157 | ||
|
|
f5ba136359 | ||
|
|
9521422ce6 | ||
|
|
b8b1b0296b | ||
|
|
93793db049 | ||
|
|
894488c442 | ||
|
|
5a71a2ddaf | ||
|
|
22fc66f6b2 | ||
|
|
dfa52c63b1 | ||
|
|
c8080e53ea | ||
|
|
7dfc67cb12 | ||
|
|
10a821553e | ||
|
|
e79c99f58c | ||
|
|
d746d01b81 | ||
|
|
e9e6f60ef1 | ||
|
|
424549c23f | ||
|
|
3d5ed2584c | ||
|
|
80da8b19e0 | ||
|
|
7b82580352 | ||
|
|
cc37490e05 | ||
|
|
f93968d6fa | ||
|
|
d55edbd8fb | ||
|
|
bdd5a9a894 | ||
|
|
f532ca96dc | ||
|
|
39ee0d13db | ||
|
|
be8ccedaf1 | ||
|
|
05e8410e0e | ||
|
|
d6f87fe6be | ||
|
|
8f5dd4ed02 | ||
|
|
64bef381f6 | ||
|
|
fe7f88a35d | ||
|
|
dd410e1165 | ||
|
|
a914889b1d | ||
|
|
e9f35e26c5 | ||
|
|
0373f4ce68 | ||
|
|
967668f7a8 | ||
|
|
a80f0f40b1 | ||
|
|
a0d73b7e21 | ||
|
|
c975d9e53b | ||
|
|
08b7c90228 | ||
|
|
7e824a1015 | ||
|
|
9ba6717e94 | ||
|
|
6203c50479 | ||
|
|
da1d0da429 | ||
|
|
147b4ee87e | ||
|
|
ff9bc90e63 | ||
|
|
e8a092ae87 | ||
|
|
748ab33969 | ||
|
|
98d56bb102 | ||
|
|
e1d7fb406b | ||
|
|
21e5fc811e | ||
|
|
8abd0a83b3 | ||
|
|
216cb004ae | ||
|
|
0fbd645cb9 | ||
|
|
a2a7ba5051 | ||
|
|
dc0052381e | ||
|
|
93dbeb6b6c | ||
|
|
e2895b19bb | ||
|
|
d0ef2ff9b6 | ||
|
|
2f4f7726e8 | ||
|
|
ae2dd1a9e7 | ||
|
|
48b0d15749 | ||
|
|
09a4f42861 | ||
|
|
2a6ce79320 | ||
|
|
dbbdaebe22 | ||
|
|
4cdb5bcc5e | ||
|
|
5971fb2a70 | ||
|
|
54f1492615 | ||
|
|
f4b3f84409 | ||
|
|
577330d5e5 | ||
|
|
8d273a2715 | ||
|
|
27cfd77df9 | ||
|
|
c3f8b441fd | ||
|
|
2913c499cf | ||
|
|
4d955be4fb | ||
|
|
ccc9a891df | ||
|
|
aee6fc4863 | ||
|
|
bae6d5cc63 | ||
|
|
74938b895c | ||
|
|
aee17de30a | ||
|
|
7f90aa0998 | ||
|
|
2bf082d908 | ||
|
|
415d74d0b8 | ||
|
|
c6dc813420 | ||
|
|
f8d89bc42f | ||
|
|
37e1e0da5a | ||
|
|
06e43a3359 | ||
|
|
cd16380a83 | ||
|
|
bb616a42d2 | ||
|
|
1cfdb4d9a7 | ||
|
|
9d97b86ee8 | ||
|
|
25cce50a2b | ||
|
|
6e498461f6 | ||
|
|
af229ebd62 | ||
|
|
3f9f6235ec | ||
|
|
284fdfe2c5 | ||
|
|
ea7088b5ca | ||
|
|
2550971d72 | ||
|
|
52cbb0a323 | ||
|
|
9274992411 | ||
|
|
b46291a74c | ||
|
|
f3710a43d4 | ||
|
|
931182598d | ||
|
|
a6f2efe9b9 | ||
|
|
011c963926 | ||
|
|
30c0457978 | ||
|
|
bbd936d32b | ||
|
|
475f5ce6a4 | ||
|
|
012d8ebf02 | ||
|
|
efcf474d42 | ||
|
|
c76dabf9ec | ||
|
|
1baf716a7e | ||
|
|
e02c4e519e | ||
|
|
67b9469754 | ||
|
|
091eb07803 | ||
|
|
3d132f2920 | ||
|
|
e690b737fe | ||
|
|
912943034e | ||
|
|
3f0748f1fc | ||
|
|
f3a9c9f867 | ||
|
|
96cd7fcecb | ||
|
|
749e947bb0 | ||
|
|
6e84861179 | ||
|
|
13f3b4a83d | ||
|
|
950afbb705 | ||
|
|
a1f9fb88ae | ||
|
|
72b0831ffa | ||
|
|
5fd5cf7fdb | ||
|
|
6e9440ced8 | ||
|
|
1c8986e45c | ||
|
|
c04fbbda3e | ||
|
|
1b34d6171b | ||
|
|
91c162586c | ||
|
|
a75ca610b8 | ||
|
|
e17cd73fb7 | ||
|
|
c46e41cb3c | ||
|
|
d432ab2b5a | ||
|
|
ca4b408968 | ||
|
|
532117de29 | ||
|
|
b1919066ca | ||
|
|
fc2947b112 | ||
|
|
4fdf05e199 | ||
|
|
d188594b11 | ||
|
|
8590ec9b56 | ||
|
|
c2232321b6 | ||
|
|
cb7b1c56b7 | ||
|
|
d408931bba | ||
|
|
835e11c892 | ||
|
|
7e39695461 | ||
|
|
a843b5e5e3 | ||
|
|
b607f86288 | ||
|
|
7cdd96323c | ||
|
|
18b40a8892 | ||
|
|
f33343a5c1 | ||
|
|
abc59d776a | ||
|
|
0a484e868f | ||
|
|
937a9a3532 | ||
|
|
f68d5ee16c | ||
|
|
bcd7e6d879 | ||
|
|
0875592763 | ||
|
|
0f26218905 | ||
|
|
9b720899fc | ||
|
|
d2ae632d3b | ||
|
|
35278e4c18 | ||
|
|
f1d2934216 | ||
|
|
d0a2057786 | ||
|
|
00cbb5c185 | ||
|
|
bd30d3a61c | ||
|
|
d63325f6a1 | ||
|
|
b1a8733511 | ||
|
|
55ee0329c5 | ||
|
|
78dbd08dd2 | ||
|
|
46763bcc0b | ||
|
|
c53b459fdd | ||
|
|
08f605c073 | ||
|
|
36d29700dc | ||
|
|
4a873ee966 | ||
|
|
0a9f1fe8d6 | ||
|
|
5094b42197 | ||
|
|
23ad2c6071 | ||
|
|
b922f6521e | ||
|
|
003e854b98 | ||
|
|
2d758d548b | ||
|
|
ca5ecf2e76 | ||
|
|
574a7ad04c | ||
|
|
d25732f852 | ||
|
|
1d20770d41 | ||
|
|
e9d2508694 | ||
|
|
73e959e1ee | ||
|
|
9c3d1efcaa | ||
|
|
f622d854a7 | ||
|
|
4d64dbfe48 | ||
|
|
8d5a0d77fb | ||
|
|
4c66cbc3be | ||
|
|
3e4d55a6f9 | ||
|
|
ed3c98434f | ||
|
|
4275404626 | ||
|
|
90cafed4c2 | ||
|
|
52188f1ea3 | ||
|
|
8ad634877c | ||
|
|
071d7fb6d7 | ||
|
|
42abbf0969 | ||
|
|
4cc99ea2e9 | ||
|
|
8b43767b7c | ||
|
|
ab797f7e47 | ||
|
|
19ee64303e | ||
|
|
e037f0d26b | ||
|
|
c09a2b5faf | ||
|
|
29d8658311 | ||
|
|
858d6e7176 | ||
|
|
9a6cc3c927 | ||
|
|
f55a1a1fe7 | ||
|
|
236415e339 | ||
|
|
3620ca1339 | ||
|
|
e5285cc421 | ||
|
|
467fd96e7e | ||
|
|
2089f7a21a | ||
|
|
1d7c3a2782 | ||
|
|
89cf1c1163 | ||
|
|
d969436205 | ||
|
|
94872348e8 | ||
|
|
e7b06f7cf8 | ||
|
|
7367729ec7 | ||
|
|
55e3b8711f | ||
|
|
26309a1c3a | ||
|
|
6c2fad11ac | ||
|
|
ce6e5738fc | ||
|
|
7c535c501b | ||
|
|
5b278937df | ||
|
|
12b740fbe0 | ||
|
|
1ef79b7f1f | ||
|
|
56f613b130 | ||
|
|
3197a2687c | ||
|
|
7c463ac477 | ||
|
|
f6b2efcdff | ||
|
|
c4a3e8112a | ||
|
|
f26a0407d2 | ||
|
|
a709b10bb6 | ||
|
|
6f76fdb41e | ||
|
|
038ed0a08e | ||
|
|
568368cdf5 | ||
|
|
8d68f1c5ce | ||
|
|
82a6563414 | ||
|
|
93f8baeb9a | ||
|
|
4cdbae926b | ||
|
|
67fd809ca3 | ||
|
|
3d39549ded | ||
|
|
0c512a52bd | ||
|
|
9268f14879 | ||
|
|
44df867382 | ||
|
|
5deea7fce6 | ||
|
|
a89675ee5c | ||
|
|
6a46bd9a86 | ||
|
|
94e5ea6b5e | ||
|
|
a1e8acc736 | ||
|
|
65b4ab11e1 | ||
|
|
23d429ff84 | ||
|
|
e3df223a5a | ||
|
|
b65c1c667b | ||
|
|
406522d1d2 | ||
|
|
4d7c14fdbb | ||
|
|
671be806ae | ||
|
|
a3891430bc | ||
|
|
0e1ba00059 | ||
|
|
b56990ddf8 | ||
|
|
c663ab3bb9 | ||
|
|
fb282e677c | ||
|
|
a1236b7251 | ||
|
|
7a6968f1e4 | ||
|
|
ebf477107d | ||
|
|
5cb7f294f6 | ||
|
|
b502197ec4 | ||
|
|
1937108a4a | ||
|
|
e31c32ce1b | ||
|
|
559bd48960 | ||
|
|
44c5026d9e | ||
|
|
4d2c63a9bc | ||
|
|
4180abcc1f | ||
|
|
ccd069f859 | ||
|
|
7c8c6e0760 | ||
|
|
3c94f02456 | ||
|
|
a8b03201f0 | ||
|
|
8965368eb8 | ||
|
|
df02c2471f | ||
|
|
8580ef7d0f | ||
|
|
091d22f49e | ||
|
|
5724efa69f | ||
|
|
14fabcd88e | ||
|
|
57064c12ae | ||
|
|
0d97bcf8ae | ||
|
|
0f7642674b | ||
|
|
1b11a83d52 | ||
|
|
ecce45acc4 | ||
|
|
8a3ecfc04e | ||
|
|
89865011e4 | ||
|
|
48ed7abc21 | ||
|
|
b1d1a18af9 | ||
|
|
7867c7cd8e | ||
|
|
ec4498fec1 | ||
|
|
0fbd5703c8 | ||
|
|
3201e75564 | ||
|
|
2311fb0632 | ||
|
|
28e0877682 | ||
|
|
d50cb7bbb4 | ||
|
|
aecb5f4b33 | ||
|
|
758a2262f5 | ||
|
|
ea817cdc60 | ||
|
|
ed2351e137 | ||
|
|
a7b9d61cde | ||
|
|
ae78381287 | ||
|
|
caab9f1e6f | ||
|
|
745e507c2f | ||
|
|
7e134f865f | ||
|
|
0bc729e85b | ||
|
|
2624315bf1 | ||
|
|
d457df7dc2 | ||
|
|
bf838e3333 | ||
|
|
48c16e5ef1 | ||
|
|
535963bac3 | ||
|
|
86ca8af9f1 | ||
|
|
b5a938f464 | ||
|
|
02123b7242 | ||
|
|
4b838a4b28 | ||
|
|
31ce47fe48 | ||
|
|
8c9a5d623e | ||
|
|
c8f0a2eb76 | ||
|
|
280dbed9aa | ||
|
|
06f2c1ad70 | ||
|
|
43121a02e7 | ||
|
|
bb09c4a448 | ||
|
|
58b51f5921 | ||
|
|
d48e4400fc | ||
|
|
86c1e53ee6 | ||
|
|
a31926bd75 | ||
|
|
8f504539f2 | ||
|
|
4bb3aa7dde | ||
|
|
b6f01f3260 | ||
|
|
667b303c9a | ||
|
|
cd9f40945d | ||
|
|
7f4048f9d5 | ||
|
|
fb0bd82dbe | ||
|
|
dd21bec400 | ||
|
|
a7aa47f4de | ||
|
|
b730bc0c46 | ||
|
|
07f3e5ae5c | ||
|
|
7949fd3949 | ||
|
|
d8a3185823 | ||
|
|
f7fe7e8db0 | ||
|
|
e7f83f2ecc | ||
|
|
cf0dcb6a0b | ||
|
|
d88f6c0ba6 | ||
|
|
0ff0454c59 | ||
|
|
a86cb71fca | ||
|
|
d7bc1dd922 | ||
|
|
2343840936 | ||
|
|
2c4e7ad135 | ||
|
|
2ee4d5e059 | ||
|
|
3a5b0f1787 | ||
|
|
7f228489d0 | ||
|
|
ef107448e8 | ||
|
|
3cf442872b | ||
|
|
372217c375 | ||
|
|
d2c05c96ca | ||
|
|
0e652c11be | ||
|
|
32fe7fd853 | ||
|
|
3b109ff207 | ||
|
|
58519bbe9c | ||
|
|
b30647cd23 | ||
|
|
ef4969c2ce | ||
|
|
546b3f3fce | ||
|
|
21f427801c | ||
|
|
9585077202 | ||
|
|
5abb196de8 | ||
|
|
83b7d0a66e | ||
|
|
f1385192ad | ||
|
|
5add9cbe78 | ||
|
|
012a4a5eb5 | ||
|
|
49bdaabc7d | ||
|
|
76321709d6 | ||
|
|
94dbcb107f | ||
|
|
44b453d6fb | ||
|
|
074e3b5c67 | ||
|
|
edf9d3c7f0 | ||
|
|
b7cd34eb77 | ||
|
|
7912e2936b | ||
|
|
cdc4413dac | ||
|
|
222a7b56f3 | ||
|
|
731d0e1bf6 | ||
|
|
c2dcd10964 | ||
|
|
e8af0982da | ||
|
|
e71b2c11f5 | ||
|
|
b4d8757dad | ||
|
|
2019d0e9c7 | ||
|
|
697b0f89fe | ||
|
|
1c9dfd079a | ||
|
|
823628d41f | ||
|
|
e86459e501 | ||
|
|
75cf879613 | ||
|
|
ae8bb84ecd | ||
|
|
36d6df671e | ||
|
|
b3e5ed69b5 | ||
|
|
aab882a3a6 | ||
|
|
b0bd0bba93 | ||
|
|
ee9f1abe7f | ||
|
|
1766ff1177 | ||
|
|
da764805ba | ||
|
|
52eb691e0b | ||
|
|
9df4e51f65 | ||
|
|
1d08ea938f | ||
|
|
06291ce0dd | ||
|
|
809a7012de | ||
|
|
0a60332e1b | ||
|
|
ffde7b4d71 | ||
|
|
57e83615f0 | ||
|
|
fa6a76050d | ||
|
|
1e7f2b29c4 | ||
|
|
9854d1f08d | ||
|
|
0e756842f6 | ||
|
|
e52a6b56f4 | ||
|
|
a9a191d20e | ||
|
|
49cb55146f | ||
|
|
c7531fea6e | ||
|
|
ada943b949 | ||
|
|
2ed3a383b4 | ||
|
|
a787d2565f | ||
|
|
5c80f22b64 | ||
|
|
014bc5f398 | ||
|
|
77d08060b4 | ||
|
|
2bc1d522db | ||
|
|
42e268a2b4 | ||
|
|
afd6512536 | ||
|
|
fca2dc9d0d | ||
|
|
9d1c95281e | ||
|
|
455c277f96 | ||
|
|
3147500f15 | ||
|
|
553ffd7a94 | ||
|
|
72afcf450a | ||
|
|
6e20440fb1 | ||
|
|
fb5cc99f9e | ||
|
|
4db269cfe6 | ||
|
|
cfa0ec55ce | ||
|
|
a53d6a40a7 | ||
|
|
930c3bc91d | ||
|
|
aa7f953a2e | ||
|
|
69f73cd8f5 | ||
|
|
5a69428f5e | ||
|
|
d2abdddf61 | ||
|
|
0daa83cc91 | ||
|
|
3f0b54395c | ||
|
|
87ba073dd5 | ||
|
|
c74f7f15cb | ||
|
|
49979931f6 | ||
|
|
e37de54929 | ||
|
|
0ff8b315f5 | ||
|
|
dcff65722f | ||
|
|
f3bbd1f4dd | ||
|
|
40691b7167 | ||
|
|
fae4a2cfb9 | ||
|
|
40a0e08619 | ||
|
|
b862d95c47 | ||
|
|
95ed4949f2 | ||
|
|
2147d9d6cd | ||
|
|
f9eee0ad8d | ||
|
|
6d87aaefa0 | ||
|
|
2d58c42ab8 | ||
|
|
f7c312ba6b | ||
|
|
e5f0dfb6e3 | ||
|
|
7865f82537 | ||
|
|
ef199cf66e | ||
|
|
e70927a5e5 | ||
|
|
11774eeb80 | ||
|
|
dee7ab1b79 | ||
|
|
83f74f5c56 | ||
|
|
e3c2397165 | ||
|
|
be05a036e2 | ||
|
|
af0f2cc9e5 | ||
|
|
0a1111391b | ||
|
|
ec3d3a809a | ||
|
|
a95214b198 | ||
|
|
0a065c4574 | ||
|
|
914d3e68ec | ||
|
|
8b271101a1 | ||
|
|
7a9ebd757c | ||
|
|
6a1c76807e | ||
|
|
55eae0af3b | ||
|
|
d661456225 | ||
|
|
e7e8a1bfef | ||
|
|
3287f177e0 | ||
|
|
a820e9e3bd | ||
|
|
f83df69bec | ||
|
|
bec7888be3 | ||
|
|
51f7c6bb82 | ||
|
|
97274c7f75 | ||
|
|
afc870dd76 | ||
|
|
3e76844bc1 | ||
|
|
75c203facb | ||
|
|
f3e01b69e0 | ||
|
|
1806828885 | ||
|
|
2ce06ec808 | ||
|
|
13fba490cd | ||
|
|
66145799cb | ||
|
|
34b106c391 | ||
|
|
333337b6a9 | ||
|
|
5faba45fe1 | ||
|
|
f003c50c52 | ||
|
|
76950a0e8d | ||
|
|
9d5236d73c | ||
|
|
02fbf566e8 | ||
|
|
ad1e9e7eac | ||
|
|
3c43019f8d | ||
|
|
a24639d7d3 | ||
|
|
897a69604d | ||
|
|
dc3b783b51 | ||
|
|
a2a6cfba56 | ||
|
|
1623f540b1 | ||
|
|
327403f3ac | ||
|
|
d9f5829ebe | ||
|
|
4ea016dae9 | ||
|
|
440183b440 | ||
|
|
21dd1c50c9 | ||
|
|
93e64b4448 | ||
|
|
4e5ed8ff7b | ||
|
|
0da34f968c | ||
|
|
852beefc4c | ||
|
|
d02af3a311 | ||
|
|
f82a9dbf0f | ||
|
|
cc93840d31 | ||
|
|
c5f356a603 | ||
|
|
79688aff74 | ||
|
|
0d989d52a6 | ||
|
|
2ea9d82a23 | ||
|
|
cd4c2c6caa | ||
|
|
a30b41f735 | ||
|
|
9e9be1cee7 | ||
|
|
a9c81f1919 | ||
|
|
7af69445f2 | ||
|
|
5057a8f344 | ||
|
|
073da79e5b | ||
|
|
423a2d9dde | ||
|
|
59b9ee181b | ||
|
|
86025d33a8 | ||
|
|
5d6a08e2c8 | ||
|
|
c0d1a74023 | ||
|
|
c3bf39a1f9 | ||
|
|
b7da435003 | ||
|
|
a1e51676fd | ||
|
|
c1898ee996 | ||
|
|
b426540b7f | ||
|
|
71ca0f8ece | ||
|
|
618a4372cf | ||
|
|
0ec2726a52 | ||
|
|
13c0b780a3 | ||
|
|
a8b26aaab9 | ||
|
|
aab50b9c50 | ||
|
|
1d252d7149 | ||
|
|
5ab516d068 | ||
|
|
fdbe6d81f4 | ||
|
|
e72855e4fa | ||
|
|
88271bab7c | ||
|
|
c4255fd0e3 | ||
|
|
3f450de0a9 | ||
|
|
88b59ea92f | ||
|
|
1add24e774 | ||
|
|
6c71ab2208 | ||
|
|
d99e26d2f3 | ||
|
|
83659caadb | ||
|
|
fecc74e080 | ||
|
|
50003c8cba | ||
|
|
2e6e77fd02 | ||
|
|
1eaf338acd | ||
|
|
6a5495ea3c | ||
|
|
2da8d49590 | ||
|
|
2ae72dcaf8 | ||
|
|
0c605eb94f | ||
|
|
b7ccdd7cf3 | ||
|
|
6af706846f | ||
|
|
3b0e432875 | ||
|
|
44092e06ce | ||
|
|
87690b10ff | ||
|
|
f5544e8c93 | ||
|
|
2f0a4d7c18 | ||
|
|
349300af08 | ||
|
|
b48e416d27 | ||
|
|
cfda2693c6 | ||
|
|
ca11cd104d | ||
|
|
848db89b7f | ||
|
|
288a24eebe | ||
|
|
883aea9b1d | ||
|
|
c43f762257 | ||
|
|
424fe36d32 | ||
|
|
0a49838135 | ||
|
|
685c5fb3b1 | ||
|
|
45840581d6 | ||
|
|
45599a8895 | ||
|
|
24fdf05d30 | ||
|
|
c9ef854f83 | ||
|
|
008be5dbfa | ||
|
|
e327351304 | ||
|
|
09b4cc45a3 | ||
|
|
e4ef9a8281 | ||
|
|
a7107854ba | ||
|
|
3acf6768f0 | ||
|
|
c2013308ed | ||
|
|
f4d5f3d6a2 | ||
|
|
142b874ce8 | ||
|
|
f2b90b374f | ||
|
|
1a06ac25f5 | ||
|
|
b72daebaf4 | ||
|
|
2cf0b5c19b | ||
|
|
abe07ce2ca | ||
|
|
6a7327dfa9 | ||
|
|
c396d4cd32 | ||
|
|
e3546ad2ce | ||
|
|
6582d4ad9f | ||
|
|
a3de6eddd4 | ||
|
|
dfa25a46e3 | ||
|
|
f9f3c7c5ac | ||
|
|
dee1dd64c3 | ||
|
|
e73cd348c8 | ||
|
|
3cdca7616a | ||
|
|
33c087ea9c | ||
|
|
289fd29f0b | ||
|
|
ba0199c487 | ||
|
|
3dcb572bda | ||
|
|
d0a8cca9a1 | ||
|
|
387b232126 | ||
|
|
667482ca9a | ||
|
|
2287b988ee | ||
|
|
ecda39bed4 | ||
|
|
1cb38ab924 | ||
|
|
288b2b2d4f | ||
|
|
6fa1177b0a | ||
|
|
1a2e03c323 | ||
|
|
ce49e1fdc0 | ||
|
|
599f5d7ddc | ||
|
|
5f5ce4f59f | ||
|
|
b050d7e4bf | ||
|
|
68990840b6 | ||
|
|
f2b1a01e76 | ||
|
|
72f5a6b004 | ||
|
|
75f2fcd687 | ||
|
|
806289ec66 | ||
|
|
b2eef58571 | ||
|
|
8e76cb4512 | ||
|
|
02a4e5ac6a | ||
|
|
2a090e0667 | ||
|
|
429ffda329 | ||
|
|
30702c7f54 | ||
|
|
f55a2dbf29 | ||
|
|
8b90f55dc7 | ||
|
|
d6ea2f5911 | ||
|
|
a9ad3088bf | ||
|
|
bb276e8a26 | ||
|
|
a28a430b10 | ||
|
|
c50cde67cc | ||
|
|
c36ced5e21 | ||
|
|
6185aa4e38 | ||
|
|
dce94f3e26 | ||
|
|
b13c935bbd | ||
|
|
3c34db9808 | ||
|
|
df7f57a193 | ||
|
|
924aa44c1f | ||
|
|
6c9a7fe561 | ||
|
|
b98de580c9 | ||
|
|
05ba393724 | ||
|
|
69e0f86cab | ||
|
|
186bb67c6e | ||
|
|
97be29893e | ||
|
|
62d940d2dd | ||
|
|
55ce68784f | ||
|
|
71de9ef039 | ||
|
|
a535befbeb | ||
|
|
66df6ae908 | ||
|
|
f8941b09e6 | ||
|
|
dc4c959ce1 | ||
|
|
43b6d75a08 | ||
|
|
f750c3e72d | ||
|
|
9c32c73afd | ||
|
|
766393d854 | ||
|
|
6641758221 | ||
|
|
612a3f06b4 | ||
|
|
cec0c55a35 | ||
|
|
856c2f6a47 | ||
|
|
ae3011d518 | ||
|
|
bf1c3196b5 | ||
|
|
2af946b3bf | ||
|
|
af1c53d104 | ||
|
|
e7c78881fc | ||
|
|
c83221a869 | ||
|
|
694a091d3f | ||
|
|
e7e2b56569 | ||
|
|
b1df9a9df1 | ||
|
|
33ec3eca29 | ||
|
|
a2b88b8637 | ||
|
|
85dd52f470 | ||
|
|
e29a130d8f | ||
|
|
04acc32abf | ||
|
|
87c9ec881c | ||
|
|
0fd925da77 | ||
|
|
df656c9d5a | ||
|
|
3e4d3f415c | ||
|
|
1b644ad64e | ||
|
|
50a3fa5f42 | ||
|
|
e9d3074294 | ||
|
|
368b4c6480 | ||
|
|
b17c3a7eb3 | ||
|
|
0b285cd8a6 | ||
|
|
6e4f9be492 | ||
|
|
49622ab63b | ||
|
|
5e5026b730 | ||
|
|
2f8960f784 | ||
|
|
cd40cf7139 | ||
|
|
becc4fecf4 | ||
|
|
c64e99782f | ||
|
|
350c478d7b | ||
|
|
02159e9aa8 | ||
|
|
fe3798f366 | ||
|
|
d44752a110 | ||
|
|
7a968beb46 | ||
|
|
99e5ffd1de | ||
|
|
d9efcfb556 | ||
|
|
1b5b397da8 | ||
|
|
d16bb6b70c | ||
|
|
e73944faf4 | ||
|
|
bb0617859f | ||
|
|
74297e6109 | ||
|
|
52c3edd5e0 | ||
|
|
801487f2a7 | ||
|
|
22d82d00b4 | ||
|
|
0ee24ccf8a | ||
|
|
3a895ba794 | ||
|
|
ef33ea359d | ||
|
|
6557d0c082 | ||
|
|
a568dec4cf | ||
|
|
43b37d02a1 | ||
|
|
0a50e64435 | ||
|
|
bb1f665d7f | ||
|
|
ed41fcd75c | ||
|
|
06b39b8098 | ||
|
|
2c8e7ba9b4 | ||
|
|
9ae639948a | ||
|
|
f9381847f1 | ||
|
|
6e7cbb09a9 | ||
|
|
8136ca3719 | ||
|
|
7de25c2bca | ||
|
|
c44c5ee268 | ||
|
|
ba08a51094 | ||
|
|
59f01c4a70 | ||
|
|
ed354e8f8b | ||
|
|
a4a2a181c2 | ||
|
|
f7789acdab | ||
|
|
6039689344 | ||
|
|
0120a087f4 | ||
|
|
3e9e40aee3 | ||
|
|
09442d0588 | ||
|
|
d08f5ebd9a | ||
|
|
ac2f6c4ef2 | ||
|
|
4236929fbb | ||
|
|
9b7de52d58 | ||
|
|
66351f7494 | ||
|
|
8e2b920fe6 | ||
|
|
7d8b97559b | ||
|
|
7f5bedd53b | ||
|
|
3adb0d6d01 | ||
|
|
e78a2c5df3 | ||
|
|
26df366d3b | ||
|
|
b9ee8baa49 | ||
|
|
617eb88c5e | ||
|
|
a6a703253b | ||
|
|
d01ac17559 | ||
|
|
3f1e7f1078 | ||
|
|
93feaa4ae8 | ||
|
|
ce7cffa85a | ||
|
|
1ea7752e95 | ||
|
|
4c5c555eeb | ||
|
|
c29660588f | ||
|
|
1ea73f4bdf | ||
|
|
db30fe0cb0 | ||
|
|
b6cbd980fb | ||
|
|
5ff3845d28 | ||
|
|
fe939cf842 | ||
|
|
6e3aab2f0c | ||
|
|
34e77af1bf | ||
|
|
76266be549 | ||
|
|
556e109765 | ||
|
|
f8b92c0668 | ||
|
|
a885dd025d | ||
|
|
4a6c8021b5 | ||
|
|
d02610853d | ||
|
|
ff0269e80f | ||
|
|
cd1558b89e | ||
|
|
680450f3b4 | ||
|
|
ff80a54011 | ||
|
|
455d6b1845 | ||
|
|
fadec0687f | ||
|
|
4136850f3c | ||
|
|
7953128ca6 | ||
|
|
d950e1a3bc | ||
|
|
1ca842d98b | ||
|
|
37796d70bf | ||
|
|
b49eefdb15 | ||
|
|
9d6aa8b537 | ||
|
|
907fbfff53 | ||
|
|
4ede94ab7b | ||
|
|
6ee164d47a | ||
|
|
27e6347b75 | ||
|
|
0b7acf50b6 | ||
|
|
e27295c578 | ||
|
|
7ef461948e | ||
|
|
04723b4dd1 | ||
|
|
a4953090e1 | ||
|
|
1a2465c187 | ||
|
|
2101324965 | ||
|
|
6566621345 | ||
|
|
b7ab6de628 | ||
|
|
61162bdce1 | ||
|
|
b10a6cfe24 | ||
|
|
175d6ba432 | ||
|
|
065861ce6b | ||
|
|
8671cfa343 | ||
|
|
a1c89bf03d | ||
|
|
c7ba91761c | ||
|
|
70514c7f7e | ||
|
|
0f849029d1 | ||
|
|
e9d83e94a2 | ||
|
|
7e71c9fb34 | ||
|
|
2a8de9001e | ||
|
|
5c513060b1 | ||
|
|
b793fafcb7 | ||
|
|
6902f093ff | ||
|
|
0e0eec76d9 | ||
|
|
cbfa394bfc | ||
|
|
5c6895bda1 | ||
|
|
87d1f7714f | ||
|
|
c598e14052 | ||
|
|
989d3c7691 | ||
|
|
9021351c8e | ||
|
|
52b7418670 | ||
|
|
f0f8d7ce78 | ||
|
|
23f8bd4fac | ||
|
|
db554cf271 | ||
|
|
4f7d1b3ae7 | ||
|
|
77c57ab843 | ||
|
|
1399005d7e | ||
|
|
e84d6e6102 | ||
|
|
4215d0ca68 | ||
|
|
7ba0e10501 | ||
|
|
7d976657e6 | ||
|
|
b0abf10b9f | ||
|
|
754e819438 | ||
|
|
6e7f052ef4 | ||
|
|
bcb933a0c1 | ||
|
|
72aaf56fed | ||
|
|
ec6a4de37a | ||
|
|
954e315d21 | ||
|
|
6c5577e403 | ||
|
|
cd47df1fe5 | ||
|
|
0e79b9dd03 | ||
|
|
09c4f94c9d | ||
|
|
bbb637f962 | ||
|
|
ee61d16e3e | ||
|
|
45b4271579 | ||
|
|
05444da983 | ||
|
|
b3cf5d1d96 | ||
|
|
a43f88b1c5 | ||
|
|
942e139562 | ||
|
|
93d4fddaef | ||
|
|
984431a9ef | ||
|
|
f226133c1a | ||
|
|
ef2276654e | ||
|
|
47b929b789 | ||
|
|
d5817537fa | ||
|
|
007c2f236d | ||
|
|
b1a89d3b1c | ||
|
|
3877cab329 | ||
|
|
20fd81147d | ||
|
|
df983d1994 | ||
|
|
e4495b24bc | ||
|
|
c3afef3eec | ||
|
|
09f3913734 | ||
|
|
9c9ceec6b7 | ||
|
|
1703c6841b | ||
|
|
e527aed895 | ||
|
|
e0a3a7c1e5 | ||
|
|
d6c0ff055d | ||
|
|
8ad8e1075b | ||
|
|
d538af8a0a | ||
|
|
4255db65e5 | ||
|
|
20a562321c | ||
|
|
94d90f03e2 | ||
|
|
59b296fecc | ||
|
|
30029b7ffb | ||
|
|
5f54da6fdf | ||
|
|
5e770c8f6a | ||
|
|
7b7cfa62e3 | ||
|
|
cab1a0c1d9 | ||
|
|
8fb2306be4 | ||
|
|
6e7f95b669 | ||
|
|
7d6b5bb837 | ||
|
|
dd58db7329 | ||
|
|
a7d7e8176f | ||
|
|
3045c0cbaf | ||
|
|
c78ec7e085 | ||
|
|
ca056d53bd | ||
|
|
f9bafde5e7 | ||
|
|
f473a173b8 | ||
|
|
f631e84102 | ||
|
|
c98ef8d089 | ||
|
|
a0a4ee5245 | ||
|
|
72dd398679 | ||
|
|
7e25e0780e | ||
|
|
4075ed9247 | ||
|
|
776ffbfaec | ||
|
|
4940bd9a9e | ||
|
|
d012b729fa | ||
|
|
9e27a1556c | ||
|
|
5e4f03ccf2 | ||
|
|
0d18a8b407 | ||
|
|
791ad3e9e6 | ||
|
|
6c1aca5ae2 | ||
|
|
4b20a20d33 | ||
|
|
42bffcd00a | ||
|
|
ec3b75e5ff | ||
|
|
63c324e6c4 | ||
|
|
27b995c841 | ||
|
|
1dd9bf73b7 | ||
|
|
63c50c7847 | ||
|
|
be4a3d77c4 | ||
|
|
908c45567c | ||
|
|
950951c67d | ||
|
|
233055974d | ||
|
|
071de5ccfb | ||
|
|
3a8a62c3e4 | ||
|
|
cd3b626a33 | ||
|
|
5a3da36626 | ||
|
|
98b64650c8 | ||
|
|
acb85dafb1 | ||
|
|
aab796c608 | ||
|
|
27c81f3175 | ||
|
|
ded72a96f0 | ||
|
|
f3976de591 | ||
|
|
d3068a3aff | ||
|
|
a0d874725d | ||
|
|
abb1d46636 | ||
|
|
ec8939fd47 | ||
|
|
085b86a95a | ||
|
|
875dc11364 | ||
|
|
ed5a083891 | ||
|
|
4d8bdf0357 | ||
|
|
159e8f8c3a | ||
|
|
f956457b5d | ||
|
|
28e34290ff | ||
|
|
533082e282 | ||
|
|
ebc86ae6d7 | ||
|
|
e18e20793f | ||
|
|
2974b5d666 | ||
|
|
64b229e8ff | ||
|
|
d8f14591d1 | ||
|
|
312d02afe4 | ||
|
|
aa83e7c7b8 | ||
|
|
111f444d69 | ||
|
|
9637bddc33 | ||
|
|
24c4178749 | ||
|
|
2c68aca9d7 | ||
|
|
9c8e47247b | ||
|
|
c61b589f9b | ||
|
|
9fd41abd40 | ||
|
|
a710c42f0f | ||
|
|
a0e9d310d1 | ||
|
|
d4763a2e24 | ||
|
|
ce828c6afc | ||
|
|
0d2d26d8e7 | ||
|
|
3f08d50863 | ||
|
|
05a67bcc25 | ||
|
|
7d89baa3e9 | ||
|
|
f58b6c5953 | ||
|
|
20e23ab2a3 | ||
|
|
e051b270a2 | ||
|
|
bff29314df | ||
|
|
60d744e32f | ||
|
|
406e372469 | ||
|
|
67d59d0153 | ||
|
|
1881be1e56 | ||
|
|
3a72944597 | ||
|
|
7718cb5afe | ||
|
|
5ede0b21b0 | ||
|
|
c9e0ff8831 | ||
|
|
604f9a79db | ||
|
|
3e7dcc384a | ||
|
|
beebade874 | ||
|
|
11e111ec01 | ||
|
|
9ae248e03f | ||
|
|
6c9aaf394f | ||
|
|
bcdaa46313 | ||
|
|
a9d70d1ae4 | ||
|
|
364ee94b8d | ||
|
|
5af94b5692 | ||
|
|
741c8606db | ||
|
|
4a877452f5 | ||
|
|
4b5d27869f | ||
|
|
bfddae7cee | ||
|
|
e73cf67762 | ||
|
|
6628cc7ef6 | ||
|
|
eca01c3105 | ||
|
|
d1ad89520e | ||
|
|
a34072e25b | ||
|
|
fa162417ed | ||
|
|
2434a86da4 | ||
|
|
3f88f88c80 | ||
|
|
8be9743e74 | ||
|
|
034d393bb1 | ||
|
|
62f98d64a5 | ||
|
|
5b70120293 | ||
|
|
f07e89c5f9 | ||
|
|
05103cc693 | ||
|
|
8237ac89c5 | ||
|
|
4ad6b28d83 | ||
|
|
eab324bbbb | ||
|
|
6f02e33c6f | ||
|
|
79339798b3 | ||
|
|
11b6293d1b | ||
|
|
c4ad2c0ce3 | ||
|
|
22fe98ad9f | ||
|
|
eca2dd2e8c | ||
|
|
486efb002a | ||
|
|
448a02373d | ||
|
|
1571aef9cc | ||
|
|
62e775c350 | ||
|
|
27f6878e2a | ||
|
|
95df8a7c0c | ||
|
|
a9051eb98e | ||
|
|
956e30effa | ||
|
|
2aa731e7c4 | ||
|
|
d7a806ca1a | ||
|
|
e92f9666de | ||
|
|
52cd07a0ac |
116
.gitignore
vendored
116
.gitignore
vendored
@@ -31,6 +31,7 @@ gmon.out
|
||||
Makefile
|
||||
Makefile.in
|
||||
|
||||
/.sc-*
|
||||
/ABOUT-NLS
|
||||
/aclocal.m4
|
||||
/align/stamp-virt-alignment-scan.pod
|
||||
@@ -45,7 +46,29 @@ Makefile.in
|
||||
/appliance/stamp-supermin
|
||||
/appliance/supermin.d
|
||||
/autom4te.cache
|
||||
/bash/virt-builder
|
||||
/bash/virt-cat
|
||||
/bash/virt-df
|
||||
/bash/virt-edit
|
||||
/bash/virt-filesystems
|
||||
/bash/virt-format
|
||||
/bash/virt-inspector
|
||||
/bash/virt-ls
|
||||
/bash/virt-sysprep
|
||||
/bash/virt-sparsify
|
||||
/build-aux
|
||||
/builder/.depend
|
||||
/builder/index-parse.c
|
||||
/builder/index-parse.h
|
||||
/builder/index-scan.c
|
||||
/builder/stamp-virt-builder.pod
|
||||
/builder/stamp-virt-index-validate.pod
|
||||
/builder/test-index
|
||||
/builder/virt-builder
|
||||
/builder/virt-builder.1
|
||||
/builder/virt-index-validate
|
||||
/builder/virt-index-validate.1
|
||||
/builder/*.xz
|
||||
/cat/stamp-virt-*.pod
|
||||
/cat/virt-cat
|
||||
/cat/virt-cat.1
|
||||
@@ -95,18 +118,19 @@ Makefile.in
|
||||
/erlang/examples/stamp-guestfs-erlang.pod
|
||||
/erlang/guestfs.beam
|
||||
/erlang/guestfs.erl
|
||||
/erlang/test.img
|
||||
/examples/copy_over
|
||||
/examples/create_disk
|
||||
/examples/display_icon
|
||||
/erlang/libguestfs-1.*
|
||||
/examples/copy-over
|
||||
/examples/create-disk
|
||||
/examples/debug-logging
|
||||
/examples/display-icon
|
||||
/examples/guestfs-examples.3
|
||||
/examples/guestfs-faq.1
|
||||
/examples/guestfs-performance.1
|
||||
/examples/guestfs-recipes.1
|
||||
/examples/guestfs-testing.1
|
||||
/examples/inspect_vm
|
||||
/examples/libvirt_auth
|
||||
/examples/mount_local
|
||||
/examples/inspect-vm
|
||||
/examples/libvirt-auth
|
||||
/examples/mount-local
|
||||
/examples/stamp-guestfs-examples.pod
|
||||
/examples/stamp-guestfs-faq.pod
|
||||
/examples/stamp-guestfs-performance.pod
|
||||
@@ -123,11 +147,14 @@ Makefile.in
|
||||
/fish/guestfish.1
|
||||
/fish/guestfish-actions.pod
|
||||
/fish/guestfish-commands.pod
|
||||
/fish/guestfish-prepopts.pod
|
||||
/fish/libguestfs-tools.conf.5
|
||||
/fish/prepopts.c
|
||||
/fish/prepopts.h
|
||||
/fish/rc_protocol.c
|
||||
/fish/rc_protocol.h
|
||||
/fish/stamp-guestfish.pod
|
||||
/fish/stamp-libguestfs-tools.conf.pod
|
||||
/fish/stamp-virt-copy-in.pod
|
||||
/fish/stamp-virt-copy-out.pod
|
||||
/fish/stamp-virt-tar-in.pod
|
||||
@@ -141,7 +168,11 @@ Makefile.in
|
||||
/format/virt-format.1
|
||||
/fuse/guestmount
|
||||
/fuse/guestmount.1
|
||||
/fuse/guestunmount
|
||||
/fuse/guestunmount.1
|
||||
/fuse/stamp-guestmount.pod
|
||||
/fuse/stamp-guestunmount.pod
|
||||
/fuse/test-guestunmount-fd
|
||||
/generator/.depend
|
||||
/generator/files-generated.txt
|
||||
/generator/generator
|
||||
@@ -156,18 +187,24 @@ Makefile.in
|
||||
/gobject/Guestfs-1.0.typelib
|
||||
/gobject/guestfs-gobject*.c
|
||||
/gobject/guestfs-gobject*.h
|
||||
/golang/bindtests.go
|
||||
/golang/examples/guestfs-golang.3
|
||||
/golang/examples/stamp-guestfs-golang.pod
|
||||
/golang/pkg
|
||||
/guestfs-release-notes.1
|
||||
/guestfsd-in-wine.log
|
||||
/haskell/Bindtests
|
||||
/haskell/Bindtests.hs
|
||||
/haskell/Guestfs005Load
|
||||
/haskell/Guestfs010Basic
|
||||
/haskell/Guestfs010Load
|
||||
/haskell/Guestfs030Config
|
||||
/haskell/Guestfs050LVCreate
|
||||
/haskell/Guestfs.hs
|
||||
/html/guestfish.1.html
|
||||
/html/guestfs.3.html
|
||||
/html/guestfs-erlang.3.html
|
||||
/html/guestfs-examples.3.html
|
||||
/html/guestfs-faq.1.html
|
||||
/html/guestfs-golang.3.html
|
||||
/html/guestfs-java.3.html
|
||||
/html/guestfs-lua.3.html
|
||||
/html/guestfs-ocaml.3.html
|
||||
@@ -180,9 +217,12 @@ Makefile.in
|
||||
/html/guestfs-testing.1.html
|
||||
/html/guestfsd.8.html
|
||||
/html/guestmount.1.html
|
||||
/html/guestunmount.1.html
|
||||
/html/libguestfs-make-fixed-appliance.1.html
|
||||
/html/libguestfs-test-tool.1.html
|
||||
/html/libguestfs-tools.conf.5.html
|
||||
/html/virt-alignment-scan.1.html
|
||||
/html/virt-builder.1.html
|
||||
/html/virt-cat.1.html
|
||||
/html/virt-copy-in.1.html
|
||||
/html/virt-copy-out.1.html
|
||||
@@ -190,6 +230,7 @@ Makefile.in
|
||||
/html/virt-edit.1.html
|
||||
/html/virt-filesystems.1.html
|
||||
/html/virt-format.1.html
|
||||
/html/virt-index-validate.1.html
|
||||
/html/virt-inspector.1.html
|
||||
/html/virt-list-filesystems.1.html
|
||||
/html/virt-list-partitions.1.html
|
||||
@@ -203,6 +244,7 @@ Makefile.in
|
||||
/html/virt-tar-in.1.html
|
||||
/html/virt-tar-out.1.html
|
||||
/html/virt-win-reg.1.html
|
||||
/inspector/actual-*.xml
|
||||
/inspector/stamp-virt-inspector.pod
|
||||
/inspector/test-xmllint.sh
|
||||
/inspector/virt-inspector
|
||||
@@ -226,7 +268,6 @@ Makefile.in
|
||||
/lua/examples/stamp-guestfs-lua.pod
|
||||
/lua/guestfs.so
|
||||
/lua/lua-guestfs.c
|
||||
/lua/test.img
|
||||
/m4/ChangeLog
|
||||
/m4/gnulib-cache.m4
|
||||
/m4/intmax.m4
|
||||
@@ -237,6 +278,12 @@ Makefile.in
|
||||
/m4/ltversion.m4
|
||||
/maint.mk
|
||||
/missing
|
||||
/mllib/.depend
|
||||
/mllib/common_gettext.ml
|
||||
/mllib/common_utils_tests
|
||||
/mllib/config.ml
|
||||
/mllib/dummy
|
||||
/mllib/libdir.ml
|
||||
/ocaml/bindtests.bc
|
||||
/ocaml/bindtests.opt
|
||||
/ocaml/bindtests.ml
|
||||
@@ -251,20 +298,9 @@ Makefile.in
|
||||
/ocaml/guestfs.mli
|
||||
/ocamlinit-stamp
|
||||
/ocaml/META
|
||||
/ocaml/t/guestfs_005_load.bc
|
||||
/ocaml/t/guestfs_005_load.opt
|
||||
/ocaml/t/guestfs_010_basic.bc
|
||||
/ocaml/t/guestfs_010_basic.opt
|
||||
/ocaml/t/guestfs_070_threads.bc
|
||||
/ocaml/t/guestfs_070_threads.opt
|
||||
/ocaml/t/guestfs_080_optargs.bc
|
||||
/ocaml/t/guestfs_080_optargs.opt
|
||||
/ocaml/t/guestfs_400_events.bc
|
||||
/ocaml/t/guestfs_400_events.opt
|
||||
/ocaml/t/guestfs_400_progress.bc
|
||||
/ocaml/t/guestfs_400_progress.opt
|
||||
/ocaml/t/guestfs_500_mount_local.bc
|
||||
/ocaml/t/guestfs_500_mount_local.opt
|
||||
/ocaml/stamp-mlguestfs
|
||||
/ocaml/t/*.bc
|
||||
/ocaml/t/*.opt
|
||||
/perl/bindtests.pl
|
||||
/perl/blib
|
||||
/perl/examples/guestfs-perl.3
|
||||
@@ -292,6 +328,7 @@ Makefile.in
|
||||
/php/extension/config.sub
|
||||
/php/extension/configure
|
||||
/php/extension/configure.in
|
||||
/php/extension/env
|
||||
/php/extension/guestfs_php.c
|
||||
/php/extension/guestfs_php_*.diff
|
||||
/php/extension/guestfs_php_*.exp
|
||||
@@ -314,11 +351,11 @@ Makefile.in
|
||||
/pick-guests.pl
|
||||
/po-docs/*/*.1
|
||||
/po-docs/*/*.3
|
||||
/po-docs/*/*.5
|
||||
/po-docs/*/*.8
|
||||
/po-docs/*/*.pl
|
||||
/po-docs/po4a.conf
|
||||
/po-docs/*/*.pod
|
||||
/po-docs/*/stamp-update-po
|
||||
/podwrapper.1
|
||||
/podwrapper.pl
|
||||
/po/*.gmo
|
||||
/python/bindtests.py
|
||||
@@ -334,8 +371,6 @@ Makefile.in
|
||||
/rescue/virt-rescue
|
||||
/rescue/virt-rescue.1
|
||||
/resize/.depend
|
||||
/resize/resize_gettext.ml
|
||||
/resize/resize_utils_tests
|
||||
/resize/stamp-virt-resize.pod
|
||||
/resize/virt-resize
|
||||
/resize/virt-resize.1
|
||||
@@ -344,6 +379,7 @@ Makefile.in
|
||||
/ruby/examples/guestfs-ruby.3
|
||||
/ruby/examples/stamp-guestfs-ruby.pod
|
||||
/ruby/ext/guestfs/extconf.h
|
||||
/ruby/ext/guestfs/extconf.rb
|
||||
/ruby/ext/guestfs/_guestfs.bundle
|
||||
/ruby/ext/guestfs/_guestfs.c
|
||||
/ruby/ext/guestfs/_guestfs.so
|
||||
@@ -351,23 +387,25 @@ Makefile.in
|
||||
/ruby/Rakefile
|
||||
/run
|
||||
/sparsify/.depend
|
||||
/sparsify/sparsify_gettext.ml
|
||||
/sparsify/stamp-virt-sparsify.pod
|
||||
/sparsify/virt-sparsify
|
||||
/sparsify/virt-sparsify.1
|
||||
/src/actions-?.c
|
||||
/src/actions-variants.c
|
||||
/src/bindtests.c
|
||||
/src/cleanup-structs.c
|
||||
/src/errnostring.c
|
||||
/src/errnostring-gperf.c
|
||||
/src/errnostring-gperf.gperf
|
||||
/src/errnostring.h
|
||||
/src/event-string.c
|
||||
/src/free-structs.c
|
||||
/src/guestfs.3
|
||||
/src/guestfs-actions.pod
|
||||
/src/guestfs-availability.pod
|
||||
/src/guestfs.h
|
||||
/src/guestfs-internal-actions.h
|
||||
/src/guestfs-internal-frontend-cleanups.h
|
||||
/src/guestfs_protocol.c
|
||||
/src/guestfs_protocol.h
|
||||
/src/guestfs_protocol.x
|
||||
@@ -383,12 +421,9 @@ Makefile.in
|
||||
/sysprep/stamp-script2.sh
|
||||
/sysprep/stamp-virt-sysprep.pod
|
||||
/sysprep/sysprep-extra-options.pod
|
||||
/sysprep/sysprep_gettext.ml
|
||||
/sysprep/sysprep-operations.pod
|
||||
/sysprep/virt-sysprep
|
||||
/sysprep/virt-sysprep.1
|
||||
/test1.img
|
||||
/test2.img
|
||||
/test.err
|
||||
/test.out
|
||||
/tests/c-api/test-add-drive-opts
|
||||
@@ -398,12 +433,14 @@ Makefile.in
|
||||
/tests/c-api/test-create-handle
|
||||
/tests/c-api/test-debug-to-file
|
||||
/tests/c-api/test-environment
|
||||
/tests/c-api/test-event-string
|
||||
/tests/c-api/test*.img
|
||||
/tests/c-api/test-just-header
|
||||
/tests/c-api/test-just-header-cxx
|
||||
/tests/c-api/test-last-errno
|
||||
/tests/c-api/test.log
|
||||
/tests/c-api/test-private-data
|
||||
/tests/c-api/test-pwd
|
||||
/tests/c-api/tests
|
||||
/tests/c-api/tests.c
|
||||
/tests/c-api/test*.tmp
|
||||
@@ -415,31 +452,40 @@ Makefile.in
|
||||
/tests/data/100krandom
|
||||
/tests/data/10klines
|
||||
/tests/data/abssymlink
|
||||
/tests/data/blank-disk-*
|
||||
/tests/data/blank-disk-*
|
||||
/tests/data/hello.b64
|
||||
/tests/data/initrd
|
||||
/tests/data/initrd-x86_64.img
|
||||
/tests/data/initrd-x86_64.img.gz
|
||||
/tests/data/test-grep.txt.gz
|
||||
/tests/data/test.iso
|
||||
/tests/guests/blank-*.img
|
||||
/tests/guests/debian.img
|
||||
/tests/guests/fedora.img
|
||||
/tests/guests/fedora-btrfs.img
|
||||
/tests/guests/fedora-md1.img
|
||||
/tests/guests/fedora-md2.img
|
||||
/tests/guests/guests.xml
|
||||
/tests/guests/guests-all-good.xml
|
||||
/tests/guests/guest-aux/fedora-name.db
|
||||
/tests/guests/guest-aux/fedora-packages.db
|
||||
/tests/guests/guest-aux/windows-software
|
||||
/tests/guests/guest-aux/windows-system
|
||||
/tests/guests/stamp-fedora-md.img
|
||||
/tests/guests/ubuntu.img
|
||||
/tests/guests/windows.img
|
||||
/tests/mount-local/test-parallel-mount-local
|
||||
/tests/mountable/test-internal-parse-mountable
|
||||
/tests/parallel/test-parallel
|
||||
/tests/regressions/rhbz501893
|
||||
/tests/regressions/rhbz790721
|
||||
/tests/regressions/rhbz914931
|
||||
/tests/rsync/rsyncd.pid
|
||||
/tests/syslinux/extlinux-guest.img
|
||||
/tests/syslinux/syslinux-guest.img
|
||||
/test-tool/libguestfs-test-tool
|
||||
/test-tool/libguestfs-test-tool.1
|
||||
/test-tool/libguestfs-test-tool-helper
|
||||
/test-tool/stamp-libguestfs-test-tool.pod
|
||||
/tools/test.img
|
||||
/tools/virt-*.1
|
||||
/tools/virt-*.pl
|
||||
/valgrind.log*
|
||||
|
||||
2
.gnulib
2
.gnulib
Submodule .gnulib updated: 4a8c422f31...9f4d76b604
@@ -1,5 +1,5 @@
|
||||
[main]
|
||||
host = https://www.transifex.net
|
||||
host = https://www.transifex.com
|
||||
|
||||
[libguestfs.libguestfspot]
|
||||
file_filter = po/<lang>.po
|
||||
|
||||
82
AUTHORS
82
AUTHORS
@@ -1,35 +1,47 @@
|
||||
Angus Salkeld <asalkeld@redhat.com>
|
||||
Ani Peter <apeter@redhat.com>
|
||||
Charles Duffy <cduffy@messageone.com>
|
||||
Cole Robinson <crobinso@redhat.com>
|
||||
Daniel Berrange <berrange@redhat.com>
|
||||
Daniel Cabrera <logan@fedoraproject.org>
|
||||
Douglas Schilling Landgraf <dougsland@redhat.com>
|
||||
Eric Blake <eblake@redhat.com>
|
||||
Erik Nolte <erik_nolte@acm.org>
|
||||
Evaggelos Balaskas <ebalaskas@ebalaskas.gr>
|
||||
Geert Warrink <geert.warrink@onsnet.nu>
|
||||
Guido Günther <agx@sigxcpu.org>
|
||||
Hilko Bengen <bengen@hilluzination.de>
|
||||
Jaswinder Singh <jsingh@redhat.com>
|
||||
Jim Meyering <meyering@redhat.com>
|
||||
Jiri Popelka <jpopelka@redhat.com>
|
||||
John Eckersberg <jeckersb@redhat.com>
|
||||
Karel Klíč <kklic@redhat.com>
|
||||
Marcin Gibula <m.gibula@e24cloud.com>
|
||||
Masami HIRATA <msmhrt@gmail.com>
|
||||
Matthew Booth <mbooth@redhat.com>
|
||||
Maxim Koltsov <kolmax94@gmail.com>
|
||||
Michael Scherer <misc@zarb.org>
|
||||
Nikita A Menkovich <menkovich@gmail.com>
|
||||
Nikos Skalkotos <skalkoto@gmail.com>
|
||||
Olaf Hering <olaf@aepfle.de>
|
||||
Piotr Drąg <piotrdrag@gmail.com>
|
||||
Qin Guan <qguan@redhat.com>
|
||||
Rajesh Ranjan <rranjan@redhat.com>
|
||||
Richard W.M. Jones <rjones@redhat.com>
|
||||
Sandeep Shedmake <sshedmak@redhat.com>
|
||||
Shankar Prasad <svenkate@redhat.com>
|
||||
Thomas S Hatch <thatch45@gmail.com>
|
||||
Wanlong Gao <gaowanlong@cn.fujitsu.com>
|
||||
Wulf C. Krueger <philantrop@exherbo.org>
|
||||
Adam Huffman
|
||||
Angus Salkeld
|
||||
Ani Peter
|
||||
Charles Duffy
|
||||
Cole Robinson
|
||||
Daniel Berrange
|
||||
Daniel Cabrera
|
||||
Daniel Exner
|
||||
Dave Vasilevsky
|
||||
Douglas Schilling Landgraf
|
||||
Eric Blake
|
||||
Erik Nolte
|
||||
Evaggelos Balaskas
|
||||
Geert Warrink
|
||||
Guido Günther
|
||||
Hilko Bengen
|
||||
infernix
|
||||
Jaswinder Singh
|
||||
Jim Meyering
|
||||
Jiri Popelka
|
||||
John Eckersberg
|
||||
Karel Klíč
|
||||
Marcin Gibula
|
||||
Martin Kletzander
|
||||
Masami HIRATA
|
||||
Matthew Booth
|
||||
Maxim Koltsov
|
||||
Michael Scherer
|
||||
Mike Kelly
|
||||
Nicholas Strugnell
|
||||
Nikita A Menkovich
|
||||
Nikita Menkovich
|
||||
Nikos Skalkotos
|
||||
Olaf Hering
|
||||
Or Goshen
|
||||
Paul Mackerras
|
||||
Pino Toscano
|
||||
Piotr Drąg
|
||||
Qin Guan
|
||||
Rajesh Ranjan
|
||||
Richard W.M. Jones
|
||||
Sandeep Shedmake
|
||||
Shankar Prasad
|
||||
Thomas S Hatch
|
||||
Török Edwin
|
||||
Wanlong Gao
|
||||
Wulf C. Krueger
|
||||
|
||||
384
BUGS
384
BUGS
@@ -1,5 +1,5 @@
|
||||
NOTE: This file is automatically generated from "update-bugs.sh".
|
||||
Last updated: 2012-12-13
|
||||
Last updated: 2013-12-08
|
||||
|
||||
This contains a local list of the bugs that are open against
|
||||
libguestfs. Bugs are tracked in the Red Hat Bugzilla database
|
||||
@@ -44,42 +44,21 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
|
||||
604041 NEW https://bugzilla.redhat.com/show_bug.cgi?id=604041
|
||||
guestmount absolute symlinks don't work
|
||||
|
||||
624334 NEW https://bugzilla.redhat.com/show_bug.cgi?id=624334
|
||||
blockdev-setbsz succeeds, but does not affect blockdev-getbsz
|
||||
|
||||
624335 NEW https://bugzilla.redhat.com/show_bug.cgi?id=624335
|
||||
blockdev-setbsz succeeds, but does not affect blockdev-getbsz
|
||||
|
||||
637251 NEW https://bugzilla.redhat.com/show_bug.cgi?id=637251
|
||||
virt-inspector fails to recognize data-only NTFS disk image
|
||||
|
||||
660687 NEW https://bugzilla.redhat.com/show_bug.cgi?id=660687
|
||||
guestmount: "touch" command fails: touch: setting times of `timestamp': Invalid argument
|
||||
|
||||
672485 NEW https://bugzilla.redhat.com/show_bug.cgi?id=672485
|
||||
[RFE] virt-edit/tar/inspector do not support encrypted system
|
||||
|
||||
693064 NEW https://bugzilla.redhat.com/show_bug.cgi?id=693064
|
||||
Symbolic links on ntfs-3g are not followed correctly by some commands
|
||||
|
||||
696445 NEW https://bugzilla.redhat.com/show_bug.cgi?id=696445
|
||||
Backport virt-inspector for virt-v2v
|
||||
|
||||
696451 NEW https://bugzilla.redhat.com/show_bug.cgi?id=696451
|
||||
libguestfs: unknown filesystem label SWAP-sda2
|
||||
|
||||
700342 NEW https://bugzilla.redhat.com/show_bug.cgi?id=700342
|
||||
virt-inspector resports unknown filesystem UUID
|
||||
|
||||
709326 NEW https://bugzilla.redhat.com/show_bug.cgi?id=709326
|
||||
virt-inspector cannot detect ReactOS
|
||||
|
||||
737261 NEW https://bugzilla.redhat.com/show_bug.cgi?id=737261
|
||||
libguestfs grub-install API needs grub1
|
||||
|
||||
745282 NEW https://bugzilla.redhat.com/show_bug.cgi?id=745282
|
||||
[RFE] Support to use virt-filesystems with remote libvirt systems
|
||||
|
||||
745576 NEW https://bugzilla.redhat.com/show_bug.cgi?id=745576
|
||||
libguestfs (or qemu?) hangs if sparse file runs out of disk space
|
||||
|
||||
@@ -95,33 +74,21 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
|
||||
790837 NEW https://bugzilla.redhat.com/show_bug.cgi?id=790837
|
||||
Use of atexit to clean up handles is wrong in multithreaded programs
|
||||
|
||||
803643 NEW https://bugzilla.redhat.com/show_bug.cgi?id=803643
|
||||
inspect-is-multipart return false when inspection results should be true
|
||||
|
||||
803650 NEW https://bugzilla.redhat.com/show_bug.cgi?id=803650
|
||||
inspect-is-live return false when inspection results should be true
|
||||
|
||||
803657 NEW https://bugzilla.redhat.com/show_bug.cgi?id=803657
|
||||
[RFE] inspect-is-netinst : support more distributions
|
||||
|
||||
805417 NEW https://bugzilla.redhat.com/show_bug.cgi?id=805417
|
||||
RFE: support inspection of installation ISOs of WinVista, Win7, Win2008 & Win2008r2
|
||||
|
||||
806179 NEW https://bugzilla.redhat.com/show_bug.cgi?id=806179
|
||||
RFE: support inspection of icon for more Windows guests
|
||||
|
||||
808193 NEW https://bugzilla.redhat.com/show_bug.cgi?id=808193
|
||||
g.launch() crashes on RHEL 5
|
||||
|
||||
812970 NEW https://bugzilla.redhat.com/show_bug.cgi?id=812970
|
||||
virt-rescue cannot set ><rescue> prompt, on Ubuntu 12.04
|
||||
|
||||
813290 NEW https://bugzilla.redhat.com/show_bug.cgi?id=813290
|
||||
mdadm (md-detail) test occasionally fails with 'md device /dev/md125 does not appear to be active.'
|
||||
|
||||
815149 NEW https://bugzilla.redhat.com/show_bug.cgi?id=815149
|
||||
virt-alignment-scan gives error "part_list: could not parse row from output of parted print command: /dev/vda:4194304B:virtblk:512:512:msdos:Virtio Block Device"
|
||||
|
||||
819086 NEW https://bugzilla.redhat.com/show_bug.cgi?id=819086
|
||||
look for qemu-kvm on /usr/libexec
|
||||
|
||||
822538 NEW https://bugzilla.redhat.com/show_bug.cgi?id=822538
|
||||
libguestfs tools hang on qcow2 encrypted disks
|
||||
|
||||
@@ -140,41 +107,155 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
|
||||
835622 NEW https://bugzilla.redhat.com/show_bug.cgi?id=835622
|
||||
RFE: virt-sparsify should be able to sparsify onto a thin-provisioned LV
|
||||
|
||||
837941 NEW https://bugzilla.redhat.com/show_bug.cgi?id=837941
|
||||
Data loss when writing to qcow2-format disk files
|
||||
|
||||
838081 NEW https://bugzilla.redhat.com/show_bug.cgi?id=838081
|
||||
ocaml/t/guestfs_500_parallel_mount_local crashes in caml_thread_reinitialize
|
||||
|
||||
845234 NEW https://bugzilla.redhat.com/show_bug.cgi?id=845234
|
||||
RFE: virt-ls on Windows guest doesn't support drive letters
|
||||
|
||||
846676 NEW https://bugzilla.redhat.com/show_bug.cgi?id=846676
|
||||
guestfs_launch() hangs with Debian qemu-kvm 1.1.0
|
||||
|
||||
848464 NEW https://bugzilla.redhat.com/show_bug.cgi?id=848464
|
||||
gobject javascript bindings cannot use 64 bit integers
|
||||
|
||||
857763 NEW https://bugzilla.redhat.com/show_bug.cgi?id=857763
|
||||
libguestfs 'file-architecture' returns 'ARM' for arm binaries
|
||||
|
||||
863696 NEW https://bugzilla.redhat.com/show_bug.cgi?id=863696
|
||||
[F18] libguestfs fails to mount a disk image file(in this case qcow2) as 'root'
|
||||
|
||||
864871 NEW https://bugzilla.redhat.com/show_bug.cgi?id=864871
|
||||
libvirt error: could not create appliance through libvirt: unable to set security context 'unconfined_u:object_r:svirt_image_t:s0:cXXX,cYYY' on '.../console.sock'
|
||||
|
||||
865923 NEW https://bugzilla.redhat.com/show_bug.cgi?id=865923
|
||||
Check that new qemu -machine option doesn't break libguestfs.
|
||||
|
||||
866994 NEW https://bugzilla.redhat.com/show_bug.cgi?id=866994
|
||||
tgz-out causes memory leak in guestfsd
|
||||
|
||||
869179 NEW https://bugzilla.redhat.com/show_bug.cgi?id=869179
|
||||
libguestfs fail to startup on latest rhel7 tree
|
||||
887826 NEW https://bugzilla.redhat.com/show_bug.cgi?id=887826
|
||||
RFE: virt-sparsify cannot handle multi-disk virtual machines (eg. if they use LVM, MD, LDM, etc)
|
||||
|
||||
880806 NEW https://bugzilla.redhat.com/show_bug.cgi?id=880806
|
||||
virt-df with two -a options displays incorrect disk image name
|
||||
891909 NEW https://bugzilla.redhat.com/show_bug.cgi?id=891909
|
||||
Can't make install with non-standard prefix as non-root
|
||||
|
||||
895898 NEW https://bugzilla.redhat.com/show_bug.cgi?id=895898
|
||||
RFE: Allow interface to be specified with libvirt attach-method
|
||||
|
||||
895946 NEW https://bugzilla.redhat.com/show_bug.cgi?id=895946
|
||||
Got incorrect block count number when resize ntfs file system via "ntfsresize_opts"
|
||||
|
||||
903987 NEW https://bugzilla.redhat.com/show_bug.cgi?id=903987
|
||||
Command "acl-set-file" is inconvenient to use
|
||||
|
||||
906766 NEW https://bugzilla.redhat.com/show_bug.cgi?id=906766
|
||||
virt-resize cannot resize RHEL 5 guest with GPT partition table type
|
||||
|
||||
906777 NEW https://bugzilla.redhat.com/show_bug.cgi?id=906777
|
||||
In tests, set_label sometimes fails
|
||||
|
||||
910115 NEW https://bugzilla.redhat.com/show_bug.cgi?id=910115
|
||||
RFE: support ntfsresize --bad-sectors option in virt-resize
|
||||
|
||||
910269 NEW https://bugzilla.redhat.com/show_bug.cgi?id=910269
|
||||
Tracker: Bugs in other packages that stop libguestfs working
|
||||
|
||||
913815 NEW https://bugzilla.redhat.com/show_bug.cgi?id=913815
|
||||
febootstrap: no ext2 root device found when running libguestfs-test-tools
|
||||
|
||||
917706 NEW https://bugzilla.redhat.com/show_bug.cgi?id=917706
|
||||
guestfs_umount_local is not thread safe
|
||||
|
||||
920617 NEW https://bugzilla.redhat.com/show_bug.cgi?id=920617
|
||||
RFE: virt-inspector (or another tool) should produce OVF output for oVirt / RHEV
|
||||
|
||||
923355 NEW https://bugzilla.redhat.com/show_bug.cgi?id=923355
|
||||
guestfish prints literal "n" in error messages
|
||||
|
||||
927447 NEW https://bugzilla.redhat.com/show_bug.cgi?id=927447
|
||||
[suse] virt tools hang on disk image, but libguestfs-test-tool runs OK
|
||||
|
||||
950444 NEW https://bugzilla.redhat.com/show_bug.cgi?id=950444
|
||||
inspection fails if libosinfo is not installed
|
||||
|
||||
953907 NEW https://bugzilla.redhat.com/show_bug.cgi?id=953907
|
||||
virt-sysprep does not correctly set the hostname on Debian/Ubuntu
|
||||
|
||||
960522 NEW https://bugzilla.redhat.com/show_bug.cgi?id=960522
|
||||
libguestfs is not built for F18 ppc64
|
||||
|
||||
972292 NEW https://bugzilla.redhat.com/show_bug.cgi?id=972292
|
||||
lgetxattrs can't show the file attribute list with ntfs FS in rhel7
|
||||
|
||||
972294 NEW https://bugzilla.redhat.com/show_bug.cgi?id=972294
|
||||
lsetxattr/lgetxattr doesn't work to softlink file with ntfs FS in rhel7
|
||||
|
||||
973138 NEW https://bugzilla.redhat.com/show_bug.cgi?id=973138
|
||||
RFE: sh & debug sh should be able to capture all output and error return code
|
||||
|
||||
979392 NEW https://bugzilla.redhat.com/show_bug.cgi?id=979392
|
||||
[abrt] virt-manager crash from libguestfs launch_libvirt
|
||||
|
||||
980790 NEW https://bugzilla.redhat.com/show_bug.cgi?id=980790
|
||||
fstrim returns error "FITRIM ioctl failed: Inappropriate ioctl for device"
|
||||
|
||||
982516 NEW https://bugzilla.redhat.com/show_bug.cgi?id=982516
|
||||
sh "rpm -Va" fails because apparently /dev/shm is not created/bind-mounted correctly
|
||||
|
||||
982979 NEW https://bugzilla.redhat.com/show_bug.cgi?id=982979
|
||||
Disable fstrim API/command in RHEL 6
|
||||
|
||||
983969 NEW https://bugzilla.redhat.com/show_bug.cgi?id=983969
|
||||
RFE: virt-sysprep should be SELinux-aware
|
||||
|
||||
986242 NEW https://bugzilla.redhat.com/show_bug.cgi?id=986242
|
||||
golang bindings cannot be compiled if golang-guestfs package is installed
|
||||
|
||||
987829 NEW https://bugzilla.redhat.com/show_bug.cgi?id=987829
|
||||
virt-resize error: "lvm_set_filter: vgchange: Couldn't find device with uuid .. Refusing activation of partial LV"
|
||||
|
||||
988100 NEW https://bugzilla.redhat.com/show_bug.cgi?id=988100
|
||||
RFE: journal reader in guestfish
|
||||
|
||||
991641 NEW https://bugzilla.redhat.com/show_bug.cgi?id=991641
|
||||
virt-sysprep fs-uuids plugin doesn't update UUIDs in fstab, elsewhere
|
||||
|
||||
991830 NEW https://bugzilla.redhat.com/show_bug.cgi?id=991830
|
||||
virt-resize throws ambiguous error when /dev/mapper/VG-LV path is used
|
||||
|
||||
994965 NEW https://bugzilla.redhat.com/show_bug.cgi?id=994965
|
||||
libguestfs doesn't work on armv7hl
|
||||
|
||||
997160 NEW https://bugzilla.redhat.com/show_bug.cgi?id=997160
|
||||
virt-sysprep prints: filesize: /etc/mdadm.conf: No such file or directory
|
||||
|
||||
998065 NEW https://bugzilla.redhat.com/show_bug.cgi?id=998065
|
||||
libguestfs kernel hang in RHEL 6.5
|
||||
|
||||
1019388 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1019388
|
||||
firstboot scripts (virt-builder, virt-sysprep) don't work for Debian 6 & 7 guests
|
||||
|
||||
1020806 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1020806
|
||||
All libguestfs LVM operations fail on Debian/Ubuntu
|
||||
|
||||
1021149 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1021149
|
||||
Rebase libguestfs to 1.24 in RHEL 7.1
|
||||
|
||||
1023630 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1023630
|
||||
enable-valgrind-daemon option breaks UML
|
||||
|
||||
1025942 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1025942
|
||||
Parallel virt-df and virt-alignment-scan tests sometimes deadlock
|
||||
|
||||
1026688 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1026688
|
||||
libguestfs fails examining libvirt guest with ceph drives: rbd: image name must begin with a '/'
|
||||
|
||||
1027526 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1027526
|
||||
RFE: Labels for logical partitions lost in Windows 2003 after virt-resize for primary partition
|
||||
|
||||
1028666 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1028666
|
||||
virt-builder fails if you select only --format but not --size: virt-resize: error: You cannot use --expand when there is no surplus [...]
|
||||
|
||||
1028676 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1028676
|
||||
Add virt-builder to RHEL 7.1
|
||||
|
||||
1029134 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1029134
|
||||
Broken links in virt-builder web man page
|
||||
|
||||
1033207 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1033207
|
||||
RFE: libguestfs inspection does not recognize Free4NAS live CD
|
||||
|
||||
1033573 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1033573
|
||||
libguestfs inspection does not recognize NAS4Free OS installed on QCOW2 image
|
||||
|
||||
1035320 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1035320
|
||||
test faild during build
|
||||
|
||||
503134 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=503134
|
||||
guestfish's list splitting does not recognize internal quoting
|
||||
@@ -188,56 +269,167 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
|
||||
619334 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=619334
|
||||
RFE: Enable coredump capture in the appliance
|
||||
|
||||
624335 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=624335
|
||||
blockdev-setbsz succeeds, but does not affect blockdev-getbsz
|
||||
|
||||
691389 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=691389
|
||||
Extended attributes don't work over guestmount (FUSE)
|
||||
SELinux labels don't work over guestmount (FUSE)
|
||||
|
||||
803643 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=803643
|
||||
inspect-is-multipart return false when inspection results should be true
|
||||
965495 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=965495
|
||||
New APIs required in libguestfs for virt-v2v in RHEL 6.5
|
||||
|
||||
(58 bugs)
|
||||
(86 bugs)
|
||||
|
||||
--------------------------------------------------
|
||||
Bugs in MODIFIED, POST or ON_QA state are fixed.
|
||||
You can help by testing the fixes.
|
||||
|
||||
1028650 POST https://bugzilla.redhat.com/show_bug.cgi?id=1028650
|
||||
virt-* argument parser doesn't accept --arg=value (you have to use --arg value)
|
||||
|
||||
998109 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=998109
|
||||
Let's enable kvmclock in RHEL 7
|
||||
|
||||
869179 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=869179
|
||||
libguestfs fail to startup on latest rhel7 tree
|
||||
|
||||
880806 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=880806
|
||||
virt-df with two -a options displays incorrect disk image name
|
||||
|
||||
892271 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=892271
|
||||
virt-format fail to format the same disk more than twice with lvm enable
|
||||
|
||||
985856 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=985856
|
||||
Can't set acl value for a specified user with 'acl-set-file'
|
||||
|
||||
1011922 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1011922
|
||||
Use host-passthrough instead of host-model
|
||||
|
||||
1020950 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1020950
|
||||
CVE-2013-4419 libguestfs: insecure temporary directory handling for guestfish's network socket [epel-5]
|
||||
|
||||
1036742 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1036742
|
||||
Disable libguestfs tests on PPC
|
||||
|
||||
1037795 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1037795
|
||||
libguestfs rebuild needed due to broken ABI compatibility (caused by procps-ng update to 3.3.9)
|
||||
|
||||
(10 bugs)
|
||||
|
||||
--------------------------------------------------
|
||||
These bugs are in the VERIFIED state.
|
||||
|
||||
801640 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=801640
|
||||
[RFE] the error reported by resize2fs-M need to be more clear
|
||||
672485 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=672485
|
||||
[RFE] virt-edit/tar-in/tar-out/inspector do not support encrypted system
|
||||
|
||||
816839 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=816839
|
||||
data overflow error when debug progress -1
|
||||
889536 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=889536
|
||||
[RFE]It's better to emphasize "libguestfs-winsupport" in V2V manpage or error output
|
||||
|
||||
822626 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=822626
|
||||
virt-ls error: "libguestfs: error: checksum: path: parameter cannot be NULL"
|
||||
889537 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=889537
|
||||
Libguestfs live support should be disabled in RHEL 7 packages
|
||||
|
||||
830135 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=830135
|
||||
libguestfs should support mount-local APIs in RHEL 6 (for OpenStack)
|
||||
|
||||
836501 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=836501
|
||||
dependency on fuse suggested
|
||||
|
||||
837691 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=837691
|
||||
Data loss when writing to qcow2-format disk files
|
||||
|
||||
838609 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=838609
|
||||
guestmount + fusermount allows a race condition when unmounting and immediately using the disk image
|
||||
|
||||
853763 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=853763
|
||||
virt-sparsify should use a more robust method to detect the input format
|
||||
|
||||
858126 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=858126
|
||||
virt-inspector fail to work with some windows guests
|
||||
|
||||
858128 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=858128
|
||||
libguestfs fail to list devices added by add-drive-ro-with-if twice
|
||||
|
||||
858648 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=858648
|
||||
889538 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=889538
|
||||
libguestfs can not be installed with recent iptables
|
||||
|
||||
880805 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=880805
|
||||
virt-df with two -a options displays incorrect disk image name
|
||||
892275 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=892275
|
||||
checksums-out fail to compute the checksums of all regular files in directory
|
||||
|
||||
883338 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=883338
|
||||
Missing #include <locale.h> in fuse/guestmount.c
|
||||
894241 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=894241
|
||||
aug-init fail with the newest augeas package
|
||||
|
||||
(13 bugs)
|
||||
905322 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=905322
|
||||
"hivex-commit" should fail with a relative path
|
||||
|
||||
909573 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=909573
|
||||
patch libguestfs to use 'supermin' instead of 'febootstrap' in RHEL 7
|
||||
|
||||
909667 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=909667
|
||||
Unexpected non-tail recursion in recv_from_daemon results in stack overflow in very long-running API calls that send progress messages
|
||||
|
||||
921710 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=921710
|
||||
9p support should be disabled in libguestfs in RHEL 7
|
||||
|
||||
947438 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=947438
|
||||
Some obsolete tools should be removed from libguestfs RHEL 7 package
|
||||
|
||||
949486 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=949486
|
||||
libguestfs-1.20.5-3.el7.x86_64 dependency problem
|
||||
|
||||
957616 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=957616
|
||||
libguestfs-1.21.31-1.1.el7.1.1.x86_64 won't install due to missing dependency
|
||||
|
||||
957796 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=957796
|
||||
tar-out and base64-out quoting error
|
||||
|
||||
962113 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=962113
|
||||
Disable libguestfs block drivers which are not supported by RHEL 7 qemu + libvirt
|
||||
|
||||
974490 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=974490
|
||||
Regression: Fedora inspection broken by change from guestfs_exists to guestfs_is_file
|
||||
|
||||
975573 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=975573
|
||||
virt-sysprep is in the wrong subpackage
|
||||
|
||||
975771 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=975771
|
||||
Specifying virtio interface ('iface' parameter) breaks the direct backend - libguestfs hangs
|
||||
|
||||
976250 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=976250
|
||||
Make xfs filesystem failed with specified blocksize, gives "unknown option -b" error
|
||||
|
||||
976299 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=976299
|
||||
mke2fs-J should give a meaningful error when specified type is anything except 'ext{2,3,4}'
|
||||
|
||||
980338 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=980338
|
||||
disk-format "qemu-img info: JSON parse error" when target file does not exist
|
||||
|
||||
983691 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=983691
|
||||
libguestfs double free when kernel link fails during launch
|
||||
|
||||
988862 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=988862
|
||||
virt-sysprep --firstboot option writes incorrect "99" (instead of "S99") sysv-init-style start up script
|
||||
|
||||
989356 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=989356
|
||||
cap-get-file will return error if the file has not be set capabilities
|
||||
|
||||
995176 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=995176
|
||||
RFE: Implement set-uuid command
|
||||
|
||||
995712 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=995712
|
||||
list-filesystems command fails if there are no block devices
|
||||
|
||||
998485 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=998485
|
||||
guestfish remote prints "libguestfs: error: waitpid (qemu): No child processes"
|
||||
|
||||
998750 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=998750
|
||||
guestfish does not work due to conflict of remote and interactive mode
|
||||
|
||||
1000123 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1000123
|
||||
'sh' command before mount causes daemon to segfault
|
||||
|
||||
1000428 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1000428
|
||||
virt-format uses wrong partition type for vfat filesystems
|
||||
|
||||
1001875 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1001875
|
||||
Argument 'excludes' of tar-out does not work
|
||||
|
||||
1001876 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1001876
|
||||
Update "rsync-out" helpout for using wildcard
|
||||
|
||||
1002032 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1002032
|
||||
mke2fs can't return the correct filesystem type when blockscount is less than 2048 for ext3
|
||||
|
||||
1003291 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1003291
|
||||
Backport cachemode patch to RHEL 7
|
||||
|
||||
1016465 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1016465
|
||||
blockdev-setbsz succeeds, but does not affect blockdev-getbsz
|
||||
|
||||
1019891 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1019891
|
||||
libguestfs-tools.conf should have a man page
|
||||
|
||||
1020021 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1020021
|
||||
Drop php-libguestfs subpackage
|
||||
|
||||
(37 bugs)
|
||||
|
||||
End of BUGS file.
|
||||
|
||||
282
Makefile.am
282
Makefile.am
@@ -1,5 +1,5 @@
|
||||
# libguestfs
|
||||
# Copyright (C) 2009-2012 Red Hat Inc.
|
||||
# Copyright (C) 2009-2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -15,9 +15,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
-include $(top_builddir)/localenv
|
||||
|
||||
include $(top_srcdir)/subdir-rules.mk
|
||||
include $(top_srcdir)/common-rules.mk
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
@@ -30,9 +28,7 @@ SUBDIRS += tests/data generator src examples po
|
||||
if ENABLE_DAEMON
|
||||
SUBDIRS += daemon
|
||||
endif
|
||||
if ENABLE_APPLIANCE
|
||||
SUBDIRS += appliance
|
||||
endif
|
||||
|
||||
# Tests - order is important.
|
||||
if ENABLE_APPLIANCE
|
||||
@@ -41,14 +37,18 @@ SUBDIRS += tests/guests
|
||||
SUBDIRS += tests/c-api
|
||||
SUBDIRS += tests/tmpdirs
|
||||
SUBDIRS += tests/protocol
|
||||
SUBDIRS += tests/events
|
||||
SUBDIRS += tests/parallel
|
||||
SUBDIRS += tests/disks
|
||||
SUBDIRS += tests/mountable
|
||||
SUBDIRS += tests/network
|
||||
SUBDIRS += tests/lvm
|
||||
SUBDIRS += tests/luks
|
||||
SUBDIRS += tests/md
|
||||
SUBDIRS += tests/selinux
|
||||
SUBDIRS += tests/ntfsclone
|
||||
SUBDIRS += tests/btrfs
|
||||
SUBDIRS += tests/xfs
|
||||
SUBDIRS += tests/charsets
|
||||
SUBDIRS += tests/xml
|
||||
SUBDIRS += tests/mount-local
|
||||
@@ -57,6 +57,11 @@ SUBDIRS += tests/rsync
|
||||
SUBDIRS += tests/bigdirs
|
||||
SUBDIRS += tests/disk-labels
|
||||
SUBDIRS += tests/hotplug
|
||||
SUBDIRS += tests/nbd
|
||||
SUBDIRS += tests/http
|
||||
SUBDIRS += tests/syslinux
|
||||
SUBDIRS += tests/journal
|
||||
SUBDIRS += tests/fuzz
|
||||
SUBDIRS += tests/regressions
|
||||
endif
|
||||
|
||||
@@ -69,6 +74,9 @@ SUBDIRS += fish
|
||||
# virt-tools in C.
|
||||
SUBDIRS += align cat df edit format inspector rescue
|
||||
|
||||
# bash-completion
|
||||
SUBDIRS += bash
|
||||
|
||||
# Language bindings.
|
||||
if HAVE_PERL
|
||||
SUBDIRS += perl perl/examples
|
||||
@@ -100,13 +108,17 @@ endif
|
||||
if HAVE_GOBJECT
|
||||
SUBDIRS += gobject
|
||||
endif
|
||||
if HAVE_GOLANG
|
||||
SUBDIRS += golang golang/examples
|
||||
endif
|
||||
|
||||
# Unconditional because nothing is built yet.
|
||||
SUBDIRS += csharp
|
||||
|
||||
# OCaml tools.
|
||||
# OCaml tools. Note 'mllib' contains random shared code used by
|
||||
# all of the OCaml tools.
|
||||
if HAVE_OCAML
|
||||
SUBDIRS += resize sparsify sysprep
|
||||
SUBDIRS += mllib builder builder/website resize sparsify sysprep
|
||||
endif
|
||||
|
||||
# Perl tools.
|
||||
@@ -125,17 +137,17 @@ SUBDIRS += po-docs
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(generator_built) \
|
||||
BUGS HACKING ROADMAP TODO \
|
||||
.gitignore \
|
||||
.lvimrc \
|
||||
.mailmap \
|
||||
.tx/config \
|
||||
bootstrap \
|
||||
bugs-in-changelog.sh \
|
||||
autogen.sh \
|
||||
bindtests \
|
||||
cfg.mk \
|
||||
contrib/autobuild/autobuild.sh \
|
||||
contrib/guestfsd-in-wine.sh \
|
||||
contrib/intro/libguestfs-intro.html \
|
||||
contrib/intro/overview.png \
|
||||
contrib/intro/overview.svg \
|
||||
@@ -159,18 +171,28 @@ EXTRA_DIST = \
|
||||
contrib/visualize-alignment/qemu-0.13-trace-block-device-access.patch \
|
||||
contrib/visualize-alignment/README \
|
||||
contrib/visualize-alignment/tracetops.ml \
|
||||
contrib/windows-icons.pl \
|
||||
guestfs-release-notes.pod \
|
||||
guestfs-release-notes.txt \
|
||||
html/draft.png \
|
||||
html/draft.svg \
|
||||
html/pod.css \
|
||||
html/virt-builder.svg \
|
||||
libtool-kill-dependency_libs.sh \
|
||||
logo/fish.svg logo/fish.png \
|
||||
logo/virt-builder.svg \
|
||||
m4/.gitignore \
|
||||
tmp/.gitignore \
|
||||
tx-pull.sh \
|
||||
update-bugs.sh \
|
||||
valgrind-suppressions
|
||||
valgrind-suppressions \
|
||||
.x-sc_avoid_ctype_macros \
|
||||
.x-sc_prohibit_have_config_h \
|
||||
.x-sc_prohibit_magic_number_exit \
|
||||
.x-sc_prohibit_strcmp \
|
||||
.x-sc_prohibit_strcmp_and_strncmp \
|
||||
.x-sc_TAB_in_indentation \
|
||||
.x-sc_trailing_blank
|
||||
|
||||
# The website.
|
||||
HTMLFILES = \
|
||||
@@ -178,6 +200,7 @@ HTMLFILES = \
|
||||
html/guestfs-examples.3.html \
|
||||
html/guestfs-erlang.3.html \
|
||||
html/guestfs-faq.1.html \
|
||||
html/guestfs-golang.3.html \
|
||||
html/guestfs-java.3.html \
|
||||
html/guestfs-lua.3.html \
|
||||
html/guestfs-ocaml.3.html \
|
||||
@@ -191,9 +214,11 @@ HTMLFILES = \
|
||||
html/guestfsd.8.html \
|
||||
html/guestfish.1.html \
|
||||
html/guestmount.1.html \
|
||||
html/guestunmount.1.html \
|
||||
html/libguestfs-make-fixed-appliance.1.html \
|
||||
html/libguestfs-test-tool.1.html \
|
||||
html/virt-alignment-scan.1.html \
|
||||
html/virt-builder.1.html \
|
||||
html/virt-cat.1.html \
|
||||
html/virt-copy-in.1.html \
|
||||
html/virt-copy-out.1.html \
|
||||
@@ -215,19 +240,30 @@ HTMLFILES = \
|
||||
html/virt-tar-out.1.html \
|
||||
html/virt-win-reg.1.html
|
||||
|
||||
HTMLSUPPORTFILES = html/draft.png html/pod.css
|
||||
HTMLSUPPORTFILES = \
|
||||
html/draft.png \
|
||||
html/pod.css \
|
||||
html/virt-builder.svg
|
||||
|
||||
TEXTFILES = BUGS README ROADMAP TODO
|
||||
|
||||
WEBSITEDIR = $(HOME)/d/redhat/websites/libguestfs
|
||||
BUILDERFILES = \
|
||||
builder/website/README \
|
||||
builder/website/index \
|
||||
builder/website/index.asc \
|
||||
builder/website/*.xz \
|
||||
builder/website/*.xz.sig
|
||||
|
||||
WEBSITEDIR = $(HOME)/d/websites/libguestfs
|
||||
|
||||
# For reasons not fully understood, we need to rebuild all the
|
||||
# man pages and HTMLFILES from scratch here.
|
||||
website: $(HTMLFILES) $(TEXTFILES)
|
||||
website: $(HTMLFILES) $(HTMLSUPPORTFILES) $(TEXTFILES) $(BUILDERFILES)
|
||||
find -name 'stamp-*.pod' -delete
|
||||
$(MAKE)
|
||||
cp $(HTMLFILES) $(HTMLSUPPORTFILES) $(WEBSITEDIR)
|
||||
for f in $(TEXTFILES); do cp $$f $(WEBSITEDIR)/$$f.txt; done
|
||||
cp $(BUILDERFILES) $(WEBSITEDIR)/download/builder/
|
||||
cd $(WEBSITEDIR) && \
|
||||
date=`date +%F`; \
|
||||
sed -e "s/SUBST_VERSION/$(VERSION)/" \
|
||||
@@ -241,32 +277,29 @@ dist-hook:
|
||||
$(top_srcdir)/update-bugs.sh > BUGS-t
|
||||
mv BUGS-t BUGS
|
||||
cp BUGS $(distdir)/BUGS
|
||||
git shortlog -se | awk -F'\t' '{print $$2}' > AUTHORS-t
|
||||
git shortlog -s | awk -F'\t' '{print $$2}' | sort -f > AUTHORS-t
|
||||
mv AUTHORS-t AUTHORS
|
||||
cp AUTHORS $(distdir)/AUTHORS
|
||||
|
||||
# Update the list of translatable files (po/POTFILES po/POTFILES-ml).
|
||||
# Update the list of translatable files. These are separated into:
|
||||
#
|
||||
# po/POTFILES - files with ordinary extensions, but not OCaml files
|
||||
# po/POTFILES-pl - Perl files that don't end in *.pl, which need a
|
||||
# special xgettext option [not generated here]
|
||||
# po/POTFILES-ml - OCaml files, which need a special tool to translate
|
||||
#
|
||||
# See po/Makefile.am.
|
||||
#
|
||||
# This has to be in the top-level Makefile.am so that we have access
|
||||
# to DIST_SUBDIRS.
|
||||
all-local:
|
||||
cd $(srcdir); \
|
||||
find $(DIST_SUBDIRS) \
|
||||
-name '*.c' -o -name '*.pl' -o -name '*.pm' | \
|
||||
grep -v '^perl/blib/' | \
|
||||
grep -v '^tests/' | \
|
||||
grep -v '^daemon/lib/' | \
|
||||
grep -v '^daemon/tests/' | \
|
||||
grep -v '^examples/' | \
|
||||
grep -v '^gnulib/' | \
|
||||
grep -v '^perl/examples/' | \
|
||||
grep -v '/guestfs_protocol.c' | \
|
||||
grep -v '/rc_protocol.c' | \
|
||||
grep -v '^po-docs/' | \
|
||||
grep -v '^images/' | \
|
||||
LC_ALL=C sort | \
|
||||
sed 's,^\./,,' > po/POTFILES
|
||||
find $(DIST_SUBDIRS) -name '*.c' -o -name '*.pl' -o -name '*.pm' | \
|
||||
grep -v -E '^(examples|gnulib|perl/(blib|examples)|po-docs|tests)/' | \
|
||||
grep -v -E '/((guestfs|rc)_protocol\.c)$$' | \
|
||||
LC_ALL=C sort > po/POTFILES
|
||||
cd $(srcdir); \
|
||||
find resize sparsify sysprep -name '*.ml' | \
|
||||
find builder mllib resize sparsify sysprep -name '*.ml' | \
|
||||
LC_ALL=C sort > po/POTFILES-ml
|
||||
|
||||
# Manual pages in top level directory.
|
||||
@@ -288,13 +321,33 @@ stamp-guestfs-release-notes.pod: guestfs-release-notes.pod
|
||||
$<
|
||||
touch $@
|
||||
|
||||
# NB. podwrapper is an internal tool, so the man page mustn't be installed.
|
||||
noinst_MANS = podwrapper.1
|
||||
podwrapper.1: podwrapper.pl
|
||||
$(PODWRAPPER) \
|
||||
--section 1 \
|
||||
--man $@-t \
|
||||
--license GPLv2+ \
|
||||
$<
|
||||
mv $@-t $@
|
||||
|
||||
# Make clean.
|
||||
|
||||
CLEANFILES = \
|
||||
*~ \
|
||||
html/*.html \
|
||||
pod2htm?.tmp \
|
||||
podwrapper.1 \
|
||||
qemu-wrapper.sh \
|
||||
stamp-guestfs-release-notes.pod
|
||||
stamp-guestfs-release-notes.pod \
|
||||
tmp/disk* \
|
||||
tmp/run-* \
|
||||
tmp/valgrind-*.log
|
||||
|
||||
clean-local:
|
||||
-rm -rf tmp/libguestfs??????
|
||||
-rm -rf tmp/guestfs.*
|
||||
-rm -rf tmp/.guestfs-*
|
||||
|
||||
# If you don't want to run all of the tests ('make check') then this
|
||||
# will just run libguestfs-test-tool for a quick check. Note this
|
||||
@@ -305,54 +358,92 @@ quickcheck:
|
||||
|
||||
# Non-standard tests.
|
||||
|
||||
extra-tests:
|
||||
check-all:
|
||||
$(MAKE) -j1 \
|
||||
valgrind \
|
||||
valgrind-local-guests \
|
||||
check-with-appliance \
|
||||
check \
|
||||
check-valgrind \
|
||||
check-valgrind-local-guests \
|
||||
check-direct \
|
||||
check-valgrind-direct \
|
||||
check-uml \
|
||||
check-valgrind-uml \
|
||||
check-with-upstream-qemu \
|
||||
check-with-upstream-libvirt \
|
||||
check-slow
|
||||
|
||||
check-release:
|
||||
$(MAKE) -j1 \
|
||||
check \
|
||||
check-valgrind \
|
||||
check-direct \
|
||||
check-valgrind-direct
|
||||
$(MAKE) -j1 LIBGUESTFS_HV=$(HOME)/d/linux-um/vmlinux \
|
||||
check-uml \
|
||||
check-valgrind-uml
|
||||
$(MAKE) -j1 \
|
||||
check-slow
|
||||
|
||||
check-valgrind: build-test-guests
|
||||
@for f in `grep -l '^$@:' $(SUBDIRS:%=%/Makefile.am)`; do \
|
||||
@errors=0; \
|
||||
for f in `grep -l '^$@:' $(SUBDIRS:%=%/Makefile.am)`; do \
|
||||
echo $(MAKE) -C `dirname $$f` $@; \
|
||||
$(MAKE) -C `dirname $$f` $@ || exit $$?; \
|
||||
done
|
||||
$(MAKE) -C `dirname $$f` $@ || (( errors++ )); \
|
||||
done; \
|
||||
exit $$(( $$errors ? 1 : 0 ))
|
||||
|
||||
check-valgrind-local-guests:
|
||||
@GUESTS=`$(top_builddir)/run ./pick-guests.pl 5`; \
|
||||
errors=0; \
|
||||
for f in `grep -l '^$@:' $(SUBDIRS:%=%/Makefile.am)`; do \
|
||||
echo $(MAKE) GUESTS="$$GUESTS" -C `dirname $$f` $@; \
|
||||
$(MAKE) GUESTS="$$GUESTS" -C `dirname $$f` $@ || exit $$?; \
|
||||
done
|
||||
$(MAKE) GUESTS="$$GUESTS" -C `dirname $$f` $@ || (( errors++ )); \
|
||||
done; \
|
||||
exit $$(( $$errors ? 1 : 0 ))
|
||||
|
||||
check-slow: build-test-guests
|
||||
for f in `grep -l '^$@:' $(SUBDIRS:%=%/Makefile.am)`; do \
|
||||
echo $(MAKE) -C `dirname $$f` $@; \
|
||||
$(MAKE) -C `dirname $$f` $@ || exit $$?; \
|
||||
done
|
||||
|
||||
build-test-guests:
|
||||
$(MAKE) -C tests/guests check
|
||||
|
||||
check-with-appliance:
|
||||
@method=`$(top_builddir)/run ./fish/guestfish get-attach-method`; \
|
||||
if [ "$$method" != "appliance" ]; then \
|
||||
$(MAKE) LIBGUESTFS_ATTACH_METHOD=appliance check || exit $$?; \
|
||||
check-direct:
|
||||
@backend=`$(top_builddir)/run ./fish/guestfish get-backend`; \
|
||||
if [ "$$backend" != "direct" ]; then \
|
||||
$(MAKE) LIBGUESTFS_BACKEND=direct check || exit $$?; \
|
||||
fi
|
||||
|
||||
check-with-appliance: check-direct
|
||||
|
||||
check-valgrind-direct:
|
||||
@backend=`$(top_builddir)/run ./fish/guestfish get-backend`; \
|
||||
if [ "$$backend" != "direct" ]; then \
|
||||
$(MAKE) LIBGUESTFS_BACKEND=direct check-valgrind || exit $$?; \
|
||||
fi
|
||||
|
||||
check-valgrind-with-appliance: check-valgrind-direct
|
||||
|
||||
# Tests which currently fail under UML:
|
||||
# - blockdev --setro seems to have no effect on /dev/ubd* devices [*]
|
||||
# - RHBZ#914931: test is sent a SIGTERM, apparently by UML [*]
|
||||
# - tests/md/test-inspect-fstab-md.sh hangs at various places during the
|
||||
# test, eg. running mdadm, mounting MD filesystem [*]
|
||||
# [*] = likely to be a bug in UML itself
|
||||
SKIP_TESTS_FAILING_IN_UML = \
|
||||
SKIP_TEST_BLOCKDEV_GETRO=1 \
|
||||
SKIP_TEST_BLOCKDEV_SETRO=1 \
|
||||
SKIP_TEST_RHBZ914931=1 \
|
||||
SKIP_TEST_INSPECT_FSTAB_MD_SH=1
|
||||
|
||||
check-uml:
|
||||
$(MAKE) LIBGUESTFS_BACKEND=uml $(SKIP_TESTS_FAILING_IN_UML) check
|
||||
|
||||
check-valgrind-uml:
|
||||
$(MAKE) LIBGUESTFS_BACKEND=uml $(SKIP_TESTS_FAILING_IN_UML) check-valgrind
|
||||
|
||||
QEMUDIR = $(HOME)/d/qemu
|
||||
QEMUBINARY = $(QEMUDIR)/x86_64-softmmu/qemu-system-x86_64
|
||||
|
||||
check-with-upstream-qemu:
|
||||
@if $(QEMUBINARY) --help >/dev/null 2>&1; then \
|
||||
$(MAKE) check-with-upstream-qemu-1 || exit $$?; \
|
||||
fi
|
||||
rm -f $(top_builddir)/qemu-wrapper.sh
|
||||
$(MAKE) check-with-upstream-qemu-1 || exit $$?
|
||||
|
||||
check-with-upstream-qemu-1: $(top_builddir)/qemu-wrapper.sh
|
||||
$(QEMUBINARY) --version
|
||||
$(MAKE) LIBGUESTFS_QEMU=$(abs_top_builddir)/qemu-wrapper.sh check
|
||||
$(MAKE) LIBGUESTFS_HV=$(abs_top_builddir)/qemu-wrapper.sh check
|
||||
|
||||
$(top_builddir)/qemu-wrapper.sh: Makefile
|
||||
rm -f $@ $@-t
|
||||
@@ -363,30 +454,81 @@ $(top_builddir)/qemu-wrapper.sh: Makefile
|
||||
LIBVIRTDIR = $(HOME)/d/libvirt
|
||||
|
||||
check-with-upstream-libvirt:
|
||||
@method=`$(top_builddir)/run ./fish/guestfish get-attach-method`; \
|
||||
if [ "$$method" = "libvirt" ] && [ -x "$(LIBVIRTDIR)/run" ]; then \
|
||||
@backend=`$(top_builddir)/run ./fish/guestfish get-backend`; \
|
||||
if [ "$$backend" = "libvirt" ] && [ -x "$(LIBVIRTDIR)/run" ]; then \
|
||||
$(LIBVIRTDIR)/run $(MAKE) check || exit $$?; \
|
||||
fi
|
||||
|
||||
check-slow: build-test-guests
|
||||
@errors=0; \
|
||||
for f in `grep -l '^$@:' $(SUBDIRS:%=%/Makefile.am)`; do \
|
||||
echo $(MAKE) -C `dirname $$f` $@; \
|
||||
$(MAKE) -C `dirname $$f` $@ || (( errors++ )); \
|
||||
done; \
|
||||
exit $$(( $$errors ? 1 : 0 ))
|
||||
|
||||
build-test-guests:
|
||||
$(MAKE) -C tests/guests check
|
||||
|
||||
# Print subdirs.
|
||||
#
|
||||
# If you want to selectively run tests, or if the test suite fails half
|
||||
# way through, use:
|
||||
#
|
||||
# make print-subdirs
|
||||
#
|
||||
# to print the subdirectories, select the ones you want to run / the
|
||||
# remaining ones, and do:
|
||||
#
|
||||
# make check SUBDIRS="..."
|
||||
|
||||
print-subdirs:
|
||||
@echo $(SUBDIRS)
|
||||
|
||||
# Tag HEAD with current version (only for maintainer).
|
||||
|
||||
maintainer-tag:
|
||||
git tag -a $(VERSION) -m "Version $(VERSION) ($(BRANCH_TYPE))" -f
|
||||
|
||||
# Maintainer only: check EXTRA_DIST rule is complete.
|
||||
# (Note you must have done 'make dist')
|
||||
|
||||
maintainer-check-extra-dist:
|
||||
zcat $(PACKAGE_NAME)-$(VERSION).tar.gz | tar tf - | sort | \
|
||||
sed 's,^$(PACKAGE_NAME)-$(VERSION)/,,' > tmp/tarfiles
|
||||
git ls-files | sort > tmp/gitfiles
|
||||
diff -ur tmp/tarfiles tmp/gitfiles | grep '^\+' | \
|
||||
grep -v src/api-support/[0-9]
|
||||
rm tmp/tarfiles tmp/gitfiles
|
||||
|
||||
# Provide help on common Makefile targets.
|
||||
|
||||
help:
|
||||
@echo
|
||||
@echo "make Build everything."
|
||||
@echo "make Build everything."
|
||||
@echo
|
||||
@echo "make check Run the standard tests."
|
||||
@echo "make check-valgrind Run a subset of the tests under valgrind."
|
||||
@echo "make check Run the standard tests"
|
||||
@echo "make -k check ... and display all errors at once."
|
||||
@echo
|
||||
@echo "make check-valgrind Run a subset of the tests under valgrind."
|
||||
@echo "make check-valgrind-local-guests Test under valgrind using local guests."
|
||||
@echo "make check-with-appliance Test using appliance attach-method."
|
||||
@echo "make check-direct Test using direct backend."
|
||||
@echo "make check-valgrind-direct Test valgrind + direct backend."
|
||||
@echo "make check-uml Test using User-Mode Linux."
|
||||
@echo "make check-valgrind-uml Test valgrind + User-Mode Linux."
|
||||
@echo "make check-with-upstream-qemu Test using upstream qemu."
|
||||
@echo "make check-with-upstream-libvirt Test using upstream libvirt."
|
||||
@echo "make check-slow Slow/long-running tests."
|
||||
@echo "make extra-tests Same as check-* (but not 'make check')"
|
||||
@echo "make syntax-check Check syntax and style problems in the code."
|
||||
@echo "make check-slow Slow/long-running tests."
|
||||
@echo
|
||||
@echo "make install Install everything."
|
||||
@echo "make check-all Runs all 'check*' rules."
|
||||
@echo "make check-release Runs 'check*' rules required for release."
|
||||
@echo
|
||||
@echo "make clean Clean everything."
|
||||
@echo "make syntax-check -j1 -k Check syntax and style problems in the code."
|
||||
@echo "make print-subdirs Print subdirectories."
|
||||
@echo
|
||||
@echo "make install Install everything."
|
||||
@echo
|
||||
@echo "make clean Clean everything."
|
||||
@echo
|
||||
@echo "To run programs without installing:"
|
||||
@echo " ./run ./fish/guestfish [or any other program]"
|
||||
|
||||
394
README
394
README
@@ -41,134 +41,212 @@ Debian/Ubuntu users:
|
||||
|
||||
The full requirements are described below.
|
||||
|
||||
For basic functionality and the C tools:
|
||||
|
||||
- look at appliance/packagelist.in and install as many of the packages
|
||||
that apply to your distro as possible
|
||||
|
||||
- QEMU >= 1.1.0.
|
||||
|
||||
- kernel >= 2.6.34 with virtio-serial support enabled.
|
||||
|
||||
- virtio-block and virtio-net drivers should be compiled into your
|
||||
host kernel (strictly speaking this is optional, but you will have
|
||||
to make complex changes to the ./configure command line to get it
|
||||
to work if you don't have virtio)
|
||||
|
||||
- febootstrap >= 3.20
|
||||
|
||||
Notes: (1) febootstrap 2.x WILL NOT WORK
|
||||
(2) febootstrap 3.x is distro-independent, and is required on
|
||||
Debian and other distros as well as Fedora
|
||||
(3) that is the minimum version, but later versions are better
|
||||
|
||||
- XDR, rpcgen (on Linux these are provided by glibc)
|
||||
|
||||
- cpio
|
||||
|
||||
- gperf
|
||||
|
||||
- pcre (Perl Compatible Regular Expressions C library)
|
||||
|
||||
- genisoimage (NOT mkisofs any more)
|
||||
|
||||
- hivex >= 1.2.7 (http://libguestfs.org/download) (optional)
|
||||
|
||||
- libmagic (the library that corresponds to the 'file' command) (optional)
|
||||
|
||||
- libvirt (optional, >= 0.10.2 to use the libvirt launch method)
|
||||
|
||||
- libxml2 (optional)
|
||||
|
||||
- libconfig (optional)
|
||||
|
||||
- augeas >= 0.5.0 (http://augeas.net/) (optional)
|
||||
|
||||
- Berkeley DB 'db_dump' and 'db_load' utilities
|
||||
(db4-utils or db4.X-util or similar) (optional)
|
||||
|
||||
- systemtap/DTrace userspace probes (optional)
|
||||
http://sourceware.org/systemtap/wiki/AddingUserSpaceProbingToApps
|
||||
|
||||
- perl Pod::Man and Pod::Simple are required. These are used to
|
||||
generate man pages and other documentation. Every recent Perl
|
||||
distribution ought to include both.
|
||||
|
||||
- Readline to have nicer command-line editing in guestfish (optional)
|
||||
|
||||
- xmllint (part of libxml2) to validate virt-inspector
|
||||
RELAX NG schema (optional)
|
||||
|
||||
- OCaml compiler. Optional when compiling from the tarball, but
|
||||
mandatory if you compile from git.
|
||||
|
||||
- ocaml-gettext if you want to translate OCaml tools (optional)
|
||||
|
||||
- po4a for translating manpages and POD files.
|
||||
This is optional when compiling from the tarball, but mandatory
|
||||
if you compile from git.
|
||||
|
||||
- getfacl, getfattr libraries and programs (optional)
|
||||
|
||||
- Linux capabilities library (libcap) (optional)
|
||||
|
||||
- libldm and ldmtool (optional)
|
||||
This is used to handle Windows dynamic disks.
|
||||
|
||||
- yajl >= 2 (optional)
|
||||
JSON parser, needed to handle the output of ldmtool.
|
||||
|
||||
- netpbm, icoutils (optional)
|
||||
These programs are used to render icons from guests.
|
||||
|
||||
- Perl Expect module (optional)
|
||||
This is used to test virt-rescue.
|
||||
|
||||
To build FUSE support in the core library, and guestmount:
|
||||
|
||||
- FUSE libraries and kernel module (optional)
|
||||
|
||||
To build language bindings:
|
||||
|
||||
- OCaml compiler to build the OCaml bindings (optional, but see above)
|
||||
|
||||
- Perl if you want to build the perl bindings (optional)
|
||||
|
||||
- Python if you want to build the python bindings (optional)
|
||||
|
||||
- Ruby, rake if you want to build the ruby bindings (optional)
|
||||
|
||||
- Java, JNI, jpackage-utils if you want to build the java
|
||||
bindings (optional)
|
||||
|
||||
- GHC if you want to build the Haskell bindings (optional)
|
||||
|
||||
- PHP, phpize if you want to build the PHP bindings (optional)
|
||||
|
||||
To build the Perl tools:
|
||||
|
||||
- Perl Sys::Virt module (optional)
|
||||
|
||||
- Perl Win::Hivex module (optional)
|
||||
|
||||
- Perl Pod::Usage module (optional)
|
||||
|
||||
- Perl Test::More module (from perl Test::Simple) (optional)
|
||||
|
||||
- Perl String::ShellQuote module (optional)
|
||||
|
||||
- perl-libintl for translating perl code (optional)
|
||||
R = Required
|
||||
O = Optional
|
||||
+==============+=============+===+=========================================+
|
||||
| Package name | Min.version | | Notes |
|
||||
+==============+=============+===+=========================================+
|
||||
| Install as many packages listed in appliance/packagelist.in as possible. |
|
||||
| This installs the disk management tools required by the appliance. The |
|
||||
| list below is *additional* packages needed on the host. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| qemu | 1.2.0 | R | 1.1 may work, but has broken virtio-scsi|
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| qemu-img | | R | |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| kernel | 2.6.34 | R | Make sure the following are enabled |
|
||||
| | | | compiled in or as a module: |
|
||||
| | | | - virtio-pci |
|
||||
| | | | - virtio-serial |
|
||||
| | | | - virtio-block |
|
||||
| | | | - virtio-net |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| supermin | 4.1.0 | R | This is required on all distros. |
|
||||
| febootstrap | 3.20 | | 'supermin' is the new name for |
|
||||
| | | | 'febootstrap'. |
|
||||
| | | | For alternatives, see: |
|
||||
| | | | libguestfs.org/download/binaries/appliance/
|
||||
| | | | febootstrap 2.x WILL NOT WORK |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| glibc | | R | We use various glibc-isms. |
|
||||
| | | | Also glibc provides XDR, rpcgen. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| GCC or LLVM | | R | We use __attribute__((cleanup)). |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| Perl | | R | Various build and test programs need |
|
||||
| | | | Perl. Not needed at runtime except if |
|
||||
| | | | you need to run a handful of virt-* |
|
||||
| | | | tools that are still written in Perl. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| Pod::Man | | R | Part of Perl core. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| Pod::Simple | | R | Part of Perl core. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| OCaml | |R/O| Required if compiling from git. |
|
||||
| | | | Optional if compiling from tarball. |
|
||||
| | | | To build generated files and OCaml bindings.
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| autotools | |R/O| Required if compiling from git. |
|
||||
| | | | Optional if compiling from tarball. |
|
||||
| | | | Autotools-based build system. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| cpio | | R | |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| gperf | | R | |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| flex | | R | flex & bison are required for virt- |
|
||||
+--------------+-------------+---| builder. We could make these |
|
||||
| bison | | R | optional but automakes makes it hard. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| PCRE | | R | Perl-compatible Regular Expression lib. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| genisoimage | | R | mkisofs may work. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| libxml2 | | R | Popular XML library. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| augeas | 1.0.0 | R | |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| xz | | R | Used to compress disk images. |
|
||||
| | | | Used by virt-builder for compression. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| po4a | |R/O| Required if compiling from git. |
|
||||
| | | | Optional if compiling from tarball. |
|
||||
| | | | For localizing man pages. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| hivex | 1.2.7 |R/O| Require if compiling from git. |
|
||||
| | | | Windows Registry hive parser. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| libmagic | | O | The library used by the 'file' command. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| libvirt | | O | >= 0.10.2 is needed if you want to use |
|
||||
| | | | libvirt to manage transient VMs. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| xmllint | | O | Part of libxml2. Used for tests only. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| libconfig | | O | Used to parse libguestfs's own config |
|
||||
| | | | files eg. /etc/libguestfs-tools.conf. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| libselinux | | O | Used by the libvirt backend to securely |
|
||||
| | | | confine the appliance (sVirt). |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| db utils | | O | db_dump, db_load etc. Usually found in |
|
||||
| | | | a package called db-utils, db4-utils, |
|
||||
| | | | db4.X-utils, Berkeley DB utils, etc. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| systemtap | | O | For userspace probes. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| readline | | O | For nicer command line in guestfish. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| acl | | O | Library (libacl) and programs for |
|
||||
| | | | handling POSIX ACLs. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| libcap | | O | Library (libcap) and programs for |
|
||||
| | | | handling Linux capabilities. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| libldm | | O | Library (libldm) and 'ldmtool' for |
|
||||
| | | | handling Windows Dynamic Disks. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| sd-journal | | O | systemd journal library |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| yajl | 2 | O | JSON parser for parsing output of |
|
||||
| | | | ldmtool and qemu-img info commands. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| gdisk | | O | GPT disk support. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| netpbm | | O | Render icons from guests. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| icoutils | | O | Render icons from Windows guests. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| Expect | | O | Perl module used to test virt-rescue. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| FUSE | | O | fusermount, libfuse, and kernel module |
|
||||
| | | | are all needed if you want guestmount |
|
||||
| | | | and/or 'mount-local' support. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| static glibc | | O | Used for testing only. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| qemu-nbd | | O | Used for testing only. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| uml_mkcow | | O | For the UML backend. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| curl | | O | Used by virt-builder for downloads |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| gpg | | O | Used by virt-builder for digital |
|
||||
| | | | signatures |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| liblzma | | O | Can be used by virt-builder for fast |
|
||||
| | | | uncompression of templates. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| findlib | | O | For the OCaml bindings. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| ocaml-gettext| | O | For localizing OCaml virt-* tools. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| Python | 2.2 | O | For the Python bindings. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| Ruby | | O | >= 1.9 is better than 1.8. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| rake | | O | For the Ruby bindings. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| rubygem-minitest | O | For the Ruby bindings. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| Java | 1.6 | O | Java + JNI + jpackage-utils are needed |
|
||||
| | | | for the Java bindings. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| GHC | | O | For the Haskell bindings. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| PHP | | O | For the PHP bindings. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| phpize | | O | For the PHP bindings. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| glib2 | | O | For the GObject bindings. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| gobject-introspection | O | For the GObject bindings. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| gjs | | O | For testing the GObject bindings. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| LUA | | O | For the LUA bindings. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| Erlang | | O | For the Erlang bindings. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| erl_interface| | O | For the Erlang bindings. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| golang | 1.1.1 | O | For the Go bindings. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| valgrind | | O | For testing for memory problems. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| Sys::Virt | | O | Perl bindings for libvirt. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| Win::Hivex | | O | Perl bindings for hivex. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| Pod::Usage | | O | Perl module used by tests. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| Test::More | | O | Perl module used by tests. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| String::Shellquote | O | Perl module used by some virt-* tools. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| XML::XPath | | O | Perl module used by some virt-* tools. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| XML::XPath::XMLParser | O | Perl module used by some virt-* tools. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| perl-libintl | | O | Perl module for localization. |
|
||||
+--------------+-------------+---+-----------------------------------------+
|
||||
| bash-completion | O | For tab-completion of commands in bash. |
|
||||
+==============+=============+===+=========================================+
|
||||
R = Required
|
||||
O = Optional
|
||||
|
||||
|
||||
Building
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Then make the daemon, library and root filesystem:
|
||||
Build the daemon, library and root filesystem:
|
||||
|
||||
./configure
|
||||
make
|
||||
building from tarball building from git
|
||||
--------------------- -----------------
|
||||
./configure ./autogen.sh
|
||||
make make
|
||||
|
||||
Finally run the tests:
|
||||
Run the tests:
|
||||
|
||||
make check
|
||||
|
||||
@@ -179,51 +257,56 @@ Also:
|
||||
runs a subset of the test suite under valgrind (requires valgrind to
|
||||
be installed obviously).
|
||||
|
||||
make extra-tests
|
||||
make check-all
|
||||
|
||||
runs check-valgrind + even more tests, but these require that you have
|
||||
some libvirt guests installed, that these guests' disks are accessible
|
||||
by the current user, and these tests may fail for other reasons which
|
||||
are not necessarily because of real problems.
|
||||
|
||||
If everything works, you can install the library and tools by running
|
||||
this command as root:
|
||||
make help
|
||||
|
||||
lists all 'make' targets.
|
||||
|
||||
You may install the library by running the following command as root.
|
||||
However *most users should probably not do this*. Instead, './run'
|
||||
the programs from the build directory as described below.
|
||||
|
||||
make install
|
||||
|
||||
Distro packagers should use this instead:
|
||||
|
||||
make INSTALLDIRS=vendor [DESTDIR=...] install
|
||||
|
||||
You can run guestfish, guestmount and the virt tools without needing
|
||||
to install, using the "./run" script in the top directory. This
|
||||
script sets up some environment variables. For example:
|
||||
|
||||
./run ./fish/guestfish [usual guestfish args ...]
|
||||
./run guestfish [usual guestfish args ...]
|
||||
|
||||
./run ./inspector/virt-inspector [usual virt-inspector args ...]
|
||||
./run virt-inspector [usual virt-inspector args ...]
|
||||
|
||||
If you are already in the fish/ subdirectory, then the following
|
||||
command will also work:
|
||||
|
||||
../run ./guestfish [...]
|
||||
../run guestfish [...]
|
||||
|
||||
You can also make a symlink (note: NOT a hard link) from your $PATH to
|
||||
the run script, eg:
|
||||
|
||||
cd ~/bin
|
||||
ln -s ~/libguestfs/run libguestfs-run
|
||||
cd ~/libguestfs
|
||||
libguestfs-run ./inspector/virt-inspector [...]
|
||||
The ./run script adds every libguestfs binary to the $PATH, so the
|
||||
above example runs guestfish from the build directory (not the
|
||||
globally installed guestfish if there is one).
|
||||
|
||||
You can also run the C programs under valgrind like this:
|
||||
|
||||
./run valgrind [valgrind opts...] ./cat/virt-cat [virt-cat opts...]
|
||||
./run valgrind [valgrind opts...] virt-cat [virt-cat opts...]
|
||||
|
||||
or under gdb:
|
||||
|
||||
./run gdb --args ./cat/virt-cat [virt-cat opts...]
|
||||
./run gdb --args virt-cat [virt-cat opts...]
|
||||
|
||||
This also works with sudo (eg. if you need root access for libvirt or
|
||||
to access a block device):
|
||||
|
||||
sudo ./run ./cat/virt-cat -d LinuxGuest /etc/passwd
|
||||
sudo ./run virt-cat -d LinuxGuest /etc/passwd
|
||||
|
||||
|
||||
qemu
|
||||
@@ -289,7 +372,7 @@ distributions. Non-Linux ports are trickier, but we will accept
|
||||
patches if they aren't too invasive.
|
||||
|
||||
The main porting issues are with the dependencies needed to build the
|
||||
appliance. You will need to port the febootstrap first
|
||||
appliance. You will need to port febootstrap first
|
||||
(http://people.redhat.com/~rjones/febootstrap/).
|
||||
|
||||
|
||||
@@ -307,43 +390,10 @@ Don't enable GCC warnings (ie. *don't* use
|
||||
'./configure --enable-gcc-warnings').
|
||||
|
||||
|
||||
Note on using non-x86 architectures
|
||||
----------------------------------------------------------------------
|
||||
|
||||
In theory libguestfs should work on non-x86 architectures. Usually if
|
||||
it doesn't it's because qemu isn't available or cannot boot the
|
||||
kernel.
|
||||
|
||||
For ARM you will need to specify the exact machine type and CPU
|
||||
variant that is required to boot the Linux kernel (there's no way to
|
||||
know this except by looking at how the Linux kernel was configured).
|
||||
For example:
|
||||
|
||||
./configure \
|
||||
--with-qemu="qemu-system-arm" \
|
||||
--with-qemu-options="-M versatilepb -cpu arm926"
|
||||
./configure \
|
||||
--with-qemu="qemu-system-arm" \
|
||||
--with-qemu-options="-M vexpress-a9 -cpu cortex-a9"
|
||||
|
||||
Note that since virtio is required by libguestfs, and virtio is a
|
||||
PCI-based architecture, whatever architecture qemu emulates must
|
||||
support PCI also.
|
||||
|
||||
For PPC64 you will need to specify the IBM pSeries machine type:
|
||||
|
||||
./configure \
|
||||
--with-qemu="qemu-system-ppc64" \
|
||||
--with-qemu-options="-M pseries"
|
||||
|
||||
After building libguestfs, run 'make quickcheck' and pay close
|
||||
attention to the qemu command line and kernel output.
|
||||
|
||||
|
||||
Copyright and license information
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 2009-2012 Red Hat Inc.
|
||||
Copyright (C) 2009-2013 Red Hat Inc.
|
||||
|
||||
The library is distributed under the LGPLv2+. The programs are
|
||||
distributed under the GPLv2+. Please see the files COPYING and
|
||||
|
||||
12
ROADMAP
12
ROADMAP
@@ -12,19 +12,15 @@ Before you read this:
|
||||
|
||||
(4) For general "might be good to have" items, see 'TODO'.
|
||||
|
||||
For next major stable release (1.22)
|
||||
For next major stable release (1.26)
|
||||
------------------------------------
|
||||
|
||||
* Allow remote libvirt volumes to be accessed. This requires some
|
||||
enhancements to libvirt which have been agreed but not yet
|
||||
implemented.
|
||||
|
||||
Bugs assigned to 1.22 (put "1.22" in the Devel Whiteboard field in
|
||||
Bugs assigned to 1.26 (put "1.26" in the Devel Whiteboard field in
|
||||
Bugzilla):
|
||||
|
||||
https://bugzilla.redhat.com/buglist.cgi?query_format=advanced&field0-0-0=cf_devel_whiteboard&bug_status=NEW&bug_status=ASSIGNED&bug_status=MODIFIED&bug_status=ON_DEV&bug_status=ON_QA&bug_status=VERIFIED&bug_status=FAILS_QA&bug_status=RELEASE_PENDING&bug_status=POST&bug_status=PASSES_QA&type0-0-0=anywords&value0-0-0=1.22&component=libguestfs&product=Virtualization%20Tools
|
||||
https://bugzilla.redhat.com/buglist.cgi?query_format=advanced&field0-0-0=cf_devel_whiteboard&bug_status=NEW&bug_status=ASSIGNED&bug_status=MODIFIED&bug_status=ON_DEV&bug_status=ON_QA&bug_status=VERIFIED&bug_status=FAILS_QA&bug_status=RELEASE_PENDING&bug_status=POST&bug_status=PASSES_QA&type0-0-0=anywords&value0-0-0=1.26&component=libguestfs&product=Virtualization%20Tools
|
||||
|
||||
Beyond 1.22
|
||||
Beyond 1.26
|
||||
-----------
|
||||
|
||||
* Make 'guestfish --ro' be the default, and get users to use
|
||||
|
||||
167
TODO
167
TODO
@@ -95,10 +95,22 @@ two sides to a pty, and one has to be handled after the fork).
|
||||
work. qemu is implementing its own ptys, and they are broken. Need
|
||||
to fix qemu.]
|
||||
|
||||
Windows-based daemon/appliance
|
||||
------------------------------
|
||||
Port to Windows
|
||||
---------------
|
||||
|
||||
See discussion on list:
|
||||
"Port to Windows" means different things to different people.
|
||||
|
||||
The easiest is to port the library to Windows, but reuse the Linux
|
||||
appliance/daemon. This would allow people to use libguestfs on
|
||||
Windows hosts and link libguestfs to Windows programs. Doing this is
|
||||
just a matter of chugging through the code fixing portability issues,
|
||||
using gnulib as far as possible as the portability layer.
|
||||
|
||||
The hardest is probably a port of the daemon to Windows. The reason
|
||||
to do this is so that you can use the native NTFS drivers (in Windows)
|
||||
in order to edit Windows guests. Although back in 2009 we did some
|
||||
work on this, I am now dubious about the utility of this, since
|
||||
ntfs-3g works very well. See also discussion on list:
|
||||
https://www.redhat.com/archives/libguestfs/2009-November/msg00165.html
|
||||
|
||||
virt-disk-explore
|
||||
@@ -141,11 +153,8 @@ http://sourceforge.net/projects/aide/
|
||||
http://osiris.shmoo.com/
|
||||
http://sourceforge.net/projects/tripwire/
|
||||
|
||||
Freeze/thaw filesystems
|
||||
-----------------------
|
||||
|
||||
Access to these ioctls:
|
||||
http://git.kernel.org/linus/fcccf502540e3d7
|
||||
See also: virt-aide;
|
||||
https://rwmj.wordpress.com/2013/05/16/scanning-offline-guests-using-openscap-and-guestmount/#content
|
||||
|
||||
Tips for new users in guestfish
|
||||
-------------------------------
|
||||
@@ -198,7 +207,7 @@ There are some places where we call out to the 'blkid' program. This
|
||||
might be replaced by direct use of the library (if this is easier).
|
||||
|
||||
But it is very hard to be compatible between RHEL6 and RHEL5 when
|
||||
using direct library.
|
||||
using the library directly.
|
||||
|
||||
Visualization
|
||||
-------------
|
||||
@@ -361,14 +370,14 @@ Interactive disk creator
|
||||
|
||||
An interactive disk creator program.
|
||||
|
||||
Attach method for disconnected operation
|
||||
----------------------------------------
|
||||
Backend for disconnected operation
|
||||
----------------------------------
|
||||
|
||||
http://libguestfs.org/guestfs.3.html#guestfs_set_attach_method
|
||||
http://libguestfs.org/guestfs.3.html#guestfs_set_backend
|
||||
|
||||
"Librarian" has an idea that he should be able to attach to a regular
|
||||
appliance, but disconnect from it and reconnect to it later. This
|
||||
would be some sort of modified attach method (see link above).
|
||||
would be some sort of modified backend (see link above).
|
||||
|
||||
The complexity here is that we would no longer have access to
|
||||
stdin/stdout (or we'd have to direct that somewhere else).
|
||||
@@ -388,18 +397,12 @@ virt-sysprep ideas
|
||||
. run external guestfish script virt-sysprep --fish=/tmp/foo.fish
|
||||
- if drives are encrypted, then dm-crypt key should be changed
|
||||
and drives all re-encrypted
|
||||
- /etc/pki
|
||||
(Steve says ...)
|
||||
Rpm uses nss. Nss sets up its crypto database in
|
||||
/etc/pki. Depending on how long the machine ran before cloning, you
|
||||
may have picked up some certificates or things. This is an area
|
||||
that you would want to look into.
|
||||
- secure erase of inodes etc using scrub (Steve Grubb)
|
||||
- other directories that could require cleaning include:
|
||||
/var/run/*
|
||||
(thanks Marko Myllynen, James Antill)
|
||||
- remove or modify UUIDs in /etc/fstab (eg. on Ubuntu)
|
||||
(thanks Joshua Daniel Franklin)
|
||||
- fix the virt-sysprep fs-uuids plugin
|
||||
|
||||
- virt-sysprep should be able to zero-free space on the disks (a bit
|
||||
like virt-sparsify). This is a security measure to stop people
|
||||
trying to read the deleted files.
|
||||
|
||||
Kazuo Moriwaka adds:
|
||||
|
||||
@@ -423,16 +426,9 @@ customized with the organization logo etc. Some ideas:
|
||||
- change the sign-on messages (/etc/issue.net etc)
|
||||
- Windows login script/service
|
||||
|
||||
Launch remote sessions over ssh
|
||||
-------------------------------
|
||||
|
||||
We had an idea you could add a launch method that uses ssh, ie. all
|
||||
febootstrap and qemu commands happen the same as now, but prefixed by
|
||||
ssh so it happens on a remote machine.
|
||||
|
||||
Note that proper remote support and integration with libvirt is
|
||||
different from this, and people are working on that. ssh would just
|
||||
be "remote-lite".
|
||||
Note that virt-sysprep has gradually gained some of these features,
|
||||
eg. setting hostname, changing passwords. Since this precedent has
|
||||
now been set, it could do more of the same.
|
||||
|
||||
virt-make-fs and virt-win-reg need to not be in Perl
|
||||
----------------------------------------------------
|
||||
@@ -473,11 +469,6 @@ opened with O_CLOEXEC. Therefore we need to examine every call to:
|
||||
virt-sparsify enhancements
|
||||
--------------------------
|
||||
|
||||
TMPDIR should be checked to ensure that we won't run out of space
|
||||
during the conversion, since current behaviour is very bad when this
|
||||
happens (it usually causes virt-sparsify to hang). This requires
|
||||
writing a small C binding to statvfs for OCaml.
|
||||
|
||||
'virt-sparsify --whitelist' option to generate skeletons (for
|
||||
debugging, bug forensics, diagnosis). The whilelist option would
|
||||
specify a list of files to be *preserved*. All other files in the
|
||||
@@ -485,14 +476,6 @@ image would be replaced by equivalent files of zeroes, thus minimizing
|
||||
the size of the debug image that needs to be shipped to us by the
|
||||
customer.
|
||||
|
||||
Optimize the appliance
|
||||
----------------------
|
||||
|
||||
Pass -cpu host. Anything else?
|
||||
|
||||
[The libvirt attach-method uses 'host-model' which is basically
|
||||
the same as this]
|
||||
|
||||
Sort out partitioning
|
||||
---------------------
|
||||
|
||||
@@ -518,37 +501,6 @@ this approach works, it doesn't solve the MBR problem, so likely we'd
|
||||
have to write a library for that (or perhaps go back to sfdisk but
|
||||
using a very abstracted interface over sfdisk).
|
||||
|
||||
qemu caching
|
||||
------------
|
||||
|
||||
(Suggested by Paolo Bonzini and Kevin Wolf)
|
||||
|
||||
Measure the effect of cache=none, cache=directsync,
|
||||
cache=writethrough, cache=writeback.
|
||||
|
||||
It's doubtful that using cache=none is useful, since it disables the
|
||||
host cache making read-heavy workloads slower (they rely entirely on
|
||||
the smaller appliance kernel's cache). And in libguestfs we don't
|
||||
necessarily care about ongoing data integrity while writing, as long
|
||||
as data is reliably written out when g.sync, g.shutdown or g.close
|
||||
return. Also in libguestfs we effectively control the whole stack, so
|
||||
we can ensure write barriers happen when we want.
|
||||
|
||||
libvirt attach-method
|
||||
---------------------
|
||||
|
||||
Since libguestfs 1.19.24 this mostly works. Here are some suggested
|
||||
items to work on:
|
||||
|
||||
- SELinux labelling of guestfsd.sock, console.sock
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=842307
|
||||
Once this is fixed, remove <seclabel type=none> from libvirt XML
|
||||
|
||||
- Check feature parity between src/launch-appliance.c and
|
||||
src/launch-libvirt.c.
|
||||
|
||||
- Remote support. (This requires work on libvirt)
|
||||
|
||||
virt-sparsify should use discard
|
||||
--------------------------------
|
||||
|
||||
@@ -558,19 +510,14 @@ throughout the entire stack.
|
||||
Reimplement some APIs to avoid protocol limits
|
||||
----------------------------------------------
|
||||
|
||||
We should reimplement the following APIs to avoid protocol limits.
|
||||
These would be changed from daemon_functions to non_daemon_functions,
|
||||
with the non-daemon versions implemented using guestfs_upload and
|
||||
guestfs_download (and others). This change should be transparent from
|
||||
the p.o.v of the API and ABI.
|
||||
Mostly this item was done (eg. commits a69f44f56f and before). The
|
||||
most notable API with a protocol limit remaining is:
|
||||
|
||||
- guestfs_readdir
|
||||
|
||||
hivex
|
||||
-----
|
||||
|
||||
Add more of hivex to the API, especially for writing.
|
||||
|
||||
Reimplement virt-win-reg to use this API. (This is difficult because
|
||||
the Perl libraries underneath access the hivex API directly).
|
||||
|
||||
@@ -587,3 +534,53 @@ is very poorly designed and essentially impossible for us to use:
|
||||
|
||||
particularly if we also want to maintain backwards compatibility with
|
||||
Ruby 1.8, and/or maintain volatile VALUEs on the stack.
|
||||
|
||||
virt-builder
|
||||
------------
|
||||
|
||||
- set keyboard
|
||||
|
||||
- set default timezone and language
|
||||
|
||||
- set permissions on uploaded files & created directories
|
||||
|
||||
- how can we give users a shell for debugging purposes?
|
||||
|
||||
- allow non-xz-compressed templates (faster)
|
||||
|
||||
- let notes etc be localized, ie. notes[en]=...
|
||||
|
||||
- add a CLI option to print the in-built path/fingerprint(s)
|
||||
|
||||
- allow public keys to come from local file paths
|
||||
|
||||
- doing virt-builder then running (eg. via qemu, libvirt?) is common; is
|
||||
it possible to make this more automatic?
|
||||
|
||||
- more common code between virt-sysprep & virt-builder:
|
||||
|
||||
* virt-sysprep should have --run, --run-command,
|
||||
--firstboot-command options with common code from virt-builder
|
||||
|
||||
- document:
|
||||
|
||||
* how to integrate with ansible, puppet, chef
|
||||
* how to import to OpenStack / Glance
|
||||
* how to import to EC2
|
||||
|
||||
- /etc/resolv.conf handling works but is best described as a hack:
|
||||
https://github.com/libguestfs/libguestfs/commit/9521422ce60578f7196cc8b7977d998159238c19
|
||||
|
||||
- let's make UML work
|
||||
+ SLIRP is insecure, but we could allow just a bare web proxy which
|
||||
gets proxied over virtio-serial to the outside world (except
|
||||
virtio-serial can't be multiplexed)
|
||||
|
||||
- sometimes (not always) aug_init takes ages, why?
|
||||
|
||||
Midnight Commander (mc) extension
|
||||
---------------------------------
|
||||
|
||||
Write an extension for mc that would let people browse into
|
||||
filesystems. See
|
||||
http://repo.or.cz/w/midnight-commander.git/tree/HEAD:/misc/ext.d
|
||||
|
||||
@@ -19,6 +19,7 @@ include $(top_srcdir)/subdir-rules.mk
|
||||
|
||||
EXTRA_DIST = \
|
||||
test-virt-alignment-scan.sh \
|
||||
test-virt-alignment-scan-guests.sh \
|
||||
virt-alignment-scan.pod
|
||||
|
||||
CLEANFILES = stamp-virt-alignment-scan.pod
|
||||
@@ -26,35 +27,49 @@ CLEANFILES = stamp-virt-alignment-scan.pod
|
||||
bin_PROGRAMS = virt-alignment-scan
|
||||
|
||||
SHARED_SOURCE_FILES = \
|
||||
../df/domains.c \
|
||||
../df/domains.h \
|
||||
../df/estimate-max-threads.c \
|
||||
../df/estimate-max-threads.h \
|
||||
../df/parallel.c \
|
||||
../df/parallel.h \
|
||||
../fish/config.c \
|
||||
../fish/domain.c \
|
||||
../fish/inspect.c \
|
||||
../fish/keys.c \
|
||||
../fish/options.h \
|
||||
../fish/options.c
|
||||
../fish/options.c \
|
||||
../fish/uri.h \
|
||||
../fish/uri.c
|
||||
|
||||
virt_alignment_scan_SOURCES = \
|
||||
$(SHARED_SOURCE_FILES) \
|
||||
domains.c \
|
||||
scan.c \
|
||||
scan.h
|
||||
scan.c
|
||||
|
||||
virt_alignment_scan_CFLAGS = \
|
||||
virt_alignment_scan_CPPFLAGS = \
|
||||
-DGUESTFS_WARN_DEPRECATED=1 \
|
||||
-DGUESTFS_PRIVATE=1 \
|
||||
-I$(top_srcdir)/src -I$(top_builddir)/src \
|
||||
-I$(top_srcdir)/df \
|
||||
-I$(top_srcdir)/fish \
|
||||
-I$(srcdir)/../gnulib/lib -I../gnulib/lib \
|
||||
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
|
||||
-DLOCALEBASEDIR=\""$(datadir)/locale"\"
|
||||
|
||||
virt_alignment_scan_CFLAGS = \
|
||||
-pthread \
|
||||
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
|
||||
$(GPROF_CFLAGS) $(GCOV_CFLAGS) \
|
||||
$(LIBCONFIG_CFLAGS) \
|
||||
$(LIBXML2_CFLAGS) \
|
||||
$(LIBVIRT_CFLAGS)
|
||||
|
||||
virt_alignment_scan_LDADD = \
|
||||
$(LIBCONFIG_LIBS) \
|
||||
$(top_builddir)/src/libutils.la \
|
||||
$(top_builddir)/src/libguestfs.la \
|
||||
../gnulib/lib/libgnu.la \
|
||||
$(LIBXML2_LIBS) \
|
||||
$(LIBVIRT_LIBS) \
|
||||
../gnulib/lib/libgnu.la \
|
||||
-lm
|
||||
|
||||
# Manual pages and HTML files for the website.
|
||||
@@ -79,7 +94,8 @@ TESTS =
|
||||
|
||||
if ENABLE_APPLIANCE
|
||||
TESTS += \
|
||||
test-virt-alignment-scan.sh
|
||||
test-virt-alignment-scan.sh \
|
||||
test-virt-alignment-scan-guests.sh
|
||||
endif
|
||||
|
||||
check-valgrind:
|
||||
|
||||
359
align/domains.c
359
align/domains.c
@@ -1,359 +0,0 @@
|
||||
/* virt-alignment-scan
|
||||
* Copyright (C) 2012 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <libintl.h>
|
||||
|
||||
#ifdef HAVE_LIBVIRT
|
||||
#include <libvirt/libvirt.h>
|
||||
#include <libvirt/virterror.h>
|
||||
#endif
|
||||
|
||||
#include "progname.h"
|
||||
|
||||
#if defined(HAVE_LIBVIRT) && defined(HAVE_LIBXML2)
|
||||
#define GUESTFS_PRIVATE_FOR_EACH_DISK 1
|
||||
#endif
|
||||
|
||||
#include "guestfs.h"
|
||||
#include "options.h"
|
||||
#include "scan.h"
|
||||
|
||||
#if defined(HAVE_LIBVIRT) && defined(HAVE_LIBXML2)
|
||||
|
||||
/* The list of domains and disks that we build up in
|
||||
* get_domains_from_libvirt.
|
||||
*/
|
||||
struct disk {
|
||||
struct disk *next;
|
||||
char *filename;
|
||||
char *format; /* could be NULL */
|
||||
};
|
||||
|
||||
struct domain {
|
||||
char *name;
|
||||
char *uuid;
|
||||
struct disk *disks;
|
||||
size_t nr_disks;
|
||||
};
|
||||
|
||||
struct domain *domains = NULL;
|
||||
size_t nr_domains;
|
||||
|
||||
static int
|
||||
compare_domain_names (const void *p1, const void *p2)
|
||||
{
|
||||
const struct domain *d1 = p1;
|
||||
const struct domain *d2 = p2;
|
||||
|
||||
return strcmp (d1->name, d2->name);
|
||||
}
|
||||
|
||||
static void
|
||||
free_domain (struct domain *domain)
|
||||
{
|
||||
struct disk *disk, *next;
|
||||
|
||||
for (disk = domain->disks; disk; disk = next) {
|
||||
next = disk->next;
|
||||
free (disk->filename);
|
||||
free (disk->format);
|
||||
free (disk);
|
||||
}
|
||||
|
||||
free (domain->name);
|
||||
free (domain->uuid);
|
||||
}
|
||||
|
||||
static void add_domains_by_id (virConnectPtr conn, int *ids, size_t n);
|
||||
static void add_domains_by_name (virConnectPtr conn, char **names, size_t n);
|
||||
static void add_domain (virDomainPtr dom);
|
||||
static int add_disk (guestfs_h *g, const char *filename, const char *format, int readonly, void *domain_vp);
|
||||
static size_t add_disks_to_handle_reverse (struct disk *disk, size_t *errors_r);
|
||||
static void reset_guestfs_handle (void);
|
||||
|
||||
void
|
||||
get_domains_from_libvirt (int uuid, size_t *worst_alignment_ptr)
|
||||
{
|
||||
virErrorPtr err;
|
||||
virConnectPtr conn;
|
||||
int n;
|
||||
size_t i, count, errors;
|
||||
const char *prefix;
|
||||
|
||||
nr_domains = 0;
|
||||
domains = NULL;
|
||||
|
||||
/* Get the list of all domains. */
|
||||
conn = virConnectOpenReadOnly (libvirt_uri);
|
||||
if (!conn) {
|
||||
err = virGetLastError ();
|
||||
fprintf (stderr,
|
||||
_("%s: could not connect to libvirt (code %d, domain %d): %s\n"),
|
||||
program_name, err->code, err->domain, err->message);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
n = virConnectNumOfDomains (conn);
|
||||
if (n == -1) {
|
||||
err = virGetLastError ();
|
||||
fprintf (stderr,
|
||||
_("%s: could not get number of running domains (code %d, domain %d): %s\n"),
|
||||
program_name, err->code, err->domain, err->message);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int ids[n];
|
||||
n = virConnectListDomains (conn, ids, n);
|
||||
if (n == -1) {
|
||||
err = virGetLastError ();
|
||||
fprintf (stderr,
|
||||
_("%s: could not list running domains (code %d, domain %d): %s\n"),
|
||||
program_name, err->code, err->domain, err->message);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
add_domains_by_id (conn, ids, n);
|
||||
|
||||
n = virConnectNumOfDefinedDomains (conn);
|
||||
if (n == -1) {
|
||||
err = virGetLastError ();
|
||||
fprintf (stderr,
|
||||
_("%s: could not get number of inactive domains (code %d, domain %d): %s\n"),
|
||||
program_name, err->code, err->domain, err->message);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
char *names[n];
|
||||
n = virConnectListDefinedDomains (conn, names, n);
|
||||
if (n == -1) {
|
||||
err = virGetLastError ();
|
||||
fprintf (stderr,
|
||||
_("%s: could not list inactive domains (code %d, domain %d): %s\n"),
|
||||
program_name, err->code, err->domain, err->message);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
add_domains_by_name (conn, names, n);
|
||||
|
||||
/* You must free these even though the libvirt documentation doesn't
|
||||
* mention it.
|
||||
*/
|
||||
for (i = 0; i < (size_t) n; ++i)
|
||||
free (names[i]);
|
||||
|
||||
virConnectClose (conn);
|
||||
|
||||
/* No domains? */
|
||||
if (nr_domains == 0)
|
||||
return;
|
||||
|
||||
/* Sort the domains alphabetically by name for display. */
|
||||
qsort (domains, nr_domains, sizeof (struct domain), compare_domain_names);
|
||||
|
||||
errors = 0;
|
||||
for (i = 0; i < nr_domains; ++i) {
|
||||
if (domains[i].disks == NULL)
|
||||
continue;
|
||||
|
||||
count = add_disks_to_handle_reverse (domains[i].disks, &errors);
|
||||
if (count == 0)
|
||||
continue;
|
||||
|
||||
if (guestfs_launch (g) == -1)
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
prefix = !uuid ? domains[i].name : domains[i].uuid;
|
||||
|
||||
/* Perform the scan. */
|
||||
scan (worst_alignment_ptr, prefix);
|
||||
|
||||
if (i < nr_domains - 1)
|
||||
reset_guestfs_handle ();
|
||||
}
|
||||
|
||||
/* Free up domains structure. */
|
||||
for (i = 0; i < nr_domains; ++i)
|
||||
free_domain (&domains[i]);
|
||||
free (domains);
|
||||
|
||||
if (errors > 0) {
|
||||
fprintf (stderr, _("%s: failed to analyze a disk, see error(s) above\n"),
|
||||
program_name);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
add_domains_by_id (virConnectPtr conn, int *ids, size_t n)
|
||||
{
|
||||
size_t i;
|
||||
virDomainPtr dom;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
if (ids[i] != 0) { /* RHBZ#538041 */
|
||||
dom = virDomainLookupByID (conn, ids[i]);
|
||||
if (dom) { /* transient errors are possible here, ignore them */
|
||||
add_domain (dom);
|
||||
virDomainFree (dom);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
add_domains_by_name (virConnectPtr conn, char **names, size_t n)
|
||||
{
|
||||
size_t i;
|
||||
virDomainPtr dom;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
dom = virDomainLookupByName (conn, names[i]);
|
||||
if (dom) { /* transient errors are possible here, ignore them */
|
||||
add_domain (dom);
|
||||
virDomainFree (dom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
add_domain (virDomainPtr dom)
|
||||
{
|
||||
struct domain *domain;
|
||||
|
||||
domains = realloc (domains, (nr_domains + 1) * sizeof (struct domain));
|
||||
if (domains == NULL) {
|
||||
perror ("realloc");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
domain = &domains[nr_domains];
|
||||
nr_domains++;
|
||||
|
||||
domain->name = strdup (virDomainGetName (dom));
|
||||
if (domain->name == NULL) {
|
||||
perror ("strdup");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
char uuid[VIR_UUID_STRING_BUFLEN];
|
||||
if (virDomainGetUUIDString (dom, uuid) == 0) {
|
||||
domain->uuid = strdup (uuid);
|
||||
if (domain->uuid == NULL) {
|
||||
perror ("strdup");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
else
|
||||
domain->uuid = NULL;
|
||||
|
||||
domain->disks = NULL;
|
||||
int n = guestfs___for_each_disk (g, dom, add_disk, domain);
|
||||
if (n == -1)
|
||||
exit (EXIT_FAILURE);
|
||||
domain->nr_disks = n;
|
||||
}
|
||||
|
||||
static int
|
||||
add_disk (guestfs_h *g,
|
||||
const char *filename, const char *format, int readonly,
|
||||
void *domain_vp)
|
||||
{
|
||||
struct domain *domain = domain_vp;
|
||||
struct disk *disk;
|
||||
|
||||
disk = malloc (sizeof *disk);
|
||||
if (disk == NULL) {
|
||||
perror ("malloc");
|
||||
return -1;
|
||||
}
|
||||
|
||||
disk->next = domain->disks;
|
||||
domain->disks = disk;
|
||||
|
||||
disk->filename = strdup (filename);
|
||||
if (disk->filename == NULL) {
|
||||
perror ("malloc");
|
||||
return -1;
|
||||
}
|
||||
if (format) {
|
||||
disk->format = strdup (format);
|
||||
if (disk->format == NULL) {
|
||||
perror ("malloc");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
disk->format = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static size_t
|
||||
add_disks_to_handle_reverse (struct disk *disk, size_t *errors_r)
|
||||
{
|
||||
size_t nr_disks_added;
|
||||
|
||||
if (disk == NULL)
|
||||
return 0;
|
||||
|
||||
nr_disks_added = add_disks_to_handle_reverse (disk->next, errors_r);
|
||||
|
||||
struct guestfs_add_drive_opts_argv optargs = { .bitmask = 0 };
|
||||
|
||||
optargs.bitmask |= GUESTFS_ADD_DRIVE_OPTS_READONLY_BITMASK;
|
||||
optargs.readonly = 1;
|
||||
|
||||
if (disk->format) {
|
||||
optargs.bitmask |= GUESTFS_ADD_DRIVE_OPTS_FORMAT_BITMASK;
|
||||
optargs.format = disk->format;
|
||||
}
|
||||
|
||||
if (guestfs_add_drive_opts_argv (g, disk->filename, &optargs) == -1) {
|
||||
(*errors_r)++;
|
||||
return nr_disks_added;
|
||||
}
|
||||
|
||||
return nr_disks_added+1;
|
||||
}
|
||||
|
||||
/* Close and reopen the libguestfs handle. */
|
||||
static void
|
||||
reset_guestfs_handle (void)
|
||||
{
|
||||
/* Copy the settings from the old handle. */
|
||||
int verbose = guestfs_get_verbose (g);
|
||||
int trace = guestfs_get_trace (g);
|
||||
|
||||
guestfs_close (g);
|
||||
|
||||
g = guestfs_create ();
|
||||
if (g == NULL) {
|
||||
fprintf (stderr, _("guestfs_create: failed to create handle\n"));
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
guestfs_set_verbose (g, verbose);
|
||||
guestfs_set_trace (g, trace);
|
||||
}
|
||||
|
||||
#endif
|
||||
160
align/scan.c
160
align/scan.c
@@ -25,20 +25,32 @@
|
||||
#include <inttypes.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include <errno.h>
|
||||
#include <locale.h>
|
||||
#include <assert.h>
|
||||
#include <libintl.h>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#ifdef HAVE_LIBVIRT
|
||||
#include <libvirt/libvirt.h>
|
||||
#include <libvirt/virterror.h>
|
||||
#endif
|
||||
|
||||
#include "progname.h"
|
||||
|
||||
#include "guestfs.h"
|
||||
#include "options.h"
|
||||
#include "scan.h"
|
||||
#include "parallel.h"
|
||||
#include "domains.h"
|
||||
|
||||
/* This just needs to be larger than any alignment we care about. */
|
||||
static size_t worst_alignment = UINT_MAX;
|
||||
static pthread_mutex_t worst_alignment_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
static int scan (guestfs_h *g, const char *prefix, FILE *fp);
|
||||
|
||||
#ifdef HAVE_LIBVIRT
|
||||
static int scan_work (guestfs_h *g, size_t i, FILE *fp);
|
||||
#endif
|
||||
|
||||
/* These globals are shared with options.c. */
|
||||
guestfs_h *g;
|
||||
@@ -52,12 +64,7 @@ const char *libvirt_uri = NULL;
|
||||
int inspector = 0;
|
||||
|
||||
static int quiet = 0; /* --quiet */
|
||||
|
||||
static inline char *
|
||||
bad_cast (char const *s)
|
||||
{
|
||||
return (char *) s;
|
||||
}
|
||||
static int uuid = 0; /* --uuid */
|
||||
|
||||
static void __attribute__((noreturn))
|
||||
usage (int status)
|
||||
@@ -78,6 +85,7 @@ usage (int status)
|
||||
" -d|--domain guest Add disks from libvirt guest\n"
|
||||
" --format[=raw|..] Force disk format for -a option\n"
|
||||
" --help Display brief help\n"
|
||||
" -P nr_threads Use at most nr_threads\n"
|
||||
" -q|--quiet No output, just exit code\n"
|
||||
" -v|--verbose Verbose messages\n"
|
||||
" -V|--version Display version and exit\n"
|
||||
@@ -92,22 +100,20 @@ usage (int status)
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
/* Set global program name that is not polluted with libtool artifacts. */
|
||||
set_program_name (argv[0]);
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEBASEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
enum { HELP_OPTION = CHAR_MAX + 1 };
|
||||
|
||||
static const char *options = "a:c:d:qvVx";
|
||||
static const char *options = "a:c:d:P:qvVx";
|
||||
static const struct option long_options[] = {
|
||||
{ "add", 1, 0, 'a' },
|
||||
{ "connect", 1, 0, 'c' },
|
||||
{ "domain", 1, 0, 'd' },
|
||||
{ "format", 2, 0, 0 },
|
||||
{ "help", 0, 0, HELP_OPTION },
|
||||
{ "long-options", 0, 0, 0 },
|
||||
{ "quiet", 0, 0, 'q' },
|
||||
{ "uuid", 0, 0, 0, },
|
||||
{ "verbose", 0, 0, 'v' },
|
||||
@@ -119,10 +125,9 @@ main (int argc, char *argv[])
|
||||
const char *format = NULL;
|
||||
int c;
|
||||
int option_index;
|
||||
int uuid = 0;
|
||||
/* This just needs to be larger than any alignment we care about. */
|
||||
size_t worst_alignment = UINT_MAX;
|
||||
int exit_code;
|
||||
size_t max_threads = 0;
|
||||
int r;
|
||||
|
||||
g = guestfs_create ();
|
||||
if (g == NULL) {
|
||||
@@ -130,15 +135,15 @@ main (int argc, char *argv[])
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
argv[0] = bad_cast (program_name);
|
||||
|
||||
for (;;) {
|
||||
c = getopt_long (argc, argv, options, long_options, &option_index);
|
||||
if (c == -1) break;
|
||||
|
||||
switch (c) {
|
||||
case 0: /* options which are long only */
|
||||
if (STREQ (long_options[option_index].name, "format")) {
|
||||
if (STREQ (long_options[option_index].name, "long-options"))
|
||||
display_long_options (long_options);
|
||||
else if (STREQ (long_options[option_index].name, "format")) {
|
||||
if (!optarg || STREQ (optarg, ""))
|
||||
format = NULL;
|
||||
else
|
||||
@@ -164,6 +169,13 @@ main (int argc, char *argv[])
|
||||
OPTION_d;
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
if (sscanf (optarg, "%zu", &max_threads) != 1) {
|
||||
fprintf (stderr, _("%s: -P option is not numeric\n"), program_name);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
quiet = 1;
|
||||
break;
|
||||
@@ -200,16 +212,25 @@ main (int argc, char *argv[])
|
||||
if (optind != argc)
|
||||
usage (EXIT_FAILURE);
|
||||
|
||||
/* The user didn't specify any drives to scan. */
|
||||
/* virt-alignment-scan has two modes. If the user didn't specify
|
||||
* any drives, then we do the scan on every libvirt guest. That's
|
||||
* the if-clause below. If the user specified domains/drives, then
|
||||
* we assume they belong to a single guest. That's the else-clause
|
||||
* below.
|
||||
*/
|
||||
if (drvs == NULL) {
|
||||
#if defined(HAVE_LIBVIRT) && defined(HAVE_LIBXML2)
|
||||
get_domains_from_libvirt (uuid, &worst_alignment);
|
||||
#if defined(HAVE_LIBVIRT)
|
||||
get_all_libvirt_domains (libvirt_uri);
|
||||
r = start_threads (max_threads, g, scan_work);
|
||||
free_domains ();
|
||||
if (r == -1)
|
||||
exit (EXIT_FAILURE);
|
||||
#else
|
||||
fprintf (stderr, _("%s: compiled without support for libvirt and/or libxml2.\n"),
|
||||
fprintf (stderr, _("%s: compiled without support for libvirt.\n"),
|
||||
program_name);
|
||||
exit (EXIT_FAILURE);
|
||||
#endif
|
||||
} else {
|
||||
} else { /* Single guest. */
|
||||
if (uuid) {
|
||||
fprintf (stderr, _("%s: --uuid option cannot be used with -a or -d\n"),
|
||||
program_name);
|
||||
@@ -226,9 +247,12 @@ main (int argc, char *argv[])
|
||||
free_drives (drvs);
|
||||
|
||||
/* Perform the scan. */
|
||||
scan (&worst_alignment, NULL);
|
||||
r = scan (g, NULL, stdout);
|
||||
|
||||
guestfs_close (g);
|
||||
|
||||
if (r == -1)
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Decide on an appropriate exit code. */
|
||||
@@ -242,30 +266,30 @@ main (int argc, char *argv[])
|
||||
exit (exit_code);
|
||||
}
|
||||
|
||||
void
|
||||
scan (size_t *worst_alignment, const char *prefix)
|
||||
static int
|
||||
scan (guestfs_h *g, const char *prefix, FILE *fp)
|
||||
{
|
||||
char **devices, *p;
|
||||
size_t i, j;
|
||||
size_t alignment;
|
||||
uint64_t start;
|
||||
struct guestfs_partition_list *parts;
|
||||
int err;
|
||||
|
||||
devices = guestfs_list_devices (g);
|
||||
CLEANUP_FREE_STRING_LIST char **devices = guestfs_list_devices (g);
|
||||
if (devices == NULL)
|
||||
exit (EXIT_FAILURE);
|
||||
return -1;
|
||||
|
||||
for (i = 0; devices[i] != NULL; ++i) {
|
||||
parts = guestfs_part_list (g, devices[i]);
|
||||
CLEANUP_FREE char *name = NULL;
|
||||
|
||||
CLEANUP_FREE_PARTITION_LIST struct guestfs_partition_list *parts =
|
||||
guestfs_part_list (g, devices[i]);
|
||||
if (parts == NULL)
|
||||
exit (EXIT_FAILURE);
|
||||
return -1;
|
||||
|
||||
/* Canonicalize the name of the device for printing. */
|
||||
p = guestfs_canonical_device_name (g, devices[i]);
|
||||
if (p == NULL)
|
||||
exit (EXIT_FAILURE);
|
||||
free (devices[i]);
|
||||
devices[i] = p;
|
||||
name = guestfs_canonical_device_name (g, devices[i]);
|
||||
if (name == NULL)
|
||||
return -1;
|
||||
|
||||
for (j = 0; j < parts->len; ++j) {
|
||||
/* Start offset of the partition in bytes. */
|
||||
@@ -273,10 +297,10 @@ scan (size_t *worst_alignment, const char *prefix)
|
||||
|
||||
if (!quiet) {
|
||||
if (prefix)
|
||||
printf ("%s:", prefix);
|
||||
fprintf (fp, "%s:", prefix);
|
||||
|
||||
printf ("%s%d %12" PRIu64 " ",
|
||||
devices[i], (int) parts->val[j].part_num, start);
|
||||
fprintf (fp, "%s%d %12" PRIu64 " ",
|
||||
name, (int) parts->val[j].part_num, start);
|
||||
}
|
||||
|
||||
/* What's the alignment? */
|
||||
@@ -288,30 +312,60 @@ scan (size_t *worst_alignment, const char *prefix)
|
||||
|
||||
if (!quiet) {
|
||||
if (alignment < 10)
|
||||
printf ("%12" PRIu64 " ", UINT64_C(1) << alignment);
|
||||
fprintf (fp, "%12" PRIu64 " ", UINT64_C(1) << alignment);
|
||||
else if (alignment < 64)
|
||||
printf ("%12" PRIu64 "K ", UINT64_C(1) << (alignment - 10));
|
||||
fprintf (fp, "%12" PRIu64 "K ", UINT64_C(1) << (alignment - 10));
|
||||
else
|
||||
printf ("- ");
|
||||
fprintf (fp, "- ");
|
||||
}
|
||||
|
||||
if (alignment < *worst_alignment)
|
||||
*worst_alignment = alignment;
|
||||
err = pthread_mutex_lock (&worst_alignment_mutex);
|
||||
assert (err == 0);
|
||||
if (alignment < worst_alignment)
|
||||
worst_alignment = alignment;
|
||||
err = pthread_mutex_unlock (&worst_alignment_mutex);
|
||||
assert (err == 0);
|
||||
|
||||
if (alignment < 12) { /* Bad in general: < 4K alignment */
|
||||
if (!quiet)
|
||||
printf ("bad (%s)\n", _("alignment < 4K"));
|
||||
fprintf (fp, "bad (%s)\n", _("alignment < 4K"));
|
||||
} else if (alignment < 16) { /* Bad on NetApps: < 64K alignment */
|
||||
if (!quiet)
|
||||
printf ("bad (%s)\n", _("alignment < 64K"));
|
||||
fprintf (fp, "bad (%s)\n", _("alignment < 64K"));
|
||||
} else {
|
||||
if (!quiet)
|
||||
printf ("ok\n");
|
||||
fprintf (fp, "ok\n");
|
||||
}
|
||||
}
|
||||
|
||||
guestfs_free_partition_list (parts);
|
||||
free (devices[i]);
|
||||
}
|
||||
free (devices);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(HAVE_LIBVIRT)
|
||||
|
||||
/* The multi-threaded version. This callback is called from the code
|
||||
* in "parallel.c".
|
||||
*/
|
||||
|
||||
static int
|
||||
scan_work (guestfs_h *g, size_t i, FILE *fp)
|
||||
{
|
||||
struct guestfs___add_libvirt_dom_argv optargs;
|
||||
|
||||
optargs.bitmask =
|
||||
GUESTFS___ADD_LIBVIRT_DOM_READONLY_BITMASK |
|
||||
GUESTFS___ADD_LIBVIRT_DOM_READONLYDISK_BITMASK;
|
||||
optargs.readonly = 1;
|
||||
optargs.readonlydisk = "read";
|
||||
|
||||
if (guestfs___add_libvirt_dom (g, domains[i].dom, &optargs) == -1)
|
||||
return -1;
|
||||
|
||||
if (guestfs_launch (g) == -1)
|
||||
return -1;
|
||||
|
||||
return scan (g, !uuid ? domains[i].name : domains[i].uuid, fp);
|
||||
}
|
||||
|
||||
#endif /* HAVE_LIBVIRT */
|
||||
|
||||
35
align/test-virt-alignment-scan-guests.sh
Executable file
35
align/test-virt-alignment-scan-guests.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash -
|
||||
# libguestfs
|
||||
# Copyright (C) 2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
export LANG=C
|
||||
|
||||
if [ -n "$SKIP_TEST_VIRT_ALIGNMENT_SCAN_GUESTS_SH" ]; then
|
||||
echo "$0: skipping test because SKIP_TEST_VIRT_ALIGNMENT_SCAN_GUESTS_SH is set."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
guestsdir="$(cd ../tests/guests && pwd)"
|
||||
libvirt_uri="test://$guestsdir/guests-all-good.xml"
|
||||
|
||||
$VG ./virt-alignment-scan -c "$libvirt_uri"
|
||||
r=$?
|
||||
|
||||
# 0, 2 and 3 are reasonable non-error exit codes. Others are errors.
|
||||
if [ $r -ne 0 -a $r -ne 2 -a $r -ne 3 ]; then
|
||||
exit $r
|
||||
fi
|
||||
@@ -16,6 +16,8 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
export LANG=C
|
||||
|
||||
$VG ./virt-alignment-scan -a ../tests/guests/fedora.img
|
||||
r=$?
|
||||
|
||||
|
||||
@@ -117,6 +117,12 @@ Add I<file> which should be a disk image from a virtual machine.
|
||||
The format of the disk image is auto-detected. To override this and
|
||||
force a particular format use the I<--format=..> option.
|
||||
|
||||
=item B<-a URI>
|
||||
|
||||
=item B<--add URI>
|
||||
|
||||
Add a remote disk. See L<guestfish(1)/ADDING REMOTE STORAGE>.
|
||||
|
||||
=item B<-c> URI
|
||||
|
||||
=item B<--connect> URI
|
||||
@@ -158,6 +164,18 @@ If you have untrusted raw-format guest disk images, you should use
|
||||
this option to specify the disk format. This avoids a possible
|
||||
security problem with malicious guests (CVE-2010-3851).
|
||||
|
||||
=item B<-P> nr_threads
|
||||
|
||||
Since libguestfs 1.22, virt-alignment-scan is multithreaded and
|
||||
examines guests in parallel. By default the number of threads to use
|
||||
is chosen based on the amount of free memory available at the time
|
||||
that virt-alignment-scan is started. You can force
|
||||
virt-alignment-scan to use at most C<nr_threads> by using the I<-P>
|
||||
option.
|
||||
|
||||
Note that I<-P 0> means to autodetect, and I<-P 1> means to use a
|
||||
single thread.
|
||||
|
||||
=item B<-q>
|
||||
|
||||
=item B<--quiet>
|
||||
|
||||
@@ -15,9 +15,6 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
# Old RHEL 5 autoconf doesn't have builddir.
|
||||
builddir ?= .
|
||||
|
||||
include $(top_srcdir)/subdir-rules.mk
|
||||
|
||||
EXTRA_DIST = \
|
||||
@@ -35,15 +32,27 @@ superminfsdir = $(libdir)/guestfs/supermin.d
|
||||
|
||||
fs_DATA =
|
||||
superminfs_DATA = \
|
||||
supermin.d/base.img \
|
||||
supermin.d/daemon.img \
|
||||
supermin.d/init.img \
|
||||
supermin.d/hostfiles \
|
||||
supermin.d/udev-rules.img
|
||||
|
||||
# This used to be a configure-generated file (as is update.sh still).
|
||||
# However config.status always touches the destination file, which
|
||||
# means the appliance got rebuilt too often.
|
||||
if SUPERMIN_HELPER_COMPRESSED_CPIO
|
||||
GZ = .gz
|
||||
endif
|
||||
|
||||
if ENABLE_DAEMON
|
||||
superminfs_DATA += \
|
||||
supermin.d/daemon.img$(GZ)
|
||||
endif
|
||||
|
||||
if ENABLE_APPLIANCE
|
||||
superminfs_DATA += \
|
||||
supermin.d/base.img$(GZ) \
|
||||
supermin.d/hostfiles
|
||||
endif
|
||||
|
||||
# This used to be a configure-generated file. However config.status
|
||||
# always touches the destination file, which means the appliance got
|
||||
# rebuilt too often.
|
||||
make.sh: make.sh.in $(top_builddir)/config.log $(top_builddir)/config.status
|
||||
cd $(top_builddir) && \
|
||||
./config.status --file=appliance/$@-t:appliance/$<
|
||||
@@ -51,7 +60,7 @@ make.sh: make.sh.in $(top_builddir)/config.log $(top_builddir)/config.status
|
||||
cmp -s $@ $@-t || mv $@-t $@
|
||||
rm -f $@-t
|
||||
|
||||
PACKAGELIST_CPP_FLAGS = -D$(DISTRO)=1
|
||||
PACKAGELIST_CPP_FLAGS = -D$(DISTRO)=1 -DEXTRA_PACKAGES="$(EXTRA_PACKAGES)"
|
||||
if VALGRIND_DAEMON
|
||||
PACKAGELIST_CPP_FLAGS += -DVALGRIND_DAEMON=1
|
||||
endif
|
||||
@@ -68,41 +77,46 @@ excludelist: excludelist.in Makefile
|
||||
cmp -s $@ $@-t || mv $@-t $@
|
||||
rm -f $@-t
|
||||
|
||||
supermin.d/base.img supermin.d/hostfiles: stamp-supermin
|
||||
supermin.d/base.img$(GZ) supermin.d/hostfiles: stamp-supermin
|
||||
stamp-supermin: make.sh packagelist excludelist
|
||||
mkdir -p supermin.d
|
||||
rm -f $@ supermin.d/base.img supermin.d/hostfiles
|
||||
rm -f $@ supermin.d/base.img$(GZ) supermin.d/hostfiles
|
||||
./make.sh
|
||||
if SUPERMIN_HELPER_COMPRESSED_CPIO
|
||||
gzip -9 supermin.d/base.img
|
||||
endif
|
||||
touch $@
|
||||
|
||||
supermin.d/daemon.img: ../daemon/guestfsd guestfsd.suppressions
|
||||
mkdir -p supermin.d
|
||||
rm -f $@ $@-t
|
||||
supermin.d/daemon.img$(GZ): ../daemon/guestfsd guestfsd.suppressions
|
||||
rm -f $@ $@-t $@-tt
|
||||
rm -rf tmp-d
|
||||
mkdir -p tmp-d$(DAEMON_SUPERMIN_DIR) tmp-d/etc
|
||||
ln ../daemon/guestfsd tmp-d$(DAEMON_SUPERMIN_DIR)/guestfsd
|
||||
ln $(srcdir)/guestfsd.suppressions tmp-d/etc/guestfsd.suppressions
|
||||
( cd tmp-d && find | cpio --quiet -o -H newc ) > $@-t
|
||||
rm -rf tmp-d
|
||||
rm -r tmp-d
|
||||
if SUPERMIN_HELPER_COMPRESSED_CPIO
|
||||
gzip -9 -c $@-t > $@-tt
|
||||
mv $@-tt $@-t
|
||||
endif
|
||||
mv $@-t $@
|
||||
|
||||
supermin.d/init.img: init
|
||||
cmp -s $(srcdir)/init $(builddir)/init || cp $(srcdir)/init $(builddir)/init
|
||||
mkdir -p supermin.d
|
||||
rm -f $@ $@-t
|
||||
echo "init" | cpio --quiet -o -H newc > $@-t
|
||||
rm -rf init.tmp $@ $@-t
|
||||
mkdir init.tmp
|
||||
cp $< init.tmp
|
||||
(cd init.tmp; echo "init" | cpio --quiet -o -H newc) > $@-t
|
||||
rm -r init.tmp
|
||||
mv $@-t $@
|
||||
|
||||
# We should put this file in /lib/udev/rules.d, but put it in /etc so
|
||||
# we don't have to deal with all the UsrMove crap in Fedora.
|
||||
supermin.d/udev-rules.img: 99-guestfs-serial.rules
|
||||
mkdir -p supermin.d
|
||||
rm -f $@ $@-t
|
||||
rm -rf tmp-u
|
||||
mkdir -p tmp-u/etc/udev/rules.d
|
||||
for f in $^; do ln $$f tmp-u/etc/udev/rules.d/$$f; done
|
||||
for f in $^; do ln $$f tmp-u/etc/udev/rules.d/$$(basename $$f); done
|
||||
( cd tmp-u && find | cpio --quiet -o -H newc ) > $@-t
|
||||
rm -rf tmp-u
|
||||
rm -r tmp-u
|
||||
mv $@-t $@
|
||||
|
||||
# If installing the daemon, install the udev rules too.
|
||||
@@ -132,7 +146,5 @@ stamp-libguestfs-make-fixed-appliance.pod: libguestfs-make-fixed-appliance.pod
|
||||
|
||||
CLEANFILES = packagelist excludelist \
|
||||
libguestfs-make-fixed-appliance.1 \
|
||||
stamp-libguestfs-make-fixed-appliance.pod
|
||||
|
||||
clean-local:
|
||||
rm -rf supermin.d
|
||||
stamp-libguestfs-make-fixed-appliance.pod \
|
||||
supermin.d/*
|
||||
|
||||
@@ -17,3 +17,11 @@
|
||||
fun:expand_dynamic_string_token
|
||||
fun:_dl_map_object
|
||||
}
|
||||
|
||||
# aug_setm memory leak
|
||||
{
|
||||
aug_setm_leak
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:aug_setm
|
||||
}
|
||||
|
||||
123
appliance/init
123
appliance/init
@@ -10,6 +10,16 @@ RUNLEVEL=S
|
||||
PREVLEVEL=N
|
||||
export RUNLEVEL PREVLEVEL
|
||||
|
||||
# Try to print a stack trace for segfaults inside the appliance.
|
||||
for d in /lib64 /lib; do
|
||||
f=$d/libSegFault.so
|
||||
if [ -f "$f" ]; then
|
||||
LD_PRELOAD=$f
|
||||
export LD_PRELOAD
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
mkdir -p /sysroot
|
||||
|
||||
if [ ! -d /proc ]; then rm -f /proc; fi
|
||||
@@ -18,58 +28,46 @@ mount -t proc /proc /proc
|
||||
if [ ! -d /sys ]; then rm -f /sys; fi
|
||||
mkdir -p /sys
|
||||
mount -t sysfs /sys /sys
|
||||
# taken from initramfs-tools/init --Hilko Bengen
|
||||
mkdir -p /run
|
||||
mount -t tmpfs -o "nosuid,size=20%,mode=0755" tmpfs /run
|
||||
mkdir -p /run/lock
|
||||
|
||||
# devtmpfs is required since udev 176
|
||||
mount -t devtmpfs /dev /dev
|
||||
|
||||
if [ ! -L /etc/init.d/udev -a -x /etc/init.d/udev ]; then
|
||||
if type service >/dev/null 2>&1; then
|
||||
service udev start
|
||||
else
|
||||
/etc/init.d/udev start
|
||||
fi
|
||||
elif [ -x /sbin/start_udev ] && /sbin/start_udev; then
|
||||
:
|
||||
else
|
||||
# Find udevd and run it directly.
|
||||
for f in /sbin/udevd /lib/udev/udevd \
|
||||
/lib/systemd/systemd-udevd /usr/lib/systemd/systemd-udevd \
|
||||
/usr/lib/udev/udevd; do
|
||||
if [ -x "$f" ]; then UDEVD="$f"; fi
|
||||
done
|
||||
if [ -n "$UDEVD" ]; then
|
||||
echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
|
||||
$UDEVD --daemon
|
||||
udevadm trigger
|
||||
udevadm settle --timeout=600
|
||||
else
|
||||
echo No udevd, creating /dev manually.
|
||||
mount -t tmpfs none /dev
|
||||
mkdir /dev/pts /dev/shm /dev/mapper
|
||||
mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
|
||||
# Must do each MAKEDEV individually, because if one device fails,
|
||||
# MAKEDEV will quit without creating the rest (RHBZ#507374).
|
||||
for dev in mem null port zero core full ram tty console fd \
|
||||
hda hdb hdc hdd sda sdb sdc sdd loop sd; do
|
||||
MAKEDEV $dev ||:
|
||||
done
|
||||
mknod /dev/ptmx c 5 2; chmod 0666 /dev/ptmx
|
||||
mknod /dev/random c 1 8; chmod 0666 /dev/random
|
||||
mknod /dev/urandom c 1 9; chmod 0444 /dev/urandom
|
||||
ln -sf /proc/self/fd/0 /dev/stdin
|
||||
ln -sf /proc/self/fd/1 /dev/stdout
|
||||
ln -sf /proc/self/fd/2 /dev/stderr
|
||||
|
||||
modprobe virtio_pci
|
||||
modprobe virtio_net
|
||||
fi
|
||||
# Find udevd and run it directly.
|
||||
for f in /sbin/udevd /lib/udev/udevd \
|
||||
/lib/systemd/systemd-udevd /usr/lib/systemd/systemd-udevd \
|
||||
/usr/lib/udev/udevd; do
|
||||
if [ -x "$f" ]; then UDEVD="$f"; fi
|
||||
done
|
||||
if [ -z "$UDEVD" ]; then
|
||||
echo "udev not found! Things will probably not work ..."
|
||||
fi
|
||||
|
||||
echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
|
||||
$UDEVD --daemon
|
||||
udevadm trigger
|
||||
udevadm settle --timeout=600
|
||||
|
||||
if grep -sq selinux=1 /proc/cmdline; then
|
||||
mount -t selinuxfs none /selinux
|
||||
mount -t selinuxfs none /sys/fs/selinux
|
||||
fi
|
||||
|
||||
# Set up kmod static-nodes (RHBZ#1011907).
|
||||
mkdir -p /run/tmpfiles.d
|
||||
kmod static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf
|
||||
|
||||
# Set up tmpfiles (must run after kmod.conf is created above).
|
||||
systemd-tmpfiles --prefix=/dev --create
|
||||
|
||||
# Disk optimizations.
|
||||
# Increase the SCSI timeout so we can read remote images.
|
||||
for f in /sys/block/sd*/device/timeout; do echo 300 > $f; done
|
||||
# https://access.redhat.com/site/solutions/5427
|
||||
for f in /sys/block/{h,s,ub,v}d*/queue/scheduler; do echo noop > $f; done
|
||||
|
||||
# Update the system clock.
|
||||
hwclock -u -s
|
||||
|
||||
@@ -87,6 +85,7 @@ mdadm -As --auto=yes --run
|
||||
|
||||
# Scan for LVM.
|
||||
modprobe dm_mod ||:
|
||||
lvmetad ||:
|
||||
|
||||
lvm vgscan --ignorelockingfailure
|
||||
lvm vgchange -ay --ignorelockingfailure
|
||||
@@ -94,16 +93,9 @@ lvm vgchange -ay --ignorelockingfailure
|
||||
# Scan for Windows dynamic disks.
|
||||
ldmtool create all
|
||||
|
||||
# Improve virtio-blk performance (RHBZ#509383).
|
||||
for f in /sys/block/vd*/queue/rotational; do echo 1 > $f; done
|
||||
|
||||
# http://kbase.redhat.com/faq/docs/DOC-5428
|
||||
# Disabled this until https://bugzilla.redhat.com/show_bug.cgi?id=630583
|
||||
# is fixed (broken in Linux 2.6.36).
|
||||
#for f in /sys/block/[hsv]d*/queue/scheduler; do echo noop > $f; done
|
||||
|
||||
# These are useful when debugging.
|
||||
if grep -sq guestfs_verbose=1 /proc/cmdline; then
|
||||
uname -a
|
||||
ls -lR /dev
|
||||
cat /proc/mounts
|
||||
lvm pvs
|
||||
@@ -121,23 +113,31 @@ if grep -sq guestfs_verbose=1 /proc/cmdline; then
|
||||
fi
|
||||
|
||||
if ! grep -sq guestfs_rescue=1 /proc/cmdline; then
|
||||
# Run the daemon.
|
||||
|
||||
# Run the daemon under valgrind if ./configure --enable-valgrind-daemon
|
||||
vg_channel=/dev/virtio-ports/org.libguestfs.valgrind
|
||||
if [ -w $vg_channel ]; then
|
||||
if grep -sq guestfs_valgrind_daemon=1 /proc/cmdline; then
|
||||
if [ -r /etc/guestfsd.suppressions ]; then
|
||||
suppressions="--suppressions=/etc/guestfsd.suppressions"
|
||||
fi
|
||||
exec 3>$vg_channel
|
||||
vg="valgrind --leak-check=full --log-fd=3 --error-exitcode=119 --max-stackframe=8388608 --child-silent-after-fork=yes $suppressions"
|
||||
vg="valgrind --leak-check=full --error-exitcode=119 --max-stackframe=8388608 --child-silent-after-fork=yes $suppressions"
|
||||
echo "enabling valgrind: $vg"
|
||||
fi
|
||||
|
||||
# The host will kill qemu abruptly if guestfsd shuts down normally
|
||||
# Run guestfsd, under valgrind if asked.
|
||||
$vg guestfsd
|
||||
|
||||
# Otherwise we try to clean up gracefully. For example, this ensures that a
|
||||
# core dump generated by the guest daemon will be written to disk.
|
||||
if [ $? -eq 119 ]; then
|
||||
echo "DAEMON VALGRIND FAILED"
|
||||
# Sleep so valgrind messages are seen by the host. Note this
|
||||
# only happens in non-production builds
|
||||
# (--enable-valgrind-daemon) + on an error path.
|
||||
sleep 10
|
||||
fi
|
||||
else
|
||||
# Run virt-rescue shell.
|
||||
|
||||
# Remove LD_PRELOAD=libSegFault set above.
|
||||
unset LD_PRELOAD
|
||||
# Use appliance in rescue mode, also used by the virt-rescue command.
|
||||
eval $(grep -Eo 'TERM=[^[:space:]]+' /proc/cmdline)
|
||||
PS1='><rescue> '
|
||||
@@ -158,4 +158,9 @@ else
|
||||
fi
|
||||
|
||||
sync
|
||||
reboot -f
|
||||
|
||||
if ! grep -sq guestfs_noreboot=1 /proc/cmdline; then
|
||||
# qemu has the -no-reboot flag, so issuing a reboot here actually
|
||||
# causes qemu to exit gracefully.
|
||||
reboot -f
|
||||
fi
|
||||
|
||||
@@ -15,11 +15,33 @@ libguestfs-make-fixed-appliance - Make a "fixed appliance" for libguestfs
|
||||
libguestfs-make-fixed-appliance lets you make a pre-built binary
|
||||
appliance for libguestfs.
|
||||
|
||||
B<Note that ordinary users should not need to run this tool>. The
|
||||
only reason to use it is if you want to make a self-contained
|
||||
libguestfs appliance that can be copied to another machine or platform
|
||||
that doesn't support L<febootstrap(8)>. To understand why you might
|
||||
need to use this tool, read the section L</FIXED APPLIANCE> below.
|
||||
B<Note that ordinary users should not need to run this tool>.
|
||||
|
||||
Some reasons why you I<might> want to use this include:
|
||||
|
||||
=over 4
|
||||
|
||||
=item *
|
||||
|
||||
You want to make a self-contained libguestfs appliance that can be
|
||||
copied to another machine or platform that doesn't support
|
||||
L<supermin(1)>.
|
||||
|
||||
=item *
|
||||
|
||||
You have multiple users on the same machine and want to avoid the
|
||||
storage duplication and start-up overhead of having multiple cached
|
||||
copies of the appliance.
|
||||
|
||||
=item *
|
||||
|
||||
You want to have very predictable performance from libguestfs (see
|
||||
L<guestfs-performance(1)>).
|
||||
|
||||
=back
|
||||
|
||||
For deeper understanding of why you might need this tool, read the
|
||||
section L</FIXED APPLIANCE> below.
|
||||
|
||||
Instead of running this tool, you can download fixed appliances from
|
||||
L<http://libguestfs.org/download/binaries/appliance/>. These
|
||||
@@ -107,21 +129,21 @@ looking for an appliance. The path is built into libguestfs, or can
|
||||
be set using the C<LIBGUESTFS_PATH> environment variable.
|
||||
|
||||
Normally a supermin appliance is located on this path (see
|
||||
L<febootstrap(8)/SUPERMIN APPLIANCE>). libguestfs reconstructs this
|
||||
into a full appliance by running L<febootstrap-supermin-helper(8)>.
|
||||
L<supermin(1)/SUPERMIN APPLIANCE>). libguestfs reconstructs this
|
||||
into a full appliance by running L<supermin-helper(1)>.
|
||||
|
||||
However, a simpler "fixed appliance" can also be used. libguestfs
|
||||
detects this by looking for a directory on the path containing four
|
||||
files called C<kernel>, C<initrd>, C<root> and C<README.fixed> (note
|
||||
the C<README.fixed> file must be present as well).
|
||||
|
||||
If the fixed appliance is found, libguestfs skips febootstrap entirely
|
||||
If the fixed appliance is found, libguestfs skips supermin entirely
|
||||
and just runs qemu with the kernel, initrd and root disk from the
|
||||
fixed appliance.
|
||||
|
||||
Thus the fixed appliance can be used when a platform or Linux distro
|
||||
does not support febootstrap. You build the fixed appliance on a
|
||||
platform that does support febootstrap, and copy it over, and use that
|
||||
does not support supermin. You build the fixed appliance on a
|
||||
platform that does support supermin, and copy it over, and use that
|
||||
to run libguestfs.
|
||||
|
||||
=head1 LICENSING
|
||||
@@ -144,8 +166,8 @@ libguestfs, please see the L<guestfs(3)> manual page.
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<guestfs(3)>,
|
||||
L<febootstrap(8)>,
|
||||
L<febootstrap-supermin-helper(8)>,
|
||||
L<supermin(1)>,
|
||||
L<supermin-helper(1)>,
|
||||
L<xz(1)>,
|
||||
L<http://libguestfs.org/>,
|
||||
L<http://qemu.org/>.
|
||||
@@ -156,4 +178,4 @@ Richard W.M. Jones (C<rjones at redhat dot com>)
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright (C) 2009-2012 Red Hat Inc.
|
||||
Copyright (C) 2009-2013 Red Hat Inc.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash -
|
||||
# @configure_input@
|
||||
# Copyright (C) 2009-2012 Red Hat Inc.
|
||||
# Copyright (C) 2009-2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -27,13 +27,18 @@ while read regexp <&5; do
|
||||
done
|
||||
exec 5<&-
|
||||
|
||||
# Run febootstrap on the package list.
|
||||
if [ "x@FEBOOTSTRAP_YUM_CONFIG@" != "xno" ]; then
|
||||
extra="--yum-config @FEBOOTSTRAP_YUM_CONFIG@"
|
||||
# Run supermin on the package list.
|
||||
# NB: Keep using --yum-config (deprecated alias) here since both old
|
||||
# and new supermin still support it.
|
||||
if [ "x@SUPERMIN_PACKAGER_CONFIG@" != "xno" ]; then
|
||||
extra="--yum-config @SUPERMIN_PACKAGER_CONFIG@"
|
||||
fi
|
||||
if [ "x@SUPERMIN_EXTRA_OPTIONS@" != "xno" ]; then
|
||||
extra="$extra @SUPERMIN_EXTRA_OPTIONS@"
|
||||
fi
|
||||
|
||||
echo @FEBOOTSTRAP@ -v -o supermin.d --names $(< packagelist ) $excludes $extra
|
||||
@FEBOOTSTRAP@ -v -o supermin.d --names $(< packagelist ) $excludes $extra
|
||||
echo @SUPERMIN@ -v -o supermin.d --names $(< packagelist ) $excludes $extra
|
||||
@SUPERMIN@ -v -o supermin.d --names $(< packagelist ) $excludes $extra
|
||||
|
||||
# Remove some things that we don't want in the appliance. This is
|
||||
# copied from the old febootstrap-minimize. However minimization is
|
||||
@@ -41,10 +46,6 @@ echo @FEBOOTSTRAP@ -v -o supermin.d --names $(< packagelist ) $excludes $extra
|
||||
< supermin.d/hostfiles \
|
||||
grep -v '^/usr/lib/locale' |
|
||||
grep -v '^/usr/share/locale' |
|
||||
grep -v '^/usr/lib/gconv' |
|
||||
grep -v '^/usr/lib64/gconv' |
|
||||
grep -v '^/usr/bin/localedef' |
|
||||
grep -v '^/usr/sbin/build-locale-archive' |
|
||||
grep -v '^/usr/share/man/' |
|
||||
grep -v '^/usr/share/doc/' |
|
||||
grep -v '^/usr/share/info/' |
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
*
|
||||
* There is also a list of packages which are excluded if they appear
|
||||
* as dependencies of the packages below. See: excludelist.in
|
||||
*
|
||||
* To add arbitrary extra packages, use:
|
||||
*
|
||||
* ./configure --with-extra-packages="gdb valgrind [etc]"
|
||||
*/
|
||||
|
||||
/* Basically the same with a few minor tweaks. */
|
||||
@@ -35,14 +39,16 @@
|
||||
iproute
|
||||
iputils
|
||||
kernel
|
||||
libcap
|
||||
libldm /* only Fedora has this for now, but we should add it to others later*/
|
||||
MAKEDEV
|
||||
nilfs-utils
|
||||
ntfsprogs
|
||||
ntfs-3g
|
||||
openssh-clients
|
||||
pcre
|
||||
reiserfs-utils
|
||||
libselinux
|
||||
syslinux-extlinux
|
||||
systemd /* for /sbin/reboot and udevd */
|
||||
vim-minimal
|
||||
xz
|
||||
@@ -55,6 +61,7 @@
|
||||
btrfs-tools
|
||||
cryptsetup
|
||||
e2fsprogs
|
||||
extlinux
|
||||
genisoimage
|
||||
gfs-tools
|
||||
gfs2-tools
|
||||
@@ -62,14 +69,19 @@
|
||||
hfsplus
|
||||
iproute
|
||||
libaugeas0
|
||||
libcap2
|
||||
libhivex0
|
||||
libpcre3
|
||||
libyajl2
|
||||
linux-image
|
||||
/* syslinux 'suggests' mtools, but in reality it's a hard dependency: */
|
||||
mtools
|
||||
nilfs-tools
|
||||
ntfs-3g
|
||||
ntfsprogs
|
||||
openssh-client
|
||||
reiserfsprogs
|
||||
sysvinit /* for /sbin/reboot */
|
||||
ufsutils
|
||||
vim-tiny
|
||||
xz-utils
|
||||
@@ -86,11 +98,13 @@
|
||||
hivex
|
||||
iproute2
|
||||
iputils
|
||||
libcap
|
||||
linux
|
||||
lrzip
|
||||
nilfs-utils
|
||||
ntfsprogs
|
||||
ntfs-3g
|
||||
pcre
|
||||
reiserfsprogs
|
||||
systemd
|
||||
vim
|
||||
@@ -99,6 +113,64 @@
|
||||
zfs-fuse
|
||||
#endif /* ARCHLINUX */
|
||||
|
||||
#ifdef FRUGALWARE
|
||||
augeas
|
||||
btrfs-progs
|
||||
cryptsetup-luks
|
||||
e2fsprogs
|
||||
cdrkit
|
||||
grub2
|
||||
hfsplus
|
||||
iproute2
|
||||
iputils
|
||||
kernel
|
||||
libcap
|
||||
ntfsprogs
|
||||
ntfs-3g
|
||||
openssh
|
||||
pcre
|
||||
reiserfsprogs
|
||||
syslinux
|
||||
systemd
|
||||
vim
|
||||
xz
|
||||
yajl
|
||||
xfsprogs-acl
|
||||
xfsprogs-attr
|
||||
bash
|
||||
binutils
|
||||
bzip2
|
||||
coreutils
|
||||
cpio
|
||||
diffutils
|
||||
dosfstools
|
||||
file
|
||||
findutils
|
||||
gawk
|
||||
gptfdisk
|
||||
grep
|
||||
gzip
|
||||
jfsutils
|
||||
kmod
|
||||
less
|
||||
libxml2
|
||||
lsof
|
||||
lsscsi
|
||||
lvm2
|
||||
mdadm
|
||||
module-init-tools
|
||||
parted
|
||||
procps
|
||||
psmisc
|
||||
rsync
|
||||
sed
|
||||
strace
|
||||
syslinux
|
||||
tar
|
||||
util-linux
|
||||
xfsprogs
|
||||
#endif /* FRUGALWARE */
|
||||
|
||||
acl
|
||||
attr
|
||||
bash
|
||||
@@ -111,6 +183,7 @@ dosfstools
|
||||
file
|
||||
findutils
|
||||
gawk
|
||||
gdisk
|
||||
grep
|
||||
gzip
|
||||
jfsutils
|
||||
@@ -136,6 +209,7 @@ rsync
|
||||
scrub
|
||||
sed
|
||||
strace
|
||||
syslinux
|
||||
tar
|
||||
udev
|
||||
util-linux
|
||||
@@ -152,7 +226,5 @@ zerofree
|
||||
valgrind
|
||||
#endif
|
||||
|
||||
/* Enable this to add useful debugging tools to the appliance. */
|
||||
#if 0
|
||||
gdb
|
||||
#endif
|
||||
/* Define this by doing: ./configure --with-extra-packages="..." */
|
||||
EXTRA_PACKAGES
|
||||
|
||||
71
bash/Makefile.am
Normal file
71
bash/Makefile.am
Normal file
@@ -0,0 +1,71 @@
|
||||
# libguestfs
|
||||
# Copyright (C) 2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
include $(top_srcdir)/subdir-rules.mk
|
||||
|
||||
scripts = \
|
||||
guestfish \
|
||||
guestmount \
|
||||
virt-alignment-scan \
|
||||
virt-builder \
|
||||
virt-cat \
|
||||
virt-df \
|
||||
virt-edit \
|
||||
virt-filesystems \
|
||||
virt-format \
|
||||
virt-inspector \
|
||||
virt-ls \
|
||||
virt-rescue \
|
||||
virt-resize \
|
||||
virt-sparsify \
|
||||
virt-sysprep
|
||||
|
||||
EXTRA_DIST = \
|
||||
README \
|
||||
$(scripts)
|
||||
|
||||
# Some of the scripts are simply symbolic links.
|
||||
virt-cat:
|
||||
ln -sf virt-alignment-scan $@
|
||||
virt-df:
|
||||
ln -sf virt-alignment-scan $@
|
||||
virt-edit:
|
||||
ln -sf virt-alignment-scan $@
|
||||
virt-filesystems:
|
||||
ln -sf virt-alignment-scan $@
|
||||
virt-format:
|
||||
ln -sf virt-alignment-scan $@
|
||||
virt-inspector:
|
||||
ln -sf virt-alignment-scan $@
|
||||
virt-ls:
|
||||
ln -sf virt-alignment-scan $@
|
||||
virt-sysprep:
|
||||
ln -sf virt-alignment-scan $@
|
||||
|
||||
virt-builder:
|
||||
ln -sf virt-resize $@
|
||||
virt-sparsify:
|
||||
ln -sf virt-resize $@
|
||||
|
||||
if HAVE_BASH_COMPLETION
|
||||
|
||||
# Bash completion script.
|
||||
|
||||
bashcompletiondir = $(BASH_COMPLETIONS_DIR)
|
||||
bashcompletion_DATA = $(scripts)
|
||||
|
||||
endif
|
||||
3
bash/README
Normal file
3
bash/README
Normal file
@@ -0,0 +1,3 @@
|
||||
This directory contains the scripts for tab-completing commands in
|
||||
bash. Note these new-style demand-loaded scripts require
|
||||
'bash-completion' >= 1.99.
|
||||
72
bash/guestfish
Normal file
72
bash/guestfish
Normal file
@@ -0,0 +1,72 @@
|
||||
# guestfish bash completion script -*- shell-script -*-
|
||||
# Copyright (C) 2010-2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
# List all local libvirt domains.
|
||||
_guestfs_virsh_list ()
|
||||
{
|
||||
local flag_ro=$1 flags
|
||||
|
||||
if [ "$flag_ro" -eq 1 ]; then
|
||||
flags="--all"
|
||||
else
|
||||
flags="--inactive"
|
||||
fi
|
||||
virsh list $flags | head -n -1 | tail -n +3 | awk '{print $2}'
|
||||
}
|
||||
|
||||
_guestfish ()
|
||||
{
|
||||
local cur prev words cword split
|
||||
local longopts flag_ro=0 c=1 word cmds doms
|
||||
|
||||
_init_completion -s || return
|
||||
|
||||
longopts="$(guestfish --long-options)"
|
||||
|
||||
# See if user has specified certain options anywhere on the
|
||||
# command line before the current word.
|
||||
while [ $c -lt $COMP_CWORD ]; do
|
||||
word="${COMP_WORDS[c]}"
|
||||
case "$word" in
|
||||
-r|--ro) flag_ro=1 ;;
|
||||
esac
|
||||
c=$((++c))
|
||||
done
|
||||
|
||||
case "$prev" in
|
||||
-a|--add)
|
||||
COMPREPLY=( $(compgen "$cur") )
|
||||
return ;;
|
||||
-d|--domain)
|
||||
doms=$(_guestfs_virsh_list "$flag_ro")
|
||||
COMPREPLY=( $(compgen -W "$doms" -- "$cur") )
|
||||
return ;;
|
||||
esac
|
||||
|
||||
case "$cur" in
|
||||
--*)
|
||||
# --options
|
||||
COMPREPLY=( $(compgen -W "$longopts" -- "$cur") )
|
||||
return ;;
|
||||
*)
|
||||
# Might be a guestfish command.
|
||||
cmds=$(guestfish -h| head -n -1 | tail -n +2 | awk '{print $1}')
|
||||
COMPREPLY=( $(compgen -W "$cmds" -- "$cur") )
|
||||
return ;;
|
||||
esac
|
||||
} &&
|
||||
complete -o default -F _guestfish guestfish
|
||||
67
bash/guestmount
Normal file
67
bash/guestmount
Normal file
@@ -0,0 +1,67 @@
|
||||
# guestmount bash completion script -*- shell-script -*-
|
||||
# Copyright (C) 2010-2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
# List all local libvirt domains.
|
||||
_guestfs_virsh_list ()
|
||||
{
|
||||
local flag_ro=$1 flags
|
||||
|
||||
if [ "$flag_ro" -eq 1 ]; then
|
||||
flags="--all"
|
||||
else
|
||||
flags="--inactive"
|
||||
fi
|
||||
virsh list $flags | head -n -1 | tail -n +3 | awk '{print $2}'
|
||||
}
|
||||
|
||||
_guestmount ()
|
||||
{
|
||||
local cur prev words cword split
|
||||
local longopts flag_ro=0 c=1 word doms
|
||||
|
||||
_init_completion -s || return
|
||||
|
||||
longopts="$(guestmount --long-options)"
|
||||
|
||||
# See if user has specified certain options anywhere on the
|
||||
# command line before the current word.
|
||||
while [ $c -lt $COMP_CWORD ]; do
|
||||
word="${COMP_WORDS[c]}"
|
||||
case "$word" in
|
||||
-r|--ro) flag_ro=1 ;;
|
||||
esac
|
||||
c=$((++c))
|
||||
done
|
||||
|
||||
case "$prev" in
|
||||
-d|--domain)
|
||||
doms=$(_guestfs_virsh_list "$flag_ro")
|
||||
COMPREPLY=( $(compgen -W "$doms" -- "$cur") )
|
||||
return ;;
|
||||
esac
|
||||
|
||||
case "$cur" in
|
||||
--*)
|
||||
# --options
|
||||
COMPREPLY=( $(compgen -W "$longopts" -- "$cur") )
|
||||
return ;;
|
||||
*)
|
||||
COMPREPLY=( $(compgen "$cur") )
|
||||
return ;;
|
||||
esac
|
||||
} &&
|
||||
complete -o default -F _guestmount guestmount
|
||||
108
bash/virt-alignment-scan
Normal file
108
bash/virt-alignment-scan
Normal file
@@ -0,0 +1,108 @@
|
||||
# virt-tools bash completion script -*- shell-script -*-
|
||||
# Copyright (C) 2010-2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
# List all local libvirt domains.
|
||||
_guestfs_virsh_list ()
|
||||
{
|
||||
local flag_ro=$1 flags
|
||||
|
||||
if [ "$flag_ro" -eq 1 ]; then
|
||||
flags="--all"
|
||||
else
|
||||
flags="--inactive"
|
||||
fi
|
||||
virsh list $flags | head -n -1 | tail -n +3 | awk '{print $2}'
|
||||
}
|
||||
|
||||
_guestfs_virttools ()
|
||||
{
|
||||
local cur prev words cword split
|
||||
local longopts="$1" flag_ro="$2" doms
|
||||
|
||||
_init_completion -s || return
|
||||
|
||||
case "$prev" in
|
||||
-d|--domain)
|
||||
doms=$(_guestfs_virsh_list "$flag_ro")
|
||||
COMPREPLY=( $(compgen -W "$doms" -- "$cur") )
|
||||
return ;;
|
||||
esac
|
||||
|
||||
case "$cur" in
|
||||
--*)
|
||||
# --options
|
||||
COMPREPLY=( $(compgen -W "$longopts" -- "$cur") )
|
||||
return ;;
|
||||
*)
|
||||
COMPREPLY=( $(compgen "$cur") )
|
||||
return ;;
|
||||
esac
|
||||
}
|
||||
|
||||
_virt_alignment_scan ()
|
||||
{
|
||||
_guestfs_virttools "$(virt-alignment-scan --long-options)" 1
|
||||
} &&
|
||||
complete -o default -F _virt_alignment_scan virt-alignment-scan
|
||||
|
||||
_virt_cat ()
|
||||
{
|
||||
_guestfs_virttools "$(virt-cat --long-options)" 1
|
||||
} &&
|
||||
complete -o default -F _virt_cat virt-cat
|
||||
|
||||
_virt_df ()
|
||||
{
|
||||
_guestfs_virttools "$(virt-df --long-options)" 1
|
||||
} &&
|
||||
complete -o default -F _virt_df virt-df
|
||||
|
||||
_virt_edit ()
|
||||
{
|
||||
_guestfs_virttools "$(virt-edit --long-options)" 0
|
||||
} &&
|
||||
complete -o default -F _virt_edit virt-edit
|
||||
|
||||
_virt_filesystems ()
|
||||
{
|
||||
_guestfs_virttools "$(virt-filesystems --long-options)" 1
|
||||
} &&
|
||||
complete -o default -F _virt_filesystems virt-filesystems
|
||||
|
||||
_virt_format ()
|
||||
{
|
||||
_guestfs_virttools "$(virt-format --long-options)" 0
|
||||
} &&
|
||||
complete -o default -F _virt_format virt-format
|
||||
|
||||
_virt_inspector ()
|
||||
{
|
||||
_guestfs_virttools "$(virt-inspector --long-options)" 1
|
||||
} &&
|
||||
complete -o default -F _virt_inspector virt-inspector
|
||||
|
||||
_virt_ls ()
|
||||
{
|
||||
_guestfs_virttools "$(virt-ls --long-options)" 1
|
||||
} &&
|
||||
complete -o default -F _virt_ls virt-ls
|
||||
|
||||
_virt_sysprep ()
|
||||
{
|
||||
_guestfs_virttools "$(virt-sysprep --long-options)" 0
|
||||
} &&
|
||||
complete -o default -F _virt_sysprep virt-sysprep
|
||||
67
bash/virt-rescue
Normal file
67
bash/virt-rescue
Normal file
@@ -0,0 +1,67 @@
|
||||
# virt-rescue bash completion script -*- shell-script -*-
|
||||
# Copyright (C) 2010-2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
# List all local libvirt domains.
|
||||
_guestfs_virsh_list ()
|
||||
{
|
||||
local flag_ro=$1 flags
|
||||
|
||||
if [ "$flag_ro" -eq 1 ]; then
|
||||
flags="--all"
|
||||
else
|
||||
flags="--inactive"
|
||||
fi
|
||||
virsh list $flags | head -n -1 | tail -n +3 | awk '{print $2}'
|
||||
}
|
||||
|
||||
_virt_rescue ()
|
||||
{
|
||||
local cur prev words cword split
|
||||
local longopts flag_ro=0 c=1 word doms
|
||||
|
||||
_init_completion -s || return
|
||||
|
||||
longopts="$(virt-rescue --long-options)"
|
||||
|
||||
# See if user has specified certain options anywhere on the
|
||||
# command line before the current word.
|
||||
while [ $c -lt $COMP_CWORD ]; do
|
||||
word="${COMP_WORDS[c]}"
|
||||
case "$word" in
|
||||
-r|--ro) flag_ro=1 ;;
|
||||
esac
|
||||
c=$((++c))
|
||||
done
|
||||
|
||||
case "$prev" in
|
||||
-d|--domain)
|
||||
doms=$(_guestfs_virsh_list "$flag_ro")
|
||||
COMPREPLY=( $(compgen -W "$doms" -- "$cur") )
|
||||
return ;;
|
||||
esac
|
||||
|
||||
case "$cur" in
|
||||
--*)
|
||||
# --options
|
||||
COMPREPLY=( $(compgen -W "$longopts" -- "$cur") )
|
||||
return ;;
|
||||
*)
|
||||
COMPREPLY=( $(compgen "$cur") )
|
||||
return ;;
|
||||
esac
|
||||
} &&
|
||||
complete -o default -F _virt_rescue virt-rescue
|
||||
53
bash/virt-resize
Normal file
53
bash/virt-resize
Normal file
@@ -0,0 +1,53 @@
|
||||
# virt-resize, virt-builder, virt-sparsify bash completion script
|
||||
# -*- shell-script -*-
|
||||
# Copyright (C) 2010-2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
_guestfs_options_only ()
|
||||
{
|
||||
local cur prev words cword split
|
||||
local longopts="$1"
|
||||
|
||||
_init_completion -s || return
|
||||
|
||||
case "$cur" in
|
||||
--*)
|
||||
# --options
|
||||
COMPREPLY=( $(compgen -W "$longopts" -- "$cur") )
|
||||
return ;;
|
||||
*)
|
||||
COMPREPLY=( $(compgen "$cur") )
|
||||
return ;;
|
||||
esac
|
||||
}
|
||||
|
||||
_virt_builder ()
|
||||
{
|
||||
_guestfs_options_only "$(virt-builder --long-options)"
|
||||
} &&
|
||||
complete -o default -F _virt_builder virt-builder
|
||||
|
||||
_virt_resize ()
|
||||
{
|
||||
_guestfs_options_only "$(virt-resize --long-options)"
|
||||
} &&
|
||||
complete -o default -F _virt_resize virt-resize
|
||||
|
||||
_virt_sparsify ()
|
||||
{
|
||||
_guestfs_options_only "$(virt-sparsify --long-options)"
|
||||
} &&
|
||||
complete -o default -F _virt_sparsify virt-sparsify
|
||||
@@ -34,10 +34,12 @@ libtoolize --copy --install
|
||||
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
||||
<$gnulib_tool || exit
|
||||
|
||||
(cd daemon && mkdir -p tests lib && ../$gnulib_tool --update)
|
||||
(cd daemon && mkdir -p tests lib && ../$gnulib_tool --dir=.. --update)
|
||||
|
||||
modules='
|
||||
accept4
|
||||
areadlink
|
||||
areadlinkat
|
||||
arpa_inet
|
||||
byteswap
|
||||
c-ctype
|
||||
@@ -68,13 +70,13 @@ maintainer-makefile
|
||||
manywarnings
|
||||
memmem
|
||||
mkdtemp
|
||||
mkstemps
|
||||
netdb
|
||||
netinet_in
|
||||
openat
|
||||
perror
|
||||
pipe2
|
||||
pread
|
||||
progname
|
||||
read-file
|
||||
readlink
|
||||
select
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash -
|
||||
# bugs-in-changelog.sh
|
||||
# Copyright (C) 2009-2012 Red Hat Inc.
|
||||
# Copyright (C) 2009-2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
218
builder/Makefile.am
Normal file
218
builder/Makefile.am
Normal file
@@ -0,0 +1,218 @@
|
||||
# libguestfs virt-builder tool
|
||||
# Copyright (C) 2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
include $(top_srcdir)/subdir-rules.mk
|
||||
|
||||
AM_YFLAGS = -d
|
||||
AM_CFLAGS = \
|
||||
-I$(shell $(OCAMLC) -where) \
|
||||
-I$(top_srcdir)/src \
|
||||
-I$(top_srcdir)/fish \
|
||||
-pthread \
|
||||
$(LIBLZMA_CFLAGS)
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(SOURCES) \
|
||||
virt-builder.pod \
|
||||
virt-index-validate.pod \
|
||||
test-virt-builder.sh \
|
||||
test-virt-builder-list.sh
|
||||
|
||||
CLEANFILES = *~ *.cmi *.cmo *.cmx *.cmxa *.o virt-builder
|
||||
|
||||
# Alphabetical order.
|
||||
SOURCES = \
|
||||
builder.ml \
|
||||
cmdline.ml \
|
||||
downloader.mli \
|
||||
downloader.ml \
|
||||
get_kernel.mli \
|
||||
get_kernel.ml \
|
||||
index_parser.mli \
|
||||
index_parser.ml \
|
||||
index-parser-c.c \
|
||||
list_entries.mli \
|
||||
list_entries.ml \
|
||||
perl_edit.ml \
|
||||
perl_edit.mli \
|
||||
pxzcat.ml \
|
||||
pxzcat.mli \
|
||||
pxzcat-c.c \
|
||||
sigchecker.mli \
|
||||
sigchecker.ml
|
||||
|
||||
man_MANS =
|
||||
noinst_DATA =
|
||||
|
||||
if HAVE_OCAML
|
||||
|
||||
# Note this list must be in dependency order.
|
||||
OBJECTS = \
|
||||
$(top_builddir)/mllib/libdir.cmx \
|
||||
$(top_builddir)/mllib/common_gettext.cmx \
|
||||
$(top_builddir)/mllib/common_utils.cmx \
|
||||
$(top_builddir)/mllib/urandom.cmx \
|
||||
$(top_builddir)/mllib/random_seed.cmx \
|
||||
$(top_builddir)/mllib/hostname.cmx \
|
||||
$(top_builddir)/mllib/firstboot.cmx \
|
||||
$(top_builddir)/mllib/crypt-c.o \
|
||||
$(top_builddir)/mllib/crypt.cmx \
|
||||
$(top_builddir)/mllib/fsync-c.o \
|
||||
$(top_builddir)/mllib/fsync.cmx \
|
||||
$(top_builddir)/mllib/password.cmx \
|
||||
$(top_builddir)/mllib/config.cmx \
|
||||
index-scan.o \
|
||||
index-struct.o \
|
||||
index-parse.o \
|
||||
index-parser-c.o \
|
||||
pxzcat-c.o \
|
||||
pxzcat.cmx \
|
||||
get_kernel.cmx \
|
||||
downloader.cmx \
|
||||
sigchecker.cmx \
|
||||
index_parser.cmx \
|
||||
list_entries.cmx \
|
||||
perl_edit.cmx \
|
||||
cmdline.cmx \
|
||||
builder.cmx
|
||||
|
||||
bin_SCRIPTS = virt-builder
|
||||
|
||||
# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L
|
||||
# option to be passed to gcc, so we don't try linking against an
|
||||
# installed copy of libguestfs.
|
||||
OCAMLPACKAGES = \
|
||||
-package str,unix \
|
||||
-I $(top_builddir)/src/.libs \
|
||||
-I $(top_builddir)/ocaml \
|
||||
-I $(top_builddir)/mllib
|
||||
if HAVE_OCAML_PKG_GETTEXT
|
||||
OCAMLPACKAGES += -package gettext-stub
|
||||
endif
|
||||
|
||||
OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX $(OCAMLPACKAGES)
|
||||
OCAMLOPTFLAGS = $(OCAMLCFLAGS)
|
||||
|
||||
virt-builder: $(OBJECTS)
|
||||
$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) \
|
||||
mlguestfs.cmxa -linkpkg $^ \
|
||||
-cclib '-pthread $(LIBLZMA_LIBS) -lncurses -lcrypt -lpthread' \
|
||||
$(OCAML_GCOV_LDFLAGS) \
|
||||
-o $@
|
||||
|
||||
.mli.cmi:
|
||||
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
|
||||
.ml.cmo:
|
||||
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
|
||||
.ml.cmx:
|
||||
$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -c $< -o $@
|
||||
|
||||
# Manual pages and HTML files for the website.
|
||||
|
||||
man_MANS += virt-builder.1
|
||||
noinst_DATA += $(top_builddir)/html/virt-builder.1.html
|
||||
|
||||
virt-builder.1 $(top_builddir)/html/virt-builder.1.html: stamp-virt-builder.pod
|
||||
|
||||
stamp-virt-builder.pod: virt-builder.pod
|
||||
$(PODWRAPPER) \
|
||||
--man virt-builder.1 \
|
||||
--html $(top_builddir)/html/virt-builder.1.html \
|
||||
--license GPLv2+ \
|
||||
$<
|
||||
touch $@
|
||||
|
||||
CLEANFILES += stamp-virt-builder.pod
|
||||
|
||||
# Tests.
|
||||
|
||||
TESTS_ENVIRONMENT = $(top_builddir)/run --test
|
||||
|
||||
all_disk_images := debian.xz fedora.xz ubuntu.xz windows.xz
|
||||
disk_images := $(shell for f in $(all_disk_images); do b=`basename $$f .xz`; if [ -f "../tests/guests/$$b.img" ]; then echo $$f; fi; done)
|
||||
|
||||
CLEANFILES += $(all_disk_images)
|
||||
|
||||
check_DATA = $(disk_images)
|
||||
|
||||
%.xz: ../tests/guests/%.img
|
||||
xz --best --block-size=16777216 -c $< > $@
|
||||
|
||||
TESTS = test-virt-builder-list.sh
|
||||
|
||||
if ENABLE_APPLIANCE
|
||||
TESTS += test-virt-builder.sh
|
||||
endif ENABLE_APPLIANCE
|
||||
|
||||
check-valgrind:
|
||||
$(MAKE) VG="$(top_builddir)/run @VG@" check
|
||||
|
||||
# Dependencies.
|
||||
depend: .depend
|
||||
|
||||
.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
|
||||
rm -f $@ $@-t
|
||||
$(OCAMLFIND) ocamldep -I ../ocaml -I $(abs_srcdir) -I $(top_srcdir)/mllib $^ | \
|
||||
$(SED) 's/ *$$//' | \
|
||||
$(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
|
||||
$(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
|
||||
sort > $@-t
|
||||
mv $@-t $@
|
||||
|
||||
-include .depend
|
||||
|
||||
endif
|
||||
|
||||
DISTCLEANFILES = .depend
|
||||
|
||||
.PHONY: depend docs
|
||||
|
||||
# Build a small C index validator program.
|
||||
bin_PROGRAMS = virt-index-validate
|
||||
|
||||
virt_index_validate_SOURCES = \
|
||||
index-parse.y \
|
||||
index-scan.l \
|
||||
index-struct.h \
|
||||
index-struct.c \
|
||||
index-validate.c
|
||||
|
||||
man_MANS += virt-index-validate.1
|
||||
noinst_DATA += $(top_builddir)/html/virt-index-validate.1.html
|
||||
|
||||
virt-index-validate.1 $(top_builddir)/html/virt-index-validate.1.html: stamp-virt-index-validate.pod
|
||||
|
||||
stamp-virt-index-validate.pod: virt-index-validate.pod
|
||||
$(PODWRAPPER) \
|
||||
--man virt-index-validate.1 \
|
||||
--html $(top_builddir)/html/virt-index-validate.1.html \
|
||||
--license GPLv2+ \
|
||||
$<
|
||||
touch $@
|
||||
|
||||
CLEANFILES += \
|
||||
index-parse.c \
|
||||
index-parse.h \
|
||||
index-scan.c \
|
||||
stamp-virt-index-validate.pod
|
||||
|
||||
# Fix dependencies which automake doesn't generate correctly.
|
||||
if HAVE_OCAML
|
||||
index-parser-c.o: index-parse.h
|
||||
index-scan.o: index-parse.h
|
||||
endif
|
||||
index-validate.o: index-parse.h
|
||||
776
builder/builder.ml
Normal file
776
builder/builder.ml
Normal file
@@ -0,0 +1,776 @@
|
||||
(* virt-builder
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*)
|
||||
|
||||
open Common_gettext.Gettext
|
||||
|
||||
module G = Guestfs
|
||||
|
||||
open Common_utils
|
||||
open Password
|
||||
|
||||
open Cmdline
|
||||
open Pxzcat
|
||||
|
||||
open Unix
|
||||
open Printf
|
||||
|
||||
let quote = Filename.quote
|
||||
|
||||
let prog = Filename.basename Sys.executable_name
|
||||
|
||||
let main () =
|
||||
(* Command line argument parsing - see cmdline.ml. *)
|
||||
let mode, arg,
|
||||
attach, cache, check_signature, curl, debug, delete, edit,
|
||||
firstboot, run, format, gpg, hostname, install, list_long, memsize, mkdirs,
|
||||
network, output, password_crypto, quiet, root_password, scrub,
|
||||
scrub_logfile, size, smp, sources, sync, upload, writes =
|
||||
parse_cmdline () in
|
||||
|
||||
(* Timestamped messages in ordinary, non-debug non-quiet mode. *)
|
||||
let msg fs = make_message_function ~quiet fs in
|
||||
|
||||
(* If debugging, echo the command line arguments and the sources. *)
|
||||
if debug then (
|
||||
eprintf "command line:";
|
||||
List.iter (eprintf " %s") (Array.to_list Sys.argv);
|
||||
prerr_newline ();
|
||||
iteri (
|
||||
fun i (source, fingerprint) ->
|
||||
eprintf "source[%d] = (%S, %S)\n" i source fingerprint
|
||||
) sources
|
||||
);
|
||||
|
||||
|
||||
(* Handle some modes here, some later on. *)
|
||||
let mode =
|
||||
match mode with
|
||||
| `Get_kernel -> (* --get-kernel is really a different program ... *)
|
||||
Get_kernel.get_kernel ~debug ?format ?output arg;
|
||||
exit 0
|
||||
|
||||
| `Delete_cache -> (* --delete-cache *)
|
||||
(match cache with
|
||||
| Some cachedir ->
|
||||
msg "Deleting: %s" cachedir;
|
||||
let cmd = sprintf "rm -rf %s" (quote cachedir) in
|
||||
ignore (Sys.command cmd);
|
||||
exit 0
|
||||
| None ->
|
||||
eprintf (f_"%s: error: could not find cache directory. Is $HOME set?\n")
|
||||
prog;
|
||||
exit 1
|
||||
)
|
||||
|
||||
| (`Install|`List|`Notes|`Print_cache|`Cache_all) as mode -> mode in
|
||||
|
||||
(* Check various programs/dependencies are installed. *)
|
||||
|
||||
(* Check that gpg is installed. Optional as long as the user
|
||||
* disables all signature checks.
|
||||
*)
|
||||
let cmd = sprintf "%s --help >/dev/null 2>&1" gpg in
|
||||
if Sys.command cmd <> 0 then (
|
||||
if check_signature then (
|
||||
eprintf (f_"%s: gpg is not installed (or does not work)\nYou should install gpg, or use --gpg option, or use --no-check-signature.\n") prog;
|
||||
exit 1
|
||||
)
|
||||
else if debug then
|
||||
eprintf (f_"%s: warning: gpg program is not available\n") prog
|
||||
);
|
||||
|
||||
(* Check that curl works. *)
|
||||
let cmd = sprintf "%s --help >/dev/null 2>&1" curl in
|
||||
if Sys.command cmd <> 0 then (
|
||||
eprintf (f_"%s: curl is not installed (or does not work)\n") prog;
|
||||
exit 1
|
||||
);
|
||||
|
||||
(* Check that virt-resize works. *)
|
||||
let cmd = "virt-resize --help >/dev/null 2>&1" in
|
||||
if Sys.command cmd <> 0 then (
|
||||
eprintf (f_"%s: virt-resize is not installed (or does not work)\n") prog;
|
||||
exit 1
|
||||
);
|
||||
|
||||
(* Create the cache directory. *)
|
||||
let cache =
|
||||
match cache with
|
||||
| None -> None
|
||||
| Some dir ->
|
||||
(* Annoyingly Sys.is_directory throws an exception on failure
|
||||
* (RHBZ#1022431).
|
||||
*)
|
||||
if (try Sys.is_directory dir with Sys_error _ -> false) then
|
||||
Some dir
|
||||
else (
|
||||
(* Try to make the directory. If that fails, warn and continue
|
||||
* without any cache.
|
||||
*)
|
||||
try mkdir dir 0o755; Some dir
|
||||
with exn ->
|
||||
eprintf (f_"%s: warning: cache %s: %s\n") prog dir
|
||||
(Printexc.to_string exn);
|
||||
eprintf (f_"%s: disabling the cache\n%!") prog;
|
||||
None
|
||||
)
|
||||
in
|
||||
|
||||
(* Download the sources. *)
|
||||
let downloader = Downloader.create ~debug ~curl ~cache in
|
||||
let index : Index_parser.index =
|
||||
List.concat (
|
||||
List.map (
|
||||
fun (source, fingerprint) ->
|
||||
let sigchecker =
|
||||
Sigchecker.create ~debug ~gpg ~fingerprint ~check_signature in
|
||||
Index_parser.get_index ~debug ~downloader ~sigchecker source
|
||||
) sources
|
||||
) in
|
||||
|
||||
(* Now handle the remaining modes. *)
|
||||
let mode =
|
||||
match mode with
|
||||
| `List -> (* --list *)
|
||||
List_entries.list_entries ~list_long ~sources index;
|
||||
exit 0
|
||||
|
||||
| `Print_cache -> (* --print-cache *)
|
||||
(match cache with
|
||||
| Some cachedir ->
|
||||
printf (f_"cache directory: %s\n") cachedir;
|
||||
List.iter (
|
||||
fun (name, { Index_parser.revision = revision; hidden = hidden }) ->
|
||||
if not hidden then (
|
||||
let filename = Downloader.cache_of_name cachedir name revision in
|
||||
let cached = Sys.file_exists filename in
|
||||
printf "%-24s %s\n" name
|
||||
(if cached then s_"cached" else (*s_*)"no")
|
||||
)
|
||||
) index
|
||||
| None -> printf (f_"no cache directory\n")
|
||||
);
|
||||
exit 0
|
||||
|
||||
| `Cache_all -> (* --cache-all-templates *)
|
||||
(match cache with
|
||||
| None ->
|
||||
eprintf (f_"%s: error: no cache directory\n") prog;
|
||||
exit 1
|
||||
| Some _ ->
|
||||
List.iter (
|
||||
fun (name,
|
||||
{ Index_parser.revision = revision; file_uri = file_uri }) ->
|
||||
let template = name, revision in
|
||||
msg (f_"Downloading: %s") file_uri;
|
||||
let progress_bar = not quiet in
|
||||
ignore (Downloader.download downloader ~template ~progress_bar
|
||||
file_uri)
|
||||
) index;
|
||||
exit 0
|
||||
);
|
||||
|
||||
| (`Install|`Notes) as mode -> mode in
|
||||
|
||||
(* Which os-version (ie. index entry)? *)
|
||||
let entry =
|
||||
try List.assoc arg index
|
||||
with Not_found ->
|
||||
eprintf (f_"%s: cannot find os-version '%s'.\nUse --list to list available guest types.\n")
|
||||
prog arg;
|
||||
exit 1 in
|
||||
let sigchecker = entry.Index_parser.sigchecker in
|
||||
|
||||
(match mode with
|
||||
| `Notes -> (* --notes *)
|
||||
(match entry with
|
||||
| { Index_parser.notes = Some notes } ->
|
||||
print_endline notes;
|
||||
| { Index_parser.notes = None } ->
|
||||
printf (f_"There are no notes for %s\n") arg
|
||||
);
|
||||
exit 0
|
||||
|
||||
| `Install ->
|
||||
() (* fall through to create the guest *)
|
||||
);
|
||||
|
||||
(* --- If we get here, we want to create a guest. --- *)
|
||||
|
||||
(* Download the template, or it may be in the cache. *)
|
||||
let template =
|
||||
let template, delete_on_exit =
|
||||
let { Index_parser.revision = revision; file_uri = file_uri } = entry in
|
||||
let template = arg, revision in
|
||||
msg (f_"Downloading: %s") file_uri;
|
||||
let progress_bar = not quiet in
|
||||
Downloader.download downloader ~template ~progress_bar file_uri in
|
||||
if delete_on_exit then unlink_on_exit template;
|
||||
template in
|
||||
|
||||
(* Check the signature of the file. *)
|
||||
let () =
|
||||
match entry with
|
||||
(* New-style: Using a checksum. *)
|
||||
| { Index_parser.checksum_sha512 = Some csum } ->
|
||||
Sigchecker.verify_checksum sigchecker (Sigchecker.SHA512 csum) template
|
||||
|
||||
| { Index_parser.checksum_sha512 = None } ->
|
||||
(* Old-style: detached signature. *)
|
||||
let sigfile =
|
||||
match entry with
|
||||
| { Index_parser.signature_uri = None } -> None
|
||||
| { Index_parser.signature_uri = Some signature_uri } ->
|
||||
let sigfile, delete_on_exit =
|
||||
Downloader.download downloader signature_uri in
|
||||
if delete_on_exit then unlink_on_exit sigfile;
|
||||
Some sigfile in
|
||||
|
||||
Sigchecker.verify_detached sigchecker template sigfile in
|
||||
|
||||
(* Plan how to create the output. This depends on:
|
||||
* - did the user specify --output?
|
||||
* - is the output a block device?
|
||||
* - did the user specify --size?
|
||||
*)
|
||||
let output, size, format, delete_output_file, do_resize, resize_sparse =
|
||||
let is_block_device file =
|
||||
try (stat file).st_kind = S_BLK
|
||||
with Unix_error _ -> false
|
||||
in
|
||||
|
||||
let headroom = 256L *^ 1024L *^ 1024L in
|
||||
|
||||
match output with
|
||||
(* If the output file was specified and it exists and it's a block
|
||||
* device, then we should skip the creation step.
|
||||
*)
|
||||
| Some output when is_block_device output ->
|
||||
if size <> None then (
|
||||
eprintf (f_"%s: you cannot use --size option with block devices\n")
|
||||
prog;
|
||||
exit 1
|
||||
);
|
||||
(* XXX Should check the output size is big enough. However this
|
||||
* requires running 'blockdev --getsize64 <output>'.
|
||||
*)
|
||||
|
||||
let format = match format with None -> "raw" | Some f -> f in
|
||||
|
||||
(* Dummy: The output file is never deleted in this case. *)
|
||||
let delete_output_file = ref false in
|
||||
|
||||
output, None, format, delete_output_file, true, false
|
||||
|
||||
(* Regular file output. Note the file gets deleted. *)
|
||||
| _ ->
|
||||
(* Check the --size option. *)
|
||||
let size, do_resize =
|
||||
let { Index_parser.size = default_size } = entry in
|
||||
match size with
|
||||
| None -> default_size, false
|
||||
| Some size ->
|
||||
if size < default_size +^ headroom then (
|
||||
eprintf (f_"%s: --size is too small for this disk image, minimum size is %s\n")
|
||||
prog (human_size default_size);
|
||||
exit 1
|
||||
);
|
||||
size, true in
|
||||
|
||||
(* Create the output file. *)
|
||||
let output, format =
|
||||
match output, format with
|
||||
| None, None -> sprintf "%s.img" arg, "raw"
|
||||
| None, Some "raw" -> sprintf "%s.img" arg, "raw"
|
||||
| None, Some format -> sprintf "%s.%s" arg format, format
|
||||
| Some output, None -> output, "raw"
|
||||
| Some output, Some format -> output, format in
|
||||
|
||||
(* If the input format != output format then we must run virt-resize. *)
|
||||
let do_resize =
|
||||
let input_format =
|
||||
match entry with
|
||||
| { Index_parser.format = Some format } -> format
|
||||
| { Index_parser.format = None } -> "raw" in
|
||||
if input_format <> format then true else do_resize in
|
||||
|
||||
msg (f_"Creating disk image: %s") output;
|
||||
let cmd =
|
||||
sprintf "qemu-img create -f %s%s %s %Ld%s"
|
||||
(quote format)
|
||||
(if format = "qcow2" then " -o preallocation=metadata" else "")
|
||||
(quote output) size
|
||||
(if debug then "" else " >/dev/null 2>&1") in
|
||||
let r = Sys.command cmd in
|
||||
if r <> 0 then (
|
||||
eprintf (f_"%s: error: could not create output file '%s'\n")
|
||||
prog output;
|
||||
exit 1
|
||||
);
|
||||
(* This ensures the output file will be deleted on failure,
|
||||
* until we set !delete_output_file = false at the end of the build.
|
||||
*)
|
||||
let delete_output_file = ref true in
|
||||
let delete_file () =
|
||||
if !delete_output_file then
|
||||
try unlink output with _ -> ()
|
||||
in
|
||||
at_exit delete_file;
|
||||
|
||||
output, Some size, format, delete_output_file, do_resize, true in
|
||||
|
||||
if not do_resize then (
|
||||
(* If the user did not specify --size and the output is a regular
|
||||
* file and the format is raw, then we just uncompress the template
|
||||
* directly to the output file. This is fast but less flexible.
|
||||
*)
|
||||
let { Index_parser.file_uri = file_uri } = entry in
|
||||
msg (f_"Uncompressing: %s") file_uri;
|
||||
pxzcat template output
|
||||
) else (
|
||||
(* If none of the above apply, uncompress to a temporary file and
|
||||
* run virt-resize on the result.
|
||||
*)
|
||||
let tmpfile =
|
||||
(* Uncompress it to a temporary file. *)
|
||||
let { Index_parser.file_uri = file_uri } = entry in
|
||||
let tmpfile = Filename.temp_file "vbsrc" ".img" in
|
||||
msg (f_"Uncompressing: %s") file_uri;
|
||||
pxzcat template tmpfile;
|
||||
unlink_on_exit tmpfile;
|
||||
tmpfile in
|
||||
|
||||
(* Resize the source to the output file. *)
|
||||
(match size with
|
||||
| None ->
|
||||
msg (f_"Running virt-resize to expand the disk")
|
||||
| Some size ->
|
||||
msg (f_"Running virt-resize to expand the disk to %s") (human_size size)
|
||||
);
|
||||
|
||||
let { Index_parser.expand = expand; lvexpand = lvexpand;
|
||||
format = input_format } =
|
||||
entry in
|
||||
let cmd =
|
||||
sprintf "virt-resize%s%s%s --output-format %s%s%s %s %s"
|
||||
(if debug then " --verbose" else " --quiet")
|
||||
(if not resize_sparse then " --no-sparse" else "")
|
||||
(match input_format with
|
||||
| None -> ""
|
||||
| Some input_format -> sprintf " --format %s" (quote input_format))
|
||||
(quote format)
|
||||
(match expand with
|
||||
| None -> ""
|
||||
| Some expand -> sprintf " --expand %s" (quote expand))
|
||||
(match lvexpand with
|
||||
| None -> ""
|
||||
| Some lvexpand -> sprintf " --lv-expand %s" (quote lvexpand))
|
||||
(quote tmpfile) (quote output) in
|
||||
if debug then eprintf "%s\n%!" cmd;
|
||||
let r = Sys.command cmd in
|
||||
if r <> 0 then (
|
||||
eprintf (f_"%s: error: virt-resize failed\n") prog;
|
||||
exit 1
|
||||
)
|
||||
);
|
||||
|
||||
(* Now mount the output disk so we can make changes. *)
|
||||
msg (f_"Opening the new disk");
|
||||
let g =
|
||||
let g = new G.guestfs () in
|
||||
if debug then g#set_trace true;
|
||||
|
||||
(match memsize with None -> () | Some memsize -> g#set_memsize memsize);
|
||||
(match smp with None -> () | Some smp -> g#set_smp smp);
|
||||
g#set_network network;
|
||||
|
||||
(* The output disk is being created, so use cache=unsafe here. *)
|
||||
g#add_drive_opts ~format ~cachemode:"unsafe" output;
|
||||
|
||||
(* Attach ISOs, if we have any. *)
|
||||
List.iter (
|
||||
fun (format, file) ->
|
||||
g#add_drive_opts ?format ~readonly:true file;
|
||||
) attach;
|
||||
|
||||
g#launch ();
|
||||
|
||||
g in
|
||||
|
||||
(* Inspect the disk and mount it up. *)
|
||||
let root =
|
||||
match Array.to_list (g#inspect_os ()) with
|
||||
| [root] ->
|
||||
let mps = g#inspect_get_mountpoints root in
|
||||
let cmp (a,_) (b,_) =
|
||||
compare (String.length a) (String.length b) in
|
||||
let mps = List.sort cmp mps in
|
||||
List.iter (
|
||||
fun (mp, dev) ->
|
||||
try g#mount dev mp
|
||||
with G.Error msg -> eprintf (f_"%s: %s (ignored)\n") prog msg
|
||||
) mps;
|
||||
root
|
||||
| _ ->
|
||||
eprintf (f_"%s: no guest operating systems or multiboot OS found in this disk image\nThis is a failure of the source repository. Use -v for more information.\n") prog;
|
||||
exit 1 in
|
||||
|
||||
(* Set the random seed. *)
|
||||
msg (f_"Setting a random seed");
|
||||
if not (Random_seed.set_random_seed g root) then
|
||||
eprintf (f_"%s: warning: random seed could not be set for this type of guest\n%!") prog;
|
||||
|
||||
(* Set the hostname. *)
|
||||
(match hostname with
|
||||
| None -> ()
|
||||
| Some hostname ->
|
||||
msg (f_"Setting the hostname: %s") hostname;
|
||||
if not (Hostname.set_hostname g root hostname) then
|
||||
eprintf (f_"%s: warning: hostname could not be set for this type of guest\n%!") prog
|
||||
);
|
||||
|
||||
(* Root password.
|
||||
* Note 'None' means that we randomize the root password.
|
||||
*)
|
||||
let () =
|
||||
match g#inspect_get_type root with
|
||||
| "linux" ->
|
||||
let password_map = Hashtbl.create 1 in
|
||||
let pw =
|
||||
match root_password with
|
||||
| Some pw ->
|
||||
msg (f_"Setting root password");
|
||||
pw
|
||||
| None ->
|
||||
msg (f_"Setting random root password [did you mean to use --root-password?]");
|
||||
parse_selector ~prog "random" in
|
||||
Hashtbl.replace password_map "root" pw;
|
||||
set_linux_passwords ~prog ?password_crypto g root password_map
|
||||
| _ ->
|
||||
eprintf (f_"%s: warning: root password could not be set for this type of guest\n%!") prog in
|
||||
|
||||
(* Based on the guest type, choose a log file location. *)
|
||||
let logfile =
|
||||
match g#inspect_get_type root with
|
||||
| "windows" | "dos" ->
|
||||
if g#is_dir ~followsymlinks:true "/Temp" then "/Temp/builder.log"
|
||||
else "/builder.log"
|
||||
| _ ->
|
||||
if g#is_dir ~followsymlinks:true "/tmp" then "/tmp/builder.log"
|
||||
else "/builder.log" in
|
||||
|
||||
(* Function to cat the log file, for debugging and error messages. *)
|
||||
let debug_logfile () =
|
||||
try
|
||||
(* XXX If stderr is redirected this actually truncates the
|
||||
* redirection file, which is pretty annoying to say the
|
||||
* least.
|
||||
*)
|
||||
g#download logfile "/dev/stderr"
|
||||
with exn ->
|
||||
eprintf (f_"%s: log file %s: %s (ignored)\n")
|
||||
prog logfile (Printexc.to_string exn) in
|
||||
|
||||
(* Useful wrapper for scripts. *)
|
||||
let do_run ~display cmd =
|
||||
(* Add a prologue to the scripts:
|
||||
* - Pass environment variables through from the host.
|
||||
* - Send stdout and stderr to a log file so we capture all output
|
||||
* in error messages.
|
||||
* Also catch errors and dump the log file completely on error.
|
||||
*)
|
||||
let env_vars =
|
||||
filter_map (
|
||||
fun name ->
|
||||
try Some (sprintf "export %s=%s" name (quote (Sys.getenv name)))
|
||||
with Not_found -> None
|
||||
) [ "http_proxy"; "https_proxy"; "ftp_proxy" ] in
|
||||
let env_vars = String.concat "\n" env_vars ^ "\n" in
|
||||
|
||||
let cmd = sprintf "\
|
||||
exec >>%s 2>&1
|
||||
%s
|
||||
%s
|
||||
" (quote logfile) env_vars cmd in
|
||||
|
||||
if debug then eprintf "running command:\n%s\n%!" cmd;
|
||||
try ignore (g#sh cmd)
|
||||
with
|
||||
Guestfs.Error msg ->
|
||||
debug_logfile ();
|
||||
eprintf (f_"%s: %s: command exited with an error\n") prog display;
|
||||
exit 1
|
||||
in
|
||||
|
||||
let guest_install_command packages =
|
||||
let quoted_args = String.concat " " (List.map quote packages) in
|
||||
match g#inspect_get_package_management root with
|
||||
| "apt" ->
|
||||
(* http://unix.stackexchange.com/questions/22820 *)
|
||||
sprintf "
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt_opts='-q -y -o Dpkg::Options::=--force-confnew'
|
||||
apt-get $apt_opts update
|
||||
apt-get $apt_opts install %s
|
||||
" quoted_args
|
||||
| "pisi" ->
|
||||
sprintf "pisi it %s" quoted_args
|
||||
| "pacman" ->
|
||||
sprintf "pacman -S %s" quoted_args
|
||||
| "urpmi" ->
|
||||
sprintf "urpmi %s" quoted_args
|
||||
| "yum" ->
|
||||
sprintf "yum -y install %s" quoted_args
|
||||
| "zypper" ->
|
||||
(* XXX Should we use -n option? *)
|
||||
sprintf "zypper in %s" quoted_args
|
||||
| "unknown" ->
|
||||
eprintf (f_"%s: --install is not supported for this guest operating system\n")
|
||||
prog;
|
||||
exit 1
|
||||
| pm ->
|
||||
eprintf (f_"%s: sorry, don't know how to use --install with the '%s' package manager\n")
|
||||
prog pm;
|
||||
exit 1
|
||||
in
|
||||
|
||||
(* Install packages. *)
|
||||
if install <> [] then (
|
||||
msg (f_"Installing packages: %s") (String.concat " " install);
|
||||
|
||||
let cmd = guest_install_command install in
|
||||
do_run ~display:cmd cmd
|
||||
);
|
||||
|
||||
(* Make directories. *)
|
||||
List.iter (
|
||||
fun dir ->
|
||||
msg (f_"Making directory: %s") dir;
|
||||
g#mkdir_p dir
|
||||
) mkdirs;
|
||||
|
||||
(* Write files. *)
|
||||
List.iter (
|
||||
fun (file, content) ->
|
||||
msg (f_"Writing: %s") file;
|
||||
g#write file content
|
||||
) writes;
|
||||
|
||||
(* Upload files. *)
|
||||
List.iter (
|
||||
fun (file, dest) ->
|
||||
msg (f_"Uploading: %s to %s") file dest;
|
||||
let dest =
|
||||
if g#is_dir ~followsymlinks:true dest then
|
||||
dest ^ "/" ^ Filename.basename file
|
||||
else
|
||||
dest in
|
||||
(* Do the file upload. *)
|
||||
g#upload file dest;
|
||||
|
||||
(* Copy (some of) the permissions from the local file to the
|
||||
* uploaded file.
|
||||
*)
|
||||
let statbuf = stat file in
|
||||
let perms = statbuf.st_perm land 0o7777 (* sticky & set*id *) in
|
||||
g#chmod perms dest;
|
||||
let uid, gid = statbuf.st_uid, statbuf.st_gid in
|
||||
g#chown uid gid dest
|
||||
) upload;
|
||||
|
||||
(* Edit files. *)
|
||||
List.iter (
|
||||
fun (file, expr) ->
|
||||
msg (f_"Editing: %s") file;
|
||||
|
||||
if not (g#is_file file) then (
|
||||
eprintf (f_"%s: error: %s is not a regular file in the guest\n")
|
||||
prog file;
|
||||
exit 1
|
||||
);
|
||||
|
||||
Perl_edit.edit_file ~debug g file expr
|
||||
) edit;
|
||||
|
||||
(* Delete files. *)
|
||||
List.iter (
|
||||
fun file ->
|
||||
msg (f_"Deleting: %s") file;
|
||||
g#rm_rf file
|
||||
) delete;
|
||||
|
||||
(* Scrub files. *)
|
||||
List.iter (
|
||||
fun file ->
|
||||
msg (f_"Scrubbing: %s") file;
|
||||
g#scrub_file file
|
||||
) scrub;
|
||||
|
||||
(* Firstboot scripts/commands/install. *)
|
||||
let () =
|
||||
let i = ref 0 in
|
||||
List.iter (
|
||||
fun op ->
|
||||
incr i;
|
||||
match op with
|
||||
| `Script script ->
|
||||
msg (f_"Installing firstboot script: [%d] %s") !i script;
|
||||
let cmd = read_whole_file script in
|
||||
Firstboot.add_firstboot_script g root !i cmd
|
||||
| `Command cmd ->
|
||||
msg (f_"Installing firstboot command: [%d] %s") !i cmd;
|
||||
Firstboot.add_firstboot_script g root !i cmd
|
||||
| `Packages pkgs ->
|
||||
msg (f_"Installing firstboot packages: [%d] %s") !i
|
||||
(String.concat " " pkgs);
|
||||
let cmd = guest_install_command pkgs in
|
||||
Firstboot.add_firstboot_script g root !i cmd
|
||||
) firstboot in
|
||||
|
||||
(* Run scripts. *)
|
||||
List.iter (
|
||||
function
|
||||
| `Script script ->
|
||||
msg (f_"Running: %s") script;
|
||||
let cmd = read_whole_file script in
|
||||
do_run ~display:script cmd
|
||||
| `Command cmd ->
|
||||
msg (f_"Running: %s") cmd;
|
||||
do_run ~display:cmd cmd
|
||||
) run;
|
||||
|
||||
(* Clean up the log file:
|
||||
*
|
||||
* If debugging, dump out the log file.
|
||||
* Then if asked, scrub the log file.
|
||||
*)
|
||||
if debug then debug_logfile ();
|
||||
if scrub_logfile && g#exists logfile then (
|
||||
msg (f_"Scrubbing the log file");
|
||||
|
||||
(* Try various methods with decreasing complexity. *)
|
||||
try g#scrub_file logfile
|
||||
with _ -> g#rm_f logfile
|
||||
);
|
||||
|
||||
(* Collect some stats about the final output file.
|
||||
* Notes:
|
||||
* - These are virtual disk stats.
|
||||
* - Never fail here.
|
||||
*)
|
||||
let stats =
|
||||
if not quiet then (
|
||||
try
|
||||
(* Calculate the free space (in bytes) across all mounted
|
||||
* filesystems in the guest.
|
||||
*)
|
||||
let free_bytes, total_bytes =
|
||||
let filesystems = List.map snd (g#mountpoints ()) in
|
||||
let stats = List.map g#statvfs filesystems in
|
||||
let stats = List.map (
|
||||
fun { G.bfree = bfree; bsize = bsize; blocks = blocks } ->
|
||||
bfree *^ bsize, blocks *^ bsize
|
||||
) stats in
|
||||
List.fold_left (
|
||||
fun (f,t) (f',t') -> f +^ f', t +^ t'
|
||||
) (0L, 0L) stats in
|
||||
let free_percent = 100L *^ free_bytes /^ total_bytes in
|
||||
|
||||
Some (
|
||||
String.concat "\n" [
|
||||
sprintf (f_"Output: %s") output;
|
||||
sprintf (f_"Total usable space: %s")
|
||||
(human_size total_bytes);
|
||||
sprintf (f_"Free space: %s (%Ld%%)")
|
||||
(human_size free_bytes) free_percent;
|
||||
] ^ "\n"
|
||||
)
|
||||
with
|
||||
_ -> None
|
||||
)
|
||||
else None in
|
||||
|
||||
(* Unmount everything and we're done! *)
|
||||
msg (f_"Finishing off");
|
||||
|
||||
(* Kill any daemons (eg. started by newly installed packages) using
|
||||
* the sysroot.
|
||||
* XXX How to make this nicer?
|
||||
* XXX fuser returns an error if it doesn't kill any processes, which
|
||||
* is not very useful.
|
||||
*)
|
||||
(try ignore (g#debug "sh" [| "fuser"; "-k"; "/sysroot" |])
|
||||
with exn ->
|
||||
if debug then
|
||||
eprintf (f_"%s: %s (ignored)\n") prog (Printexc.to_string exn)
|
||||
);
|
||||
g#ping_daemon (); (* tiny delay after kill *)
|
||||
|
||||
g#umount_all ();
|
||||
g#shutdown ();
|
||||
g#close ();
|
||||
|
||||
(* Because we used cache=unsafe when writing the output file, the
|
||||
* file might not be committed to disk. This is a problem if qemu is
|
||||
* immediately used afterwards with cache=none (which uses O_DIRECT
|
||||
* and therefore bypasses the host cache). In general you should not
|
||||
* use cache=none.
|
||||
*)
|
||||
if sync then
|
||||
Fsync.file output;
|
||||
|
||||
(* Now that we've finished the build, don't delete the output file on
|
||||
* exit.
|
||||
*)
|
||||
delete_output_file := false;
|
||||
|
||||
(* Print the stats calculated above. *)
|
||||
Pervasives.flush Pervasives.stdout;
|
||||
Pervasives.flush Pervasives.stderr;
|
||||
|
||||
match stats with
|
||||
| None -> ()
|
||||
| Some stats -> print_string stats
|
||||
|
||||
let () =
|
||||
try main ()
|
||||
with
|
||||
| Unix_error (code, fname, "") -> (* from a syscall *)
|
||||
eprintf (f_"%s: error: %s: %s\n") prog fname (error_message code);
|
||||
exit 1
|
||||
| Unix_error (code, fname, param) -> (* from a syscall *)
|
||||
eprintf (f_"%s: error: %s: %s: %s\n") prog fname (error_message code) param;
|
||||
exit 1
|
||||
| G.Error msg -> (* from libguestfs *)
|
||||
eprintf (f_"%s: libguestfs error: %s\n") prog msg;
|
||||
exit 1
|
||||
| Failure msg -> (* from failwith/failwithf *)
|
||||
eprintf (f_"%s: failure: %s\n") prog msg;
|
||||
exit 1
|
||||
| Invalid_argument msg -> (* probably should never happen *)
|
||||
eprintf (f_"%s: internal error: invalid argument: %s\n") prog msg;
|
||||
exit 1
|
||||
| Assert_failure (file, line, char) -> (* should never happen *)
|
||||
eprintf (f_"%s: internal error: assertion failed at %s, line %d, char %d\n") prog file line char;
|
||||
exit 1
|
||||
| Not_found -> (* should never happen *)
|
||||
eprintf (f_"%s: internal error: Not_found exception was thrown\n") prog;
|
||||
exit 1
|
||||
| exn -> (* something not matched above *)
|
||||
eprintf (f_"%s: exception: %s\n") prog (Printexc.to_string exn);
|
||||
exit 1
|
||||
421
builder/cmdline.ml
Normal file
421
builder/cmdline.ml
Normal file
@@ -0,0 +1,421 @@
|
||||
(* virt-builder
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*)
|
||||
|
||||
(* Command line argument parsing. *)
|
||||
|
||||
open Common_gettext.Gettext
|
||||
open Common_utils
|
||||
|
||||
module G = Guestfs
|
||||
|
||||
open Password
|
||||
|
||||
open Unix
|
||||
open Printf
|
||||
|
||||
let prog = Filename.basename Sys.executable_name
|
||||
|
||||
let default_cachedir =
|
||||
try Some (Sys.getenv "XDG_CACHE_HOME" // "virt-builder")
|
||||
with Not_found ->
|
||||
try Some (Sys.getenv "HOME" // ".cache" // "virt-builder")
|
||||
with Not_found ->
|
||||
None (* no cache directory *)
|
||||
|
||||
let default_source = "http://libguestfs.org/download/builder/index.asc"
|
||||
|
||||
let parse_cmdline () =
|
||||
let display_version () =
|
||||
printf "virt-builder %s\n" Config.package_version;
|
||||
exit 0
|
||||
in
|
||||
|
||||
let mode = ref `Install in
|
||||
let list_mode () = mode := `List in
|
||||
let notes_mode () = mode := `Notes in
|
||||
let get_kernel_mode () = mode := `Get_kernel in
|
||||
let cache_all_mode () = mode := `Cache_all in
|
||||
let print_cache_mode () = mode := `Print_cache in
|
||||
let delete_cache_mode () = mode := `Delete_cache in
|
||||
|
||||
let attach = ref [] in
|
||||
let attach_format = ref None in
|
||||
let set_attach_format = function
|
||||
| "auto" -> attach_format := None
|
||||
| s -> attach_format := Some s
|
||||
in
|
||||
let attach_disk s = attach := (!attach_format, s) :: !attach in
|
||||
|
||||
let cache = ref default_cachedir in
|
||||
let set_cache arg = cache := Some arg in
|
||||
let no_cache () = cache := None in
|
||||
|
||||
let check_signature = ref true in
|
||||
let curl = ref "curl" in
|
||||
let debug = ref false in
|
||||
|
||||
let delete = ref [] in
|
||||
let add_delete s = delete := s :: !delete in
|
||||
|
||||
let edit = ref [] in
|
||||
let add_edit arg =
|
||||
let i =
|
||||
try String.index arg ':'
|
||||
with Not_found ->
|
||||
eprintf (f_"%s: invalid --edit format, see the man page.\n") prog;
|
||||
exit 1 in
|
||||
let len = String.length arg in
|
||||
let file = String.sub arg 0 i in
|
||||
let expr = String.sub arg (i+1) (len-(i+1)) in
|
||||
edit := (file, expr) :: !edit
|
||||
in
|
||||
|
||||
let fingerprints = ref [] in
|
||||
let add_fingerprint arg = fingerprints := arg :: !fingerprints in
|
||||
|
||||
let firstboot = ref [] in
|
||||
let add_firstboot s =
|
||||
if not (Sys.file_exists s) then (
|
||||
if not (String.contains s ' ') then
|
||||
eprintf (f_"%s: %s: %s: file not found\n") prog "--firstboot" s
|
||||
else
|
||||
eprintf (f_"%s: %s: %s: file not found [did you mean %s?]\n") prog "--firstboot" s "--firstboot-command";
|
||||
exit 1
|
||||
);
|
||||
firstboot := `Script s :: !firstboot
|
||||
in
|
||||
let add_firstboot_cmd s = firstboot := `Command s :: !firstboot in
|
||||
let add_firstboot_install pkgs =
|
||||
let pkgs = string_nsplit "," pkgs in
|
||||
firstboot := `Packages pkgs :: !firstboot
|
||||
in
|
||||
|
||||
let format = ref "" in
|
||||
let gpg = ref "gpg" in
|
||||
|
||||
let hostname = ref None in
|
||||
let set_hostname s = hostname := Some s in
|
||||
|
||||
let install = ref [] in
|
||||
let add_install pkgs =
|
||||
let pkgs = string_nsplit "," pkgs in
|
||||
install := pkgs @ !install
|
||||
in
|
||||
|
||||
let list_long = ref false in
|
||||
|
||||
let memsize = ref None in
|
||||
let set_memsize arg = memsize := Some arg in
|
||||
|
||||
let mkdirs = ref [] in
|
||||
let add_mkdir arg = mkdirs := arg :: !mkdirs in
|
||||
|
||||
let network = ref true in
|
||||
let output = ref "" in
|
||||
|
||||
let password_crypto : password_crypto option ref = ref None in
|
||||
let set_password_crypto arg =
|
||||
password_crypto := Some (password_crypto_of_string ~prog arg)
|
||||
in
|
||||
|
||||
let quiet = ref false in
|
||||
|
||||
let root_password = ref None in
|
||||
let set_root_password arg =
|
||||
let pw = parse_selector ~prog arg in
|
||||
root_password := Some pw
|
||||
in
|
||||
|
||||
let run = ref [] in
|
||||
let add_run s =
|
||||
if not (Sys.file_exists s) then (
|
||||
if not (String.contains s ' ') then
|
||||
eprintf (f_"%s: %s: %s: file not found\n") prog "--run" s
|
||||
else
|
||||
eprintf (f_"%s: %s: %s: file not found [did you mean %s?]\n") prog "--run" s "--run-command";
|
||||
exit 1
|
||||
);
|
||||
run := `Script s :: !run
|
||||
in
|
||||
let add_run_cmd s = run := `Command s :: !run in
|
||||
|
||||
let scrub = ref [] in
|
||||
let add_scrub s = scrub := s :: !scrub in
|
||||
|
||||
let scrub_logfile = ref false in
|
||||
|
||||
let size = ref None in
|
||||
let set_size arg = size := Some (parse_size ~prog arg) in
|
||||
|
||||
let smp = ref None in
|
||||
let set_smp arg = smp := Some arg in
|
||||
|
||||
let sources = ref [] in
|
||||
let add_source arg = sources := arg :: !sources in
|
||||
|
||||
let sync = ref true in
|
||||
|
||||
let upload = ref [] in
|
||||
let add_upload arg =
|
||||
let i =
|
||||
try String.index arg ':'
|
||||
with Not_found ->
|
||||
eprintf (f_"%s: invalid --upload format, see the man page.\n") prog;
|
||||
exit 1 in
|
||||
let len = String.length arg in
|
||||
let file = String.sub arg 0 i in
|
||||
if not (Sys.file_exists file) then (
|
||||
eprintf (f_"%s: --upload: %s: file not found\n") prog file;
|
||||
exit 1
|
||||
);
|
||||
let dest = String.sub arg (i+1) (len-(i+1)) in
|
||||
upload := (file, dest) :: !upload
|
||||
in
|
||||
|
||||
let writes = ref [] in
|
||||
let add_write arg =
|
||||
let i =
|
||||
try String.index arg ':'
|
||||
with Not_found ->
|
||||
eprintf (f_"%s: invalid --write format, see the man page.\n") prog;
|
||||
exit 1 in
|
||||
let len = String.length arg in
|
||||
let file = String.sub arg 0 i in
|
||||
let content = String.sub arg (i+1) (len-(i+1)) in
|
||||
writes := (file, content) :: !writes
|
||||
in
|
||||
|
||||
let ditto = " -\"-" in
|
||||
let argspec = Arg.align [
|
||||
"--attach", Arg.String attach_disk, "iso" ^ " " ^ s_"Attach data disk/ISO during install";
|
||||
"--attach-format", Arg.String set_attach_format,
|
||||
"format" ^ " " ^ s_"Set attach disk format";
|
||||
"--cache", Arg.String set_cache, "dir" ^ " " ^ s_"Set template cache dir";
|
||||
"--no-cache", Arg.Unit no_cache, " " ^ s_"Disable template cache";
|
||||
"--cache-all-templates", Arg.Unit cache_all_mode,
|
||||
" " ^ s_"Download all templates to the cache";
|
||||
"--check-signature", Arg.Set check_signature,
|
||||
" " ^ s_"Check digital signatures";
|
||||
"--check-signatures", Arg.Set check_signature, ditto;
|
||||
"--no-check-signature", Arg.Clear check_signature,
|
||||
" " ^ s_"Disable digital signatures";
|
||||
"--no-check-signatures", Arg.Clear check_signature, ditto;
|
||||
"--curl", Arg.Set_string curl, "curl" ^ " " ^ s_"Set curl binary/command";
|
||||
"--delete", Arg.String add_delete, "name" ^ " " ^ s_"Delete a file or dir";
|
||||
"--delete-cache", Arg.Unit delete_cache_mode,
|
||||
" " ^ s_"Delete the template cache";
|
||||
"--edit", Arg.String add_edit, "file:expr" ^ " " ^ s_"Edit file with Perl expr";
|
||||
"--fingerprint", Arg.String add_fingerprint,
|
||||
"AAAA.." ^ " " ^ s_"Fingerprint of valid signing key";
|
||||
"--firstboot", Arg.String add_firstboot, "script" ^ " " ^ s_"Run script at first guest boot";
|
||||
"--firstboot-command", Arg.String add_firstboot_cmd, "cmd+args" ^ " " ^ s_"Run command at first guest boot";
|
||||
"--firstboot-install", Arg.String add_firstboot_install,
|
||||
"pkg,pkg" ^ " " ^ s_"Add package(s) to install at firstboot";
|
||||
"--format", Arg.Set_string format, "raw|qcow2" ^ " " ^ s_"Output format (default: raw)";
|
||||
"--get-kernel", Arg.Unit get_kernel_mode,
|
||||
"image" ^ " " ^ s_"Get kernel from image";
|
||||
"--gpg", Arg.Set_string gpg, "gpg" ^ " " ^ s_"Set GPG binary/command";
|
||||
"--hostname", Arg.String set_hostname, "hostname" ^ " " ^ s_"Set the hostname";
|
||||
"--install", Arg.String add_install, "pkg,pkg" ^ " " ^ s_"Add package(s) to install";
|
||||
"-l", Arg.Unit list_mode, " " ^ s_"List available templates";
|
||||
"--list", Arg.Unit list_mode, ditto;
|
||||
"--long", Arg.Set list_long, ditto;
|
||||
"--no-logfile", Arg.Set scrub_logfile, " " ^ s_"Scrub build log file";
|
||||
"--long-options", Arg.Unit display_long_options, " " ^ s_"List long options";
|
||||
"-m", Arg.Int set_memsize, "mb" ^ " " ^ s_"Set memory size";
|
||||
"--memsize", Arg.Int set_memsize, "mb" ^ ditto;
|
||||
"--mkdir", Arg.String add_mkdir, "dir" ^ " " ^ s_"Create directory";
|
||||
"--network", Arg.Set network, " " ^ s_"Enable appliance network (default)";
|
||||
"--no-network", Arg.Clear network, " " ^ s_"Disable appliance network";
|
||||
"--notes", Arg.Unit notes_mode, " " ^ s_"Display installation notes";
|
||||
"-o", Arg.Set_string output, "file" ^ " " ^ s_"Set output filename";
|
||||
"--output", Arg.Set_string output, "file" ^ ditto;
|
||||
"--password-crypto", Arg.String set_password_crypto,
|
||||
"md5|sha256|sha512" ^ " " ^ s_"Set password crypto";
|
||||
"--print-cache", Arg.Unit print_cache_mode,
|
||||
" " ^ s_"Print info about template cache";
|
||||
"--quiet", Arg.Set quiet, " " ^ s_"No progress messages";
|
||||
"--root-password", Arg.String set_root_password,
|
||||
"..." ^ " " ^ s_"Set root password";
|
||||
"--run", Arg.String add_run, "script" ^ " " ^ s_"Run script in disk image";
|
||||
"--run-command", Arg.String add_run_cmd, "cmd+args" ^ " " ^ s_"Run command in disk image";
|
||||
"--scrub", Arg.String add_scrub, "name" ^ " " ^ s_"Scrub a file";
|
||||
"--size", Arg.String set_size, "size" ^ " " ^ s_"Set output disk size";
|
||||
"--smp", Arg.Int set_smp, "vcpus" ^ " " ^ s_"Set number of vCPUs";
|
||||
"--source", Arg.String add_source, "URL" ^ " " ^ s_"Set source URL";
|
||||
"--no-sync", Arg.Clear sync, " " ^ s_"Do not fsync output file on exit";
|
||||
"--upload", Arg.String add_upload, "file:dest" ^ " " ^ s_"Upload file to dest";
|
||||
"-v", Arg.Set debug, " " ^ s_"Enable debugging messages";
|
||||
"--verbose", Arg.Set debug, ditto;
|
||||
"-V", Arg.Unit display_version, " " ^ s_"Display version and exit";
|
||||
"--version", Arg.Unit display_version, ditto;
|
||||
"--write", Arg.String add_write, "file:content" ^ " " ^ s_"Write file";
|
||||
] in
|
||||
long_options := argspec;
|
||||
|
||||
let args = ref [] in
|
||||
let anon_fun s = args := s :: !args in
|
||||
let usage_msg =
|
||||
sprintf (f_"\
|
||||
%s: build virtual machine images quickly
|
||||
|
||||
virt-builder OS-VERSION
|
||||
virt-builder -l
|
||||
virt-builder --notes OS-VERSION
|
||||
virt-builder --print-cache
|
||||
virt-builder --cache-all-templates
|
||||
virt-builder --delete-cache
|
||||
virt-builder --get-kernel IMAGE
|
||||
|
||||
A short summary of the options is given below. For detailed help please
|
||||
read the man page virt-builder(1).
|
||||
")
|
||||
prog in
|
||||
Arg.parse argspec anon_fun usage_msg;
|
||||
|
||||
(* Dereference options. *)
|
||||
let args = List.rev !args in
|
||||
let mode = !mode in
|
||||
let attach = List.rev !attach in
|
||||
let cache = !cache in
|
||||
let check_signature = !check_signature in
|
||||
let curl = !curl in
|
||||
let debug = !debug in
|
||||
let delete = List.rev !delete in
|
||||
let edit = List.rev !edit in
|
||||
let fingerprints = List.rev !fingerprints in
|
||||
let firstboot = List.rev !firstboot in
|
||||
let run = List.rev !run in
|
||||
let format = match !format with "" -> None | s -> Some s in
|
||||
let gpg = !gpg in
|
||||
let hostname = !hostname in
|
||||
let install = !install in
|
||||
let list_long = !list_long in
|
||||
let memsize = !memsize in
|
||||
let mkdirs = List.rev !mkdirs in
|
||||
let network = !network in
|
||||
let output = match !output with "" -> None | s -> Some s in
|
||||
let password_crypto = !password_crypto in
|
||||
let quiet = !quiet in
|
||||
let root_password = !root_password in
|
||||
let scrub = List.rev !scrub in
|
||||
let scrub_logfile = !scrub_logfile in
|
||||
let size = !size in
|
||||
let smp = !smp in
|
||||
let sources = List.rev !sources in
|
||||
let sync = !sync in
|
||||
let upload = List.rev !upload in
|
||||
let writes = List.rev !writes in
|
||||
|
||||
(* Check options. *)
|
||||
let arg =
|
||||
match mode with
|
||||
| `Install ->
|
||||
(match args with
|
||||
| [arg] -> arg
|
||||
| [] ->
|
||||
eprintf (f_"%s: virt-builder os-version\nMissing 'os-version'. Use '--list' to list available template names.\n") prog;
|
||||
exit 1
|
||||
| _ ->
|
||||
eprintf (f_"%s: virt-builder: too many parameters, expecting 'os-version'\n") prog;
|
||||
exit 1
|
||||
)
|
||||
| `List ->
|
||||
(match args with
|
||||
| [] -> ""
|
||||
| _ ->
|
||||
eprintf (f_"%s: virt-builder --list does not need any extra arguments.\n") prog;
|
||||
exit 1
|
||||
)
|
||||
| `Notes ->
|
||||
(match args with
|
||||
| [arg] -> arg
|
||||
| [] ->
|
||||
eprintf (f_"%s: virt-builder --notes os-version\nMissing 'os-version'. Use '--list' to list available template names.\n") prog;
|
||||
exit 1
|
||||
| _ ->
|
||||
eprintf (f_"%s: virt-builder: too many parameters, expecting 'os-version'\n") prog;
|
||||
exit 1
|
||||
)
|
||||
| `Cache_all
|
||||
| `Print_cache
|
||||
| `Delete_cache ->
|
||||
(match args with
|
||||
| [] -> ""
|
||||
| _ ->
|
||||
eprintf (f_"%s: virt-builder --cache-all-templates/--print-cache/--delete-cache does not need any extra arguments.\n") prog;
|
||||
exit 1
|
||||
)
|
||||
| `Get_kernel ->
|
||||
(match args with
|
||||
| [arg] -> arg
|
||||
| [] ->
|
||||
eprintf (f_"%s: virt-builder --get-kernel image\nMissing 'image' (disk image file) argument.\n") prog;
|
||||
exit 1
|
||||
| _ ->
|
||||
eprintf (f_"%s: virt-builder --get-kernel: too many parameters\n") prog;
|
||||
exit 1
|
||||
) in
|
||||
|
||||
(* Check source(s) and fingerprint(s), or use environment or default. *)
|
||||
let sources =
|
||||
let list_split = function "" -> [] | str -> string_nsplit "," str in
|
||||
let rec repeat x = function
|
||||
| 0 -> [] | 1 -> [x]
|
||||
| n -> x :: repeat x (n-1)
|
||||
in
|
||||
|
||||
let sources =
|
||||
if sources <> [] then sources
|
||||
else (
|
||||
try list_split (Sys.getenv "VIRT_BUILDER_SOURCE")
|
||||
with Not_found -> [ default_source ]
|
||||
) in
|
||||
let fingerprints =
|
||||
if fingerprints <> [] then fingerprints
|
||||
else (
|
||||
try list_split (Sys.getenv "VIRT_BUILDER_FINGERPRINT")
|
||||
with Not_found -> [ Sigchecker.default_fingerprint ]
|
||||
) in
|
||||
|
||||
let nr_sources = List.length sources in
|
||||
let fingerprints =
|
||||
match fingerprints with
|
||||
| [fingerprint] ->
|
||||
(* You're allowed to have multiple sources and one fingerprint: it
|
||||
* means that the same fingerprint is used for all sources.
|
||||
*)
|
||||
repeat fingerprint nr_sources
|
||||
| xs -> xs in
|
||||
|
||||
if List.length fingerprints <> nr_sources then (
|
||||
eprintf (f_"%s: source and fingerprint lists are not the same length\n")
|
||||
prog;
|
||||
exit 1
|
||||
);
|
||||
|
||||
assert (nr_sources > 0);
|
||||
|
||||
(* Combine the sources and fingerprints into a single list of pairs. *)
|
||||
List.combine sources fingerprints in
|
||||
|
||||
mode, arg,
|
||||
attach, cache, check_signature, curl, debug, delete, edit,
|
||||
firstboot, run, format, gpg, hostname, install, list_long, memsize, mkdirs,
|
||||
network, output, password_crypto, quiet, root_password, scrub,
|
||||
scrub_logfile, size, smp, sources, sync, upload, writes
|
||||
128
builder/downloader.ml
Normal file
128
builder/downloader.ml
Normal file
@@ -0,0 +1,128 @@
|
||||
(* virt-builder
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*)
|
||||
|
||||
open Common_gettext.Gettext
|
||||
open Common_utils
|
||||
|
||||
open Unix
|
||||
open Printf
|
||||
|
||||
let quote = Filename.quote
|
||||
let (//) = Filename.concat
|
||||
|
||||
let cache_of_name cachedir name revision =
|
||||
cachedir // sprintf "%s.%d" name revision
|
||||
|
||||
type uri = string
|
||||
type filename = string
|
||||
|
||||
type t = {
|
||||
debug : bool;
|
||||
curl : string;
|
||||
cache : string option; (* cache directory for templates *)
|
||||
}
|
||||
|
||||
let create ~debug ~curl ~cache = {
|
||||
debug = debug;
|
||||
curl = curl;
|
||||
cache = cache;
|
||||
}
|
||||
|
||||
let rec download t ?template ?progress_bar uri =
|
||||
match template with
|
||||
| None -> (* no cache, simple download *)
|
||||
(* Create a temporary name. *)
|
||||
let tmpfile = Filename.temp_file "vbcache" ".txt" in
|
||||
download_to t ?progress_bar uri tmpfile;
|
||||
(tmpfile, true)
|
||||
|
||||
| Some (name, revision) ->
|
||||
match t.cache with
|
||||
| None ->
|
||||
(* Not using the cache at all? *)
|
||||
download t ?progress_bar uri
|
||||
|
||||
| Some cachedir ->
|
||||
let filename = cache_of_name cachedir name revision in
|
||||
|
||||
(* Is the requested template name + revision in the cache already?
|
||||
* If not, download it.
|
||||
*)
|
||||
if not (Sys.file_exists filename) then
|
||||
download_to t ?progress_bar uri filename;
|
||||
|
||||
(filename, false)
|
||||
|
||||
and download_to t ?(progress_bar = false) uri filename =
|
||||
(* Get the status code first to ensure the file exists. *)
|
||||
let cmd = sprintf "%s%s -g -o /dev/null -I -w '%%{http_code}' %s"
|
||||
t.curl
|
||||
(if t.debug then "" else " -s -S")
|
||||
(quote uri) in
|
||||
if t.debug then eprintf "%s\n%!" cmd;
|
||||
let chan = open_process_in cmd in
|
||||
let status_code = input_line chan in
|
||||
let stat = close_process_in chan in
|
||||
(match stat with
|
||||
| WEXITED 0 -> ()
|
||||
| WEXITED i ->
|
||||
eprintf (f_"virt-builder: curl (download) command failed downloading '%s'\n") uri;
|
||||
exit 1
|
||||
| WSIGNALED i ->
|
||||
eprintf (f_"virt-builder: external command '%s' killed by signal %d\n")
|
||||
cmd i;
|
||||
exit 1
|
||||
| WSTOPPED i ->
|
||||
eprintf (f_"virt-builder: external command '%s' stopped by signal %d\n")
|
||||
cmd i;
|
||||
exit 1
|
||||
);
|
||||
let bad_status_code = function
|
||||
| "" -> true
|
||||
| s when s.[0] = '4' -> true (* 4xx *)
|
||||
| s when s.[0] = '5' -> true (* 5xx *)
|
||||
| _ -> false
|
||||
in
|
||||
if bad_status_code status_code then (
|
||||
eprintf (f_"virt-builder: failed to download %s: HTTP status code %s\n")
|
||||
uri status_code;
|
||||
exit 1
|
||||
);
|
||||
|
||||
(* Now download the file.
|
||||
*
|
||||
* Note because there may be parallel virt-builder instances running
|
||||
* and also to avoid partial downloads in the cachedir if the network
|
||||
* fails, we download to a random name in the cache and then
|
||||
* atomically rename it to the final filename.
|
||||
*)
|
||||
let filename_new = filename ^ "." ^ string_random8 () in
|
||||
unlink_on_exit filename_new;
|
||||
let cmd = sprintf "%s%s -g -o %s %s"
|
||||
t.curl
|
||||
(if t.debug then "" else if progress_bar then " -#" else " -s -S")
|
||||
(quote filename_new) (quote uri) in
|
||||
if t.debug then eprintf "%s\n%!" cmd;
|
||||
let r = Sys.command cmd in
|
||||
if r <> 0 then (
|
||||
eprintf (f_"virt-builder: curl (download) command failed downloading '%s'\n") uri;
|
||||
exit 1
|
||||
);
|
||||
|
||||
(* Rename the file if curl was successful. *)
|
||||
rename filename_new filename
|
||||
47
builder/downloader.mli
Normal file
47
builder/downloader.mli
Normal file
@@ -0,0 +1,47 @@
|
||||
(* virt-builder
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*)
|
||||
|
||||
(** This module is a wrapper around curl, plus local caching. *)
|
||||
|
||||
val cache_of_name : string -> string -> int -> string
|
||||
(** [cache_of_name cachedir name revision] returns the filename
|
||||
of the cached file. (Note: It doesn't check if the filename
|
||||
exists, this is just a simple string transformation). *)
|
||||
|
||||
type uri = string
|
||||
type filename = string
|
||||
|
||||
type t
|
||||
(** The abstract data type. *)
|
||||
|
||||
val create : debug:bool -> curl:string -> cache:string option -> t
|
||||
(** Create the abstract type. *)
|
||||
|
||||
val download : t -> ?template:(string*int) -> ?progress_bar:bool -> uri -> (filename * bool)
|
||||
(** Download the URI, returning the downloaded filename and a
|
||||
temporary file flag. The temporary file flag is [true] iff
|
||||
the downloaded file is temporary and should be deleted by the
|
||||
caller (otherwise it's in the cache and you shouldn't delete it).
|
||||
|
||||
For templates, you must supply [~template:(name, revision)]. This
|
||||
causes the cache to be used (if possible). Name and revision are
|
||||
used for cache control (see the man page for details).
|
||||
|
||||
If [~progress_bar:true] then display a progress bar if the file
|
||||
doesn't come from the cache. In debug mode, progress messages
|
||||
are always displayed. *)
|
||||
121
builder/get_kernel.ml
Normal file
121
builder/get_kernel.ml
Normal file
@@ -0,0 +1,121 @@
|
||||
(* virt-builder
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*)
|
||||
|
||||
open Common_gettext.Gettext
|
||||
open Common_utils
|
||||
|
||||
module G = Guestfs
|
||||
|
||||
open Printf
|
||||
|
||||
let rex_numbers = Str.regexp "^\\([0-9]+\\)\\(.*\\)$"
|
||||
let rex_letters = Str.regexp_case_fold "^\\([a-z]+\\)\\(.*\\)$"
|
||||
|
||||
(* Originally:
|
||||
* http://rwmj.wordpress.com/2013/09/13/get-kernel-and-initramfs-from-a-disk-image/
|
||||
*)
|
||||
let rec get_kernel ~debug ?format ?output disk =
|
||||
let g = new G.guestfs () in
|
||||
if debug then g#set_trace true;
|
||||
g#add_drive_opts ?format ~readonly:true disk;
|
||||
g#launch ();
|
||||
|
||||
let roots = g#inspect_os () in
|
||||
if Array.length roots = 0 then (
|
||||
eprintf (f_"virt-builder: get-kernel: no operating system found\n");
|
||||
exit 1
|
||||
);
|
||||
if Array.length roots > 1 then (
|
||||
eprintf (f_"virt-builder: get-kernel: daual/mult-boot images are not supported by this tool\n");
|
||||
exit 1
|
||||
);
|
||||
let root = roots.(0) in
|
||||
|
||||
(* Mount up the disks. *)
|
||||
let mps = g#inspect_get_mountpoints root in
|
||||
let cmp (a,_) (b,_) = compare (String.length a) (String.length b) in
|
||||
let mps = List.sort cmp mps in
|
||||
List.iter (
|
||||
fun (mp, dev) ->
|
||||
try g#mount_ro dev mp
|
||||
with Guestfs.Error msg -> eprintf "%s (ignored)\n" msg
|
||||
) mps;
|
||||
|
||||
(* Get all kernels and initramfses. *)
|
||||
let glob w = Array.to_list (g#glob_expand w) in
|
||||
let kernels = glob "/boot/vmlinuz-*" in
|
||||
let initrds = glob "/boot/initramfs-*" in
|
||||
|
||||
(* Old RHEL: *)
|
||||
let initrds = if initrds <> [] then initrds else glob "/boot/initrd-*" in
|
||||
|
||||
(* Debian/Ubuntu: *)
|
||||
let initrds = if initrds <> [] then initrds else glob "/boot/initrd.img-*" in
|
||||
|
||||
(* Sort by version to get the latest version as first element. *)
|
||||
let kernels = List.rev (List.sort compare_version kernels) in
|
||||
let initrds = List.rev (List.sort compare_version initrds) in
|
||||
|
||||
if kernels = [] then (
|
||||
eprintf (f_"virt-builder: no kernel found\n");
|
||||
exit 1
|
||||
);
|
||||
|
||||
(* Download the latest. *)
|
||||
let outputdir =
|
||||
match output with
|
||||
| None -> Filename.current_dir_name
|
||||
| Some dir -> dir in
|
||||
let kernel_in = List.hd kernels in
|
||||
let kernel_out = outputdir // Filename.basename kernel_in in
|
||||
printf "download: %s -> %s\n%!" kernel_in kernel_out;
|
||||
g#download kernel_in kernel_out;
|
||||
|
||||
if initrds <> [] then (
|
||||
let initrd_in = List.hd initrds in
|
||||
let initrd_out = outputdir // Filename.basename initrd_in in
|
||||
printf "download: %s -> %s\n%!" initrd_in initrd_out;
|
||||
g#download initrd_in initrd_out
|
||||
);
|
||||
|
||||
(* Shutdown. *)
|
||||
g#shutdown ();
|
||||
g#close ()
|
||||
|
||||
and compare_version v1 v2 =
|
||||
compare (split_version v1) (split_version v2)
|
||||
|
||||
and split_version = function
|
||||
| "" -> []
|
||||
| str ->
|
||||
let first, rest =
|
||||
if Str.string_match rex_numbers str 0 then (
|
||||
let n = Str.matched_group 1 str in
|
||||
let rest = Str.matched_group 2 str in
|
||||
let n =
|
||||
try `Number (int_of_string n)
|
||||
with Failure "int_of_string" -> `String n in
|
||||
n, rest
|
||||
)
|
||||
else if Str.string_match rex_letters str 0 then
|
||||
`String (Str.matched_group 1 str), Str.matched_group 2 str
|
||||
else (
|
||||
let len = String.length str in
|
||||
`Char str.[0], String.sub str 1 (len-1)
|
||||
) in
|
||||
first :: split_version rest
|
||||
19
builder/get_kernel.mli
Normal file
19
builder/get_kernel.mli
Normal file
@@ -0,0 +1,19 @@
|
||||
(* virt-builder
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*)
|
||||
|
||||
val get_kernel : debug:bool -> ?format:string -> ?output:string -> string -> unit
|
||||
123
builder/index-parse.y
Normal file
123
builder/index-parse.y
Normal file
@@ -0,0 +1,123 @@
|
||||
/* libguestfs virt-builder tool -*- fundamental -*-
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
%{
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "index-struct.h"
|
||||
|
||||
extern void yyerror (const char *);
|
||||
extern int yylex (void);
|
||||
|
||||
/* Join two strings with \n */
|
||||
static char *
|
||||
concat_newline (const char *str1, const char *str2)
|
||||
{
|
||||
size_t len1, len2, len;
|
||||
char *ret;
|
||||
|
||||
if (str2 == NULL)
|
||||
return strdup (str1);
|
||||
|
||||
len1 = strlen (str1);
|
||||
len2 = strlen (str2);
|
||||
len = len1 + 1 /* \n */ + len2 + 1 /* \0 */;
|
||||
ret = malloc (len);
|
||||
memcpy (ret, str1, len1);
|
||||
ret[len1] = '\n';
|
||||
memcpy (ret + len1 + 1, str2, len2);
|
||||
ret[len-1] = '\0';
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
%locations
|
||||
|
||||
%union {
|
||||
struct section *section;
|
||||
struct field *field;
|
||||
char *str;
|
||||
}
|
||||
|
||||
%token <str> SECTION_HEADER
|
||||
%token <field> FIELD
|
||||
%token <str> VALUE_CONT
|
||||
%token EMPTY_LINE
|
||||
%token PGP_PROLOGUE
|
||||
%token PGP_EPILOGUE
|
||||
|
||||
%type <section> sections section
|
||||
%type <field> fields field
|
||||
%type <str> continuations
|
||||
|
||||
%%
|
||||
|
||||
index:
|
||||
sections
|
||||
{ parsed_index = $1; }
|
||||
| PGP_PROLOGUE sections PGP_EPILOGUE
|
||||
{ parsed_index = $2; }
|
||||
|
||||
sections:
|
||||
section
|
||||
{ $$ = $1; }
|
||||
| section EMPTY_LINE sections
|
||||
{ $$ = $1; $$->next = $3; }
|
||||
|
||||
section:
|
||||
SECTION_HEADER fields
|
||||
{ $$ = malloc (sizeof (struct section));
|
||||
$$->next = NULL;
|
||||
$$->name = $1;
|
||||
$$->fields = $2; }
|
||||
|
||||
fields:
|
||||
/* empty */
|
||||
{ $$ = NULL; }
|
||||
| field fields
|
||||
{ $$ = $1; $$->next = $2; }
|
||||
|
||||
field: FIELD continuations
|
||||
{ $$ = $1;
|
||||
char *old_value = $$->value;
|
||||
$$->value = concat_newline (old_value, $2);
|
||||
free (old_value);
|
||||
free ($2); }
|
||||
|
||||
continuations:
|
||||
/* empty */
|
||||
{ $$ = NULL; }
|
||||
| VALUE_CONT continuations
|
||||
{ $$ = concat_newline ($1, $2);
|
||||
free ($1);
|
||||
free ($2); }
|
||||
|
||||
%%
|
||||
|
||||
void
|
||||
yyerror (const char *msg)
|
||||
{
|
||||
fprintf (stderr, "syntax error at line %d: %s\n",
|
||||
yylloc.first_line, msg);
|
||||
}
|
||||
105
builder/index-parser-c.c
Normal file
105
builder/index-parser-c.c
Normal file
@@ -0,0 +1,105 @@
|
||||
/* virt-builder
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/* This file handles the interface between the C/lex/yacc index file
|
||||
* parser, and the OCaml world. See index_parser.ml for the OCaml
|
||||
* type definition.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <caml/alloc.h>
|
||||
#include <caml/fail.h>
|
||||
#include <caml/memory.h>
|
||||
#include <caml/mlvalues.h>
|
||||
|
||||
#ifdef HAVE_CAML_UNIXSUPPORT_H
|
||||
#include <caml/unixsupport.h>
|
||||
#else
|
||||
#define Nothing ((value) 0)
|
||||
extern void unix_error (int errcode, char * cmdname, value arg) Noreturn;
|
||||
#endif
|
||||
|
||||
#include "index-struct.h"
|
||||
#include "index-parse.h"
|
||||
|
||||
extern FILE *yyin;
|
||||
|
||||
value
|
||||
virt_builder_parse_index (value filenamev)
|
||||
{
|
||||
CAMLparam1 (filenamev);
|
||||
CAMLlocal4 (rv, v, sv, fv);
|
||||
struct section *sections;
|
||||
size_t i, nr_sections;
|
||||
|
||||
yyin = fopen (String_val (filenamev), "r");
|
||||
if (yyin == NULL)
|
||||
unix_error (errno, (char *) "fopen", filenamev);
|
||||
|
||||
if (yyparse () != 0) {
|
||||
fclose (yyin);
|
||||
caml_invalid_argument ("parse error");
|
||||
}
|
||||
|
||||
if (fclose (yyin) == EOF)
|
||||
unix_error (errno, (char *) "fclose", filenamev);
|
||||
|
||||
/* Convert the parsed data to OCaml structures. */
|
||||
nr_sections = 0;
|
||||
for (sections = parsed_index; sections != NULL; sections = sections->next)
|
||||
nr_sections++;
|
||||
rv = caml_alloc (nr_sections, 0);
|
||||
|
||||
for (i = 0, sections = parsed_index; sections != NULL;
|
||||
i++, sections = sections->next) {
|
||||
struct field *fields;
|
||||
size_t j, nr_fields;
|
||||
|
||||
nr_fields = 0;
|
||||
for (fields = sections->fields; fields != NULL; fields = fields->next)
|
||||
nr_fields++;
|
||||
fv = caml_alloc (nr_fields, 0);
|
||||
|
||||
for (j = 0, fields = sections->fields; fields != NULL;
|
||||
j++, fields = fields->next) {
|
||||
v = caml_alloc_tuple (2);
|
||||
sv = caml_copy_string (fields->key);
|
||||
Store_field (v, 0, sv); /* (key, value) */
|
||||
sv = caml_copy_string (fields->value);
|
||||
Store_field (v, 1, sv);
|
||||
Store_field (fv, j, v); /* assign to return array of fields */
|
||||
}
|
||||
|
||||
v = caml_alloc_tuple (2);
|
||||
sv = caml_copy_string (sections->name);
|
||||
Store_field (v, 0, sv); /* (name, fields) */
|
||||
Store_field (v, 1, fv);
|
||||
Store_field (rv, i, v); /* assign to return array of sections */
|
||||
}
|
||||
|
||||
/* Free parsed global data. */
|
||||
free_index ();
|
||||
|
||||
CAMLreturn (rv);
|
||||
}
|
||||
103
builder/index-scan.l
Normal file
103
builder/index-scan.l
Normal file
@@ -0,0 +1,103 @@
|
||||
/* libguestfs virt-builder tool -*- fundamental -*-
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
%{
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "index-parse.h"
|
||||
#include "index-struct.h"
|
||||
|
||||
#define YY_USER_ACTION yylloc.first_line = yylloc.last_line = yylineno;
|
||||
|
||||
extern void yyerror (const char *);
|
||||
|
||||
%}
|
||||
|
||||
%option noyywrap
|
||||
%option yylineno
|
||||
|
||||
%%
|
||||
|
||||
/* Apart from the PGP prologue/epilogue which is a hack, the
|
||||
* scanning strategy is to deal with the file strictly line by
|
||||
* line, and pass those lines up to the parser which deals with
|
||||
* whether they appear in the right order to be meaningful.
|
||||
* Note that flex does longest-match.
|
||||
*/
|
||||
|
||||
/* Ignore comments - '#' MUST appear at the start of a line. */
|
||||
^"#".*\n { seen_comments++; }
|
||||
|
||||
/* An empty line is significant. */
|
||||
^\n { return EMPTY_LINE; }
|
||||
|
||||
/* [...] marks beginning of a section. */
|
||||
^"["[-A-Za-z0-9.]+"]"\n {
|
||||
yylval.str = strndup (yytext+1, yyleng-3);
|
||||
return SECTION_HEADER;
|
||||
}
|
||||
|
||||
/* field=value or field[subfield]=value */
|
||||
^[A-Za-z0-9_.]+("["[A-Za-z0-9_,.]+"]")?"=".*\n {
|
||||
size_t i = strcspn (yytext, "=");
|
||||
yylval.field = malloc (sizeof (struct field));
|
||||
yylval.field->next = NULL;
|
||||
yylval.field->key = strndup (yytext, i);
|
||||
/* Note we chop the final \n off here. */
|
||||
yylval.field->value = strndup (yytext+i+1, yyleng-(i+2));
|
||||
return FIELD;
|
||||
}
|
||||
|
||||
/* Continuation line for multi-line values. */
|
||||
^[[:blank:]].*\n {
|
||||
yylval.str = strndup (yytext+1, yyleng-2);
|
||||
return VALUE_CONT;
|
||||
}
|
||||
|
||||
/* Hack to eat the PGP prologue. */
|
||||
^"-----BEGIN PGP SIGNED MESSAGE-----\n" {
|
||||
int c, prevnl = 0;
|
||||
|
||||
/* Eat everything to the first blank line. */
|
||||
while ((c = input ()) != EOF) {
|
||||
if (c == '\n' && prevnl)
|
||||
break;
|
||||
prevnl = c == '\n';
|
||||
}
|
||||
|
||||
return PGP_PROLOGUE;
|
||||
}
|
||||
|
||||
/* Hack to eat the PGP epilogue. */
|
||||
^"-----BEGIN PGP SIGNATURE-----\n" {
|
||||
/* Eat everything to the end of the file. */
|
||||
while (input () != EOF)
|
||||
;
|
||||
|
||||
return PGP_EPILOGUE;
|
||||
}
|
||||
|
||||
/* anything else is an error */
|
||||
. {
|
||||
yyerror ("unexpected character in input");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
58
builder/index-struct.c
Normal file
58
builder/index-struct.c
Normal file
@@ -0,0 +1,58 @@
|
||||
/* libguestfs virt-builder tool
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "index-struct.h"
|
||||
|
||||
struct section *parsed_index = NULL;
|
||||
int seen_comments = 0;
|
||||
|
||||
static void free_section (struct section *section);
|
||||
static void free_field (struct field *field);
|
||||
|
||||
void
|
||||
free_index (void)
|
||||
{
|
||||
free_section (parsed_index);
|
||||
}
|
||||
|
||||
static void
|
||||
free_section (struct section *section)
|
||||
{
|
||||
if (section) {
|
||||
free_section (section->next);
|
||||
free (section->name);
|
||||
free_field (section->fields);
|
||||
free (section);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
free_field (struct field *field)
|
||||
{
|
||||
if (field) {
|
||||
free_field (field->next);
|
||||
free (field->key);
|
||||
free (field->value);
|
||||
free (field);
|
||||
}
|
||||
}
|
||||
48
builder/index-struct.h
Normal file
48
builder/index-struct.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/* libguestfs virt-builder tool
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/* The data structures produced when parsing the index file. */
|
||||
|
||||
#ifndef INDEX_STRUCT_H
|
||||
#define INDEX_STRUCT_H
|
||||
|
||||
/* A section or list of sections. */
|
||||
struct section {
|
||||
struct section *next;
|
||||
char *name;
|
||||
struct field *fields;
|
||||
};
|
||||
|
||||
/* A field or list of fields. */
|
||||
struct field {
|
||||
struct field *next;
|
||||
char *key;
|
||||
char *value;
|
||||
};
|
||||
|
||||
/* The parser (yyparse) stores the result here. */
|
||||
extern struct section *parsed_index;
|
||||
|
||||
/* yyparse sets this if any comments were seen. Required for checking
|
||||
* compatibility with virt-builder 1.24.
|
||||
*/
|
||||
extern int seen_comments;
|
||||
|
||||
extern void free_index (void);
|
||||
|
||||
#endif /* INDEX_STRUCT_H */
|
||||
161
builder/index-validate.c
Normal file
161
builder/index-validate.c
Normal file
@@ -0,0 +1,161 @@
|
||||
/* libguestfs virt-builder tool
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <getopt.h>
|
||||
#include <errno.h>
|
||||
#include <libintl.h>
|
||||
|
||||
#include <guestfs.h>
|
||||
|
||||
#include "guestfs-internal-frontend.h"
|
||||
|
||||
#include "index-struct.h"
|
||||
#include "index-parse.h"
|
||||
|
||||
extern FILE *yyin;
|
||||
|
||||
static void
|
||||
usage (int exit_status)
|
||||
{
|
||||
printf ("%s index\n", program_name);
|
||||
exit (exit_status);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
enum { HELP_OPTION = CHAR_MAX + 1 };
|
||||
static const char *options = "V";
|
||||
static const struct option long_options[] = {
|
||||
{ "help", 0, 0, HELP_OPTION },
|
||||
{ "compat-1.24.0", 0, 0, 0 },
|
||||
{ "compat-1.24.1", 0, 0, 0 },
|
||||
{ "version", 0, 0, 'V' },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
int c;
|
||||
int option_index;
|
||||
int compat_1_24_0 = 0;
|
||||
int compat_1_24_1 = 0;
|
||||
const char *input;
|
||||
struct section *sections;
|
||||
|
||||
for (;;) {
|
||||
c = getopt_long (argc, argv, options, long_options, &option_index);
|
||||
if (c == -1) break;
|
||||
|
||||
switch (c) {
|
||||
case 0: /* options which are long only */
|
||||
if (STREQ (long_options[option_index].name, "compat-1.24.0"))
|
||||
compat_1_24_0 = compat_1_24_1 = 1;
|
||||
else if (STREQ (long_options[option_index].name, "compat-1.24.1"))
|
||||
compat_1_24_1 = 1;
|
||||
else {
|
||||
fprintf (stderr, _("%s: unknown long option: %s (%d)\n"),
|
||||
program_name, long_options[option_index].name, option_index);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
printf ("%s %s\n", PACKAGE_NAME, PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
|
||||
case HELP_OPTION:
|
||||
usage (EXIT_SUCCESS);
|
||||
|
||||
default:
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
if (optind != argc-1)
|
||||
usage (EXIT_FAILURE);
|
||||
|
||||
input = argv[optind++];
|
||||
|
||||
yyin = fopen (input, "r");
|
||||
if (yyin == NULL) {
|
||||
perror (input);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (yyparse () != 0) {
|
||||
fprintf (stderr, _("%s: '%s' could not be validated, see errors above\n"),
|
||||
program_name, input);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (fclose (yyin) == EOF) {
|
||||
fprintf (stderr, _("%s: %s: error reading input file: %m\n"),
|
||||
program_name, input);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (compat_1_24_1 && seen_comments) {
|
||||
fprintf (stderr, _("%s: %s contains comments which will not work with virt-builder 1.24.1\n"),
|
||||
program_name, input);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Iterate over the parsed sections, semantically validating it. */
|
||||
for (sections = parsed_index; sections != NULL; sections = sections->next) {
|
||||
int seen_sig = 0;
|
||||
struct field *fields;
|
||||
|
||||
for (fields = sections->fields; fields != NULL; fields = fields->next) {
|
||||
if (compat_1_24_0) {
|
||||
if (strchr (fields->key, '[') ||
|
||||
strchr (fields->key, ']')) {
|
||||
fprintf (stderr, _("%s: %s: section [%s], field '%s' has invalid characters which will not work with virt-builder 1.24.0\n"),
|
||||
program_name, input, sections->name, fields->key);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
if (compat_1_24_1) {
|
||||
if (strchr (fields->key, '.') ||
|
||||
strchr (fields->key, ',')) {
|
||||
fprintf (stderr, _("%s: %s: section [%s], field '%s' has invalid characters which will not work with virt-builder 1.24.1\n"),
|
||||
program_name, input, sections->name, fields->key);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
if (STREQ (fields->key, "sig"))
|
||||
seen_sig = 1;
|
||||
}
|
||||
|
||||
if (compat_1_24_0 && !seen_sig) {
|
||||
fprintf (stderr, _("%s: %s: section [%s] is missing a 'sig' field which will not work with virt-builder 1.24.0\n"),
|
||||
program_name, input, sections->name);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
/* Free the parsed data. */
|
||||
free_index ();
|
||||
|
||||
printf ("%s validated OK\n", input);
|
||||
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
275
builder/index_parser.ml
Normal file
275
builder/index_parser.ml
Normal file
@@ -0,0 +1,275 @@
|
||||
(* virt-builder
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*)
|
||||
|
||||
open Common_gettext.Gettext
|
||||
open Common_utils
|
||||
|
||||
open Printf
|
||||
open Unix
|
||||
|
||||
type index = (string * entry) list (* string = "os-version" *)
|
||||
and entry = {
|
||||
printable_name : string option; (* the name= field *)
|
||||
osinfo : string option;
|
||||
file_uri : string;
|
||||
signature_uri : string option; (* deprecated, will be removed in 1.26 *)
|
||||
checksum_sha512 : string option;
|
||||
revision : int;
|
||||
format : string option;
|
||||
size : int64;
|
||||
compressed_size : int64 option;
|
||||
expand : string option;
|
||||
lvexpand : string option;
|
||||
notes : string option;
|
||||
hidden : bool;
|
||||
|
||||
sigchecker : Sigchecker.t;
|
||||
}
|
||||
|
||||
let print_entry chan (name, { printable_name = printable_name;
|
||||
file_uri = file_uri;
|
||||
osinfo = osinfo;
|
||||
signature_uri = signature_uri;
|
||||
checksum_sha512 = checksum_sha512;
|
||||
revision = revision;
|
||||
format = format;
|
||||
size = size;
|
||||
compressed_size = compressed_size;
|
||||
expand = expand;
|
||||
lvexpand = lvexpand;
|
||||
notes = notes;
|
||||
hidden = hidden }) =
|
||||
let fp fs = fprintf chan fs in
|
||||
fp "[%s]\n" name;
|
||||
(match printable_name with
|
||||
| None -> ()
|
||||
| Some name -> fp "name=%s\n" name
|
||||
);
|
||||
(match osinfo with
|
||||
| None -> ()
|
||||
| Some id -> fp "osinfo=%s\n" id
|
||||
);
|
||||
fp "file=%s\n" file_uri;
|
||||
(match signature_uri with
|
||||
| None -> ()
|
||||
| Some uri -> fp "sig=%s\n" uri
|
||||
);
|
||||
(match checksum_sha512 with
|
||||
| None -> ()
|
||||
| Some uri -> fp "checksum[sha512]=%s\n" uri
|
||||
);
|
||||
fp "revision=%d\n" revision;
|
||||
(match format with
|
||||
| None -> ()
|
||||
| Some format -> fp "format=%s\n" format
|
||||
);
|
||||
fp "size=%Ld\n" size;
|
||||
(match compressed_size with
|
||||
| None -> ()
|
||||
| Some size -> fp "compressed_size=%Ld\n" size
|
||||
);
|
||||
(match expand with
|
||||
| None -> ()
|
||||
| Some expand -> fp "expand=%s\n" expand
|
||||
);
|
||||
(match lvexpand with
|
||||
| None -> ()
|
||||
| Some lvexpand -> fp "lvexpand=%s\n" lvexpand
|
||||
);
|
||||
(match notes with
|
||||
| None -> ()
|
||||
| Some notes -> fp "notes=%s\n" notes
|
||||
);
|
||||
if hidden then fp "hidden=true\n"
|
||||
|
||||
(* Types returned by the C index parser. *)
|
||||
type sections = section array
|
||||
and section = string * fields (* [name] + fields *)
|
||||
and fields = field array
|
||||
and field = string * string (* key + value *)
|
||||
|
||||
(* Calls yyparse in the C code. *)
|
||||
external parse_index : string -> sections = "virt_builder_parse_index"
|
||||
|
||||
let get_index ~debug ~downloader ~sigchecker source =
|
||||
let corrupt_file () =
|
||||
eprintf (f_"\nThe index file downloaded from '%s' is corrupt.\nYou need to ask the supplier of this file to fix it and upload a fixed version.\n")
|
||||
source;
|
||||
exit 1
|
||||
in
|
||||
|
||||
let rec get_index () =
|
||||
(* Get the index page. *)
|
||||
let tmpfile, delete_tmpfile = Downloader.download downloader source in
|
||||
|
||||
(* Check index file signature (also verifies it was fully
|
||||
* downloaded and not corrupted in transit).
|
||||
*)
|
||||
Sigchecker.verify sigchecker tmpfile;
|
||||
|
||||
(* Try parsing the file. *)
|
||||
let sections = parse_index tmpfile in
|
||||
if delete_tmpfile then
|
||||
(try Unix.unlink tmpfile with _ -> ());
|
||||
|
||||
let sections = Array.to_list sections in
|
||||
let sections = List.map (
|
||||
fun (n, fields) ->
|
||||
n, Array.to_list fields
|
||||
) sections in
|
||||
|
||||
(* Check for repeated os-version names. *)
|
||||
let nseen = Hashtbl.create 13 in
|
||||
List.iter (
|
||||
fun (n, _) ->
|
||||
if Hashtbl.mem nseen n then (
|
||||
eprintf (f_"virt-builder: index is corrupt: os-version '%s' appears two or more times\n") n;
|
||||
corrupt_file ()
|
||||
);
|
||||
Hashtbl.add nseen n true
|
||||
) sections;
|
||||
|
||||
(* Check for repeated fields. *)
|
||||
List.iter (
|
||||
fun (n, fields) ->
|
||||
let fseen = Hashtbl.create 13 in
|
||||
List.iter (
|
||||
fun (field, _) ->
|
||||
if Hashtbl.mem fseen field then (
|
||||
eprintf (f_"virt-builder: index is corrupt: %s: field '%s' appears two or more times\n") n field;
|
||||
corrupt_file ()
|
||||
);
|
||||
Hashtbl.add fseen field true
|
||||
) fields
|
||||
) sections;
|
||||
|
||||
(* Turn the sections into the final index. *)
|
||||
let entries =
|
||||
List.map (
|
||||
fun (n, fields) ->
|
||||
let printable_name =
|
||||
try Some (List.assoc "name" fields) with Not_found -> None in
|
||||
let osinfo =
|
||||
try Some (List.assoc "osinfo" fields) with Not_found -> None in
|
||||
let file_uri =
|
||||
try make_absolute_uri (List.assoc "file" fields)
|
||||
with Not_found ->
|
||||
eprintf (f_"virt-builder: no 'file' (URI) entry for '%s'\n") n;
|
||||
corrupt_file () in
|
||||
let signature_uri =
|
||||
try Some (make_absolute_uri (List.assoc "sig" fields))
|
||||
with Not_found -> None in
|
||||
let checksum_sha512 =
|
||||
try Some (List.assoc "checksum[sha512]" fields)
|
||||
with Not_found ->
|
||||
try Some (List.assoc "checksum" fields)
|
||||
with Not_found -> None in
|
||||
let revision =
|
||||
try int_of_string (List.assoc "revision" fields)
|
||||
with
|
||||
| Not_found -> 1
|
||||
| Failure "int_of_string" ->
|
||||
eprintf (f_"virt-builder: cannot parse 'revision' field for '%s'\n")
|
||||
n;
|
||||
corrupt_file () in
|
||||
let format =
|
||||
try Some (List.assoc "format" fields) with Not_found -> None in
|
||||
let size =
|
||||
try Int64.of_string (List.assoc "size" fields)
|
||||
with
|
||||
| Not_found ->
|
||||
eprintf (f_"virt-builder: no 'size' field for '%s'\n") n;
|
||||
corrupt_file ()
|
||||
| Failure "int_of_string" ->
|
||||
eprintf (f_"virt-builder: cannot parse 'size' field for '%s'\n")
|
||||
n;
|
||||
corrupt_file () in
|
||||
let compressed_size =
|
||||
try Some (Int64.of_string (List.assoc "compressed_size" fields))
|
||||
with
|
||||
| Not_found ->
|
||||
None
|
||||
| Failure "int_of_string" ->
|
||||
eprintf (f_"virt-builder: cannot parse 'compressed_size' field for '%s'\n")
|
||||
n;
|
||||
corrupt_file () in
|
||||
let expand =
|
||||
try Some (List.assoc "expand" fields) with Not_found -> None in
|
||||
let lvexpand =
|
||||
try Some (List.assoc "lvexpand" fields) with Not_found -> None in
|
||||
let notes =
|
||||
try Some (List.assoc "notes" fields) with Not_found -> None in
|
||||
let hidden =
|
||||
try bool_of_string (List.assoc "hidden" fields)
|
||||
with
|
||||
| Not_found -> false
|
||||
| Failure "bool_of_string" ->
|
||||
eprintf (f_"virt-builder: cannot parse 'hidden' field for '%s'\n")
|
||||
n;
|
||||
corrupt_file () in
|
||||
|
||||
let entry = { printable_name = printable_name;
|
||||
osinfo = osinfo;
|
||||
file_uri = file_uri;
|
||||
signature_uri = signature_uri;
|
||||
checksum_sha512 = checksum_sha512;
|
||||
revision = revision;
|
||||
format = format;
|
||||
size = size;
|
||||
compressed_size = compressed_size;
|
||||
expand = expand;
|
||||
lvexpand = lvexpand;
|
||||
notes = notes;
|
||||
hidden = hidden;
|
||||
sigchecker = sigchecker } in
|
||||
n, entry
|
||||
) sections in
|
||||
|
||||
if debug then (
|
||||
eprintf "index file (%s) after parsing (C parser):\n" source;
|
||||
List.iter (print_entry Pervasives.stderr) entries
|
||||
);
|
||||
|
||||
entries
|
||||
|
||||
(* Verify same-origin policy for the file= and sig= fields. *)
|
||||
and make_absolute_uri path =
|
||||
if String.length path = 0 then (
|
||||
eprintf (f_"virt-builder: zero length path in the index file\n");
|
||||
corrupt_file ()
|
||||
)
|
||||
else if string_find path "://" >= 0 then (
|
||||
eprintf (f_"virt-builder: cannot use a URI ('%s') in the index file\n")
|
||||
path;
|
||||
corrupt_file ()
|
||||
)
|
||||
else if path.[0] = '/' then (
|
||||
eprintf (f_"virt-builder: you must use relative paths (not '%s') in the index file\n") path;
|
||||
corrupt_file ()
|
||||
)
|
||||
else (
|
||||
(* Construct the URI. *)
|
||||
try
|
||||
let i = String.rindex source '/' in
|
||||
String.sub source 0 (i+1) ^ path
|
||||
with
|
||||
Not_found -> source // path
|
||||
)
|
||||
in
|
||||
|
||||
get_index ()
|
||||
38
builder/index_parser.mli
Normal file
38
builder/index_parser.mli
Normal file
@@ -0,0 +1,38 @@
|
||||
(* virt-builder
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*)
|
||||
|
||||
type index = (string * entry) list (* string = "os-version" *)
|
||||
and entry = {
|
||||
printable_name : string option; (* the name= field *)
|
||||
osinfo : string option;
|
||||
file_uri : string;
|
||||
signature_uri : string option; (* deprecated, will be removed in 1.26 *)
|
||||
checksum_sha512 : string option;
|
||||
revision : int;
|
||||
format : string option;
|
||||
size : int64;
|
||||
compressed_size : int64 option;
|
||||
expand : string option;
|
||||
lvexpand : string option;
|
||||
notes : string option;
|
||||
hidden : bool;
|
||||
|
||||
sigchecker : Sigchecker.t;
|
||||
}
|
||||
|
||||
val get_index : debug:bool -> downloader:Downloader.t -> sigchecker:Sigchecker.t -> string -> index
|
||||
70
builder/list_entries.ml
Normal file
70
builder/list_entries.ml
Normal file
@@ -0,0 +1,70 @@
|
||||
(* virt-builder
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*)
|
||||
|
||||
open Common_gettext.Gettext
|
||||
open Common_utils
|
||||
|
||||
open Printf
|
||||
|
||||
let list_entries ?(list_long = false) ~sources index =
|
||||
if list_long then (
|
||||
List.iter (
|
||||
fun (source, fingerprint) ->
|
||||
printf (f_"Source URI: %s\n") source;
|
||||
printf (f_"Fingerprint: %s\n") fingerprint;
|
||||
printf "\n"
|
||||
) sources
|
||||
);
|
||||
|
||||
List.iter (
|
||||
fun (name, { Index_parser.printable_name = printable_name;
|
||||
size = size;
|
||||
compressed_size = compressed_size;
|
||||
notes = notes;
|
||||
hidden = hidden }) ->
|
||||
if not hidden then (
|
||||
if not list_long then ( (* Short *)
|
||||
printf "%-24s" name;
|
||||
(match printable_name with
|
||||
| None -> ()
|
||||
| Some s -> printf " %s" s
|
||||
);
|
||||
printf "\n"
|
||||
)
|
||||
else ( (* Long *)
|
||||
printf "%-24s %s\n" "os-version:" name;
|
||||
(match printable_name with
|
||||
| None -> ()
|
||||
| Some name -> printf "%-24s %s\n" (s_"Full name:") name;
|
||||
);
|
||||
printf "%-24s %s\n" (s_"Minimum/default size:") (human_size size);
|
||||
(match compressed_size with
|
||||
| None -> ()
|
||||
| Some size ->
|
||||
printf "%-24s %s\n" (s_"Download size:") (human_size size);
|
||||
);
|
||||
(match notes with
|
||||
| None -> ()
|
||||
| Some notes ->
|
||||
printf "\n";
|
||||
printf (f_"Notes:\n\n%s\n") notes
|
||||
);
|
||||
printf "\n"
|
||||
)
|
||||
)
|
||||
) index
|
||||
19
builder/list_entries.mli
Normal file
19
builder/list_entries.mli
Normal file
@@ -0,0 +1,19 @@
|
||||
(* virt-builder
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*)
|
||||
|
||||
val list_entries : ?list_long:bool -> sources:(string * string) list -> Index_parser.index -> unit
|
||||
105
builder/perl_edit.ml
Normal file
105
builder/perl_edit.ml
Normal file
@@ -0,0 +1,105 @@
|
||||
(* virt-builder
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*)
|
||||
|
||||
open Common_gettext.Gettext
|
||||
open Common_utils
|
||||
|
||||
open Printf
|
||||
|
||||
(* Implement the --edit option.
|
||||
*
|
||||
* Code copied from virt-edit.
|
||||
*)
|
||||
let rec edit_file ~debug (g : Guestfs.guestfs) file expr =
|
||||
let file_old = file ^ "~" in
|
||||
g#rename file file_old;
|
||||
|
||||
(* Download the file to a temporary. *)
|
||||
let tmpfile = Filename.temp_file "vbedit" "" in
|
||||
unlink_on_exit tmpfile;
|
||||
g#download file_old tmpfile;
|
||||
|
||||
do_perl_edit ~debug g tmpfile expr;
|
||||
|
||||
(* Upload the file. Unlike virt-edit we can afford to fail here
|
||||
* so we don't need the temporary upload file.
|
||||
*)
|
||||
g#upload tmpfile file;
|
||||
|
||||
(* However like virt-edit we do need to copy attributes. *)
|
||||
copy_attributes g file_old file;
|
||||
g#rm file_old
|
||||
|
||||
and do_perl_edit ~debug g file expr =
|
||||
(* Pass the expression to Perl via the environment. This sidesteps
|
||||
* any quoting problems with the already complex Perl command line.
|
||||
*)
|
||||
Unix.putenv "virt_edit_expr" expr;
|
||||
|
||||
(* Call out to a canned Perl script. *)
|
||||
let cmd = sprintf "\
|
||||
perl -e '
|
||||
$lineno = 0;
|
||||
$expr = $ENV{virt_edit_expr};
|
||||
while (<STDIN>) {
|
||||
$lineno++;
|
||||
eval $expr;
|
||||
die if $@;
|
||||
print STDOUT $_ or die \"print: $!\";
|
||||
}
|
||||
close STDOUT or die \"close: $!\";
|
||||
' < %s > %s.out" file file in
|
||||
|
||||
if debug then
|
||||
eprintf "%s\n%!" cmd;
|
||||
|
||||
let r = Sys.command cmd in
|
||||
if r <> 0 then (
|
||||
eprintf (f_"virt-builder: error: could not evaluate Perl expression '%s'\n")
|
||||
expr;
|
||||
exit 1
|
||||
);
|
||||
|
||||
Unix.rename (file ^ ".out") file
|
||||
|
||||
and copy_attributes g src dest =
|
||||
let has_linuxxattrs = g#feature_available [|"linuxxattrs"|] in
|
||||
|
||||
(* Get the mode. *)
|
||||
let stat = g#stat src in
|
||||
|
||||
(* Get the SELinux context. XXX Should we copy over other extended
|
||||
* attributes too?
|
||||
*)
|
||||
let selinux_context =
|
||||
if has_linuxxattrs then (
|
||||
try Some (g#getxattr src "security.selinux") with _ -> None
|
||||
) else None in
|
||||
|
||||
(* Set the permissions (inc. sticky and set*id bits), UID, GID. *)
|
||||
let mode = Int64.to_int stat.G.mode
|
||||
and uid = Int64.to_int stat.G.uid and gid = Int64.to_int stat.G.gid in
|
||||
g#chmod (mode land 0o7777) dest;
|
||||
g#chown uid gid dest;
|
||||
|
||||
(* Set the SELinux context. *)
|
||||
match selinux_context with
|
||||
| None -> ()
|
||||
| Some selinux_context ->
|
||||
g#setxattr "security.selinux"
|
||||
selinux_context (String.length selinux_context) dest
|
||||
19
builder/perl_edit.mli
Normal file
19
builder/perl_edit.mli
Normal file
@@ -0,0 +1,19 @@
|
||||
(* virt-builder
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*)
|
||||
|
||||
val edit_file : debug:bool -> Guestfs.guestfs -> string -> string -> unit
|
||||
650
builder/pxzcat-c.c
Normal file
650
builder/pxzcat-c.c
Normal file
@@ -0,0 +1,650 @@
|
||||
/* virt-builder
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include <caml/alloc.h>
|
||||
#include <caml/fail.h>
|
||||
#include <caml/memory.h>
|
||||
#include <caml/mlvalues.h>
|
||||
|
||||
#ifdef HAVE_CAML_UNIXSUPPORT_H
|
||||
#include <caml/unixsupport.h>
|
||||
#else
|
||||
#define Nothing ((value) 0)
|
||||
extern void unix_error (int errcode, char * cmdname, value arg) Noreturn;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBLZMA
|
||||
#include <lzma.h>
|
||||
|
||||
static void pxzcat (value filenamev, value outputfilev, unsigned nr_threads);
|
||||
#endif
|
||||
|
||||
value
|
||||
virt_builder_pxzcat (value inputfilev, value outputfilev)
|
||||
{
|
||||
CAMLparam2 (inputfilev, outputfilev);
|
||||
|
||||
#ifdef HAVE_LIBLZMA
|
||||
|
||||
/* Parallel implementation of xzcat (pxzcat). */
|
||||
/* XXX Make number of threads configurable? */
|
||||
long i;
|
||||
unsigned nr_threads;
|
||||
|
||||
i = sysconf (_SC_NPROCESSORS_ONLN);
|
||||
if (i <= 0) {
|
||||
perror ("could not get number of cores");
|
||||
i = 1;
|
||||
}
|
||||
nr_threads = (unsigned) i;
|
||||
|
||||
/* NB: This might throw an exception if something fails. If it
|
||||
* does, this function won't return as a regular C function.
|
||||
*/
|
||||
pxzcat (inputfilev, outputfilev, nr_threads);
|
||||
|
||||
#else
|
||||
|
||||
/* Fallback: use regular xzcat. */
|
||||
int fd;
|
||||
pid_t pid;
|
||||
int status;
|
||||
|
||||
fd = open (String_val (outputfilev), O_WRONLY|O_CREAT|O_TRUNC|O_NOCTTY, 0666);
|
||||
if (fd == -1)
|
||||
unix_error (errno, "open", outputfilev);
|
||||
|
||||
pid = fork ();
|
||||
if (pid == -1) {
|
||||
int err = errno;
|
||||
close (fd);
|
||||
unix_error (err, "fork", Nothing);
|
||||
}
|
||||
|
||||
if (pid == 0) { /* child - run xzcat */
|
||||
dup2 (fd, 1);
|
||||
execlp (XZCAT, XZCAT, String_val (inputfilev), NULL);
|
||||
perror (XZCAT);
|
||||
_exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
close (fd);
|
||||
|
||||
if (waitpid (pid, &status, 0) == -1)
|
||||
unix_error (errno, "waitpid", Nothing);
|
||||
if (!WIFEXITED (status) || WEXITSTATUS (status) != 0)
|
||||
caml_failwith (XZCAT " program failed, see earlier error messages");
|
||||
|
||||
#endif
|
||||
|
||||
CAMLreturn (Val_unit);
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBLZMA
|
||||
|
||||
#define DEBUG 0
|
||||
|
||||
#if DEBUG
|
||||
#define debug(fs,...) fprintf (stderr, "pxzcat: debug: " fs "\n", ## __VA_ARGS__)
|
||||
#else
|
||||
#define debug(fs,...) /* nothing */
|
||||
#endif
|
||||
|
||||
/* Size of buffers used in decompression loop. */
|
||||
#define BUFFER_SIZE (64*1024)
|
||||
|
||||
#define XZ_HEADER_MAGIC "\xfd" "7zXZ\0"
|
||||
#define XZ_HEADER_MAGIC_LEN 6
|
||||
#define XZ_FOOTER_MAGIC "YZ"
|
||||
#define XZ_FOOTER_MAGIC_LEN 2
|
||||
|
||||
static int check_header_magic (int fd);
|
||||
static lzma_index *parse_indexes (value filenamev, int fd);
|
||||
static void iter_blocks (lzma_index *idx, unsigned nr_threads, value filenamev, int fd, value outputfilev, int ofd);
|
||||
|
||||
static void
|
||||
pxzcat (value filenamev, value outputfilev, unsigned nr_threads)
|
||||
{
|
||||
int fd, ofd;
|
||||
uint64_t size;
|
||||
lzma_index *idx;
|
||||
|
||||
/* Open the file. */
|
||||
fd = open (String_val (filenamev), O_RDONLY);
|
||||
if (fd == -1)
|
||||
unix_error (errno, "open", filenamev);
|
||||
|
||||
/* Check file magic. */
|
||||
if (!check_header_magic (fd)) {
|
||||
close (fd);
|
||||
caml_invalid_argument ("input file is not an xz file");
|
||||
}
|
||||
|
||||
/* Read and parse the indexes. */
|
||||
idx = parse_indexes (filenamev, fd);
|
||||
|
||||
/* Get the file uncompressed size, create the output file. */
|
||||
size = lzma_index_uncompressed_size (idx);
|
||||
debug ("uncompressed size = %" PRIu64 " bytes", size);
|
||||
|
||||
/* Avoid annoying ext4 auto_da_alloc which causes a flush on close
|
||||
* unless we are very careful about not truncating a regular file
|
||||
* from non-zero size to zero size. (Thanks Eric Sandeen)
|
||||
*/
|
||||
ofd = open (String_val (outputfilev), O_WRONLY|O_CREAT|O_NOCTTY, 0644);
|
||||
if (ofd == -1) {
|
||||
int err = errno;
|
||||
close (fd);
|
||||
unix_error (err, "open", outputfilev);
|
||||
}
|
||||
|
||||
if (ftruncate (ofd, 1) == -1) {
|
||||
int err = errno;
|
||||
close (fd);
|
||||
unix_error (err, "ftruncate", outputfilev);
|
||||
}
|
||||
|
||||
if (lseek (ofd, 0, SEEK_SET) == -1) {
|
||||
int err = errno;
|
||||
close (fd);
|
||||
unix_error (err, "lseek", outputfilev);
|
||||
}
|
||||
|
||||
if (write (ofd, "\0", 1) == -1) {
|
||||
int err = errno;
|
||||
close (fd);
|
||||
unix_error (err, "write", outputfilev);
|
||||
}
|
||||
|
||||
if (ftruncate (ofd, size) == -1) {
|
||||
int err = errno;
|
||||
close (fd);
|
||||
unix_error (err, "ftruncate", outputfilev);
|
||||
}
|
||||
|
||||
/* Tell the kernel we won't read the output file. */
|
||||
posix_fadvise (fd, 0, 0, POSIX_FADV_RANDOM|POSIX_FADV_DONTNEED);
|
||||
|
||||
/* Iterate over blocks. */
|
||||
iter_blocks (idx, nr_threads, filenamev, fd, outputfilev, ofd);
|
||||
|
||||
lzma_index_end (idx, NULL);
|
||||
|
||||
if (close (fd) == -1)
|
||||
unix_error (errno, "close", filenamev);
|
||||
}
|
||||
|
||||
static int
|
||||
check_header_magic (int fd)
|
||||
{
|
||||
char buf[XZ_HEADER_MAGIC_LEN];
|
||||
|
||||
if (lseek (fd, 0, SEEK_SET) == -1)
|
||||
return 0;
|
||||
if (read (fd, buf, XZ_HEADER_MAGIC_LEN) != XZ_HEADER_MAGIC_LEN)
|
||||
return 0;
|
||||
if (memcmp (buf, XZ_HEADER_MAGIC, XZ_HEADER_MAGIC_LEN) != 0)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* For explanation of this function, see src/xz/list.c:parse_indexes
|
||||
* in the xz sources.
|
||||
*/
|
||||
static lzma_index *
|
||||
parse_indexes (value filenamev, int fd)
|
||||
{
|
||||
lzma_ret r;
|
||||
off_t pos, index_size;
|
||||
uint8_t footer[LZMA_STREAM_HEADER_SIZE];
|
||||
uint8_t header[LZMA_STREAM_HEADER_SIZE];
|
||||
lzma_stream_flags footer_flags;
|
||||
lzma_stream_flags header_flags;
|
||||
lzma_stream strm = LZMA_STREAM_INIT;
|
||||
ssize_t n;
|
||||
lzma_index *combined_index = NULL;
|
||||
lzma_index *this_index = NULL;
|
||||
lzma_vli stream_padding = 0;
|
||||
size_t nr_streams = 0;
|
||||
|
||||
/* Check file size is a multiple of 4 bytes. */
|
||||
pos = lseek (fd, 0, SEEK_END);
|
||||
if (pos == (off_t) -1)
|
||||
unix_error (errno, "lseek", filenamev);
|
||||
|
||||
if ((pos & 3) != 0)
|
||||
caml_invalid_argument ("input not an xz file: size is not a multiple of 4 bytes");
|
||||
|
||||
/* Jump backwards through the file identifying each stream. */
|
||||
while (pos > 0) {
|
||||
debug ("looping through streams: pos = %" PRIu64, (uint64_t) pos);
|
||||
|
||||
if (pos < LZMA_STREAM_HEADER_SIZE)
|
||||
caml_invalid_argument ("corrupted xz file");
|
||||
|
||||
if (lseek (fd, -LZMA_STREAM_HEADER_SIZE, SEEK_CUR) == -1)
|
||||
unix_error (errno, "lseek", filenamev);
|
||||
|
||||
if (read (fd, footer, LZMA_STREAM_HEADER_SIZE) != LZMA_STREAM_HEADER_SIZE)
|
||||
unix_error (errno, "read", filenamev);
|
||||
|
||||
/* Skip stream padding. */
|
||||
if (footer[8] == 0 && footer[9] == 0 &&
|
||||
footer[10] == 0 && footer[11] == 0) {
|
||||
stream_padding += 4;
|
||||
pos -= 4;
|
||||
continue;
|
||||
}
|
||||
|
||||
pos -= LZMA_STREAM_HEADER_SIZE;
|
||||
nr_streams++;
|
||||
|
||||
debug ("decode stream footer at pos = %" PRIu64, (uint64_t) pos);
|
||||
|
||||
/* Does the stream footer look reasonable? */
|
||||
r = lzma_stream_footer_decode (&footer_flags, footer);
|
||||
if (r != LZMA_OK) {
|
||||
fprintf (stderr, "invalid stream footer - error %d\n", r);
|
||||
caml_invalid_argument ("invalid stream footer");
|
||||
}
|
||||
|
||||
debug ("backward_size = %" PRIu64, (uint64_t) footer_flags.backward_size);
|
||||
index_size = footer_flags.backward_size;
|
||||
if (pos < index_size + LZMA_STREAM_HEADER_SIZE)
|
||||
caml_invalid_argument ("invalid stream footer");
|
||||
|
||||
pos -= index_size;
|
||||
debug ("decode index at pos = %" PRIu64, (uint64_t) pos);
|
||||
|
||||
/* Seek backwards to the index of this stream. */
|
||||
if (lseek (fd, pos, SEEK_SET) == -1)
|
||||
unix_error (errno, "lseek", filenamev);
|
||||
|
||||
/* Decode the index. */
|
||||
r = lzma_index_decoder (&strm, &this_index, UINT64_MAX);
|
||||
if (r != LZMA_OK) {
|
||||
fprintf (stderr, "invalid stream index - error %d\n", r);
|
||||
caml_invalid_argument ("invalid stream index");
|
||||
}
|
||||
|
||||
do {
|
||||
uint8_t buf[BUFSIZ];
|
||||
|
||||
strm.avail_in = index_size;
|
||||
if (strm.avail_in > BUFSIZ)
|
||||
strm.avail_in = BUFSIZ;
|
||||
|
||||
n = read (fd, &buf, strm.avail_in);
|
||||
if (n == -1)
|
||||
unix_error (errno, "read", filenamev);
|
||||
|
||||
index_size -= strm.avail_in;
|
||||
|
||||
strm.next_in = buf;
|
||||
r = lzma_code (&strm, LZMA_RUN);
|
||||
} while (r == LZMA_OK);
|
||||
|
||||
if (r != LZMA_STREAM_END) {
|
||||
fprintf (stderr, "could not parse index - error %d\n", r);
|
||||
caml_invalid_argument ("could not parse index");
|
||||
}
|
||||
|
||||
pos -= lzma_index_total_size (this_index) + LZMA_STREAM_HEADER_SIZE;
|
||||
|
||||
debug ("decode stream header at pos = %" PRIu64, (uint64_t) pos);
|
||||
|
||||
/* Read and decode the stream header. */
|
||||
if (lseek (fd, pos, SEEK_SET) == -1)
|
||||
unix_error (errno, "lseek", filenamev);
|
||||
|
||||
if (read (fd, header, LZMA_STREAM_HEADER_SIZE) != LZMA_STREAM_HEADER_SIZE)
|
||||
unix_error (errno, "read stream header", filenamev);
|
||||
|
||||
r = lzma_stream_header_decode (&header_flags, header);
|
||||
if (r != LZMA_OK) {
|
||||
fprintf (stderr, "invalid stream header - error %d\n", r);
|
||||
caml_invalid_argument ("invalid stream header");
|
||||
}
|
||||
|
||||
/* Header and footer of the stream should be equal. */
|
||||
r = lzma_stream_flags_compare (&header_flags, &footer_flags);
|
||||
if (r != LZMA_OK) {
|
||||
fprintf (stderr, "header and footer of stream are not equal - error %d\n",
|
||||
r);
|
||||
caml_invalid_argument ("header and footer of stream are not equal");
|
||||
}
|
||||
|
||||
/* Store the decoded stream flags in this_index. */
|
||||
r = lzma_index_stream_flags (this_index, &footer_flags);
|
||||
if (r != LZMA_OK) {
|
||||
fprintf (stderr, "cannot read stream_flags from index - error %d\n", r);
|
||||
caml_invalid_argument ("cannot read stream_flags from index");
|
||||
}
|
||||
|
||||
/* Store the amount of stream padding so far. Needed to calculate
|
||||
* compressed offsets correctly in multi-stream files.
|
||||
*/
|
||||
r = lzma_index_stream_padding (this_index, stream_padding);
|
||||
if (r != LZMA_OK) {
|
||||
fprintf (stderr, "cannot set stream_padding in index - error %d\n", r);
|
||||
caml_invalid_argument ("cannot set stream_padding in index");
|
||||
}
|
||||
|
||||
if (combined_index != NULL) {
|
||||
r = lzma_index_cat (this_index, combined_index, NULL);
|
||||
if (r != LZMA_OK) {
|
||||
fprintf (stderr, "cannot combine indexes - error %d\n", r);
|
||||
caml_invalid_argument ("cannot combine indexes");
|
||||
}
|
||||
}
|
||||
|
||||
combined_index = this_index;
|
||||
this_index = NULL;
|
||||
}
|
||||
|
||||
lzma_end (&strm);
|
||||
|
||||
return combined_index;
|
||||
}
|
||||
|
||||
/* Return true iff the buffer is all zero bytes.
|
||||
*
|
||||
* Note that gcc is smart enough to optimize this properly:
|
||||
* http://stackoverflow.com/questions/1493936/faster-means-of-checking-for-an-empty-buffer-in-c/1493989#1493989
|
||||
*/
|
||||
static inline int
|
||||
is_zero (const char *buffer, size_t size)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < size; ++i) {
|
||||
if (buffer[i] != 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct global_state {
|
||||
/* Current iterator. Threads update this, but it is protected by a
|
||||
* mutex, and each thread takes a copy of it when working on it.
|
||||
*/
|
||||
lzma_index_iter iter;
|
||||
lzma_bool iter_finished;
|
||||
pthread_mutex_t iter_mutex;
|
||||
|
||||
/* Note that all threads are accessing these fds, so you have
|
||||
* to use pread/pwrite instead of lseek!
|
||||
*/
|
||||
|
||||
/* Input file. */
|
||||
const char *filename;
|
||||
int fd;
|
||||
|
||||
/* Output file. */
|
||||
const char *outputfile;
|
||||
int ofd;
|
||||
};
|
||||
|
||||
struct per_thread_state {
|
||||
unsigned thread_num;
|
||||
struct global_state *global;
|
||||
int status;
|
||||
};
|
||||
|
||||
/* Create threads to iterate over the blocks and uncompress. */
|
||||
static void *worker_thread (void *vp);
|
||||
|
||||
static void
|
||||
iter_blocks (lzma_index *idx, unsigned nr_threads,
|
||||
value filenamev, int fd, value outputfilev, int ofd)
|
||||
{
|
||||
struct global_state global;
|
||||
struct per_thread_state per_thread[nr_threads];
|
||||
pthread_t thread[nr_threads];
|
||||
unsigned u, nr_errors;
|
||||
int err;
|
||||
void *status;
|
||||
|
||||
lzma_index_iter_init (&global.iter, idx);
|
||||
global.iter_finished = 0;
|
||||
err = pthread_mutex_init (&global.iter_mutex, NULL);
|
||||
if (err != 0)
|
||||
unix_error (err, "pthread_mutex_init", Nothing);
|
||||
|
||||
global.filename = String_val (filenamev);
|
||||
global.fd = fd;
|
||||
global.outputfile = String_val (outputfilev);
|
||||
global.ofd = ofd;
|
||||
|
||||
for (u = 0; u < nr_threads; ++u) {
|
||||
per_thread[u].thread_num = u;
|
||||
per_thread[u].global = &global;
|
||||
}
|
||||
|
||||
/* Start the threads. */
|
||||
for (u = 0; u < nr_threads; ++u) {
|
||||
err = pthread_create (&thread[u], NULL, worker_thread, &per_thread[u]);
|
||||
if (err != 0)
|
||||
unix_error (err, "pthread_create", Nothing);
|
||||
}
|
||||
|
||||
/* Wait for the threads to exit. */
|
||||
nr_errors = 0;
|
||||
for (u = 0; u < nr_threads; ++u) {
|
||||
err = pthread_join (thread[u], &status);
|
||||
if (err != 0) {
|
||||
fprintf (stderr, "pthread_join (%u): %s\n", u, strerror (err));
|
||||
nr_errors++;
|
||||
}
|
||||
if (*(int *)status == -1)
|
||||
nr_errors++;
|
||||
}
|
||||
|
||||
if (nr_errors > 0)
|
||||
caml_invalid_argument ("some threads failed, see earlier errors");
|
||||
}
|
||||
|
||||
/* Iterate over the blocks and uncompress. */
|
||||
static void *
|
||||
worker_thread (void *vp)
|
||||
{
|
||||
struct per_thread_state *state = vp;
|
||||
struct global_state *global = state->global;
|
||||
lzma_index_iter iter;
|
||||
int err;
|
||||
off_t position, oposition;
|
||||
uint8_t header[LZMA_BLOCK_HEADER_SIZE_MAX];
|
||||
ssize_t n;
|
||||
lzma_block block;
|
||||
lzma_filter filters[LZMA_FILTERS_MAX + 1];
|
||||
lzma_ret r;
|
||||
lzma_stream strm = LZMA_STREAM_INIT;
|
||||
uint8_t buf[BUFFER_SIZE];
|
||||
char outbuf[BUFFER_SIZE];
|
||||
size_t i;
|
||||
lzma_bool iter_finished;
|
||||
|
||||
state->status = -1;
|
||||
|
||||
for (;;) {
|
||||
/* Get the next block. */
|
||||
err = pthread_mutex_lock (&global->iter_mutex);
|
||||
if (err != 0) abort ();
|
||||
iter_finished = global->iter_finished;
|
||||
if (!iter_finished) {
|
||||
iter_finished = global->iter_finished =
|
||||
lzma_index_iter_next (&global->iter, LZMA_INDEX_ITER_NONEMPTY_BLOCK);
|
||||
if (!iter_finished)
|
||||
/* Take a local copy of this iterator since another thread will
|
||||
* update the global version.
|
||||
*/
|
||||
iter = global->iter;
|
||||
}
|
||||
err = pthread_mutex_unlock (&global->iter_mutex);
|
||||
if (err != 0) abort ();
|
||||
if (iter_finished)
|
||||
break;
|
||||
|
||||
/* Read the block header. Start by reading a single byte which
|
||||
* tell us how big the block header is.
|
||||
*/
|
||||
position = iter.block.compressed_file_offset;
|
||||
n = pread (global->fd, header, 1, position);
|
||||
if (n == 0) {
|
||||
fprintf (stderr,
|
||||
"%s: read: unexpected end of file reading block header byte\n",
|
||||
global->filename);
|
||||
return &state->status;
|
||||
}
|
||||
if (n == -1) {
|
||||
perror (String_val (global->filename));
|
||||
return &state->status;
|
||||
}
|
||||
position++;
|
||||
|
||||
if (header[0] == '\0') {
|
||||
fprintf (stderr,
|
||||
"%s: read: unexpected invalid block in file, header[0] = 0\n",
|
||||
global->filename);
|
||||
return &state->status;
|
||||
}
|
||||
|
||||
block.version = 0;
|
||||
block.check = iter.stream.flags->check;
|
||||
block.filters = filters;
|
||||
block.header_size = lzma_block_header_size_decode (header[0]);
|
||||
|
||||
/* Now read and decode the block header. */
|
||||
n = pread (global->fd, &header[1], block.header_size-1, position);
|
||||
if (n >= 0 && n != block.header_size-1) {
|
||||
fprintf (stderr,
|
||||
"%s: read: unexpected end of file reading block header\n",
|
||||
global->filename);
|
||||
return &state->status;
|
||||
}
|
||||
if (n == -1) {
|
||||
perror (global->filename);
|
||||
return &state->status;
|
||||
}
|
||||
position += n;
|
||||
|
||||
r = lzma_block_header_decode (&block, NULL, header);
|
||||
if (r != LZMA_OK) {
|
||||
fprintf (stderr, "%s: invalid block header (error %d)\n",
|
||||
global->filename, r);
|
||||
return &state->status;
|
||||
}
|
||||
|
||||
/* What this actually does is it checks that the block header
|
||||
* matches the index.
|
||||
*/
|
||||
r = lzma_block_compressed_size (&block, iter.block.unpadded_size);
|
||||
if (r != LZMA_OK) {
|
||||
fprintf (stderr,
|
||||
"%s: cannot calculate compressed size (error %d)\n",
|
||||
global->filename, r);
|
||||
return &state->status;
|
||||
}
|
||||
|
||||
/* Where we will start writing to. */
|
||||
oposition = iter.block.uncompressed_file_offset;
|
||||
|
||||
/* Read the block data and uncompress it. */
|
||||
r = lzma_block_decoder (&strm, &block);
|
||||
if (r != LZMA_OK) {
|
||||
fprintf (stderr, "%s: invalid block (error %d)\n", global->filename, r);
|
||||
return &state->status;
|
||||
}
|
||||
|
||||
strm.next_in = NULL;
|
||||
strm.avail_in = 0;
|
||||
strm.next_out = outbuf;
|
||||
strm.avail_out = sizeof outbuf;
|
||||
|
||||
for (;;) {
|
||||
lzma_action action = LZMA_RUN;
|
||||
|
||||
if (strm.avail_in == 0) {
|
||||
strm.next_in = buf;
|
||||
n = pread (global->fd, buf, sizeof buf, position);
|
||||
if (n == -1) {
|
||||
perror (global->filename);
|
||||
return &state->status;
|
||||
}
|
||||
position += n;
|
||||
strm.avail_in = n;
|
||||
if (n == 0)
|
||||
action = LZMA_FINISH;
|
||||
}
|
||||
|
||||
r = lzma_code (&strm, action);
|
||||
|
||||
if (strm.avail_out == 0 || r == LZMA_STREAM_END) {
|
||||
size_t wsz = sizeof outbuf - strm.avail_out;
|
||||
|
||||
/* Don't write if the block is all zero, to preserve output file
|
||||
* sparseness. However we have to update oposition.
|
||||
*/
|
||||
if (!is_zero (outbuf, wsz)) {
|
||||
if (pwrite (global->ofd, outbuf, wsz, oposition) != wsz) {
|
||||
/* XXX Handle short writes. */
|
||||
perror (global->filename);
|
||||
return &state->status;
|
||||
}
|
||||
}
|
||||
oposition += wsz;
|
||||
|
||||
strm.next_out = outbuf;
|
||||
strm.avail_out = sizeof outbuf;
|
||||
}
|
||||
|
||||
if (r == LZMA_STREAM_END)
|
||||
break;
|
||||
if (r != LZMA_OK) {
|
||||
fprintf (stderr,
|
||||
"%s: could not parse block data (error %d)\n",
|
||||
global->filename, r);
|
||||
return &state->status;
|
||||
}
|
||||
}
|
||||
|
||||
lzma_end (&strm);
|
||||
|
||||
for (i = 0; filters[i].id != LZMA_VLI_UNKNOWN; ++i)
|
||||
free (filters[i].options);
|
||||
}
|
||||
|
||||
state->status = 0;
|
||||
return &state->status;
|
||||
}
|
||||
|
||||
#endif /* HAVE_LIBLZMA */
|
||||
19
builder/pxzcat.ml
Normal file
19
builder/pxzcat.ml
Normal file
@@ -0,0 +1,19 @@
|
||||
(* virt-builder
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*)
|
||||
|
||||
external pxzcat : string -> string -> unit = "virt_builder_pxzcat"
|
||||
31
builder/pxzcat.mli
Normal file
31
builder/pxzcat.mli
Normal file
@@ -0,0 +1,31 @@
|
||||
(* virt-builder
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*)
|
||||
|
||||
(** {1 Parallel xzcat (or fall back to regular xzcat).}
|
||||
|
||||
Eventually regular xzcat will be able to work in parallel and this
|
||||
code can go away.
|
||||
*)
|
||||
|
||||
val pxzcat : string -> string -> unit
|
||||
(** [pxzcat input output] uncompresses the file [input] to the file
|
||||
[output]. The input and output must both be seekable.
|
||||
|
||||
If liblzma was found at compile time, this uses an internal
|
||||
implementation of parallel xzcat. Otherwise regular xzcat is
|
||||
used. *)
|
||||
237
builder/sigchecker.ml
Normal file
237
builder/sigchecker.ml
Normal file
@@ -0,0 +1,237 @@
|
||||
(* virt-builder
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*)
|
||||
|
||||
open Common_gettext.Gettext
|
||||
open Common_utils
|
||||
|
||||
open Printf
|
||||
open Unix
|
||||
|
||||
let quote = Filename.quote
|
||||
|
||||
(* These are the public key and fingerprint belonging to
|
||||
* Richard W.M. Jones who signs the templates on
|
||||
* http://libguestfs.org/download/builder.
|
||||
*)
|
||||
let default_fingerprint = "F777 4FB1 AD07 4A7E 8C87 67EA 9173 8F73 E1B7 68A0"
|
||||
let default_pubkey = "\
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
Version: GnuPG v1.4.14 (GNU/Linux)
|
||||
|
||||
mQINBE6UMMEBEADM811hfTulaF4JpkVpAI10FImyb4ArvOiu8NdcUwTFo+cyWno3
|
||||
U85B86H1Bsk/LgLTYtthSrTgsCtdxy+i5OaMjxZDIwKQ2+IYI3FCn9T3Mn28Idyh
|
||||
kLHzrO9ph0Dv0BNfrlDZhQEC53aAFe/QxN7+A49BNBV7D1VAOOCsHjxMEDzcZkCa
|
||||
oCrtXw1aNm2vkkj5ukbfukHAyLcQL7kow0qKPSVa1G4lfQP0WiG259Ydy+sUmbVb
|
||||
TGdb6MEC84PQRDuw6/ZeoV04tn7ZNtQEMOS0uiciHOGfr2hBxQf9VIPNrHg42yaL
|
||||
dOv51D99GuaxZ9E0HSoH/RwB1oXgd6rFdqVNYaBIQnnkwJANUEeGBArtIOZNCADT
|
||||
Bt8vkSDm+lLEAFS+V8CACyW/LMIrGCvLdHeqtoAv0GDVyR2GPxldYfdtEmCUMWcb
|
||||
Jlf71V9iAse2gUdoiHp5FfpGMkA5j7idKuxIws11XxRZJXXbBqiBqmVEAQ/v0m6p
|
||||
kdo0MYTHydmecLuUK2bAGhpysfX97EfTSrxfrYphYWjTfKRD9GrADeZNfuz1DbKs
|
||||
7LSqVaQJSjQrfgAwcnZLRaU0V4P5zxiz50gz1Aj3AZRL+Y3meZenzZTXcLFdnusg
|
||||
wUfhhCuL3tluMtEh6tznumyxb43WO1yLwj6J6LtveiuJN1Z+KSQ6OieZcwARAQAB
|
||||
tCVSaWNoYXJkIFcuTS4gSm9uZXMgPHJpY2hAYW5uZXhpYS5vcmc+iQI4BBMBAgAi
|
||||
BQJOlDDBAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRCRc49z4bdooHQY
|
||||
D/wJLklSZNyXIW+rG5sUbg7j9cTIF5p/lB9kI2yx6KodJp/2knKyvnmzz0gBw/OE
|
||||
HL4E4UW26oWKo+36I8wkBnuGa6UtANeITcJqFE19VpHEXHsxre64jNQnO8/w748W
|
||||
1ROW+Ry43xmrlRWKuCm4oPYUzlp0fq9ATAne8eblfG+NOs8DYuA8xZNQzFaI2kDC
|
||||
QLD4YoXLoNsP27Koga36b0KwxPFD9tyVZiu9XDH/3hMN7Nb15B66PFr+HcMmQ67G
|
||||
nUIN5ulcIwj38i40cyaTs1VRheOzTHXE/a6Q2AhMKiKqOoEjQ73/mV7cAVoPtM3o
|
||||
83Q/8aVKBH0bVRwAeV1tju6b14fqKoG0zNBEcXdlSkht6ScxJYIc/LPUxAMDwgSE
|
||||
OWshjmeRzKXypBbHn/DP8QVyM2gk5wY+mMSH7MpR0p/hgj+rFO8H9L7pC4dCog3E
|
||||
qzrYhRN+TaP6MPH3WkOwPH4d4IfQRFnHp+VPYPijKEiLrUl/o8k3DyAanAPBpJ/x
|
||||
na4wXAjlFBctOq6g+SrCUiHpwk7b2YNwGgr5Vl3GmZELzK/G8gg3uJYKQ9Bpv16t
|
||||
WWOz+IFiOFa0UULeo0QPmFAIMZiDojNsY1SwBKB3ZL1YWZezgMdQAbpze/IXoSt7
|
||||
zxWJoKH2jK7q9mvFiaY12l2YnKuCcegWVAViLxRpBnrbz7QmUmljaGFyZCBXLk0u
|
||||
IEpvbmVzIDxyam9uZXNAcmVkaGF0LmNvbT6JAjgEEwECACIFAk6UOQsCGwMGCwkI
|
||||
BwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEJFzj3Pht2igIUYQAKomI0edLakahsUQ
|
||||
MxOZuhBbXJ4/VWF8bXYChDNPKvJp5nB7fBXujJ+39cIUM5fe2ViO6qSDpFC29imx
|
||||
F5pPbAqspZBPBkLLiZLji8R42hGarntdtTW0UWSBpq+nC5+G1psrnATI3uXGNxKQ
|
||||
R99c5HoMY7dBC2Y8TCGE64NINZ/XVh472s6IGLPn8MTn26YdRKC9BrVkCFMP2OBr
|
||||
6D4IprnyTAWAzb68ew20QmyWO+NBi9MplaDNQVl8PIOgfpyWlkgX1z9m67pcSDkw
|
||||
46hksp0yuOD1VwR4iVZ2/CmIsGRUlx41vWD6BIp9KxKyDIU1CYTRhq72dahHsl/8
|
||||
BjCndV5PO0GphqfCzmCv4DXjUwmrMTbH/GFnt5rfwcMcXUgcK0vV9vQ2SOU56Zd1
|
||||
fb27ZCFJKZc0Fu8krwFldCp/NYILf6ogUL/C1hfuCGSSuyDVY16Gg3dla1x+6zpF
|
||||
asnWQlaw8xT5LlMWvTZs5WsoSVHu7dVZWlgxINP++hlZrTz/S8l38yyQ15YFFl3W
|
||||
9M7dzkegOeDTPfx6B89WgfvfJjA/D0/FYxxWPXEtrn9DlJ4daEJqNsrvfLErz9R8
|
||||
4IQmfmhR93j+rdotner+6keC/wVByEfbW1wmXtmFKXQ6srdpj8VKRFrvkyXVgepM
|
||||
DypLgRH2v7lL2kdWhUu2y4EAgrwzuQINBE6UMMEBEADxQxMgUuDrw5GT4tqARTPI
|
||||
SSdNcUsRxRhVA8srYOyECliE+B3TwcRDFBs+MyPFJVEuX8fi4eGj/AK5t1GHerfk
|
||||
orUGlz72q4c7LLhkfZrsuJbk2dgkjvldKJnIazQJa6epGLqdsE5RlmSgwedIbtMd
|
||||
naGJBQH8aKP/Wi1+wUxsm5N3p7+R2WRx48VfpEhYB+Zf/FkFm1Ycjwh57KQ0+OHw
|
||||
ykf8VfMisxuH30tDxOCV+VptWKfOF2rDNdaNPWhij2YIjhJXRpkuRR+1PpI4jLaD
|
||||
JxcVZmG/0zucacupUN2g5OUH59ySU/totD6YMnmp3FONoyF1uIEJo6Vs30npHGkO
|
||||
XgBo3Pxt7oLJeykLPtdSLgm3cwXIYMWarVsAkKNXitQIVGpVRLeaK373VwmXFqoi
|
||||
M2SMHeawTUdOORFjpQzkknlJWM1TmUVtHHKt8Pl9+/5+wXKyt2IDdcUkMrB6K5qF
|
||||
fb7EwVhoI8ehJQK+eeDCjFwCAiwB3iV8JlyW+tEU7JuyXOQlwY1VWm/WqMD8gaRi
|
||||
rT+RFDFliZ3tQbW2pqUoZBROV5HN4tieDfwxGKCvk6Tsdb30zA9DPQp93+238bYf
|
||||
312sg9R+CD0AqxoxFG5FJu4HShcPRrPnYtRZqKRe40GDWvBEArXZprwL1qrP+Kl/
|
||||
mRrEQpxAGIoFG8HbVvD3EQARAQABiQIfBBgBAgAJBQJOlDDBAhsMAAoJEJFzj3Ph
|
||||
t2igSLQP/2uIrAY2CDr0kWBJiD3TztiHy8IdxwUpyTBTebwmAbi44/EvtJfIisrG
|
||||
YjKIEv/w0E61gO7O1JBG4+IG93W+v9fTT/e39JMyxsYqoZZHUhP11Okx5grDS5b0
|
||||
O8VXOmXVRMdVNfstRBr10HD9uNDq7ruKD18TxYTwN0GPD4gj1dbHQDR77Tr5cyBs
|
||||
6Ou5PBOH4r3qcqf/cJUSMeUUu75xLwixux6E7tD2S+t6F07wlWxntUcPtzyAHj20
|
||||
J89orUC+dT6r6MypBoI0jdJCp9JPGtR7i+fE5Gm4E5+AUSubLPtZGRY9Um2eMoS2
|
||||
DnQpGOKx1VvsixR/Kw44j2tRAvmYMS4iDKcuZU+nZ+xokAgObILj/b9n/Qe2/fXy
|
||||
CFdcgSvbm+dV1fZxsdMF/P9OU8aqdT9A9Fv5y+cDMEg4DVnhwMJTxGh/TCkw/H+A
|
||||
frHEtRc98lSQN5odpITNG17mG6JOdHM+wA57qHH0uy4+5RsbyAJahcdBcmObK/RF
|
||||
i4WZlThpbHftX5O/LH98aYQ2fJayIxv1EAjzOBOQ0MfBHI0KCJR1pysEisX28sJA
|
||||
Ic73gnJJ3BLZbqfBRgxjNMNroxC+5Tw6uPGFHa3YnuIAxxw0HcDVZ9vnTWBWFPGw
|
||||
ZvXkQ3FVJwZoLmHw47vvlVpLD/4gi1SuHWieRvZ+UdDq00E348pm
|
||||
=neBW
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
"
|
||||
let key_imported = ref false
|
||||
|
||||
type t = {
|
||||
debug : bool;
|
||||
gpg : string;
|
||||
fingerprint : string;
|
||||
check_signature : bool;
|
||||
}
|
||||
|
||||
let create ~debug ~gpg ~fingerprint ~check_signature =
|
||||
{
|
||||
debug = debug;
|
||||
gpg = gpg;
|
||||
fingerprint = fingerprint;
|
||||
check_signature = check_signature;
|
||||
}
|
||||
|
||||
(* Compare two strings of hex digits ignoring whitespace and case. *)
|
||||
let rec equal_fingerprints fp1 fp2 =
|
||||
let len1 = String.length fp1 and len2 = String.length fp2 in
|
||||
let rec loop i j =
|
||||
if i = len1 && j = len2 then true (* match! *)
|
||||
else if i = len1 || j = len2 then false (* no match - different lengths *)
|
||||
else (
|
||||
let x1 = getxdigit fp1.[i] and x2 = getxdigit fp2.[j] in
|
||||
match x1, x2 with
|
||||
| Some x1, Some x2 when x1 = x2 -> loop (i+1) (j+1)
|
||||
| Some x1, Some x2 -> false (* no match - different content *)
|
||||
| Some _, None -> loop i (j+1)
|
||||
| None, Some _ -> loop (i+1) j
|
||||
| None, None -> loop (i+1) (j+1)
|
||||
)
|
||||
in
|
||||
loop 0 0
|
||||
|
||||
and getxdigit = function
|
||||
| '0'..'9' as c -> Some (Char.code c - Char.code '0')
|
||||
| 'a'..'f' as c -> Some (Char.code c - Char.code 'a')
|
||||
| 'A'..'F' as c -> Some (Char.code c - Char.code 'A')
|
||||
| _ -> None
|
||||
|
||||
let rec verify t filename =
|
||||
if t.check_signature then (
|
||||
let args = quote filename in
|
||||
do_verify t args
|
||||
)
|
||||
|
||||
and verify_detached t filename sigfile =
|
||||
if t.check_signature then (
|
||||
match sigfile with
|
||||
| None ->
|
||||
eprintf (f_"virt-builder: error: there is no detached signature file\nThis probably means the index file is missing a sig=... line.\nYou can use --no-check-signature to ignore this error, but that means\nyou are susceptible to man-in-the-middle attacks.\n");
|
||||
exit 1
|
||||
| Some sigfile ->
|
||||
let args = sprintf "%s %s" (quote sigfile) (quote filename) in
|
||||
do_verify t args
|
||||
)
|
||||
|
||||
and do_verify t args =
|
||||
import_key t;
|
||||
|
||||
let status_file = Filename.temp_file "vbstat" ".txt" in
|
||||
unlink_on_exit status_file;
|
||||
let cmd =
|
||||
sprintf "%s --verify%s --status-file %s %s"
|
||||
t.gpg (if t.debug then "" else " -q --logger-file /dev/null")
|
||||
(quote status_file) args in
|
||||
if t.debug then eprintf "%s\n%!" cmd;
|
||||
let r = Sys.command cmd in
|
||||
if r <> 0 then (
|
||||
eprintf (f_"virt-builder: error: GPG failure: could not verify digital signature of file\nTry:\n - Use the '-v' option and look for earlier error messages.\n - Delete the cache: virt-builder --delete-cache\n - Check no one has tampered with the website or your network!\n");
|
||||
exit 1
|
||||
);
|
||||
|
||||
(* Check the fingerprint is who it should be. *)
|
||||
let status = read_whole_file status_file in
|
||||
|
||||
let status = string_nsplit "\n" status in
|
||||
let fingerprint = ref "" in
|
||||
List.iter (
|
||||
fun line ->
|
||||
let line = string_nsplit " " line in
|
||||
match line with
|
||||
| "[GNUPG:]" :: "VALIDSIG" :: fp :: _ -> fingerprint := fp
|
||||
| _ -> ()
|
||||
) status;
|
||||
|
||||
if not (equal_fingerprints !fingerprint t.fingerprint) then (
|
||||
eprintf (f_"virt-builder: error: fingerprint of signature does not match the expected fingerprint!\n found fingerprint: %s\n expected fingerprint: %s\n")
|
||||
!fingerprint t.fingerprint;
|
||||
exit 1
|
||||
)
|
||||
|
||||
(* Import the default public key. *)
|
||||
and import_key t =
|
||||
if not !key_imported then (
|
||||
let filename, chan = Filename.open_temp_file "vbpubkey" ".asc" in
|
||||
unlink_on_exit filename;
|
||||
output_string chan default_pubkey;
|
||||
close_out chan;
|
||||
|
||||
let cmd = sprintf "%s --import %s%s"
|
||||
t.gpg (quote filename)
|
||||
(if t.debug then "" else " >/dev/null 2>&1") in
|
||||
let r = Sys.command cmd in
|
||||
if r <> 0 then (
|
||||
eprintf (f_"virt-builder: error: could not import public key\nUse the '-v' option and look for earlier error messages.\n");
|
||||
exit 1
|
||||
);
|
||||
key_imported := true
|
||||
)
|
||||
|
||||
type csum_t = SHA512 of string
|
||||
|
||||
let verify_checksum t (SHA512 csum) filename =
|
||||
let csum_file = Filename.temp_file "vbcsum" ".txt" in
|
||||
unlink_on_exit csum_file;
|
||||
let cmd = sprintf "sha512sum %s | awk '{print $1}' > %s"
|
||||
(quote filename) (quote csum_file) in
|
||||
if t.debug then eprintf "%s\n%!" cmd;
|
||||
let r = Sys.command cmd in
|
||||
if r <> 0 then (
|
||||
eprintf (f_"virt-builder: error: could not run sha512sum command to verify checksum\n");
|
||||
exit 1
|
||||
);
|
||||
|
||||
let csum_actual = read_whole_file csum_file in
|
||||
|
||||
let csum_actual =
|
||||
let len = String.length csum_actual in
|
||||
if len > 0 && csum_actual.[len-1] = '\n' then
|
||||
String.sub csum_actual 0 (len-1)
|
||||
else
|
||||
csum_actual in
|
||||
|
||||
if csum <> csum_actual then (
|
||||
eprintf (f_"virt-builder: error: checksum of template did not match the expected checksum!\n found checksum: %s\n expected checksum: %s\nTry:\n - Use the '-v' option and look for earlier error messages.\n - Delete the cache: virt-builder --delete-cache\n - Check no one has tampered with the website or your network!\n")
|
||||
csum_actual csum;
|
||||
exit 1
|
||||
)
|
||||
36
builder/sigchecker.mli
Normal file
36
builder/sigchecker.mli
Normal file
@@ -0,0 +1,36 @@
|
||||
(* virt-builder
|
||||
* Copyright (C) 2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*)
|
||||
|
||||
val default_fingerprint : string
|
||||
|
||||
type t
|
||||
|
||||
val create : debug:bool -> gpg:string -> fingerprint:string -> check_signature:bool -> t
|
||||
|
||||
val verify : t -> string -> unit
|
||||
(** Verify the file is signed (if check_signature is true). *)
|
||||
|
||||
val verify_detached : t -> string -> string option -> unit
|
||||
(** Verify the file is signed against the detached signature
|
||||
(if check_signature is true). *)
|
||||
|
||||
type csum_t = SHA512 of string
|
||||
|
||||
val verify_checksum : t -> csum_t -> string -> unit
|
||||
(** Verify the checksum of the file. This is always verified even if
|
||||
check_signature if false. *)
|
||||
33
builder/test-index.in
Normal file
33
builder/test-index.in
Normal file
@@ -0,0 +1,33 @@
|
||||
[phony-debian]
|
||||
name=Phony Debian
|
||||
file=debian.xz
|
||||
format=raw
|
||||
size=536870912
|
||||
expand=/dev/sda2
|
||||
lvexpand=/dev/debian/root
|
||||
notes=Phony Debian look-alike used for testing.
|
||||
|
||||
[phony-fedora]
|
||||
name=Phony Fedora
|
||||
file=fedora.xz
|
||||
format=raw
|
||||
size=1073741824
|
||||
expand=/dev/sda2
|
||||
lvexpand=/dev/VG/Root
|
||||
notes=Phony Fedora look-alike used for testing.
|
||||
|
||||
[phony-ubuntu]
|
||||
name=Phony Ubuntu
|
||||
file=ubuntu.xz
|
||||
format=raw
|
||||
size=536870912
|
||||
expand=/dev/sda2
|
||||
notes=Phony Ubuntu look-alike used for testing.
|
||||
|
||||
[phony-windows]
|
||||
name=Phony Windows
|
||||
file=windows.xz
|
||||
format=raw
|
||||
size=536870912
|
||||
expand=/dev/sda2
|
||||
notes=Phony Windows look-alike used for testing.
|
||||
78
builder/test-virt-builder-list.sh
Executable file
78
builder/test-virt-builder-list.sh
Executable file
@@ -0,0 +1,78 @@
|
||||
#!/bin/bash -
|
||||
# libguestfs virt-builder test script
|
||||
# Copyright (C) 2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
# Test the virt-builder --list [--long] options.
|
||||
|
||||
export LANG=C
|
||||
set -e
|
||||
|
||||
abs_builddir=$(pwd)
|
||||
|
||||
export VIRT_BUILDER_SOURCE=file://$abs_builddir/test-index
|
||||
|
||||
short_list=$($VG ./virt-builder --no-check-signature --no-cache --list)
|
||||
|
||||
if [ "$short_list" != "phony-debian Phony Debian
|
||||
phony-fedora Phony Fedora
|
||||
phony-ubuntu Phony Ubuntu
|
||||
phony-windows Phony Windows" ]; then
|
||||
echo "$0: unexpected --list output:"
|
||||
echo "$short_list"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
long_list=$(./virt-builder --no-check-signature --no-cache --list --long)
|
||||
|
||||
if [ "$long_list" != "Source URI: $VIRT_BUILDER_SOURCE
|
||||
Fingerprint: F777 4FB1 AD07 4A7E 8C87 67EA 9173 8F73 E1B7 68A0
|
||||
|
||||
os-version: phony-debian
|
||||
Full name: Phony Debian
|
||||
Minimum/default size: 512.0M
|
||||
|
||||
Notes:
|
||||
|
||||
Phony Debian look-alike used for testing.
|
||||
|
||||
os-version: phony-fedora
|
||||
Full name: Phony Fedora
|
||||
Minimum/default size: 1.0G
|
||||
|
||||
Notes:
|
||||
|
||||
Phony Fedora look-alike used for testing.
|
||||
|
||||
os-version: phony-ubuntu
|
||||
Full name: Phony Ubuntu
|
||||
Minimum/default size: 512.0M
|
||||
|
||||
Notes:
|
||||
|
||||
Phony Ubuntu look-alike used for testing.
|
||||
|
||||
os-version: phony-windows
|
||||
Full name: Phony Windows
|
||||
Minimum/default size: 512.0M
|
||||
|
||||
Notes:
|
||||
|
||||
Phony Windows look-alike used for testing." ]; then
|
||||
echo "$0: unexpected --list --long output:"
|
||||
echo "$long_list"
|
||||
exit 1
|
||||
fi
|
||||
67
builder/test-virt-builder.sh
Executable file
67
builder/test-virt-builder.sh
Executable file
@@ -0,0 +1,67 @@
|
||||
#!/bin/bash -
|
||||
# libguestfs virt-builder test script
|
||||
# Copyright (C) 2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
export LANG=C
|
||||
set -e
|
||||
|
||||
abs_builddir=$(pwd)
|
||||
|
||||
export VIRT_BUILDER_SOURCE=file://$abs_builddir/test-index
|
||||
|
||||
if [ ! -f fedora.xz ]; then
|
||||
echo "$0: test skipped because there is no fedora.xz in the build directory"
|
||||
exit 77
|
||||
fi
|
||||
|
||||
output=phony-fedora.img
|
||||
|
||||
format=qcow2
|
||||
if [ "$(../fish/guestfish get-backend)" = "uml" ]; then
|
||||
format=raw
|
||||
|
||||
# XXX We specifically want virt-builder to work with the UML
|
||||
# backend. However currently it fails with:
|
||||
# error: uml backend does not support networking
|
||||
# We should be able to make uml have a network backend, but in
|
||||
# the meantime add this:
|
||||
no_network=--no-network
|
||||
fi
|
||||
|
||||
rm -f $output
|
||||
|
||||
# Test as many options as we can!
|
||||
#
|
||||
# Note we cannot test --install, --run since the phony Fedora doesn't
|
||||
# have a real OS inside just some configuration files. Just about
|
||||
# every other option is fair game.
|
||||
$VG ./virt-builder phony-fedora \
|
||||
-v --no-cache --no-check-signature $no_network \
|
||||
-o $output --size 2G --format $format \
|
||||
--hostname test.example.com \
|
||||
--root-password password:123456 \
|
||||
--mkdir /etc/foo/bar/baz \
|
||||
--write '/etc/foo/bar/baz/foo:Hello World' \
|
||||
--upload Makefile:/Makefile \
|
||||
--upload Makefile:/etc/foo/bar/baz \
|
||||
--delete /Makefile \
|
||||
--firstboot Makefile --firstboot-command 'echo "hello"' \
|
||||
--firstboot-install "minicom,inkscape"
|
||||
|
||||
# XXX Test that the modifications were made.
|
||||
|
||||
rm $output
|
||||
1508
builder/virt-builder.pod
Normal file
1508
builder/virt-builder.pod
Normal file
File diff suppressed because it is too large
Load Diff
92
builder/virt-index-validate.pod
Normal file
92
builder/virt-index-validate.pod
Normal file
@@ -0,0 +1,92 @@
|
||||
=encoding utf8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
virt-index-validate - Validate virt-builder index file
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
virt-index-validate index
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
L<virt-builder(1)> uses an index file to store metadata about templates
|
||||
that it knows how to use. This index file has a specific format which
|
||||
virt-index-validate knows how to validate.
|
||||
|
||||
Note that virt-index-validate can validate either the signed or
|
||||
unsigned index file (ie. either C<index> or C<index.asc>). It can
|
||||
only validate a local file, not a URL.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 4
|
||||
|
||||
=item B<--compat-1.24.0>
|
||||
|
||||
Check for compatibility with virt-builder 1.24.0. (Using this option
|
||||
implies I<--compat-1.24.1>, so you don't need to use both.)
|
||||
|
||||
In particular:
|
||||
|
||||
=over 4
|
||||
|
||||
=item *
|
||||
|
||||
This version of virt-builder could not handle C<[...]>
|
||||
(square brackets) in field names (eg. C<checksum[sha512]=...>).
|
||||
|
||||
=item *
|
||||
|
||||
It required detached signatures (C<sig=...>).
|
||||
|
||||
=back
|
||||
|
||||
=item B<--compat-1.24.1>
|
||||
|
||||
Check for compatibility with virt-builder E<ge> 1.24.1.
|
||||
|
||||
In particular:
|
||||
|
||||
=over 4
|
||||
|
||||
=item *
|
||||
|
||||
This version of virt-builder could not handle C<.> (period) in field
|
||||
names or C<,> (comma) in subfield names.
|
||||
|
||||
=item *
|
||||
|
||||
It could not handle comments appearing in the file.
|
||||
|
||||
=back
|
||||
|
||||
=item B<--help>
|
||||
|
||||
Display help.
|
||||
|
||||
=item B<-V>
|
||||
|
||||
=item B<--version>
|
||||
|
||||
Display version number and exit.
|
||||
|
||||
=back
|
||||
|
||||
=head1 EXIT STATUS
|
||||
|
||||
This program returns 0 if the index file validates, or non-zero if
|
||||
there was an error.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<virt-builder(1)>,
|
||||
L<http://libguestfs.org/>.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Richard W.M. Jones L<http://people.redhat.com/~rjones/>
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright (C) 2013 Red Hat Inc.
|
||||
1
builder/website/.gitignore
vendored
Normal file
1
builder/website/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.xz
|
||||
50
builder/website/Makefile.am
Normal file
50
builder/website/Makefile.am
Normal file
@@ -0,0 +1,50 @@
|
||||
# libguestfs virt-builder tool
|
||||
# Copyright (C) 2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
include $(top_srcdir)/subdir-rules.mk
|
||||
|
||||
EXTRA_DIST = \
|
||||
.gitignore \
|
||||
compress.sh \
|
||||
test-guest.sh \
|
||||
validate.sh \
|
||||
README \
|
||||
index \
|
||||
index.asc \
|
||||
centos.sh \
|
||||
centos-6.xz.sig \
|
||||
debian.preseed \
|
||||
debian.sh \
|
||||
debian-6.xz.sig \
|
||||
debian-7.xz.sig \
|
||||
fedora.sh \
|
||||
fedora-18.xz.sig \
|
||||
fedora-19.xz.sig \
|
||||
rhel.sh \
|
||||
scientificlinux.sh \
|
||||
scientificlinux-6.xz.sig \
|
||||
ubuntu.preseed \
|
||||
ubuntu.sh \
|
||||
ubuntu-10.04.xz.sig \
|
||||
ubuntu-12.04.xz.sig \
|
||||
ubuntu-13.10.xz.sig
|
||||
|
||||
CLEANFILES = *~
|
||||
|
||||
# Validates the index file.
|
||||
TESTS_ENVIRONMENT = $(top_builddir)/run --test
|
||||
TESTS = validate.sh
|
||||
42
builder/website/README
Normal file
42
builder/website/README
Normal file
@@ -0,0 +1,42 @@
|
||||
If you are looking at this file at http://libguestfs.org/download/builder
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
This directory is used by the libguestfs 'virt-builder' to store the
|
||||
clean, signed OS templates used for building new virtual machines.
|
||||
|
||||
The index file is the default source URL and links to the other OS
|
||||
templates. It has the canonical URL:
|
||||
|
||||
http://libguestfs.org/download/builder/index.asc
|
||||
|
||||
If you are looking at this file in the git repository
|
||||
-----------------------------------------------------
|
||||
|
||||
libguestfs.git/builder/website/ contains a copy of the website, minus
|
||||
the huge OS template files (because of their size, they are stored
|
||||
elsewhere and merged into the website when it is uploaded).
|
||||
|
||||
When you use the ./run script to run virt-builder without installing,
|
||||
the ./run script sets $VIRT_BUILDER_SOURCE to point to this directory.
|
||||
If you actually want to use this configuration for anything except
|
||||
simple testing, you will have to download one or more OS templates
|
||||
from the libguestfs website and put them into the builder/website/
|
||||
directory.
|
||||
|
||||
ie:
|
||||
|
||||
./run virt-builder fedora-20
|
||||
|
||||
will fail unless you have downloaded fedora-20.xz here.
|
||||
|
||||
Fedora guests
|
||||
-------------
|
||||
|
||||
The general plan for using kickstart and virt-install is outlined
|
||||
by Kashyap here:
|
||||
|
||||
http://kashyapc.wordpress.com/2011/08/18/unattended-guest-install-with-a-local-kickstart/
|
||||
|
||||
If you want to reproduce the builds then the kickstart files are
|
||||
located in fedora-<N>.ks and the virt-install + other commands are in
|
||||
fedora-<N>.sh.
|
||||
17
builder/website/centos-6.xz.sig
Normal file
17
builder/website/centos-6.xz.sig
Normal file
@@ -0,0 +1,17 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v1.4.15 (GNU/Linux)
|
||||
|
||||
iQIcBAABAgAGBQJSovhrAAoJEJFzj3Pht2igwDMP/3kxGo8Uhro4c08/AmARucOn
|
||||
K8xVFMNth6e70ULit0iBnzsqsRcLXMtcdaIzA3wPNJoa3Uw0ZKzHO1FIP1DZC0Yp
|
||||
wQgnT/HV70k4YKMbJk2ayk9RPop/tRY/Pet9b0MoBwf/H7QzfQX+rU5WYCkcvr60
|
||||
t18hgugLfFh4wS5UP8jz1S5f6ftrb4TKQUB95lge+Fs7hCf2eqSy4jOciX92yQA6
|
||||
ACsh1e8hkWlAuDBesg+vcPFrh0oR05HZykUPOH5jUC9zM7kP2w4Y/mPFMIB6J/Zg
|
||||
SWOTfQWyKYWpW8MZ3huuB8/4EziOOwmIE9pDMcXIS4Cei08DOvq+/F6nbtpErfDU
|
||||
GdeypPIAsQPjjYDlPUEgYv6L8egzDGuOYWxgNO+2EaYCRjmtvDIxgnf4Q2fQLAhS
|
||||
Eir9hgvGH6BnNjaLigG1nA/wT6G0U6Ng1vqVrdGUpW1c6m7QoyjhRt4CyaaK0Rj/
|
||||
3H4FPPdamw/PXLM9IGVauthx/40umcBEZpSq5FSNGbzfzYPxMExJnu2W2bFF4QBD
|
||||
I/wnPxk5RCYq/AUmRwNrx4klmXnhZZKHYHTDkMuwoV8eIe9Bb6/+f9BY2ujkeMZR
|
||||
EbeG4i/E8YQ3fwSDfUpQS6kWZ74gMRfuC8vW2LGKMwKPrCaXJu4mVNYmdJGd3d8v
|
||||
fQ9MlcBUSfaMkyAQ2gc4
|
||||
=Phm4
|
||||
-----END PGP SIGNATURE-----
|
||||
87
builder/website/centos.sh
Executable file
87
builder/website/centos.sh
Executable file
@@ -0,0 +1,87 @@
|
||||
#!/bin/bash -
|
||||
# virt-builder
|
||||
# Copyright (C) 2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
unset CDPATH
|
||||
export LANG=C
|
||||
set -e
|
||||
set -x
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "$0 VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version=$1
|
||||
output=centos-$version
|
||||
tmpname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
|
||||
|
||||
# We rebuild this every time there is a new 6.x release, and bump
|
||||
# the revision in the index.
|
||||
tree=http://mirror.bytemark.co.uk/centos/$version/os/x86_64/
|
||||
|
||||
rm -f $output $output.old $output.xz
|
||||
|
||||
# Generate the kickstart to a temporary file.
|
||||
ks=$(mktemp)
|
||||
cat > $ks <<'EOF'
|
||||
install
|
||||
text
|
||||
reboot
|
||||
lang en_US.UTF-8
|
||||
keyboard us
|
||||
network --bootproto dhcp
|
||||
rootpw builder
|
||||
firewall --enabled --ssh
|
||||
selinux --enforcing
|
||||
timezone --utc America/New_York
|
||||
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH"
|
||||
zerombr
|
||||
clearpart --all --initlabel
|
||||
part /boot --fstype=ext4 --size=512 --asprimary
|
||||
part swap --size=1024 --asprimary
|
||||
part / --fstype=ext4 --size=1024 --grow --asprimary
|
||||
|
||||
# Halt the system once configuration has finished.
|
||||
poweroff
|
||||
|
||||
%packages
|
||||
@core
|
||||
%end
|
||||
EOF
|
||||
|
||||
# Clean up function.
|
||||
cleanup ()
|
||||
{
|
||||
rm -f $ks
|
||||
virsh undefine $tmpname ||:
|
||||
}
|
||||
trap cleanup INT QUIT TERM EXIT ERR
|
||||
|
||||
virt-install \
|
||||
--name=$tmpname \
|
||||
--ram=2048 \
|
||||
--cpu=host --vcpus=2 \
|
||||
--os-type=linux --os-variant=rhel$version \
|
||||
--initrd-inject=$ks \
|
||||
--extra-args="ks=file:/`basename $ks` console=tty0 console=ttyS0,115200 proxy=$http_proxy" \
|
||||
--disk $(pwd)/$output,size=6 \
|
||||
--location=$tree \
|
||||
--nographics \
|
||||
--noreboot
|
||||
|
||||
source $(dirname "$0")/compress.sh $output
|
||||
38
builder/website/compress.sh
Normal file
38
builder/website/compress.sh
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash -
|
||||
# virt-builder
|
||||
# Copyright (C) 2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
# Common code which syspreps, sparsifies and compresses the templates.
|
||||
|
||||
output=$1
|
||||
|
||||
# Sysprep (removes logfiles and so on).
|
||||
# Note this also touches /.autorelabel so the further installation
|
||||
# changes that we make will be labelled properly at first boot.
|
||||
virt-sysprep -a $output
|
||||
|
||||
# Sparsify.
|
||||
mv $output $output.old
|
||||
virt-sparsify $output.old $output
|
||||
rm $output.old
|
||||
|
||||
# Compress.
|
||||
xz --best --block-size=16777216 $output
|
||||
|
||||
# Result. These can be copied into the index file directly.
|
||||
echo -n compressed_size= ; stat -c %s $output.xz
|
||||
echo -n checksum= ; sha512sum $output.xz | awk '{print $1}'
|
||||
17
builder/website/debian-6.xz.sig
Normal file
17
builder/website/debian-6.xz.sig
Normal file
@@ -0,0 +1,17 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v1.4.14 (GNU/Linux)
|
||||
|
||||
iQIcBAABAgAGBQJSgNPNAAoJEJFzj3Pht2igb1MP/2sQeJEznpBguE5bbs+ulGyW
|
||||
Aa6jHgM+sG90OF0J9YlDZcYWYKiuVt+kdPOCw9WPg/e5AglKOu6FiMdFA/R9uP9i
|
||||
ga49So8xYQwaGS6GitHT6dI/kDNLSvTny0nNvAtut62mEJ5D5m9xxtXgYrttUByk
|
||||
DGQNUJizj8KehUbu9G+sVDM4ojyEbQlSWqi+SRK8uSFwINXXMwwimjZsq/BddcC6
|
||||
5DplyxS4o9EkbJP/QJKjkfyuhyBzMdIbVstPNFefqPn/xRX7h8VZOyVxr5dw0gYd
|
||||
PUU5aXeNJFiYR+LvJ2dLxjbcMEmFT+zhUOcxFWwZnjSYaRDdz47AeGfMLzEoFN4K
|
||||
/fYmtlusjLn9TDNsQ85ffXTETQU8CrhAfUvFmSPU1XuyY/G0UfK6LQehhg5tmHVL
|
||||
sfOBTKm/lOj+DG4CS0uAjY7JhLEn9K88kKgXhRGIcKt8UjgsPLvTq9sI87OlbcEe
|
||||
e4++ALWkXpfXF3Nf7mFXNwhQQSiiG9NIATsbfxSS9C7b0Y3HGWOy6pp4TyN8SIEi
|
||||
RNyWq93iOOtg91kuoRdScEn0crNninok7BmNt2MJry3Cujet+wBpBXYxuVdvRTPO
|
||||
6kBdl48bxvRb6hcwLqVjeWw8FM6sBGaA8mnTzshHu8nk6hl+tNwfk0loFwyO2M18
|
||||
bx0DKFFg024W/hfFqKkt
|
||||
=9ZnB
|
||||
-----END PGP SIGNATURE-----
|
||||
17
builder/website/debian-7.xz.sig
Normal file
17
builder/website/debian-7.xz.sig
Normal file
@@ -0,0 +1,17 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v1.4.14 (GNU/Linux)
|
||||
|
||||
iQIcBAABAgAGBQJSgN0FAAoJEJFzj3Pht2igfCAP/RUpnWQd1XjLKyyZjJSLMyPb
|
||||
oFF5JmQbFLF906L3wj/kuqyVf+VEdPXBSYTCw/5qvcAoNW/4DxtooSztK0P6j8TX
|
||||
Ez1g/Hamp0brIdBaFaerTMFSMtrHsIfBjSRCZJy2WCmlJH/piefPdRS06GXqLcDO
|
||||
WwLN5RZ2R5bWsSkS7DU4V/QODX35jFKV5xMwmX622jitDDWyStLESmyzF8E9MwKh
|
||||
QbRSguMilpszac9+GcaN05UTv4htarcsy5EkHBxZzjrS5srxlBQl5ygt0ZIj9GBh
|
||||
UUvfrIXnCZz7WhsBrbB72VhyXFnZj6gsPJsxRdvDg0nH9ORbmsnUo+Q3AJm6h8Vg
|
||||
UlOPMn05eToeDHF7U5Ki1w5G39TovUTLDJ43jTLHEy/im4zIIRSJgKaD8a4xLhib
|
||||
6wLWV9LHYQXHesoIqpfb5ife4KEFi5OVlioZ4REK0auKVVOA0y0eQnjDGJ0szBpp
|
||||
2xx+c+v2q5rn5X3S79lugAC0TpNxbM3X7rtli+kwa5l9Y7f5Z0XZJ7iuywoPs/VN
|
||||
5WxfG6vc0yfCMs8gpLL1TDVWZW6baoALTUkWj3ePn5od4KL/V9RXTnWhjaDQ+XbX
|
||||
/DEHwg7E+ICMPiZSqkeqfSAmbc+8Njdf77sEFCZF+ZV046BlHy+aFvxAY6rmrQTZ
|
||||
+d6Z2oiZ3UZ5R8iOqiDB
|
||||
=HZIe
|
||||
-----END PGP SIGNATURE-----
|
||||
385
builder/website/debian.preseed
Normal file
385
builder/website/debian.preseed
Normal file
@@ -0,0 +1,385 @@
|
||||
#### Contents of the preconfiguration file (for wheezy)
|
||||
### Localization
|
||||
# Preseeding only locale sets language, country and locale.
|
||||
d-i debian-installer/locale string en_US
|
||||
|
||||
# The values can also be preseeded individually for greater flexibility.
|
||||
#d-i debian-installer/language string en
|
||||
#d-i debian-installer/country string NL
|
||||
#d-i debian-installer/locale string en_GB.UTF-8
|
||||
# Optionally specify additional locales to be generated.
|
||||
#d-i localechooser/supported-locales multiselect en_US.UTF-8, nl_NL.UTF-8
|
||||
|
||||
# Keyboard selection.
|
||||
# keymap is an alias for keyboard-configuration/xkb-keymap
|
||||
d-i keymap select us
|
||||
# d-i keyboard-configuration/toggle select No toggling
|
||||
|
||||
### Network configuration
|
||||
# Disable network configuration entirely. This is useful for cdrom
|
||||
# installations on non-networked devices where the network questions,
|
||||
# warning and long timeouts are a nuisance.
|
||||
d-i netcfg/enable boolean true
|
||||
|
||||
# netcfg will choose an interface that has link if possible. This makes it
|
||||
# skip displaying a list if there is more than one interface.
|
||||
d-i netcfg/choose_interface select auto
|
||||
|
||||
# To pick a particular interface instead:
|
||||
#d-i netcfg/choose_interface select eth1
|
||||
|
||||
# To set a different link detection timeout (default is 3 seconds).
|
||||
# Values are interpreted as seconds.
|
||||
#d-i netcfg/link_detection_timeout string 10
|
||||
|
||||
# If you have a slow dhcp server and the installer times out waiting for
|
||||
# it, this might be useful.
|
||||
#d-i netcfg/dhcp_timeout string 60
|
||||
#d-i netcfg/dhcpv6_timeout string 60
|
||||
|
||||
# If you prefer to configure the network manually, uncomment this line and
|
||||
# the static network configuration below.
|
||||
#d-i netcfg/disable_autoconfig boolean true
|
||||
|
||||
# If you want the preconfiguration file to work on systems both with and
|
||||
# without a dhcp server, uncomment these lines and the static network
|
||||
# configuration below.
|
||||
#d-i netcfg/dhcp_failed note
|
||||
#d-i netcfg/dhcp_options select Configure network manually
|
||||
|
||||
# Static network configuration.
|
||||
#
|
||||
# IPv4 example
|
||||
#d-i netcfg/get_ipaddress string 192.168.1.42
|
||||
#d-i netcfg/get_netmask string 255.255.255.0
|
||||
#d-i netcfg/get_gateway string 192.168.1.1
|
||||
#d-i netcfg/get_nameservers string 192.168.1.1
|
||||
#d-i netcfg/confirm_static boolean true
|
||||
#
|
||||
# IPv6 example
|
||||
#d-i netcfg/get_ipaddress string fc00::2
|
||||
#d-i netcfg/get_netmask string ffff:ffff:ffff:ffff::
|
||||
#d-i netcfg/get_gateway string fc00::1
|
||||
#d-i netcfg/get_nameservers string fc00::1
|
||||
#d-i netcfg/confirm_static boolean true
|
||||
|
||||
# Any hostname and domain names assigned from dhcp take precedence over
|
||||
# values set here. However, setting the values still prevents the questions
|
||||
# from being shown, even if values come from dhcp.
|
||||
d-i netcfg/get_hostname string unassigned-hostname
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
|
||||
# If you want to force a hostname, regardless of what either the DHCP
|
||||
# server returns or what the reverse DNS entry for the IP is, uncomment
|
||||
# and adjust the following line.
|
||||
#d-i netcfg/hostname string somehost
|
||||
|
||||
# Disable that annoying WEP key dialog.
|
||||
d-i netcfg/wireless_wep string
|
||||
# The wacky dhcp hostname that some ISPs use as a password of sorts.
|
||||
#d-i netcfg/dhcp_hostname string radish
|
||||
|
||||
# If non-free firmware is needed for the network or other hardware, you can
|
||||
# configure the installer to always try to load it, without prompting. Or
|
||||
# change to false to disable asking.
|
||||
#d-i hw-detect/load_firmware boolean true
|
||||
|
||||
### Network console
|
||||
# Use the following settings if you wish to make use of the network-console
|
||||
# component for remote installation over SSH. This only makes sense if you
|
||||
# intend to perform the remainder of the installation manually.
|
||||
#d-i anna/choose_modules string network-console
|
||||
#d-i network-console/authorized_keys_url string http://10.0.0.1/openssh-key
|
||||
#d-i network-console/password password r00tme
|
||||
#d-i network-console/password-again password r00tme
|
||||
|
||||
### Mirror settings
|
||||
# If you select ftp, the mirror/country string does not need to be set.
|
||||
#d-i mirror/protocol string ftp
|
||||
d-i mirror/country string manual
|
||||
d-i mirror/http/hostname string ftp.uk.debian.org
|
||||
d-i mirror/http/directory string /debian
|
||||
d-i mirror/http/proxy string @CACHE@
|
||||
|
||||
# Suite to install.
|
||||
#d-i mirror/suite string testing
|
||||
# Suite to use for loading installer components (optional).
|
||||
#d-i mirror/udeb/suite string testing
|
||||
|
||||
### Account setup
|
||||
# Skip creation of a root account (normal user account will be able to
|
||||
# use sudo).
|
||||
#d-i passwd/root-login boolean false
|
||||
# Alternatively, to skip creation of a normal user account.
|
||||
d-i passwd/make-user boolean false
|
||||
|
||||
# Root password, either in clear text
|
||||
d-i passwd/root-password password builder
|
||||
d-i passwd/root-password-again password builder
|
||||
# or encrypted using an MD5 hash.
|
||||
#d-i passwd/root-password-crypted password [MD5 hash]
|
||||
|
||||
# To create a normal user account.
|
||||
#d-i passwd/user-fullname string Debian User
|
||||
#d-i passwd/username string debian
|
||||
# Normal user's password, either in clear text
|
||||
#d-i passwd/user-password password insecure
|
||||
#d-i passwd/user-password-again password insecure
|
||||
# or encrypted using an MD5 hash.
|
||||
#d-i passwd/user-password-crypted password [MD5 hash]
|
||||
# Create the first user with the specified UID instead of the default.
|
||||
#d-i passwd/user-uid string 1010
|
||||
|
||||
# The user account will be added to some standard initial groups. To
|
||||
# override that, use this.
|
||||
#d-i passwd/user-default-groups string audio cdrom video
|
||||
|
||||
### Clock and time zone setup
|
||||
# Controls whether or not the hardware clock is set to UTC.
|
||||
d-i clock-setup/utc boolean true
|
||||
|
||||
# You may set this to any valid setting for $TZ; see the contents of
|
||||
# /usr/share/zoneinfo/ for valid values.
|
||||
d-i time/zone string US/Eastern
|
||||
|
||||
# Controls whether to use NTP to set the clock during the install
|
||||
d-i clock-setup/ntp boolean true
|
||||
# NTP server to use. The default is almost always fine here.
|
||||
#d-i clock-setup/ntp-server string ntp.example.com
|
||||
|
||||
### Partitioning
|
||||
## Partitioning example
|
||||
# If the system has free space you can choose to only partition that space.
|
||||
# This is only honoured if partman-auto/method (below) is not set.
|
||||
#d-i partman-auto/init_automatically_partition select biggest_free
|
||||
|
||||
# Alternatively, you may specify a disk to partition. If the system has only
|
||||
# one disk the installer will default to using that, but otherwise the device
|
||||
# name must be given in traditional, non-devfs format (so e.g. /dev/hda or
|
||||
# /dev/sda, and not e.g. /dev/discs/disc0/disc).
|
||||
# For example, to use the first SCSI/SATA hard disk:
|
||||
#d-i partman-auto/disk string /dev/sda
|
||||
# In addition, you'll need to specify the method to use.
|
||||
# The presently available methods are:
|
||||
# - regular: use the usual partition types for your architecture
|
||||
# - lvm: use LVM to partition the disk
|
||||
# - crypto: use LVM within an encrypted partition
|
||||
d-i partman-auto/method string regular
|
||||
|
||||
# If one of the disks that are going to be automatically partitioned
|
||||
# contains an old LVM configuration, the user will normally receive a
|
||||
# warning. This can be preseeded away...
|
||||
d-i partman-lvm/device_remove_lvm boolean true
|
||||
# The same applies to pre-existing software RAID array:
|
||||
d-i partman-md/device_remove_md boolean true
|
||||
# And the same goes for the confirmation to write the lvm partitions.
|
||||
d-i partman-lvm/confirm boolean true
|
||||
d-i partman-lvm/confirm_nooverwrite boolean true
|
||||
|
||||
# You can choose one of the three predefined partitioning recipes:
|
||||
# - atomic: all files in one partition
|
||||
# - home: separate /home partition
|
||||
# - multi: separate /home, /usr, /var, and /tmp partitions
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
|
||||
# Or provide a recipe of your own...
|
||||
# If you have a way to get a recipe file into the d-i environment, you can
|
||||
# just point at it.
|
||||
#d-i partman-auto/expert_recipe_file string /hd-media/recipe
|
||||
|
||||
# If not, you can put an entire recipe into the preconfiguration file in one
|
||||
# (logical) line. This example creates a small /boot partition, suitable
|
||||
# swap, and uses the rest of the space for the root partition:
|
||||
#d-i partman-auto/expert_recipe string \
|
||||
# boot-root :: \
|
||||
# 40 50 100 ext3 \
|
||||
# $primary{ } $bootable{ } \
|
||||
# method{ format } format{ } \
|
||||
# use_filesystem{ } filesystem{ ext3 } \
|
||||
# mountpoint{ /boot } \
|
||||
# . \
|
||||
# 500 10000 1000000000 ext3 \
|
||||
# method{ format } format{ } \
|
||||
# use_filesystem{ } filesystem{ ext3 } \
|
||||
# mountpoint{ / } \
|
||||
# . \
|
||||
# 64 512 300% linux-swap \
|
||||
# method{ swap } format{ } \
|
||||
# .
|
||||
|
||||
# The full recipe format is documented in the file partman-auto-recipe.txt
|
||||
# included in the 'debian-installer' package or available from D-I source
|
||||
# repository. This also documents how to specify settings such as file
|
||||
# system labels, volume group names and which physical devices to include
|
||||
# in a volume group.
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
d-i partman-partitioning/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
|
||||
## Partitioning using RAID
|
||||
# The method should be set to "raid".
|
||||
#d-i partman-auto/method string raid
|
||||
# Specify the disks to be partitioned. They will all get the same layout,
|
||||
# so this will only work if the disks are the same size.
|
||||
#d-i partman-auto/disk string /dev/sda /dev/sdb
|
||||
|
||||
# Next you need to specify the physical partitions that will be used.
|
||||
#d-i partman-auto/expert_recipe string \
|
||||
# multiraid :: \
|
||||
# 1000 5000 4000 raid \
|
||||
# $primary{ } method{ raid } \
|
||||
# . \
|
||||
# 64 512 300% raid \
|
||||
# method{ raid } \
|
||||
# . \
|
||||
# 500 10000 1000000000 raid \
|
||||
# method{ raid } \
|
||||
# .
|
||||
|
||||
# Last you need to specify how the previously defined partitions will be
|
||||
# used in the RAID setup. Remember to use the correct partition numbers
|
||||
# for logical partitions. RAID levels 0, 1, 5, 6 and 10 are supported;
|
||||
# devices are separated using "#".
|
||||
# Parameters are:
|
||||
# <raidtype> <devcount> <sparecount> <fstype> <mountpoint> \
|
||||
# <devices> <sparedevices>
|
||||
|
||||
#d-i partman-auto-raid/recipe string \
|
||||
# 1 2 0 ext3 / \
|
||||
# /dev/sda1#/dev/sdb1 \
|
||||
# . \
|
||||
# 1 2 0 swap - \
|
||||
# /dev/sda5#/dev/sdb5 \
|
||||
# . \
|
||||
# 0 2 0 ext3 /home \
|
||||
# /dev/sda6#/dev/sdb6 \
|
||||
# .
|
||||
|
||||
# For additional information see the file partman-auto-raid-recipe.txt
|
||||
# included in the 'debian-installer' package or available from D-I source
|
||||
# repository.
|
||||
|
||||
# This makes partman automatically partition without confirmation.
|
||||
d-i partman-md/confirm boolean true
|
||||
d-i partman-partitioning/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
|
||||
## Controlling how partitions are mounted
|
||||
# The default is to mount by UUID, but you can also choose "traditional" to
|
||||
# use traditional device names, or "label" to try filesystem labels before
|
||||
# falling back to UUIDs.
|
||||
#d-i partman/mount_style select uuid
|
||||
|
||||
### Base system installation
|
||||
# Configure APT to not install recommended packages by default. Use of this
|
||||
# option can result in an incomplete system and should only be used by very
|
||||
# experienced users.
|
||||
#d-i base-installer/install-recommends boolean false
|
||||
|
||||
# The kernel image (meta) package to be installed; "none" can be used if no
|
||||
# kernel is to be installed.
|
||||
#d-i base-installer/kernel/image string linux-image-486
|
||||
|
||||
### Apt setup
|
||||
# You can choose to install non-free and contrib software.
|
||||
#d-i apt-setup/non-free boolean true
|
||||
#d-i apt-setup/contrib boolean true
|
||||
# Uncomment this if you don't want to use a network mirror.
|
||||
#d-i apt-setup/use_mirror boolean false
|
||||
# Select which update services to use; define the mirrors to be used.
|
||||
# Values shown below are the normal defaults.
|
||||
#d-i apt-setup/services-select multiselect security, volatile
|
||||
#d-i apt-setup/security_host string security.debian.org
|
||||
#d-i apt-setup/volatile_host string volatile.debian.org
|
||||
|
||||
# Additional repositories, local[0-9] available
|
||||
#d-i apt-setup/local0/repository string \
|
||||
# http://local.server/debian stable main
|
||||
#d-i apt-setup/local0/comment string local server
|
||||
# Enable deb-src lines
|
||||
#d-i apt-setup/local0/source boolean true
|
||||
# URL to the public key of the local repository; you must provide a key or
|
||||
# apt will complain about the unauthenticated repository and so the
|
||||
# sources.list line will be left commented out
|
||||
#d-i apt-setup/local0/key string http://local.server/key
|
||||
|
||||
# By default the installer requires that repositories be authenticated
|
||||
# using a known gpg key. This setting can be used to disable that
|
||||
# authentication. Warning: Insecure, not recommended.
|
||||
#d-i debian-installer/allow_unauthenticated boolean true
|
||||
|
||||
### Package selection
|
||||
#tasksel tasksel/first multiselect standard, web-server
|
||||
# If the desktop task is selected, install the kde and xfce desktops
|
||||
# instead of the default gnome desktop.
|
||||
#tasksel tasksel/desktop multiselect kde, xfce
|
||||
|
||||
# Individual additional packages to install
|
||||
#d-i pkgsel/include string openssh-server build-essential
|
||||
# Whether to upgrade packages after debootstrap.
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
#d-i pkgsel/upgrade select none
|
||||
|
||||
# Some versions of the installer can report back on what software you have
|
||||
# installed, and what software you use. The default is not to report back,
|
||||
# but sending reports helps the project determine what software is most
|
||||
# popular and include it on CDs.
|
||||
popularity-contest popularity-contest/participate boolean false
|
||||
|
||||
### Finishing up the installation
|
||||
# During installations from serial console, the regular virtual consoles
|
||||
# (VT1-VT6) are normally disabled in /etc/inittab. Uncomment the next
|
||||
# line to prevent this.
|
||||
#d-i finish-install/keep-consoles boolean true
|
||||
|
||||
# Avoid that last message about the install being complete.
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
# This will prevent the installer from ejecting the CD during the reboot,
|
||||
# which is useful in some situations.
|
||||
#d-i cdrom-detect/eject boolean false
|
||||
|
||||
# This is how to make the installer shutdown when finished, but not
|
||||
# reboot into the installed system.
|
||||
#d-i debian-installer/exit/halt boolean true
|
||||
# This will power off the machine instead of just halting it.
|
||||
#d-i debian-installer/exit/poweroff boolean true
|
||||
|
||||
### Preseeding other packages
|
||||
# Depending on what software you choose to install, or if things go wrong
|
||||
# during the installation process, it's possible that other questions may
|
||||
# be asked. You can preseed those too, of course. To get a list of every
|
||||
# possible question that could be asked during an install, do an
|
||||
# installation, and then run these commands:
|
||||
# debconf-get-selections --installer > file
|
||||
# debconf-get-selections >> file
|
||||
|
||||
|
||||
#### Advanced options
|
||||
### Running custom commands during the installation
|
||||
# d-i preseeding is inherently not secure. Nothing in the installer checks
|
||||
# for attempts at buffer overflows or other exploits of the values of a
|
||||
# preconfiguration file like this one. Only use preconfiguration files from
|
||||
# trusted locations! To drive that home, and because it's generally useful,
|
||||
# here's a way to run any shell command you'd like inside the installer,
|
||||
# automatically.
|
||||
|
||||
# This first command is run as early as possible, just after
|
||||
# preseeding is read.
|
||||
#d-i preseed/early_command string anna-install some-udeb
|
||||
# This command is run immediately before the partitioner starts. It may be
|
||||
# useful to apply dynamic partitioner preseeding that depends on the state
|
||||
# of the disks (which may not be visible when preseed/early_command runs).
|
||||
#d-i partman/early_command \
|
||||
# string debconf-set partman-auto/disk "$(list-devices disk | head -n1)"
|
||||
# This command is run just before the install finishes, but when there is
|
||||
# still a usable /target directory. You can chroot to /target and use it
|
||||
# directly, or use the apt-install and in-target commands to easily install
|
||||
# packages and run commands in the target system.
|
||||
#d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh
|
||||
77
builder/website/debian.sh
Executable file
77
builder/website/debian.sh
Executable file
@@ -0,0 +1,77 @@
|
||||
#!/bin/bash -
|
||||
# libguestfs
|
||||
# Copyright (C) 2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
# The basic plan comes from:
|
||||
# http://honk.sigxcpu.org/con/Preseeding_Debian_virtual_machines_with_virt_install.html
|
||||
# https://wiki.debian.org/DebianInstaller/Preseed
|
||||
|
||||
unset CDPATH
|
||||
export LANG=C
|
||||
set -e
|
||||
set -x
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "$0 VERSION DIST"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Some configuration.
|
||||
version=$1
|
||||
dist=$2
|
||||
location=http://ftp.uk.debian.org/debian/dists/$dist/main/installer-amd64
|
||||
output=debian-$version
|
||||
tmpname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
|
||||
|
||||
rm -f $output $output.old $output.xz
|
||||
|
||||
# Make sure it's being run from the correct directory.
|
||||
if [ ! -f debian.preseed ]; then
|
||||
echo "You are running this script from the wrong directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Note that the injected file must be called "/preseed.cfg" in order
|
||||
# for d-i to pick it up.
|
||||
sed -e "s,@CACHE@,$http_proxy,g" < debian.preseed > preseed.cfg
|
||||
|
||||
# Clean up function.
|
||||
cleanup ()
|
||||
{
|
||||
rm -f preseed.cfg
|
||||
virsh undefine $tmpname ||:
|
||||
}
|
||||
trap cleanup INT QUIT TERM EXIT ERR
|
||||
|
||||
virt-install \
|
||||
--name=$tmpname \
|
||||
--ram=1024 \
|
||||
--os-type=linux --os-variant=debian$dist \
|
||||
--initrd-inject=$(pwd)/preseed.cfg \
|
||||
--extra-args="auto console=tty0 console=ttyS0,115200" \
|
||||
--disk=$(pwd)/$output,size=4 \
|
||||
--location=$location \
|
||||
--nographics \
|
||||
--noreboot
|
||||
|
||||
# Remove apt proxy configuration (thanks: Daniel Miranda).
|
||||
guestfish -a $output -i <<EOF
|
||||
rm /etc/apt/apt.conf
|
||||
touch /etc/apt/apt.conf
|
||||
EOF
|
||||
|
||||
source $(dirname "$0")/compress.sh $output
|
||||
17
builder/website/fedora-18.xz.sig
Normal file
17
builder/website/fedora-18.xz.sig
Normal file
@@ -0,0 +1,17 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v1.4.14 (GNU/Linux)
|
||||
|
||||
iQIcBAABAgAGBQJSSt3OAAoJEJFzj3Pht2ig8x4QAKoQVfMWxXiFvV3lrHUVsjpG
|
||||
n+fDcoFJqMKeE/kMLhmlmzF+QDz1qRs3Xlypy7C8B5ii5jbFVCv6q5edeEWrVYE3
|
||||
HZOeNgUgmVJEiCSgScEXPpVMAOL/zppJ2PjAbg7CNLHQ64HweNkv6F1ePg4NCIoA
|
||||
Op5yIvzm0gUHN9ONfsJRBLlZGQRu8bdsNhdYOAr3rmdxhuuunIi/17qNrT6eaWFO
|
||||
2pnGFIyYMn9q2ReXBG8mFIkHlac9ZpT2sR7EKY3LBt0FvGz0qQrNM+9M9bQBwbIQ
|
||||
dD/IRfSUUQqjCLYLqiFvFVC/pqAAcR1G2rQ20jRLPkpSUFceFL/K5ueI2flEPEJk
|
||||
mF6WR4MsN4lX4w0iiJvpWwE0jqlLVQ1GnhoE2GDZEHgkth/4l+0pN0Jos8OKINDJ
|
||||
wB4W1Xc2aXNXaD1JAaebu+CthZNnFEXpa5TrXMFAOnBY4oQ4DgOt/ad1s9Ju4zLX
|
||||
EI+Zn0Q++l+iMyU2InXnTHoaTagqKqtngvHWGmSuK55dM8jW9HoYsjZZl0oC0lVz
|
||||
GbXQ/1t1loTBqh+crr4kcP0oKvRFT9YPASadUVThmeYlxOyhvQ0e30IBdz0Te1OR
|
||||
rqfymVGR8NsGdLW+jCKOfbLEaYShTksTnUmr+yF5w5D2uzZHqZasE7cpwPXAEhuZ
|
||||
TF7ZoSqz1utSQF9/xBnz
|
||||
=L4x6
|
||||
-----END PGP SIGNATURE-----
|
||||
17
builder/website/fedora-19.xz.sig
Normal file
17
builder/website/fedora-19.xz.sig
Normal file
@@ -0,0 +1,17 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v1.4.14 (GNU/Linux)
|
||||
|
||||
iQIcBAABAgAGBQJSSt3WAAoJEJFzj3Pht2igSeMQAI42FK1YU6Fr/LreD9/BdjNH
|
||||
TUJ3L/B3ZMJwlMT+F4cX9r1uVD5udzpXdClUEcKgdwPdqzPsQvuwLSBS4fn38nZM
|
||||
mryzNeUjbcNPSPSY6bj/MNuYNlYNaWShhL6UjHBD6XYIhAs6hYp0RGcogcpgRU9Z
|
||||
0peHFyJBp+uUqCpnBDz00zJht49mgT6ovUA3cGd/vPhHrsrJUusgzzi46X3F90+H
|
||||
9eRoe6/xzCbmbiD7HUlARnMK8ec0b7H/CWsNNCd0v9KBNyW9QROkbwBMtRcWtQZW
|
||||
p9h9JGT2N3AmIqRbUbKwfWxGN6AfK+Xtl9YjJb/ugwSlw0Pif055EKNeUZjGUUzk
|
||||
V4YA9b1Z6mncyL4wxV8VD9w8en+dr5Iu6ga02r7Xr0rIHuTQyQQaKfHvNoWZFmhq
|
||||
WI2xsSBLr1EYfLEetdqUkEo2f2gpy7f6UKL1bsHi/6oqA3NaOOXiPdVlbVDNOQFe
|
||||
kXPfjz/8hnzQ/8O/zIiSiDefQObdM4DQDTk5ha/vOu4pt5XevHkusaciPNGUAhx1
|
||||
JmxEmPF6sqg2Y0xmeFZB2ab5s6VL/CfVGBF5ZFq7QmDj9eNFjrElfv+uN9NqD+ll
|
||||
YlR/g3f7vFLHSG64ez4yV/Hgmfv1+4DMGi9MNmhFF3u0W5AIxznTsQzj1KFhbvmV
|
||||
8QUyTDG7lGNqsgsSgb7W
|
||||
=l9GJ
|
||||
-----END PGP SIGNATURE-----
|
||||
85
builder/website/fedora.sh
Executable file
85
builder/website/fedora.sh
Executable file
@@ -0,0 +1,85 @@
|
||||
#!/bin/bash -
|
||||
# virt-builder
|
||||
# Copyright (C) 2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
# This script was used to create the Fedora templates used by
|
||||
# virt-builder.
|
||||
|
||||
unset CDPATH
|
||||
export LANG=C
|
||||
set -e
|
||||
set -x
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "$0 VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version=$1
|
||||
tree=http://mirror.bytemark.co.uk/fedora/linux/releases/$version/Fedora/x86_64/os/
|
||||
output=fedora-$version
|
||||
tmpname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
|
||||
|
||||
rm -f $output $output.old $output.xz
|
||||
|
||||
# Generate the kickstart to a temporary file.
|
||||
ks=$(mktemp)
|
||||
cat > $ks <<'EOF'
|
||||
install
|
||||
text
|
||||
reboot
|
||||
lang en_US.UTF-8
|
||||
keyboard us
|
||||
network --bootproto dhcp
|
||||
rootpw builder
|
||||
firewall --enabled --ssh
|
||||
selinux --enforcing
|
||||
timezone --utc America/New_York
|
||||
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH"
|
||||
zerombr
|
||||
clearpart --all --initlabel
|
||||
autopart --type=plain
|
||||
|
||||
# Halt the system once configuration has finished.
|
||||
poweroff
|
||||
|
||||
%packages
|
||||
@core
|
||||
%end
|
||||
EOF
|
||||
|
||||
# Clean up function.
|
||||
cleanup ()
|
||||
{
|
||||
rm -f $ks
|
||||
virsh undefine $tmpname ||:
|
||||
}
|
||||
trap cleanup INT QUIT TERM EXIT ERR
|
||||
|
||||
virt-install \
|
||||
--name=$tmpname \
|
||||
--ram=2048 \
|
||||
--cpu=host --vcpus=2 \
|
||||
--os-type=linux --os-variant=fedora18 \
|
||||
--initrd-inject=$ks \
|
||||
--extra-args="ks=file:/`basename $ks` console=tty0 console=ttyS0,115200 proxy=$http_proxy" \
|
||||
--disk $(pwd)/$output,size=6 \
|
||||
--location=$tree \
|
||||
--nographics \
|
||||
--noreboot
|
||||
|
||||
source $(dirname "$0")/compress.sh $output
|
||||
228
builder/website/index
Normal file
228
builder/website/index
Normal file
@@ -0,0 +1,228 @@
|
||||
[centos-6]
|
||||
name=CentOS 6.5
|
||||
revision=5
|
||||
osinfo=centos6.5
|
||||
file=centos-6.xz
|
||||
sig=centos-6.xz.sig
|
||||
checksum=8f08505ec708b04a25bbd21816cdda8a5eff8bbf85fec3caff6d7a9a7bfba07dafa707e60772f5676c437a6d3381cd26b4e48bc82a232bc940ca9dcddcff7a85
|
||||
format=raw
|
||||
size=6442450944
|
||||
compressed_size=197139324
|
||||
expand=/dev/sda3
|
||||
notes=CentOS 6.5
|
||||
|
||||
This CentOS image contains only unmodified @Core group packages.
|
||||
|
||||
It is thus very minimal. The kickstart and install script can be
|
||||
found in the libguestfs source tree:
|
||||
|
||||
builder/website/centos.sh
|
||||
|
||||
Note that `virt-builder centos-6' will always install the latest
|
||||
6.x release.
|
||||
|
||||
[debian-6]
|
||||
name=Debian 6 (Squeeze)
|
||||
osinfo=debian6
|
||||
file=debian-6.xz
|
||||
revision=2
|
||||
sig=debian-6.xz.sig
|
||||
checksum=bff9c28da0375fde65fa238d7a2ea644cbfad0ea3246783a2f44a98f2374850987679c3f1032a632d3c6238de8d9e43291d07a82efc1e824945000e206b9f6cc
|
||||
format=raw
|
||||
size=4294967296
|
||||
compressed_size=139615908
|
||||
expand=/dev/sda1
|
||||
notes=Debian 6 (Squeeze).
|
||||
|
||||
This is a default Debian install.
|
||||
|
||||
The preseed and virt-install scripts that produced this image
|
||||
can be found in the libguestfs source tree:
|
||||
|
||||
builder/website/debian.preseed
|
||||
builder/website/debian.sh
|
||||
|
||||
This image is so very minimal that it only includes an ssh
|
||||
server and no virtual consoles. To enable virtual consoles
|
||||
use this virt-builder option:
|
||||
|
||||
virt-builder debian-6 \
|
||||
--edit '/etc/inittab: s,^#([1-9].*respawn.*/sbin/getty.*),$1,'
|
||||
|
||||
This image does not contain SSH host keys. To regenerate them use:
|
||||
|
||||
--firstboot-command "dpkg-reconfigure openssh-server"
|
||||
|
||||
[debian-7]
|
||||
name=Debian 7 (Wheezy)
|
||||
osinfo=debian7
|
||||
file=debian-7.xz
|
||||
revision=2
|
||||
sig=debian-7.xz.sig
|
||||
checksum=c980a7d878c086b14619b3b9f644ab131c1f88b87729062f2832de12a938ba9e5a511c49402a9d02b740a30876f51889d20e7d0ed4997755f542650b8485f013
|
||||
format=raw
|
||||
size=4294967296
|
||||
compressed_size=150734028
|
||||
expand=/dev/sda1
|
||||
notes=Debian 7 (Wheezy).
|
||||
|
||||
This is a default Debian install.
|
||||
|
||||
The preseed and virt-install scripts that produced this image
|
||||
can be found in the libguestfs source tree:
|
||||
|
||||
builder/website/debian.preseed
|
||||
builder/website/debian.sh
|
||||
|
||||
This image is so very minimal that it only includes an ssh
|
||||
server and no virtual consoles. To enable virtual consoles
|
||||
use this virt-builder option:
|
||||
|
||||
virt-builder debian-7 \
|
||||
--edit '/etc/inittab: s,^#([1-9].*respawn.*/sbin/getty.*),$1,'
|
||||
|
||||
This image does not contain SSH host keys. To regenerate them use:
|
||||
|
||||
--firstboot-command "dpkg-reconfigure openssh-server"
|
||||
|
||||
[fedora-18]
|
||||
name=Fedora® 18
|
||||
osinfo=fedora18
|
||||
file=fedora-18.xz
|
||||
sig=fedora-18.xz.sig
|
||||
checksum=12435775193b69f6e22658aaa001d4ca9b15fd68a04b4b7e9be20b3b517e857e417dc3268a302979d4a702b20f25754025f7ae0e9fb7088419a4ca1669585e6f
|
||||
format=raw
|
||||
size=6442450944
|
||||
compressed_size=148947524
|
||||
expand=/dev/sda3
|
||||
notes=Fedora 18.
|
||||
|
||||
This Fedora image contains only unmodified @Core group packages.
|
||||
|
||||
It is thus very minimal. The kickstart and install script can be
|
||||
found in the libguestfs source tree:
|
||||
|
||||
builder/website/fedora.sh
|
||||
|
||||
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
|
||||
Source and further information is available from http://fedoraproject.org/
|
||||
|
||||
[fedora-19]
|
||||
name=Fedora® 19
|
||||
osinfo=fedora19
|
||||
file=fedora-19.xz
|
||||
sig=fedora-19.xz.sig
|
||||
checksum=6228792b15df695260eea5530770e22b1bce40a1986410252928adbe4131ab85c031bcf8892736b63240fd585e39a5f44ed7770ba0dc1e6d8de6834cccee3767
|
||||
format=raw
|
||||
size=4294967296
|
||||
compressed_size=172190964
|
||||
expand=/dev/sda3
|
||||
notes=Fedora 19.
|
||||
|
||||
This Fedora image contains only unmodified @Core group packages.
|
||||
|
||||
It is thus very minimal. The kickstart and install script can be
|
||||
found in the libguestfs source tree:
|
||||
|
||||
builder/website/fedora.sh
|
||||
|
||||
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
|
||||
Source and further information is available from http://fedoraproject.org/
|
||||
|
||||
[scientificlinux-6]
|
||||
name=Scientific Linux 6.4
|
||||
revision=4
|
||||
osinfo=centos6.4
|
||||
file=scientificlinux-6.xz
|
||||
sig=scientificlinux-6.xz.sig
|
||||
checksum=806dd95dd73820b6183c183a9040c547f44b7e9fc109a8ce3cedf7646a9e02d3b65e9dd31f99b656e76c5842b0471f35fa93c4b4d49bf372c842617987b6bd7b
|
||||
format=raw
|
||||
size=6442450944
|
||||
compressed_size=183917692
|
||||
expand=/dev/sda3
|
||||
notes=Scientific Linux 6.4
|
||||
|
||||
This Scientific Linux image contains only unmodified @Core group packages.
|
||||
|
||||
It is thus very minimal. The kickstart and install script can be
|
||||
found in the libguestfs source tree:
|
||||
|
||||
builder/website/scientificlinux.sh
|
||||
|
||||
Note that `virt-builder scientificlinux-6' will always install the
|
||||
latest 6.x release.
|
||||
|
||||
[ubuntu-10.04]
|
||||
name=Ubuntu 10.04 (Lucid)
|
||||
osinfo=ubuntulucid
|
||||
file=ubuntu-10.04.xz
|
||||
sig=ubuntu-10.04.xz.sig
|
||||
checksum=9e322782bc77c740ce956d57d0d89ec9ac9f2b890c474ac937f400db848df3e164683eaf4631b989f8b4771f64e0c0972452d1555a15c65714b5ceefb295fb7e
|
||||
format=raw
|
||||
size=4294967296
|
||||
compressed_size=149728112
|
||||
expand=/dev/sda1
|
||||
notes=Ubuntu 10.04 (Lucid).
|
||||
|
||||
This is a minimal Ubuntu 10.04 (Lucid) install.
|
||||
|
||||
Only the openssh-server package is selected in tasksel.
|
||||
The preseed and virt-install scripts that produced this image
|
||||
can be found in the libguestfs source tree:
|
||||
|
||||
builder/website/ubuntu.preseed
|
||||
builder/website/ubuntu.sh
|
||||
|
||||
This image does not contain SSH host keys. To regenerate them use:
|
||||
|
||||
--firstboot-command "dpkg-reconfigure openssh-server"
|
||||
|
||||
[ubuntu-12.04]
|
||||
name=Ubuntu 12.04 (Precise)
|
||||
osinfo=ubuntuprecise
|
||||
file=ubuntu-12.04.xz
|
||||
sig=ubuntu-12.04.xz.sig
|
||||
checksum=15eab4610a44bf28423c08982cec47f6c3d43f29834791440249916ed76cc2dfeaf0405fddc8627086257bbbdaa4016c8982ad9b269f57f8f625b0e70d09e4e0
|
||||
format=raw
|
||||
size=4294967296
|
||||
compressed_size=168593316
|
||||
expand=/dev/sda1
|
||||
notes=Ubuntu 12.04 (Precise).
|
||||
|
||||
This is a minimal Ubuntu 12.04 (Precise) install.
|
||||
|
||||
Only the openssh-server package is selected in tasksel.
|
||||
The preseed and virt-install scripts that produced this image
|
||||
can be found in the libguestfs source tree:
|
||||
|
||||
builder/website/ubuntu.preseed
|
||||
builder/website/ubuntu.sh
|
||||
|
||||
This image does not contain SSH host keys. To regenerate them use:
|
||||
|
||||
--firstboot-command "dpkg-reconfigure openssh-server"
|
||||
|
||||
[ubuntu-13.10]
|
||||
name=Ubuntu 13.10 (Saucy)
|
||||
osinfo=ubuntusaucy
|
||||
file=ubuntu-13.10.xz
|
||||
sig=ubuntu-13.10.xz.sig
|
||||
checksum=841876f027c63229a0aaac4540ba80d23e56d211138987e3d8187cacb04bc801d144a9831d842fc04aea557fc0c690c812c045ed440123b1d616e61ab2d56049
|
||||
format=raw
|
||||
size=4294967296
|
||||
compressed_size=196481392
|
||||
expand=/dev/sda1
|
||||
notes=Ubuntu 13.10 (Saucy).
|
||||
|
||||
This is a minimal Ubuntu 13.10 (Saucy) install.
|
||||
|
||||
Only the openssh-server package is selected in tasksel.
|
||||
The preseed and virt-install scripts that produced this image
|
||||
can be found in the libguestfs source tree:
|
||||
|
||||
builder/website/ubuntu.preseed
|
||||
builder/website/ubuntu.sh
|
||||
|
||||
This image does not contain SSH host keys. To regenerate them use:
|
||||
|
||||
--firstboot-command "dpkg-reconfigure openssh-server"
|
||||
248
builder/website/index.asc
Normal file
248
builder/website/index.asc
Normal file
@@ -0,0 +1,248 @@
|
||||
-----BEGIN PGP SIGNED MESSAGE-----
|
||||
Hash: SHA1
|
||||
|
||||
[centos-6]
|
||||
name=CentOS 6.5
|
||||
revision=5
|
||||
osinfo=centos6.5
|
||||
file=centos-6.xz
|
||||
sig=centos-6.xz.sig
|
||||
checksum=8f08505ec708b04a25bbd21816cdda8a5eff8bbf85fec3caff6d7a9a7bfba07dafa707e60772f5676c437a6d3381cd26b4e48bc82a232bc940ca9dcddcff7a85
|
||||
format=raw
|
||||
size=6442450944
|
||||
compressed_size=197139324
|
||||
expand=/dev/sda3
|
||||
notes=CentOS 6.5
|
||||
|
||||
This CentOS image contains only unmodified @Core group packages.
|
||||
|
||||
It is thus very minimal. The kickstart and install script can be
|
||||
found in the libguestfs source tree:
|
||||
|
||||
builder/website/centos.sh
|
||||
|
||||
Note that `virt-builder centos-6' will always install the latest
|
||||
6.x release.
|
||||
|
||||
[debian-6]
|
||||
name=Debian 6 (Squeeze)
|
||||
osinfo=debian6
|
||||
file=debian-6.xz
|
||||
revision=2
|
||||
sig=debian-6.xz.sig
|
||||
checksum=bff9c28da0375fde65fa238d7a2ea644cbfad0ea3246783a2f44a98f2374850987679c3f1032a632d3c6238de8d9e43291d07a82efc1e824945000e206b9f6cc
|
||||
format=raw
|
||||
size=4294967296
|
||||
compressed_size=139615908
|
||||
expand=/dev/sda1
|
||||
notes=Debian 6 (Squeeze).
|
||||
|
||||
This is a default Debian install.
|
||||
|
||||
The preseed and virt-install scripts that produced this image
|
||||
can be found in the libguestfs source tree:
|
||||
|
||||
builder/website/debian.preseed
|
||||
builder/website/debian.sh
|
||||
|
||||
This image is so very minimal that it only includes an ssh
|
||||
server and no virtual consoles. To enable virtual consoles
|
||||
use this virt-builder option:
|
||||
|
||||
virt-builder debian-6 \
|
||||
--edit '/etc/inittab: s,^#([1-9].*respawn.*/sbin/getty.*),$1,'
|
||||
|
||||
This image does not contain SSH host keys. To regenerate them use:
|
||||
|
||||
--firstboot-command "dpkg-reconfigure openssh-server"
|
||||
|
||||
[debian-7]
|
||||
name=Debian 7 (Wheezy)
|
||||
osinfo=debian7
|
||||
file=debian-7.xz
|
||||
revision=2
|
||||
sig=debian-7.xz.sig
|
||||
checksum=c980a7d878c086b14619b3b9f644ab131c1f88b87729062f2832de12a938ba9e5a511c49402a9d02b740a30876f51889d20e7d0ed4997755f542650b8485f013
|
||||
format=raw
|
||||
size=4294967296
|
||||
compressed_size=150734028
|
||||
expand=/dev/sda1
|
||||
notes=Debian 7 (Wheezy).
|
||||
|
||||
This is a default Debian install.
|
||||
|
||||
The preseed and virt-install scripts that produced this image
|
||||
can be found in the libguestfs source tree:
|
||||
|
||||
builder/website/debian.preseed
|
||||
builder/website/debian.sh
|
||||
|
||||
This image is so very minimal that it only includes an ssh
|
||||
server and no virtual consoles. To enable virtual consoles
|
||||
use this virt-builder option:
|
||||
|
||||
virt-builder debian-7 \
|
||||
--edit '/etc/inittab: s,^#([1-9].*respawn.*/sbin/getty.*),$1,'
|
||||
|
||||
This image does not contain SSH host keys. To regenerate them use:
|
||||
|
||||
--firstboot-command "dpkg-reconfigure openssh-server"
|
||||
|
||||
[fedora-18]
|
||||
name=Fedora® 18
|
||||
osinfo=fedora18
|
||||
file=fedora-18.xz
|
||||
sig=fedora-18.xz.sig
|
||||
checksum=12435775193b69f6e22658aaa001d4ca9b15fd68a04b4b7e9be20b3b517e857e417dc3268a302979d4a702b20f25754025f7ae0e9fb7088419a4ca1669585e6f
|
||||
format=raw
|
||||
size=6442450944
|
||||
compressed_size=148947524
|
||||
expand=/dev/sda3
|
||||
notes=Fedora 18.
|
||||
|
||||
This Fedora image contains only unmodified @Core group packages.
|
||||
|
||||
It is thus very minimal. The kickstart and install script can be
|
||||
found in the libguestfs source tree:
|
||||
|
||||
builder/website/fedora.sh
|
||||
|
||||
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
|
||||
Source and further information is available from http://fedoraproject.org/
|
||||
|
||||
[fedora-19]
|
||||
name=Fedora® 19
|
||||
osinfo=fedora19
|
||||
file=fedora-19.xz
|
||||
sig=fedora-19.xz.sig
|
||||
checksum=6228792b15df695260eea5530770e22b1bce40a1986410252928adbe4131ab85c031bcf8892736b63240fd585e39a5f44ed7770ba0dc1e6d8de6834cccee3767
|
||||
format=raw
|
||||
size=4294967296
|
||||
compressed_size=172190964
|
||||
expand=/dev/sda3
|
||||
notes=Fedora 19.
|
||||
|
||||
This Fedora image contains only unmodified @Core group packages.
|
||||
|
||||
It is thus very minimal. The kickstart and install script can be
|
||||
found in the libguestfs source tree:
|
||||
|
||||
builder/website/fedora.sh
|
||||
|
||||
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
|
||||
Source and further information is available from http://fedoraproject.org/
|
||||
|
||||
[scientificlinux-6]
|
||||
name=Scientific Linux 6.4
|
||||
revision=4
|
||||
osinfo=centos6.4
|
||||
file=scientificlinux-6.xz
|
||||
sig=scientificlinux-6.xz.sig
|
||||
checksum=806dd95dd73820b6183c183a9040c547f44b7e9fc109a8ce3cedf7646a9e02d3b65e9dd31f99b656e76c5842b0471f35fa93c4b4d49bf372c842617987b6bd7b
|
||||
format=raw
|
||||
size=6442450944
|
||||
compressed_size=183917692
|
||||
expand=/dev/sda3
|
||||
notes=Scientific Linux 6.4
|
||||
|
||||
This Scientific Linux image contains only unmodified @Core group packages.
|
||||
|
||||
It is thus very minimal. The kickstart and install script can be
|
||||
found in the libguestfs source tree:
|
||||
|
||||
builder/website/scientificlinux.sh
|
||||
|
||||
Note that `virt-builder scientificlinux-6' will always install the
|
||||
latest 6.x release.
|
||||
|
||||
[ubuntu-10.04]
|
||||
name=Ubuntu 10.04 (Lucid)
|
||||
osinfo=ubuntulucid
|
||||
file=ubuntu-10.04.xz
|
||||
sig=ubuntu-10.04.xz.sig
|
||||
checksum=9e322782bc77c740ce956d57d0d89ec9ac9f2b890c474ac937f400db848df3e164683eaf4631b989f8b4771f64e0c0972452d1555a15c65714b5ceefb295fb7e
|
||||
format=raw
|
||||
size=4294967296
|
||||
compressed_size=149728112
|
||||
expand=/dev/sda1
|
||||
notes=Ubuntu 10.04 (Lucid).
|
||||
|
||||
This is a minimal Ubuntu 10.04 (Lucid) install.
|
||||
|
||||
Only the openssh-server package is selected in tasksel.
|
||||
The preseed and virt-install scripts that produced this image
|
||||
can be found in the libguestfs source tree:
|
||||
|
||||
builder/website/ubuntu.preseed
|
||||
builder/website/ubuntu.sh
|
||||
|
||||
This image does not contain SSH host keys. To regenerate them use:
|
||||
|
||||
--firstboot-command "dpkg-reconfigure openssh-server"
|
||||
|
||||
[ubuntu-12.04]
|
||||
name=Ubuntu 12.04 (Precise)
|
||||
osinfo=ubuntuprecise
|
||||
file=ubuntu-12.04.xz
|
||||
sig=ubuntu-12.04.xz.sig
|
||||
checksum=15eab4610a44bf28423c08982cec47f6c3d43f29834791440249916ed76cc2dfeaf0405fddc8627086257bbbdaa4016c8982ad9b269f57f8f625b0e70d09e4e0
|
||||
format=raw
|
||||
size=4294967296
|
||||
compressed_size=168593316
|
||||
expand=/dev/sda1
|
||||
notes=Ubuntu 12.04 (Precise).
|
||||
|
||||
This is a minimal Ubuntu 12.04 (Precise) install.
|
||||
|
||||
Only the openssh-server package is selected in tasksel.
|
||||
The preseed and virt-install scripts that produced this image
|
||||
can be found in the libguestfs source tree:
|
||||
|
||||
builder/website/ubuntu.preseed
|
||||
builder/website/ubuntu.sh
|
||||
|
||||
This image does not contain SSH host keys. To regenerate them use:
|
||||
|
||||
--firstboot-command "dpkg-reconfigure openssh-server"
|
||||
|
||||
[ubuntu-13.10]
|
||||
name=Ubuntu 13.10 (Saucy)
|
||||
osinfo=ubuntusaucy
|
||||
file=ubuntu-13.10.xz
|
||||
sig=ubuntu-13.10.xz.sig
|
||||
checksum=841876f027c63229a0aaac4540ba80d23e56d211138987e3d8187cacb04bc801d144a9831d842fc04aea557fc0c690c812c045ed440123b1d616e61ab2d56049
|
||||
format=raw
|
||||
size=4294967296
|
||||
compressed_size=196481392
|
||||
expand=/dev/sda1
|
||||
notes=Ubuntu 13.10 (Saucy).
|
||||
|
||||
This is a minimal Ubuntu 13.10 (Saucy) install.
|
||||
|
||||
Only the openssh-server package is selected in tasksel.
|
||||
The preseed and virt-install scripts that produced this image
|
||||
can be found in the libguestfs source tree:
|
||||
|
||||
builder/website/ubuntu.preseed
|
||||
builder/website/ubuntu.sh
|
||||
|
||||
This image does not contain SSH host keys. To regenerate them use:
|
||||
|
||||
--firstboot-command "dpkg-reconfigure openssh-server"
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v1.4.15 (GNU/Linux)
|
||||
|
||||
iQIcBAEBAgAGBQJSoviGAAoJEJFzj3Pht2igYTUP/R2Q8eE8a+aID+7LpmLLFdEa
|
||||
RPDEzwasiirPl7B9pRFYa+jgdwFxD0jlgVLNtPQS6qeYAOyTJ1bnUo5EFJRwSUHe
|
||||
7auga+DkMAH1oWXlBdC8iQEpk6JAtHxeF+/s25Y889kk7SYQaA4MKv+MeQxDChR1
|
||||
t8OrYm+OV7UL6sCrxBkUwFSV4klqWQT/0cLl18lhZOsdR428DIVjr45ybVe/ofyd
|
||||
WC2YgacP/OxryoT7udcOCrWidZAFMcI4qDYELI6IXMK9qtzw5TXsxfUVMtlzu8JD
|
||||
gECZ57qANbWEunDYHtwP5S2GLgZQk0StJjUdzFLhV8fSt1NLew6aMCH6uzjev7yC
|
||||
bQvcZ+WxMyKyxJMH4TXpfXEQtrF8dGBtjgIOB/M2GHs1W3KEFbiAhwoJLmNOicXU
|
||||
WPXSgGNaJsYwll3gtlqjj5UnzdlMyGOkAWL7Yd4Ql/znlX1Jh9oJUX2Fx0xS9gtd
|
||||
41iJZDt9Nq0xlGsA4cOxRXJTcy9tzsJO3yF57fNWcvxpLdOq/SmlziIyUQ+A8QaR
|
||||
quQJMJ7bHfOwR4Gs3YM/Eue/HkDhc1pmu4qOSae/qvrx+r5sCbBK8iexxk8MQaDg
|
||||
b1QTm8sVaVRTE7aOpYkYZHQoKxdDyVfGrUiZW85xFwUnhPFrpO7EueWGaqxKtDCx
|
||||
YZl8xaH8A8r3wv8EnG60
|
||||
=P6NK
|
||||
-----END PGP SIGNATURE-----
|
||||
166
builder/website/rhel.sh
Executable file
166
builder/website/rhel.sh
Executable file
@@ -0,0 +1,166 @@
|
||||
#!/bin/bash -
|
||||
# virt-builder
|
||||
# Copyright (C) 2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
unset CDPATH
|
||||
export LANG=C
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# Hack for RWMJ
|
||||
unset http_proxy
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "$0 VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version=$1
|
||||
output=rhel-$version
|
||||
tmpname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
|
||||
|
||||
case $version in
|
||||
5.*)
|
||||
major=5
|
||||
minor=`echo $version | awk -F. '{print $2}'`
|
||||
topurl=http://download.devel.redhat.com/released/RHEL-$major-Server/U$minor
|
||||
tree=$topurl/x86_64/os
|
||||
srpms=$topurl/source/SRPMS
|
||||
bootfs=ext2
|
||||
;;
|
||||
6.*)
|
||||
major=6
|
||||
topurl=http://download.devel.redhat.com/released/RHEL-$major/$version
|
||||
tree=$topurl/Server/x86_64/os
|
||||
srpms=$topurl/source/SRPMS
|
||||
optional=$topurl/Server/optional/x86_64/os
|
||||
optionalsrpms=$topurl/Server/optional/source/SRPMS
|
||||
bootfs=ext4
|
||||
;;
|
||||
*)
|
||||
echo "$0: version $version not supported by this script yet"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
rm -f $output $output.old $output.xz
|
||||
|
||||
# Generate the kickstart to a temporary file.
|
||||
ks=$(mktemp)
|
||||
cat > $ks <<'EOF'
|
||||
install
|
||||
text
|
||||
lang en_US.UTF-8
|
||||
keyboard us
|
||||
network --bootproto dhcp
|
||||
rootpw builder
|
||||
firewall --enabled --ssh
|
||||
selinux --enforcing
|
||||
timezone --utc America/New_York
|
||||
EOF
|
||||
|
||||
if [ $major -eq 5 ]; then
|
||||
cat >> $ks <<EOF
|
||||
key --skip
|
||||
EOF
|
||||
fi
|
||||
|
||||
cat >> $ks <<EOF
|
||||
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH"
|
||||
zerombr
|
||||
clearpart --all --initlabel
|
||||
part /boot --fstype=$bootfs --size=512 --asprimary
|
||||
part swap --size=1024 --asprimary
|
||||
part / --fstype=ext4 --size=1024 --grow --asprimary
|
||||
|
||||
# Halt the system once configuration has finished.
|
||||
poweroff
|
||||
|
||||
%packages
|
||||
@core
|
||||
EOF
|
||||
|
||||
# RHEL 5 didn't understand the %end directive, but RHEL >= 6
|
||||
# requires it.
|
||||
if [ $major -ge 6 ]; then
|
||||
cat >> $ks <<EOF
|
||||
%end
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Yum configuration.
|
||||
yum=$(mktemp)
|
||||
cat > $yum <<EOF
|
||||
[rhel$major]
|
||||
name=RHEL $major Server
|
||||
baseurl=$tree
|
||||
enabled=1
|
||||
gpgcheck=0
|
||||
keepcache=0
|
||||
|
||||
[rhel$major-source]
|
||||
name=RHEL $major Server Source
|
||||
baseurl=$srpms
|
||||
enabled=0
|
||||
gpgcheck=0
|
||||
keepcache=0
|
||||
EOF
|
||||
|
||||
if [ -n "$optional" ]; then
|
||||
cat >> $yum <<EOF
|
||||
[rhel$major-optional]
|
||||
name=RHEL $major Server Optional
|
||||
baseurl=$optional
|
||||
enabled=1
|
||||
gpgcheck=0
|
||||
keepcache=0
|
||||
|
||||
[rhel$major-optional-source]
|
||||
name=RHEL $major Server Optional
|
||||
baseurl=$optionalsrpms
|
||||
enabled=0
|
||||
gpgcheck=0
|
||||
keepcache=0
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Clean up function.
|
||||
cleanup ()
|
||||
{
|
||||
rm -f $ks
|
||||
rm -f $yum
|
||||
virsh undefine $tmpname ||:
|
||||
}
|
||||
trap cleanup INT QUIT TERM EXIT ERR
|
||||
|
||||
virt-install \
|
||||
--name=$tmpname \
|
||||
--ram=2048 \
|
||||
--cpu=host --vcpus=2 \
|
||||
--os-type=linux --os-variant=rhel$major \
|
||||
--initrd-inject=$ks \
|
||||
--extra-args="ks=file:/`basename $ks` console=tty0 console=ttyS0,115200" \
|
||||
--disk $(pwd)/$output,size=6 \
|
||||
--location=$tree \
|
||||
--nographics \
|
||||
--noreboot
|
||||
|
||||
# We have to replace yum config so it doesn't try to use RHN (it
|
||||
# won't be registered).
|
||||
guestfish --rw -a $output -m /dev/sda3 \
|
||||
upload $yum /etc/yum.repos.d/download.devel.redhat.com.repo
|
||||
|
||||
source $(dirname "$0")/compress.sh $output
|
||||
17
builder/website/scientificlinux-6.xz.sig
Normal file
17
builder/website/scientificlinux-6.xz.sig
Normal file
@@ -0,0 +1,17 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v1.4.14 (GNU/Linux)
|
||||
|
||||
iQIcBAABAgAGBQJSerbJAAoJEJFzj3Pht2igy+IP/3lkQnpPWz39TUahttdrbwlG
|
||||
4E+EhqZPXc/53/DVxgOI/AtHZLfpyQ5KghWTfS2Sk/M0j+SYo5BaZgiZE2RlSl33
|
||||
maynqvrsuCqHtYBsegLxgSPexI+CvysEEUGqZSbLKDbTFeVWsCvfNz0mk4N0+TwH
|
||||
JIcKu9ziY5219pMkFhAeqhQobGm/rc9RFsSalaPRgZg04dhpUU6zk3lwchvkQ4q8
|
||||
Wg9BuWKsqBcyi7p9swTq6+gP7SI96pwaUwAum2Cqo3v/dqAJ6KXFK1fo5NDCTpBX
|
||||
YHIhusm8R/U+2opmdkHAyd3bWT+SHufv3mNtr233K8774FCxgiF7IhcNMtbcx5f8
|
||||
/p9Uh0NkNWVZt+H2dU+k8xGH5zUmm92h/+GbX8R/qs//tu3DiOrdBT2Cjq98Yrho
|
||||
lsjII069rvqOVzjR31vuGmpCx7bKCB5Am2VBLmR+Viv16/ZnXlbIwXKJBBLiqdht
|
||||
Jih3b8U4MVDYt+ZpaCnKpbihNj+WRQ7IwAkNG9EvxVYnzrBbY5NMVtbvL7p6LRNs
|
||||
GJRwgC0VmZuBVq/yVokT5LVJ/ZWN3mS6MIulsUi0rgEdZyTb11GSLNtKQOlQ6j85
|
||||
I7VzG0ojI5drBkL2ps/8cgd7yAaXa/k8J4RLvpqoeXL3VPjG3e3tJberBbpn4ZYM
|
||||
qEy/MJrUC92zo8Chffss
|
||||
=dSpW
|
||||
-----END PGP SIGNATURE-----
|
||||
87
builder/website/scientificlinux.sh
Executable file
87
builder/website/scientificlinux.sh
Executable file
@@ -0,0 +1,87 @@
|
||||
#!/bin/bash -
|
||||
# virt-builder
|
||||
# Copyright (C) 2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
unset CDPATH
|
||||
export LANG=C
|
||||
set -e
|
||||
set -x
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "$0 VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version=$1
|
||||
output=scientificlinux-$version
|
||||
tmpname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
|
||||
|
||||
# We rebuild this every time there is a new 6.x release, and bump
|
||||
# the revision in the index.
|
||||
tree=http://www.mirrorservice.org/sites/ftp.scientificlinux.org/linux/scientific/$version/x86_64/os
|
||||
|
||||
rm -f $output $output.old $output.xz
|
||||
|
||||
# Generate the kickstart to a temporary file.
|
||||
ks=$(mktemp)
|
||||
cat > $ks <<'EOF'
|
||||
install
|
||||
text
|
||||
reboot
|
||||
lang en_US.UTF-8
|
||||
keyboard us
|
||||
network --bootproto dhcp
|
||||
rootpw builder
|
||||
firewall --enabled --ssh
|
||||
selinux --enforcing
|
||||
timezone --utc America/New_York
|
||||
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH"
|
||||
zerombr
|
||||
clearpart --all --initlabel
|
||||
part /boot --fstype=ext4 --size=512 --asprimary
|
||||
part swap --size=1024 --asprimary
|
||||
part / --fstype=ext4 --size=1024 --grow --asprimary
|
||||
|
||||
# Halt the system once configuration has finished.
|
||||
poweroff
|
||||
|
||||
%packages
|
||||
@core
|
||||
%end
|
||||
EOF
|
||||
|
||||
# Clean up function.
|
||||
cleanup ()
|
||||
{
|
||||
rm -f $ks
|
||||
virsh undefine $tmpname ||:
|
||||
}
|
||||
trap cleanup INT QUIT TERM EXIT ERR
|
||||
|
||||
virt-install \
|
||||
--name=$tmpname \
|
||||
--ram=2048 \
|
||||
--cpu=host --vcpus=2 \
|
||||
--os-type=linux --os-variant=rhel$version \
|
||||
--initrd-inject=$ks \
|
||||
--extra-args="ks=file:/`basename $ks` console=tty0 console=ttyS0,115200 proxy=$http_proxy" \
|
||||
--disk $(pwd)/$output,size=6 \
|
||||
--location=$tree \
|
||||
--nographics \
|
||||
--noreboot
|
||||
|
||||
source $(dirname "$0")/compress.sh $output
|
||||
90
builder/website/test-guest.sh
Executable file
90
builder/website/test-guest.sh
Executable file
@@ -0,0 +1,90 @@
|
||||
#!/bin/bash -
|
||||
# virt-builder
|
||||
# Copyright (C) 2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
# This is not part of the automated test suite. It's a manual test
|
||||
# run by the maintainer which must be run on each new guest to ensure
|
||||
# that all the virt-builder features work on the new guest.
|
||||
#
|
||||
# Usage:
|
||||
# ./run builder/website/test-guest.sh os-version [extra virt-builder args]
|
||||
# Then read the instructions ...
|
||||
|
||||
export LANG=C
|
||||
set -e
|
||||
|
||||
if [ ! -x builder/virt-builder ]; then
|
||||
echo "$0: running the test from the wrong directory, or libguestfs has not been built"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "$0: missing os-version"
|
||||
echo "try: ./run builder/virt-builder -l"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
osversion="$1"
|
||||
shift
|
||||
output="$osversion.img"
|
||||
|
||||
builder/virt-builder "$osversion" \
|
||||
--no-cache -v \
|
||||
--size 10G \
|
||||
--root-password password:123456 \
|
||||
--hostname test.example.com \
|
||||
--install scrub \
|
||||
--edit '/etc/issue: s/(.*)/$lineno: $1/' \
|
||||
--upload builder/virt-builder.pod:/virt-builder.pod \
|
||||
--run-command 'echo RUN COMMAND 1 >> /run-command.log' \
|
||||
--run-command 'echo RUN COMMAND 2 >> /run-command.log' \
|
||||
--run-command 'echo RUN COMMAND 3 >> /run-command.log' \
|
||||
--firstboot-command 'useradd -m -p "" rjones ; chage -d 0 rjones' \
|
||||
--firstboot-command 'echo FIRSTBOOT COMMAND 1' \
|
||||
--firstboot-command 'echo FIRSTBOOT COMMAND 2' \
|
||||
--firstboot-command 'echo FIRSTBOOT COMMAND 3' \
|
||||
"$@" |& tee "$osversion.log"
|
||||
|
||||
# Boot the guest.
|
||||
qemu-system-x86_64 \
|
||||
-m 1024 \
|
||||
-drive "file=$output,format=raw,snapshot=on,if=ide" &
|
||||
|
||||
cat <<EOF
|
||||
|
||||
========================================
|
||||
The "$osversion" guest is being booted.
|
||||
The trace file is here: "$osversion.log"
|
||||
|
||||
Checklist:
|
||||
|
||||
1: Root password is 123456
|
||||
2: Hostname is test.example.com
|
||||
3: scrub package is installed
|
||||
4: /etc/issue has line numbers
|
||||
5: /virt-builder.pod exists and looks reasonable
|
||||
6: /run-command.log exists and has 3 lines in correct order
|
||||
7: /root/virt-sysprep-firstboot.log exists and has 3 entries in correct order
|
||||
8: rjones account exists, with no password
|
||||
9: rjones password must be changed at first login
|
||||
10: /home/rjones exists and is populated
|
||||
11: random-seed file was created or modified
|
||||
========================================
|
||||
|
||||
EOF
|
||||
|
||||
#rm $output
|
||||
17
builder/website/ubuntu-10.04.xz.sig
Normal file
17
builder/website/ubuntu-10.04.xz.sig
Normal file
@@ -0,0 +1,17 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v1.4.14 (GNU/Linux)
|
||||
|
||||
iQIcBAABAgAGBQJSUslLAAoJEJFzj3Pht2igo7MQAJoaHvLfYFBsgx242/U3sY3e
|
||||
V8WNF77t9NDoTkIS5q/XK9c6w/JeNDsq8SdiLP6+LaFNbFh9O+mo4bhu3Vme3Op8
|
||||
/ubZ9s1RrysG+dSdUsqEIipUEiII0Xr/ZTONzJpLA5p9k2zDMoJLVgCmywlgnNQp
|
||||
wdthLDmvQuZQl7YZLbV8TeMjkNm0vOcEZXv+eeOb2guYMZKnfYo6NFBivlCiZxL2
|
||||
tjZZkCVy/tGRTVrsi8YUumY0TJ4jhZn4Rkzu/KtvbUkfG+jQPoesTCHk3u0tBF5m
|
||||
h+vrGbj7xf0OHvHtjQhAghlaLMEs1M8QDNV17g+zleu3hVw/WkcgClKa+g4AVbb0
|
||||
rGlDT3570viQ+Y8fj0upBUQypIwzPMZP88XVKiGCpl6xLinTZBha1SPoTK75Wxue
|
||||
3Mu2IKqBUi/Y5zMTcPD6EHvssK/pDu7XMtebGzI2AEVTdvTrNyw73d4GkaLtM+eR
|
||||
AyZt7RxrsRF89EQfBN6adH2WMztNPQvghrk0KphG91E3Dxo4+tp40QWXKKSwHs7S
|
||||
DnSFVQTrmKI9CxWueUp8b2Lkjlo+tgmolFXrK7HwNHziymdcZtPx+yuSSR5Wa9/5
|
||||
H3JP133/RWCgJ1MfiIcdVV1yUpP87ApXQo0X/ibU8jXMqIpy+20b6J9dOim+ggjd
|
||||
Gf/ClDA++NoU5qDijjvR
|
||||
=iWQP
|
||||
-----END PGP SIGNATURE-----
|
||||
17
builder/website/ubuntu-12.04.xz.sig
Normal file
17
builder/website/ubuntu-12.04.xz.sig
Normal file
@@ -0,0 +1,17 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v1.4.14 (GNU/Linux)
|
||||
|
||||
iQIcBAABAgAGBQJSUslUAAoJEJFzj3Pht2igf2wP/iRAY6RO6R3kavBolQufnJ5I
|
||||
Zx1jy1wL7JkTuUeNi2q69iv/JNvf+1bU6egSGcKV1uGUoJMa7mUMe3vF+WlW/XvM
|
||||
/RpU2sWnOnoe8JrWpaV+PFHV4oQNqR4Xu/wiq+fqsrC3AFkGz9O3ht+7X9pWO5V2
|
||||
6XUfAeYNnl/r9ISYFATxn5mysvRtlO7pTra9UhBeLUMEShU0Se2pcppAmqOWhCKv
|
||||
GYmB8kW28ioOilmcoBJO4Q9MwXYHTP5ZpR1hV6HXG+dv6VkC8WVG5OQIxp6pCqnh
|
||||
jN0tVc8ahdTX9eE6stzXmfrJzlKnbVnBcmFBTpFoFj5Vdwir2oXrzVMpZqF+V6R9
|
||||
DmCSFWo7wtv2qjU+Zajk9Jht8NDf3il8Oz3ROSH8dbHz2AkE8nLh0FXQo3Hbj3gB
|
||||
iYZNqWz1TCh1j9R9/JMhz+C55nSQO6GM2kc4JUo3B6BZVbhoRVV7w5zv56xCneg1
|
||||
cZm8tU1xydIiBePn71o/mmKhxUdq6gCrmGw6Cx55pRegkydoYXDXr8Xjt+dqw9En
|
||||
EM2fEvpMzsJZ5uyA2e1GsDaf/+8HuZ0PXYGgBqrC7zOOZv4S13dLDtB6cs2K9vI2
|
||||
6FjtyBdDscxuFGla9yA8aD8yx2rZ41VWIReaM+RIlbS5hElxiK6YUbLQmnI6DZex
|
||||
Z1yGEDgOGRa52YrCEsgP
|
||||
=UfhD
|
||||
-----END PGP SIGNATURE-----
|
||||
17
builder/website/ubuntu-13.10.xz.sig
Normal file
17
builder/website/ubuntu-13.10.xz.sig
Normal file
@@ -0,0 +1,17 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v1.4.14 (GNU/Linux)
|
||||
|
||||
iQIcBAABAgAGBQJSUslaAAoJEJFzj3Pht2ig/VcQAIwP3uzFYusmDRLTJsgb8x+6
|
||||
Pb4QrtR3jltu6MmXtJAdMhvSwReETCy+h18amKtPQObRrrMB0lq+NGXtaWIkmY+j
|
||||
BhMJpsmjqOot1pvBp1ag9Q/Jsq2oh4vZw+2YTPlZ9E6orJPXm1AvN366zHgrf4jt
|
||||
8747ASmzFRbExoQmwIBOYPe5Mo/jMmzk5et87r8Hlcs0g41OADMVP5JAs+T17CbI
|
||||
e+EM64BhHGMjaxe7NsnGhyb2+VwakJxUSCMYJ2WblLirKaXwIU9nNZgi/iIpk4/D
|
||||
ntZSnHvp/3tyPmcK8pWZar46xLM1J5TJ18Ko1O9I9mGYMPyvbSgw7WviRKhMMzcr
|
||||
U8Y5fnb4zZ6ciGH8jC6VhalWW46ArMpHUuadLEzTK2ofMeyKVa6zw6YB4rTHhAd9
|
||||
HXm2rlsBK3m4uSuhnS775N2SRMFwsfhZFLS9qTy2BdK1Yh20kQJ4Yop5WviEUjgz
|
||||
UNICOs0FUmOa6DRJFibMp7duqjlyE2DVtZxWOMIqjgN4TmxgLZ7L7lNXxF0ZGx6v
|
||||
laRfsHj/IC/nuysptZf1knrT7NEKJrvebI/nGSP96RqCX/Mv9t0Rtj7rki9fwL0H
|
||||
EofsCl4BS1L5Owm8/iM5cH+Pv/2TuN4Wg78E1Z4uDli9jYpH/QZatoKanFj5QjNc
|
||||
VqofvPjofGRrQDHk+7Hv
|
||||
=SauI
|
||||
-----END PGP SIGNATURE-----
|
||||
376
builder/website/ubuntu.preseed
Normal file
376
builder/website/ubuntu.preseed
Normal file
@@ -0,0 +1,376 @@
|
||||
#### Contents of the preconfiguration file (for &releasename;)
|
||||
### Localization
|
||||
# Locale sets language and country.
|
||||
d-i debian-installer/locale string en_US
|
||||
|
||||
# Keyboard selection.
|
||||
# Disable automatic (interactive) keymap detection.
|
||||
d-i console-setup/ask_detect boolean false
|
||||
#d-i console-setup/modelcode string pc105
|
||||
d-i console-setup/layoutcode string us
|
||||
# To select a variant of the selected layout (if you leave this out, the
|
||||
# basic form of the layout will be used):
|
||||
#d-i console-setup/variantcode string dvorak
|
||||
|
||||
### Network configuration
|
||||
# netcfg will choose an interface that has link if possible. This makes it
|
||||
# skip displaying a list if there is more than one interface.
|
||||
d-i netcfg/choose_interface select auto
|
||||
|
||||
# To pick a particular interface instead:
|
||||
#d-i netcfg/choose_interface select eth1
|
||||
|
||||
# If you have a slow dhcp server and the installer times out waiting for
|
||||
# it, this might be useful.
|
||||
#d-i netcfg/dhcp_timeout string 60
|
||||
|
||||
# If you prefer to configure the network manually, uncomment this line and
|
||||
# the static network configuration below.
|
||||
#d-i netcfg/disable_dhcp boolean true
|
||||
|
||||
# If you want the preconfiguration file to work on systems both with and
|
||||
# without a dhcp server, uncomment these lines and the static network
|
||||
# configuration below.
|
||||
#d-i netcfg/dhcp_failed note
|
||||
#d-i netcfg/dhcp_options select Configure network manually
|
||||
|
||||
# Static network configuration.
|
||||
#d-i netcfg/get_nameservers string 192.168.1.1
|
||||
#d-i netcfg/get_ipaddress string 192.168.1.42
|
||||
#d-i netcfg/get_netmask string 255.255.255.0
|
||||
#d-i netcfg/get_gateway string 192.168.1.1
|
||||
#d-i netcfg/confirm_static boolean true
|
||||
|
||||
# Any hostname and domain names assigned from dhcp take precedence over
|
||||
# values set here. However, setting the values still prevents the questions
|
||||
# from being shown, even if values come from dhcp.
|
||||
d-i netcfg/get_hostname string unassigned-hostname
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
|
||||
# Disable that annoying WEP key dialog.
|
||||
d-i netcfg/wireless_wep string
|
||||
# The wacky dhcp hostname that some ISPs use as a password of sorts.
|
||||
#d-i netcfg/dhcp_hostname string radish
|
||||
|
||||
# If non-free firmware is needed for the network or other hardware, you can
|
||||
# configure the installer to always try to load it, without prompting. Or
|
||||
# change to false to disable asking.
|
||||
#d-i hw-detect/load_firmware boolean true
|
||||
|
||||
### Mirror settings
|
||||
# If you select ftp, the mirror/country string does not need to be set.
|
||||
#d-i mirror/protocol string ftp
|
||||
#d-i mirror/country string manual
|
||||
#d-i mirror/http/hostname string http.us.debian.org
|
||||
#d-i mirror/http/directory string /ubuntu
|
||||
#d-i mirror/http/proxy string
|
||||
|
||||
# Alternatively: by default, the installer uses CC.archive.ubuntu.com where
|
||||
# CC is the ISO-3166-2 code for the selected country. You can preseed this
|
||||
# so that it does so without asking.
|
||||
d-i mirror/http/mirror select uk.archive.ubuntu.com
|
||||
|
||||
# Suite to install.
|
||||
#d-i mirror/suite string &releasename;
|
||||
# Suite to use for loading installer components (optional).
|
||||
#d-i mirror/udeb/suite string &releasename;
|
||||
# Components to use for loading installer components (optional).
|
||||
#d-i mirror/udeb/components multiselect main, restricted
|
||||
|
||||
### Clock and time zone setup
|
||||
# Controls whether or not the hardware clock is set to UTC.
|
||||
d-i clock-setup/utc boolean true
|
||||
|
||||
# You may set this to any valid setting for $TZ; see the contents of
|
||||
# /usr/share/zoneinfo/ for valid values.
|
||||
d-i time/zone string US/Eastern
|
||||
|
||||
# Controls whether to use NTP to set the clock during the install
|
||||
d-i clock-setup/ntp boolean true
|
||||
# NTP server to use. The default is almost always fine here.
|
||||
#d-i clock-setup/ntp-server string ntp.example.com
|
||||
|
||||
### Partitioning
|
||||
# If the system has free space you can choose to only partition that space.
|
||||
# Alternatives: custom, some_device, some_device_crypto, some_device_lvm.
|
||||
#d-i partman-auto/init_automatically_partition select biggest_free
|
||||
|
||||
# Alternatively, you can specify a disk to partition. The device name must
|
||||
# be given in traditional non-devfs format.
|
||||
# Note: A disk must be specified, unless the system has only one disk.
|
||||
# For example, to use the first SCSI/SATA hard disk:
|
||||
#d-i partman-auto/disk string /dev/sda
|
||||
# In addition, you'll need to specify the method to use.
|
||||
# The presently available methods are: "regular", "lvm" and "crypto"
|
||||
d-i partman-auto/method string regular
|
||||
|
||||
# If one of the disks that are going to be automatically partitioned
|
||||
# contains an old LVM configuration, the user will normally receive a
|
||||
# warning. This can be preseeded away...
|
||||
d-i partman-lvm/device_remove_lvm boolean true
|
||||
# The same applies to pre-existing software RAID array:
|
||||
d-i partman-md/device_remove_md boolean true
|
||||
# And the same goes for the confirmation to write the lvm partitions.
|
||||
d-i partman-lvm/confirm boolean true
|
||||
|
||||
# For LVM partitioning, you can select how much of the volume group to use
|
||||
# for logical volumes.
|
||||
#d-i partman-auto-lvm/guided_size string max
|
||||
#d-i partman-auto-lvm/guided_size string 10GB
|
||||
#d-i partman-auto-lvm/guided_size string 50%
|
||||
|
||||
# You can choose one of the three predefined partitioning recipes:
|
||||
# - atomic: all files in one partition
|
||||
# - home: separate /home partition
|
||||
# - multi: separate /home, /usr, /var, and /tmp partitions
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
|
||||
# Or provide a recipe of your own...
|
||||
# The recipe format is documented in the file devel/partman-auto-recipe.txt.
|
||||
# If you have a way to get a recipe file into the d-i environment, you can
|
||||
# just point at it.
|
||||
#d-i partman-auto/expert_recipe_file string /hd-media/recipe
|
||||
|
||||
# If not, you can put an entire recipe into the preconfiguration file in one
|
||||
# (logical) line. This example creates a small /boot partition, suitable
|
||||
# swap, and uses the rest of the space for the root partition:
|
||||
#d-i partman-auto/expert_recipe string \
|
||||
# boot-root :: \
|
||||
# 40 50 100 ext3 \
|
||||
# $primary{ } $bootable{ } \
|
||||
# method{ format } format{ } \
|
||||
# use_filesystem{ } filesystem{ ext3 } \
|
||||
# mountpoint{ /boot } \
|
||||
# . \
|
||||
# 500 10000 1000000000 ext3 \
|
||||
# method{ format } format{ } \
|
||||
# use_filesystem{ } filesystem{ ext3 } \
|
||||
# mountpoint{ / } \
|
||||
# . \
|
||||
# 64 512 300% linux-swap \
|
||||
# method{ swap } format{ } \
|
||||
# .
|
||||
|
||||
# If you just want to change the default filesystem from ext3 to something
|
||||
# else, you can do that without providing a full recipe.
|
||||
#d-i partman/default_filesystem string ext4
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
|
||||
### Controlling how partitions are mounted
|
||||
# The default is to mount by UUID, but you can also choose "traditional" to
|
||||
# use traditional device names, or "label" to try filesystem labels before
|
||||
# falling back to UUIDs.
|
||||
#d-i partman/mount_style select uuid
|
||||
|
||||
### Base system installation
|
||||
# The kernel image (meta) package to be installed; "none" can be used if no
|
||||
# kernel is to be installed.
|
||||
#d-i base-installer/kernel/image string linux-generic
|
||||
|
||||
### Account setup
|
||||
# Skip creation of a root account (normal user account will be able to
|
||||
# use sudo). The default is false; preseed this to true if you want to set
|
||||
# a root password.
|
||||
#d-i passwd/root-login boolean false
|
||||
# Alternatively, to skip creation of a normal user account.
|
||||
d-i passwd/make-user boolean false
|
||||
|
||||
# Root password, either in clear text
|
||||
d-i passwd/root-password password builder
|
||||
d-i passwd/root-password-again password builder
|
||||
# or encrypted using an MD5 hash.
|
||||
#d-i passwd/root-password-crypted password [MD5 hash]
|
||||
|
||||
# To create a normal user account.
|
||||
#d-i passwd/user-fullname string Ubuntu User
|
||||
#d-i passwd/username string ubuntu
|
||||
# Normal user's password, either in clear text
|
||||
#d-i passwd/user-password password insecure
|
||||
#d-i passwd/user-password-again password insecure
|
||||
# or encrypted using an MD5 hash.
|
||||
#d-i passwd/user-password-crypted password [MD5 hash]
|
||||
# Create the first user with the specified UID instead of the default.
|
||||
#d-i passwd/user-uid string 1010
|
||||
# The installer will warn about weak passwords. If you are sure you know
|
||||
# what you're doing and want to override it, uncomment this.
|
||||
#d-i user-setup/allow-password-weak boolean true
|
||||
|
||||
# The user account will be added to some standard initial groups. To
|
||||
# override that, use this.
|
||||
#d-i passwd/user-default-groups string audio cdrom video
|
||||
|
||||
# Set to true if you want to encrypt the first user's home directory.
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
|
||||
### Apt setup
|
||||
# You can choose to install restricted and universe software, or to install
|
||||
# software from the backports repository.
|
||||
#d-i apt-setup/restricted boolean true
|
||||
#d-i apt-setup/universe boolean true
|
||||
#d-i apt-setup/backports boolean true
|
||||
# Uncomment this if you don't want to use a network mirror.
|
||||
#d-i apt-setup/use_mirror boolean false
|
||||
# Select which update services to use; define the mirrors to be used.
|
||||
# Values shown below are the normal defaults.
|
||||
#d-i apt-setup/services-select multiselect security
|
||||
#d-i apt-setup/security_host string security.ubuntu.com
|
||||
#d-i apt-setup/security_path string /ubuntu
|
||||
|
||||
# Additional repositories, local[0-9] available
|
||||
#d-i apt-setup/local0/repository string \
|
||||
# http://local.server/ubuntu &releasename; main
|
||||
#d-i apt-setup/local0/comment string local server
|
||||
# Enable deb-src lines
|
||||
#d-i apt-setup/local0/source boolean true
|
||||
# URL to the public key of the local repository; you must provide a key or
|
||||
# apt will complain about the unauthenticated repository and so the
|
||||
# sources.list line will be left commented out
|
||||
#d-i apt-setup/local0/key string http://local.server/key
|
||||
|
||||
# By default the installer requires that repositories be authenticated
|
||||
# using a known gpg key. This setting can be used to disable that
|
||||
# authentication. Warning: Insecure, not recommended.
|
||||
#d-i debian-installer/allow_unauthenticated string true
|
||||
|
||||
### Package selection
|
||||
#tasksel tasksel/first multiselect ubuntu-desktop
|
||||
#tasksel tasksel/first multiselect lamp-server, print-server
|
||||
#tasksel tasksel/first multiselect kubuntu-desktop
|
||||
tasksel tasksel/first multiselect openssh-server
|
||||
|
||||
# Individual additional packages to install
|
||||
#d-i pkgsel/include string openssh-server build-essential
|
||||
# Whether to upgrade packages after debootstrap.
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
#d-i pkgsel/upgrade select none
|
||||
|
||||
# Language pack selection
|
||||
#d-i pkgsel/language-packs multiselect de, en, zh
|
||||
|
||||
# Policy for applying updates. May be "none" (no automatic updates),
|
||||
# "unattended-upgrades" (install security updates automatically), or
|
||||
# "landscape" (manage system with Landscape).
|
||||
#d-i pkgsel/update-policy select none
|
||||
|
||||
# Some versions of the installer can report back on what software you have
|
||||
# installed, and what software you use. The default is not to report back,
|
||||
# but sending reports helps the project determine what software is most
|
||||
# popular and include it on CDs.
|
||||
#popularity-contest popularity-contest/participate boolean false
|
||||
|
||||
# By default, the system's locate database will be updated after the
|
||||
# installer has finished installing most packages. This may take a while, so
|
||||
# if you don't want it, you can set this to "false" to turn it off.
|
||||
#d-i pkgsel/updatedb boolean true
|
||||
|
||||
### Boot loader installation
|
||||
# Grub is the default boot loader (for x86). If you want lilo installed
|
||||
# instead, uncomment this:
|
||||
#d-i grub-installer/skip boolean true
|
||||
# To also skip installing lilo, and install no bootloader, uncomment this
|
||||
# too:
|
||||
#d-i lilo-installer/skip boolean true
|
||||
|
||||
# This is fairly safe to set, it makes grub install automatically to the MBR
|
||||
# if no other operating system is detected on the machine.
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
# This one makes grub-installer install to the MBR if it also finds some other
|
||||
# OS, which is less safe as it might not be able to boot that other OS.
|
||||
d-i grub-installer/with_other_os boolean true
|
||||
|
||||
# Alternatively, if you want to install to a location other than the mbr,
|
||||
# uncomment and edit these lines:
|
||||
#d-i grub-installer/only_debian boolean false
|
||||
#d-i grub-installer/with_other_os boolean false
|
||||
#d-i grub-installer/bootdev string (hd0,0)
|
||||
# To install grub to multiple disks:
|
||||
#d-i grub-installer/bootdev string (hd0,0) (hd1,0) (hd2,0)
|
||||
|
||||
# Optional password for grub, either in clear text
|
||||
#d-i grub-installer/password password r00tme
|
||||
#d-i grub-installer/password-again password r00tme
|
||||
# or encrypted using an MD5 hash, see grub-md5-crypt(8).
|
||||
#d-i grub-installer/password-crypted password [MD5 hash]
|
||||
|
||||
### Finishing up the installation
|
||||
# During installations from serial console, the regular virtual consoles
|
||||
# (VT1-VT6) are normally disabled in /etc/inittab. Uncomment the next
|
||||
# line to prevent this.
|
||||
#d-i finish-install/keep-consoles boolean true
|
||||
|
||||
# Avoid that last message about the install being complete.
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
# This will prevent the installer from ejecting the CD during the reboot,
|
||||
# which is useful in some situations.
|
||||
#d-i cdrom-detect/eject boolean false
|
||||
|
||||
# This is how to make the installer shutdown when finished, but not
|
||||
# reboot into the installed system.
|
||||
#d-i debian-installer/exit/halt boolean true
|
||||
# This will power off the machine instead of just halting it.
|
||||
#d-i debian-installer/exit/poweroff boolean true
|
||||
|
||||
### X configuration
|
||||
# X can detect the right driver for some cards, but if you're preseeding,
|
||||
# you override whatever it chooses. Still, vesa will work most places.
|
||||
#xserver-xorg xserver-xorg/config/device/driver select vesa
|
||||
|
||||
# A caveat with mouse autodetection is that if it fails, X will retry it
|
||||
# over and over. So if it's preseeded to be done, there is a possibility of
|
||||
# an infinite loop if the mouse is not autodetected.
|
||||
#xserver-xorg xserver-xorg/autodetect_mouse boolean true
|
||||
|
||||
# Monitor autodetection is recommended.
|
||||
xserver-xorg xserver-xorg/autodetect_monitor boolean true
|
||||
# Uncomment if you have an LCD display.
|
||||
#xserver-xorg xserver-xorg/config/monitor/lcd boolean true
|
||||
# X has three configuration paths for the monitor. Here's how to preseed
|
||||
# the "medium" path, which is always available. The "simple" path may not
|
||||
# be available, and the "advanced" path asks too many questions.
|
||||
xserver-xorg xserver-xorg/config/monitor/selection-method \
|
||||
select medium
|
||||
xserver-xorg xserver-xorg/config/monitor/mode-list \
|
||||
select 1024x768 @ 60 Hz
|
||||
|
||||
### Preseeding other packages
|
||||
# Depending on what software you choose to install, or if things go wrong
|
||||
# during the installation process, it's possible that other questions may
|
||||
# be asked. You can preseed those too, of course. To get a list of every
|
||||
# possible question that could be asked during an install, do an
|
||||
# installation, and then run these commands:
|
||||
# debconf-get-selections --installer > file
|
||||
# debconf-get-selections >> file
|
||||
|
||||
|
||||
#### Advanced options
|
||||
### Running custom commands during the installation
|
||||
# d-i preseeding is inherently not secure. Nothing in the installer checks
|
||||
# for attempts at buffer overflows or other exploits of the values of a
|
||||
# preconfiguration file like this one. Only use preconfiguration files from
|
||||
# trusted locations! To drive that home, and because it's generally useful,
|
||||
# here's a way to run any shell command you'd like inside the installer,
|
||||
# automatically.
|
||||
|
||||
# This first command is run as early as possible, just after
|
||||
# preseeding is read.
|
||||
#d-i preseed/early_command string anna-install some-udeb
|
||||
|
||||
# This command is run immediately before the partitioner starts. It may be
|
||||
# useful to apply dynamic partitioner preseeding that depends on the state
|
||||
# of the disks (which may not be visible when preseed/early_command runs).
|
||||
#d-i partman/early_command string debconf-set partman-auto/disk "$(list-devices disk | head -n1)"
|
||||
|
||||
# This command is run just before the install finishes, but when there is
|
||||
# still a usable /target directory. You can chroot to /target and use it
|
||||
# directly, or use the apt-install and in-target commands to easily install
|
||||
# packages and run commands in the target system.
|
||||
#d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh
|
||||
|
||||
72
builder/website/ubuntu.sh
Executable file
72
builder/website/ubuntu.sh
Executable file
@@ -0,0 +1,72 @@
|
||||
#!/bin/bash -
|
||||
# libguestfs
|
||||
# Copyright (C) 2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
# The basic plan comes from:
|
||||
# http://honk.sigxcpu.org/con/Preseeding_Debian_virtual_machines_with_virt_install.html
|
||||
# https://wiki.debian.org/DebianInstaller/Preseed
|
||||
# https://help.ubuntu.com/10.04/installation-guide/i386/preseed-using.html
|
||||
|
||||
unset CDPATH
|
||||
export LANG=C
|
||||
set -e
|
||||
set -x
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "$0 VERSION DIST"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Some configuration.
|
||||
version=$1
|
||||
dist=$2
|
||||
location=http://archive.ubuntu.net/ubuntu/dists/$dist/main/installer-amd64
|
||||
output=ubuntu-$version
|
||||
tmpname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
|
||||
|
||||
rm -f $output $output.old $output.xz
|
||||
|
||||
# Make sure it's being run from the correct directory.
|
||||
if [ ! -f ubuntu.preseed ]; then
|
||||
echo "You are running this script from the wrong directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Note that the injected file must be called "/preseed.cfg" in order
|
||||
# for d-i to pick it up.
|
||||
sed -e "s,@CACHE@,$http_proxy,g" < ubuntu.preseed > preseed.cfg
|
||||
|
||||
# Clean up function.
|
||||
cleanup ()
|
||||
{
|
||||
rm -f preseed.cfg
|
||||
virsh undefine $tmpname ||:
|
||||
}
|
||||
trap cleanup INT QUIT TERM EXIT ERR
|
||||
|
||||
virt-install \
|
||||
--name=$tmpname \
|
||||
--ram=1024 \
|
||||
--os-type=linux --os-variant=ubuntu$dist \
|
||||
--initrd-inject=$(pwd)/preseed.cfg \
|
||||
--extra-args="auto console=tty0 console=ttyS0,115200" \
|
||||
--disk=$(pwd)/$output,size=4 \
|
||||
--location=$location \
|
||||
--nographics \
|
||||
--noreboot
|
||||
|
||||
source $(dirname "$0")/compress.sh $output
|
||||
24
builder/website/validate.sh
Executable file
24
builder/website/validate.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash -
|
||||
# libguestfs virt-builder validate index
|
||||
# Copyright (C) 2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
export LANG=C
|
||||
set -e
|
||||
|
||||
../virt-index-validate index
|
||||
../virt-index-validate index.asc
|
||||
|
||||
@@ -35,63 +35,83 @@ SHARED_SOURCE_FILES = \
|
||||
../fish/inspect.c \
|
||||
../fish/keys.c \
|
||||
../fish/options.h \
|
||||
../fish/options.c
|
||||
../fish/options.c \
|
||||
../fish/uri.h \
|
||||
../fish/uri.c
|
||||
|
||||
virt_cat_SOURCES = \
|
||||
$(SHARED_SOURCE_FILES) \
|
||||
virt-cat.c
|
||||
cat.c
|
||||
|
||||
virt_cat_CFLAGS = \
|
||||
virt_cat_CPPFLAGS = \
|
||||
-DGUESTFS_WARN_DEPRECATED=1 \
|
||||
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
|
||||
-I$(top_srcdir)/src -I$(top_builddir)/src \
|
||||
-I$(top_srcdir)/fish \
|
||||
-I$(srcdir)/../gnulib/lib -I../gnulib/lib \
|
||||
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
|
||||
-I$(srcdir)/../gnulib/lib -I../gnulib/lib
|
||||
|
||||
virt_cat_CFLAGS = \
|
||||
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
|
||||
$(GPROF_CFLAGS) $(GCOV_CFLAGS) \
|
||||
$(LIBCONFIG_CFLAGS)
|
||||
$(LIBCONFIG_CFLAGS) \
|
||||
$(LIBXML2_CFLAGS)
|
||||
|
||||
virt_cat_LDADD = \
|
||||
$(LIBCONFIG_LIBS) \
|
||||
$(top_builddir)/src/libutils.la \
|
||||
$(top_builddir)/src/libguestfs.la \
|
||||
$(LIBXML2_LIBS) \
|
||||
$(LIBVIRT_LIBS) \
|
||||
../gnulib/lib/libgnu.la
|
||||
|
||||
virt_filesystems_SOURCES = \
|
||||
$(SHARED_SOURCE_FILES) \
|
||||
virt-filesystems.c
|
||||
filesystems.c
|
||||
|
||||
virt_filesystems_CFLAGS = \
|
||||
virt_filesystems_CPPFLAGS = \
|
||||
-DGUESTFS_WARN_DEPRECATED=1 \
|
||||
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
|
||||
-I$(top_srcdir)/src -I$(top_builddir)/src \
|
||||
-I$(top_srcdir)/fish \
|
||||
-I$(srcdir)/../gnulib/lib -I../gnulib/lib \
|
||||
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
|
||||
-I$(srcdir)/../gnulib/lib -I../gnulib/lib
|
||||
|
||||
virt_filesystems_CFLAGS = \
|
||||
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
|
||||
$(GPROF_CFLAGS) $(GCOV_CFLAGS) \
|
||||
$(LIBCONFIG_CFLAGS)
|
||||
$(LIBCONFIG_CFLAGS) \
|
||||
$(LIBXML2_CFLAGS)
|
||||
|
||||
virt_filesystems_LDADD = \
|
||||
$(LIBCONFIG_LIBS) \
|
||||
$(top_builddir)/src/libutils.la \
|
||||
$(top_builddir)/src/libguestfs.la \
|
||||
$(LIBXML2_LIBS) \
|
||||
$(LIBVIRT_LIBS) \
|
||||
../gnulib/lib/libgnu.la
|
||||
|
||||
virt_ls_SOURCES = \
|
||||
$(SHARED_SOURCE_FILES) \
|
||||
virt-ls.c
|
||||
ls.c
|
||||
|
||||
virt_ls_CFLAGS = \
|
||||
virt_ls_CPPFLAGS = \
|
||||
-DGUESTFS_WARN_DEPRECATED=1 \
|
||||
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
|
||||
-I$(top_srcdir)/src -I$(top_builddir)/src \
|
||||
-I$(top_srcdir)/fish \
|
||||
-I$(srcdir)/../gnulib/lib -I../gnulib/lib \
|
||||
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
|
||||
-I$(srcdir)/../gnulib/lib -I../gnulib/lib
|
||||
|
||||
virt_ls_CFLAGS = \
|
||||
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
|
||||
$(GPROF_CFLAGS) $(GCOV_CFLAGS) \
|
||||
$(LIBCONFIG_CFLAGS)
|
||||
$(LIBCONFIG_CFLAGS) \
|
||||
$(LIBXML2_CFLAGS)
|
||||
|
||||
virt_ls_LDADD = \
|
||||
$(LIBCONFIG_LIBS) \
|
||||
$(top_builddir)/src/libutils.la \
|
||||
$(top_builddir)/src/libguestfs.la \
|
||||
$(LIBXML2_LIBS) \
|
||||
$(LIBVIRT_LIBS) \
|
||||
../gnulib/lib/libgnu.la
|
||||
|
||||
# Manual pages and HTML files for the website.
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
#include <inttypes.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include <errno.h>
|
||||
#include <locale.h>
|
||||
#include <assert.h>
|
||||
#include <libintl.h>
|
||||
|
||||
#include "progname.h"
|
||||
#include "c-ctype.h"
|
||||
|
||||
#include "guestfs.h"
|
||||
@@ -45,15 +45,10 @@ int echo_keys = 0;
|
||||
const char *libvirt_uri = NULL;
|
||||
int inspector = 1;
|
||||
|
||||
static int do_cat (int argc, char *argv[]);
|
||||
static int is_windows (guestfs_h *g, const char *root);
|
||||
static char *windows_path (guestfs_h *g, const char *root, const char *filename);
|
||||
|
||||
static inline char *
|
||||
bad_cast (char const *s)
|
||||
{
|
||||
return (char *) s;
|
||||
}
|
||||
|
||||
static void __attribute__((noreturn))
|
||||
usage (int status)
|
||||
{
|
||||
@@ -88,9 +83,6 @@ usage (int status)
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
/* Set global program name that is not polluted with libtool artifacts. */
|
||||
set_program_name (argv[0]);
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEBASEDIR);
|
||||
textdomain (PACKAGE);
|
||||
@@ -106,6 +98,7 @@ main (int argc, char *argv[])
|
||||
{ "format", 2, 0, 0 },
|
||||
{ "help", 0, 0, HELP_OPTION },
|
||||
{ "keys-from-stdin", 0, 0, 0 },
|
||||
{ "long-options", 0, 0, 0 },
|
||||
{ "verbose", 0, 0, 'v' },
|
||||
{ "version", 0, 0, 'V' },
|
||||
{ 0, 0, 0, 0 }
|
||||
@@ -114,6 +107,7 @@ main (int argc, char *argv[])
|
||||
struct drv *drv;
|
||||
const char *format = NULL;
|
||||
int c;
|
||||
int r;
|
||||
int option_index;
|
||||
|
||||
g = guestfs_create ();
|
||||
@@ -122,15 +116,15 @@ main (int argc, char *argv[])
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
argv[0] = bad_cast (program_name);
|
||||
|
||||
for (;;) {
|
||||
c = getopt_long (argc, argv, options, long_options, &option_index);
|
||||
if (c == -1) break;
|
||||
|
||||
switch (c) {
|
||||
case 0: /* options which are long only */
|
||||
if (STREQ (long_options[option_index].name, "keys-from-stdin")) {
|
||||
if (STREQ (long_options[option_index].name, "long-options"))
|
||||
display_long_options (long_options);
|
||||
else if (STREQ (long_options[option_index].name, "keys-from-stdin")) {
|
||||
keys_from_stdin = 1;
|
||||
} else if (STREQ (long_options[option_index].name, "echo-keys")) {
|
||||
echo_keys = 1;
|
||||
@@ -192,7 +186,11 @@ main (int argc, char *argv[])
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
drv->type = drv_a;
|
||||
drv->a.filename = argv[optind];
|
||||
drv->a.filename = strdup (argv[optind]);
|
||||
if (!drv->a.filename) {
|
||||
perror ("strdup");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
drv->next = drvs;
|
||||
drvs = drv;
|
||||
} else { /* simulate -d option */
|
||||
@@ -240,24 +238,34 @@ main (int argc, char *argv[])
|
||||
/* Free up data structures, no longer needed after this point. */
|
||||
free_drives (drvs);
|
||||
|
||||
r = do_cat (argc - optind, &argv[optind]);
|
||||
|
||||
guestfs_close (g);
|
||||
|
||||
exit (r == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
static int
|
||||
do_cat (int argc, char *argv[])
|
||||
{
|
||||
unsigned errors = 0;
|
||||
int windows;
|
||||
char *root, **roots;
|
||||
int windows, i;
|
||||
char *root;
|
||||
|
||||
/* Get root mountpoint. See: fish/inspect.c:inspect_mount */
|
||||
roots = guestfs_inspect_get_roots (g);
|
||||
CLEANUP_FREE_STRING_LIST char **roots = guestfs_inspect_get_roots (g);
|
||||
|
||||
assert (roots);
|
||||
assert (roots[0] != NULL);
|
||||
assert (roots[1] == NULL);
|
||||
root = roots[0];
|
||||
free (roots);
|
||||
|
||||
/* Windows? Special handling is required. */
|
||||
windows = is_windows (g, root);
|
||||
|
||||
for (; optind < argc; optind++) {
|
||||
char *filename_to_free = NULL;
|
||||
const char *filename = argv[optind];
|
||||
for (i = 0; i < argc; ++i) {
|
||||
CLEANUP_FREE char *filename_to_free = NULL;
|
||||
const char *filename = argv[i];
|
||||
|
||||
if (windows) {
|
||||
filename = filename_to_free = windows_path (g, root, filename);
|
||||
@@ -269,15 +277,9 @@ main (int argc, char *argv[])
|
||||
|
||||
if (guestfs_download (g, filename, "/dev/stdout") == -1)
|
||||
errors++;
|
||||
|
||||
free (filename_to_free);
|
||||
}
|
||||
|
||||
free (root);
|
||||
|
||||
guestfs_close (g);
|
||||
|
||||
exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
return errors == 0 ? 0 : -1;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <inttypes.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include <errno.h>
|
||||
#include <locale.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
@@ -31,7 +32,6 @@
|
||||
|
||||
#include "c-ctype.h"
|
||||
#include "human.h"
|
||||
#include "progname.h"
|
||||
|
||||
#include "guestfs.h"
|
||||
#include "options.h"
|
||||
@@ -80,12 +80,6 @@ static void do_output_end (void);
|
||||
static struct guestfs_lvm_pv_list *get_pvs (void);
|
||||
static void free_pvs (void);
|
||||
|
||||
static inline char *
|
||||
bad_cast (char const *s)
|
||||
{
|
||||
return (char *) s;
|
||||
}
|
||||
|
||||
static void __attribute__((noreturn))
|
||||
usage (int status)
|
||||
{
|
||||
@@ -137,9 +131,6 @@ usage (int status)
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
/* Set global program name that is not polluted with libtool artifacts. */
|
||||
set_program_name (argv[0]);
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEBASEDIR);
|
||||
textdomain (PACKAGE);
|
||||
@@ -162,9 +153,10 @@ main (int argc, char *argv[])
|
||||
{ "help", 0, 0, HELP_OPTION },
|
||||
{ "human-readable", 0, 0, 'h' },
|
||||
{ "keys-from-stdin", 0, 0, 0 },
|
||||
{ "long", 0, 0, 'l' },
|
||||
{ "logical-volumes", 0, 0, 0 },
|
||||
{ "logvols", 0, 0, 0 },
|
||||
{ "long", 0, 0, 'l' },
|
||||
{ "long-options", 0, 0, 0 },
|
||||
{ "lvs", 0, 0, 0 },
|
||||
{ "no-title", 0, 0, 0 },
|
||||
{ "parts", 0, 0, 0 },
|
||||
@@ -197,15 +189,15 @@ main (int argc, char *argv[])
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
argv[0] = bad_cast (program_name);
|
||||
|
||||
for (;;) {
|
||||
c = getopt_long (argc, argv, options, long_options, &option_index);
|
||||
if (c == -1) break;
|
||||
|
||||
switch (c) {
|
||||
case 0: /* options which are long only */
|
||||
if (STREQ (long_options[option_index].name, "keys-from-stdin")) {
|
||||
if (STREQ (long_options[option_index].name, "long-options"))
|
||||
display_long_options (long_options);
|
||||
else if (STREQ (long_options[option_index].name, "keys-from-stdin")) {
|
||||
keys_from_stdin = 1;
|
||||
} else if (STREQ (long_options[option_index].name, "echo-keys")) {
|
||||
echo_keys = 1;
|
||||
@@ -379,9 +371,6 @@ static int is_md (char *device);
|
||||
static char **parents_of_md (char *device);
|
||||
static char **parents_of_vg (char *vg);
|
||||
|
||||
static void free_strings (char **strings);
|
||||
static size_t count_strings (char **strings);
|
||||
|
||||
static void
|
||||
do_output_title (void)
|
||||
{
|
||||
@@ -438,22 +427,21 @@ do_output (void)
|
||||
static void
|
||||
do_output_filesystems (void)
|
||||
{
|
||||
char **fses;
|
||||
size_t i;
|
||||
|
||||
fses = guestfs_list_filesystems (g);
|
||||
CLEANUP_FREE_STRING_LIST char **fses = guestfs_list_filesystems (g);
|
||||
if (fses == NULL)
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
for (i = 0; fses[i] != NULL; i += 2) {
|
||||
char *dev, *vfs_label = NULL, *vfs_uuid = NULL;
|
||||
char **parents;
|
||||
CLEANUP_FREE char *dev = NULL, *vfs_label = NULL, *vfs_uuid = NULL;
|
||||
CLEANUP_FREE_STRING_LIST char **parents = NULL;
|
||||
int64_t size = -1;
|
||||
|
||||
/* Skip swap and unknown, unless --extra flag was given. */
|
||||
if (!(output & OUTPUT_FILESYSTEMS_EXTRA) &&
|
||||
(STREQ (fses[i+1], "swap") || STREQ (fses[i+1], "unknown")))
|
||||
goto next;
|
||||
continue;
|
||||
|
||||
dev = guestfs_canonical_device_name (g, fses[i]);
|
||||
if (dev == NULL)
|
||||
@@ -499,32 +487,20 @@ do_output_filesystems (void)
|
||||
|
||||
write_row (dev, "filesystem",
|
||||
fses[i+1], vfs_label, -1, size, parents, vfs_uuid);
|
||||
|
||||
free_strings (parents);
|
||||
free (dev);
|
||||
free (vfs_label);
|
||||
free (vfs_uuid);
|
||||
|
||||
next:
|
||||
free (fses[i]);
|
||||
free (fses[i+1]);
|
||||
}
|
||||
|
||||
free (fses);
|
||||
}
|
||||
|
||||
static void
|
||||
do_output_lvs (void)
|
||||
{
|
||||
char **lvs;
|
||||
size_t i;
|
||||
|
||||
lvs = guestfs_lvs (g);
|
||||
CLEANUP_FREE_STRING_LIST char **lvs = guestfs_lvs (g);
|
||||
if (lvs == NULL)
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
for (i = 0; lvs[i] != NULL; ++i) {
|
||||
char *uuid = NULL, *parent_name = NULL;
|
||||
CLEANUP_FREE char *uuid = NULL, *parent_name = NULL;
|
||||
const char *parents[2];
|
||||
int64_t size = -1;
|
||||
|
||||
@@ -553,29 +529,23 @@ do_output_lvs (void)
|
||||
|
||||
write_row (lvs[i], "lv",
|
||||
NULL, NULL, -1, size, (char **) parents, uuid);
|
||||
|
||||
free (uuid);
|
||||
free (parent_name);
|
||||
free (lvs[i]);
|
||||
}
|
||||
|
||||
free (lvs);
|
||||
}
|
||||
|
||||
static void
|
||||
do_output_vgs (void)
|
||||
{
|
||||
struct guestfs_lvm_vg_list *vgs;
|
||||
size_t i;
|
||||
|
||||
vgs = guestfs_vgs_full (g);
|
||||
CLEANUP_FREE_LVM_VG_LIST struct guestfs_lvm_vg_list *vgs =
|
||||
guestfs_vgs_full (g);
|
||||
if (vgs == NULL)
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
for (i = 0; i < vgs->len; ++i) {
|
||||
char *name;
|
||||
CLEANUP_FREE char *name = NULL;
|
||||
char uuid[33];
|
||||
char **parents;
|
||||
CLEANUP_FREE_STRING_LIST char **parents = NULL;
|
||||
|
||||
if (asprintf (&name, "/dev/%s", vgs->val[i].vg_name) == -1) {
|
||||
perror ("asprintf");
|
||||
@@ -589,12 +559,7 @@ do_output_vgs (void)
|
||||
|
||||
write_row (name, "vg",
|
||||
NULL, NULL, -1, (int64_t) vgs->val[i].vg_size, parents, uuid);
|
||||
|
||||
free (name);
|
||||
free_strings (parents);
|
||||
}
|
||||
|
||||
guestfs_free_lvm_vg_list (vgs);
|
||||
}
|
||||
|
||||
/* Cache the output of guestfs_pvs_full, since we use it in a few places. */
|
||||
@@ -629,11 +594,11 @@ do_output_pvs (void)
|
||||
struct guestfs_lvm_pv_list *pvs = get_pvs ();
|
||||
|
||||
for (i = 0; i < pvs->len; ++i) {
|
||||
char *dev;
|
||||
char uuid[33];
|
||||
const char *parents[1] = { NULL };
|
||||
|
||||
dev = guestfs_canonical_device_name (g, pvs->val[i].pv_name);
|
||||
CLEANUP_FREE char *dev =
|
||||
guestfs_canonical_device_name (g, pvs->val[i].pv_name);
|
||||
if (!dev)
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
@@ -642,15 +607,13 @@ do_output_pvs (void)
|
||||
write_row (dev, "pv",
|
||||
NULL, NULL, -1, (int64_t) pvs->val[i].pv_size,
|
||||
(char **) parents, uuid);
|
||||
|
||||
free (dev);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
get_mbr_id (const char *dev, const char *parent_name)
|
||||
{
|
||||
char *parttype = NULL;
|
||||
CLEANUP_FREE char *parttype = NULL;
|
||||
int mbr_id = -1, partnum;
|
||||
|
||||
guestfs_push_error_handler (g, NULL, NULL);
|
||||
@@ -663,8 +626,6 @@ get_mbr_id (const char *dev, const char *parent_name)
|
||||
mbr_id = guestfs_part_get_mbr_id (g, parent_name, partnum);
|
||||
}
|
||||
|
||||
free (parttype);
|
||||
|
||||
guestfs_pop_error_handler (g);
|
||||
|
||||
return mbr_id;
|
||||
@@ -673,15 +634,14 @@ get_mbr_id (const char *dev, const char *parent_name)
|
||||
static void
|
||||
do_output_partitions (void)
|
||||
{
|
||||
char **parts;
|
||||
size_t i;
|
||||
|
||||
parts = guestfs_list_partitions (g);
|
||||
CLEANUP_FREE_STRING_LIST char **parts = guestfs_list_partitions (g);
|
||||
if (parts == NULL)
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
for (i = 0; parts[i] != NULL; ++i) {
|
||||
char *dev, *parent_name = NULL;
|
||||
CLEANUP_FREE char *dev = NULL, *parent_name = NULL, *canonical_name = NULL;
|
||||
const char *parents[2];
|
||||
int64_t size = -1;
|
||||
int mbr_id = -1;
|
||||
@@ -703,41 +663,32 @@ do_output_partitions (void)
|
||||
if ((columns & COLUMN_MBR))
|
||||
mbr_id = get_mbr_id (parts[i], parent_name);
|
||||
|
||||
char *p = guestfs_canonical_device_name (g, parent_name);
|
||||
if (!p)
|
||||
canonical_name = guestfs_canonical_device_name (g, parent_name);
|
||||
if (!canonical_name)
|
||||
exit (EXIT_FAILURE);
|
||||
free (parent_name);
|
||||
parent_name = p;
|
||||
|
||||
parents[0] = parent_name;
|
||||
parents[0] = canonical_name;
|
||||
parents[1] = NULL;
|
||||
}
|
||||
|
||||
write_row (dev, "partition",
|
||||
NULL, NULL, mbr_id, size, (char **) parents, NULL);
|
||||
|
||||
free (dev);
|
||||
free (parent_name);
|
||||
free (parts[i]);
|
||||
}
|
||||
|
||||
free (parts);
|
||||
}
|
||||
|
||||
static void
|
||||
do_output_blockdevs (void)
|
||||
{
|
||||
char **devices;
|
||||
size_t i;
|
||||
|
||||
devices = guestfs_list_devices (g);
|
||||
CLEANUP_FREE_STRING_LIST char **devices = guestfs_list_devices (g);
|
||||
if (devices == NULL)
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
for (i = 0; devices[i] != NULL; ++i) {
|
||||
int64_t size = -1;
|
||||
char *dev;
|
||||
char **parents;
|
||||
CLEANUP_FREE_STRING_LIST char **parents = NULL;
|
||||
CLEANUP_FREE char *dev = NULL;
|
||||
|
||||
dev = guestfs_canonical_device_name (g, devices[i]);
|
||||
if (!dev)
|
||||
@@ -756,18 +707,10 @@ do_output_blockdevs (void)
|
||||
|
||||
write_row (dev, "device",
|
||||
NULL, NULL, -1, size, parents, NULL);
|
||||
|
||||
free (dev);
|
||||
free (devices[i]);
|
||||
free_strings (parents);
|
||||
}
|
||||
|
||||
free (devices);
|
||||
}
|
||||
|
||||
/* Returns an empty list of parents. Note this must be freed using
|
||||
* free_strings.
|
||||
*/
|
||||
/* Returns an empty list of parents. Note this must be freed. */
|
||||
static char **
|
||||
no_parents (void)
|
||||
{
|
||||
@@ -806,11 +749,11 @@ is_md (char *device)
|
||||
static char **
|
||||
parents_of_md (char *device)
|
||||
{
|
||||
struct guestfs_mdstat_list *stats;
|
||||
char **ret;
|
||||
size_t i;
|
||||
|
||||
stats = guestfs_md_stat (g, device);
|
||||
CLEANUP_FREE_MDSTAT_LIST struct guestfs_mdstat_list *stats =
|
||||
guestfs_md_stat (g, device);
|
||||
if (!stats)
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
@@ -828,8 +771,6 @@ parents_of_md (char *device)
|
||||
|
||||
ret[stats->len] = NULL;
|
||||
|
||||
guestfs_free_mdstat_list (stats);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -861,15 +802,14 @@ static char **
|
||||
parents_of_vg (char *vg)
|
||||
{
|
||||
struct guestfs_lvm_pv_list *pvs = get_pvs ();
|
||||
char **pvuuids;
|
||||
char **ret;
|
||||
size_t n, i, j;
|
||||
|
||||
pvuuids = guestfs_vgpvuuids (g, vg);
|
||||
CLEANUP_FREE_STRING_LIST char **pvuuids = guestfs_vgpvuuids (g, vg);
|
||||
if (!pvuuids)
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
n = count_strings (pvuuids);
|
||||
n = guestfs___count_strings (pvuuids);
|
||||
|
||||
ret = malloc ((n + 1) * sizeof (char *));
|
||||
if (!ret) {
|
||||
@@ -901,37 +841,6 @@ parents_of_vg (char *vg)
|
||||
|
||||
ret[i] = NULL;
|
||||
|
||||
free_strings (pvuuids);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *
|
||||
join_comma (char **strings)
|
||||
{
|
||||
size_t i, count;
|
||||
char *ret;
|
||||
|
||||
for (count = i = 0; strings[i] != NULL; ++i) {
|
||||
if (i > 0)
|
||||
count++;
|
||||
count += strlen (strings[i]);
|
||||
}
|
||||
|
||||
ret = malloc (count + 1);
|
||||
if (ret == NULL) {
|
||||
perror ("malloc");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
for (count = i = 0; strings[i] != NULL; ++i) {
|
||||
if (i > 0)
|
||||
ret[count++] = ',';
|
||||
strcpy (&ret[count], strings[i]);
|
||||
count += strlen (strings[i]);
|
||||
}
|
||||
ret[count] = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -941,7 +850,7 @@ write_row (const char *name, const char *type,
|
||||
int64_t size, char **parents, const char *uuid)
|
||||
{
|
||||
const char *strings[NR_COLUMNS];
|
||||
char *parents_str = NULL;
|
||||
CLEANUP_FREE char *parents_str = NULL;
|
||||
size_t len = 0;
|
||||
char hum[LONGEST_HUMAN_READABLE];
|
||||
char num[256];
|
||||
@@ -981,7 +890,7 @@ write_row (const char *name, const char *type,
|
||||
}
|
||||
if ((columns & COLUMN_PARENTS)) {
|
||||
/* Internally comma-separated field. */
|
||||
parents_str = join_comma (parents);
|
||||
parents_str = guestfs___join_strings (",", parents);
|
||||
strings[len++] = parents_str;
|
||||
}
|
||||
if ((columns & COLUMN_UUID))
|
||||
@@ -989,8 +898,6 @@ write_row (const char *name, const char *type,
|
||||
assert (len <= NR_COLUMNS);
|
||||
|
||||
write_row_strings ((char **) strings, len);
|
||||
|
||||
free (parents_str);
|
||||
}
|
||||
|
||||
static void add_row (char **strings, size_t len);
|
||||
@@ -1159,23 +1066,3 @@ do_output_end (void)
|
||||
}
|
||||
free (rows);
|
||||
}
|
||||
|
||||
static void
|
||||
free_strings (char **strings)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; strings[i] != NULL; ++i)
|
||||
free (strings[i]);
|
||||
free (strings);
|
||||
}
|
||||
|
||||
static size_t
|
||||
count_strings (char **strings)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; strings[i] != NULL; ++i)
|
||||
;
|
||||
return i;
|
||||
}
|
||||
@@ -25,13 +25,13 @@
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <locale.h>
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
#include <libintl.h>
|
||||
|
||||
#include "human.h"
|
||||
#include "progname.h"
|
||||
|
||||
#include "guestfs.h"
|
||||
#include "options.h"
|
||||
@@ -82,14 +82,6 @@ static int is_fifo (int64_t mode);
|
||||
static int is_lnk (int64_t mode);
|
||||
static int is_sock (int64_t mode);
|
||||
|
||||
static void free_strings (char **);
|
||||
|
||||
static inline char *
|
||||
bad_cast (char const *s)
|
||||
{
|
||||
return (char *) s;
|
||||
}
|
||||
|
||||
static void __attribute__((noreturn))
|
||||
usage (int status)
|
||||
{
|
||||
@@ -138,9 +130,6 @@ main (int argc, char *argv[])
|
||||
/* Current time for --time-days, --time-relative output. */
|
||||
time (&now);
|
||||
|
||||
/* Set global program name that is not polluted with libtool artifacts. */
|
||||
set_program_name (argv[0]);
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEBASEDIR);
|
||||
textdomain (PACKAGE);
|
||||
@@ -163,6 +152,7 @@ main (int argc, char *argv[])
|
||||
{ "human-readable", 0, 0, 'h' },
|
||||
{ "keys-from-stdin", 0, 0, 0 },
|
||||
{ "long", 0, 0, 'l' },
|
||||
{ "long-options", 0, 0, 0 },
|
||||
{ "recursive", 0, 0, 'R' },
|
||||
{ "time", 0, 0, 0 },
|
||||
{ "times", 0, 0, 0 },
|
||||
@@ -191,15 +181,15 @@ main (int argc, char *argv[])
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
argv[0] = bad_cast (program_name);
|
||||
|
||||
for (;;) {
|
||||
c = getopt_long (argc, argv, options, long_options, &option_index);
|
||||
if (c == -1) break;
|
||||
|
||||
switch (c) {
|
||||
case 0: /* options which are long only */
|
||||
if (STREQ (long_options[option_index].name, "keys-from-stdin")) {
|
||||
if (STREQ (long_options[option_index].name, "long-options"))
|
||||
display_long_options (long_options);
|
||||
else if (STREQ (long_options[option_index].name, "keys-from-stdin")) {
|
||||
keys_from_stdin = 1;
|
||||
} else if (STREQ (long_options[option_index].name, "echo-keys")) {
|
||||
echo_keys = 1;
|
||||
@@ -301,7 +291,11 @@ main (int argc, char *argv[])
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
drv->type = drv_a;
|
||||
drv->a.filename = argv[optind];
|
||||
drv->a.filename = strdup (argv[optind]);
|
||||
if (!drv->a.filename) {
|
||||
perror ("strdup");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
drv->next = drvs;
|
||||
drvs = drv;
|
||||
} else { /* simulate -d option */
|
||||
@@ -408,18 +402,14 @@ main (int argc, char *argv[])
|
||||
static int
|
||||
do_ls (const char *dir)
|
||||
{
|
||||
char **lines;
|
||||
size_t i;
|
||||
CLEANUP_FREE_STRING_LIST char **lines = guestfs_ls (g, dir);
|
||||
|
||||
if ((lines = guestfs_ls (g, dir)) == NULL) {
|
||||
if (lines == NULL)
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; lines[i] != NULL; ++i) {
|
||||
for (i = 0; lines[i] != NULL; ++i)
|
||||
printf ("%s\n", lines[i]);
|
||||
free (lines[i]);
|
||||
}
|
||||
free (lines);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -427,13 +417,12 @@ do_ls (const char *dir)
|
||||
static int
|
||||
do_ls_l (const char *dir)
|
||||
{
|
||||
char *out;
|
||||
CLEANUP_FREE char *out = guestfs_ll (g, dir);
|
||||
|
||||
if ((out = guestfs_ll (g, dir)) == NULL)
|
||||
if (out == NULL)
|
||||
return -1;
|
||||
|
||||
printf ("%s", out);
|
||||
free (out);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -441,18 +430,14 @@ do_ls_l (const char *dir)
|
||||
static int
|
||||
do_ls_R (const char *dir)
|
||||
{
|
||||
char **dirs;
|
||||
size_t i;
|
||||
CLEANUP_FREE_STRING_LIST char **dirs = guestfs_find (g, dir);
|
||||
|
||||
dirs = guestfs_find (g, dir);
|
||||
if (dirs == NULL)
|
||||
return -1;
|
||||
|
||||
for (i = 0; dirs[i] != NULL; ++i) {
|
||||
for (i = 0; dirs[i] != NULL; ++i)
|
||||
puts (dirs[i]);
|
||||
free (dirs[i]);
|
||||
}
|
||||
free (dirs);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -473,8 +458,8 @@ visit (int depth, const char *dir, visitor_function f)
|
||||
* case.
|
||||
*/
|
||||
if (depth == 0) {
|
||||
struct guestfs_stat *stat;
|
||||
struct guestfs_xattr_list *xattrs;
|
||||
CLEANUP_FREE_STAT struct guestfs_stat *stat = NULL;
|
||||
CLEANUP_FREE_XATTR_LIST struct guestfs_xattr_list *xattrs = NULL;
|
||||
int r;
|
||||
|
||||
stat = guestfs_lstat (g, dir);
|
||||
@@ -482,40 +467,35 @@ visit (int depth, const char *dir, visitor_function f)
|
||||
return -1;
|
||||
|
||||
xattrs = guestfs_lgetxattrs (g, dir);
|
||||
if (xattrs == NULL) {
|
||||
guestfs_free_stat (stat);
|
||||
if (xattrs == NULL)
|
||||
return -1;
|
||||
}
|
||||
|
||||
r = f (dir, NULL, stat, xattrs);
|
||||
guestfs_free_stat (stat);
|
||||
guestfs_free_xattr_list (xattrs);
|
||||
|
||||
if (r == -1)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ret = -1;
|
||||
char **names = NULL;
|
||||
char *path = NULL;
|
||||
size_t i, xattrp;
|
||||
struct guestfs_stat_list *stats = NULL;
|
||||
struct guestfs_xattr_list *xattrs = NULL;
|
||||
CLEANUP_FREE_STRING_LIST char **names = NULL;
|
||||
CLEANUP_FREE_STAT_LIST struct guestfs_stat_list *stats = NULL;
|
||||
CLEANUP_FREE_XATTR_LIST struct guestfs_xattr_list *xattrs = NULL;
|
||||
|
||||
names = guestfs_ls (g, dir);
|
||||
if (names == NULL)
|
||||
goto out;
|
||||
return -1;
|
||||
|
||||
stats = guestfs_lstatlist (g, dir, names);
|
||||
if (stats == NULL)
|
||||
goto out;
|
||||
return -1;
|
||||
|
||||
xattrs = guestfs_lxattrlist (g, dir, names);
|
||||
if (xattrs == NULL)
|
||||
goto out;
|
||||
return -1;
|
||||
|
||||
/* Call function on everything in this directory. */
|
||||
for (i = 0, xattrp = 0; names[i] != NULL; ++i, ++xattrp) {
|
||||
CLEANUP_FREE char *path = NULL;
|
||||
struct guestfs_xattr_list file_xattrs;
|
||||
size_t nr_xattrs;
|
||||
|
||||
@@ -528,7 +508,7 @@ visit (int depth, const char *dir, visitor_function f)
|
||||
if (xattrs->val[xattrp].attrval_len == 0) {
|
||||
fprintf (stderr, _("%s: error getting extended attrs for %s %s\n"),
|
||||
program_name, dir, names[i]);
|
||||
goto out;
|
||||
return -1;
|
||||
}
|
||||
/* attrval is not \0-terminated. */
|
||||
char attrval[xattrs->val[xattrp].attrval_len+1];
|
||||
@@ -538,7 +518,7 @@ visit (int depth, const char *dir, visitor_function f)
|
||||
if (sscanf (attrval, "%zu", &nr_xattrs) != 1) {
|
||||
fprintf (stderr, _("%s: error: cannot parse xattr count for %s %s\n"),
|
||||
program_name, dir, names[i]);
|
||||
goto out;
|
||||
return -1;
|
||||
}
|
||||
|
||||
file_xattrs.len = nr_xattrs;
|
||||
@@ -547,28 +527,17 @@ visit (int depth, const char *dir, visitor_function f)
|
||||
|
||||
/* Call the function. */
|
||||
if (f (dir, names[i], &stats->val[i], &file_xattrs) == -1)
|
||||
goto out;
|
||||
return -1;
|
||||
|
||||
/* Recursively call visit, but only on directories. */
|
||||
if (is_dir (stats->val[i].mode)) {
|
||||
path = full_path (dir, names[i]);
|
||||
if (visit (depth + 1, path, f) == -1)
|
||||
goto out;
|
||||
free (path); path = NULL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
free (path);
|
||||
if (names)
|
||||
free_strings (names);
|
||||
if (stats)
|
||||
guestfs_free_stat_list (stats);
|
||||
if (xattrs)
|
||||
guestfs_free_xattr_list (xattrs);
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char *
|
||||
@@ -610,29 +579,28 @@ show_file (const char *dir, const char *name,
|
||||
const struct guestfs_stat *stat,
|
||||
const struct guestfs_xattr_list *xattrs)
|
||||
{
|
||||
char filetype[2];
|
||||
char *path, *csum = NULL, *link = NULL;
|
||||
const char *filetype;
|
||||
CLEANUP_FREE char *path = NULL, *csum = NULL, *link = NULL;
|
||||
|
||||
/* Display the basic fields. */
|
||||
output_start_line ();
|
||||
|
||||
if (is_reg (stat->mode))
|
||||
filetype[0] = '-';
|
||||
filetype = "-";
|
||||
else if (is_dir (stat->mode))
|
||||
filetype[0] = 'd';
|
||||
filetype = "d";
|
||||
else if (is_chr (stat->mode))
|
||||
filetype[0] = 'c';
|
||||
filetype = "c";
|
||||
else if (is_blk (stat->mode))
|
||||
filetype[0] = 'b';
|
||||
filetype = "b";
|
||||
else if (is_fifo (stat->mode))
|
||||
filetype[0] = 'p';
|
||||
filetype = "p";
|
||||
else if (is_lnk (stat->mode))
|
||||
filetype[0] = 'l';
|
||||
filetype = "l";
|
||||
else if (is_sock (stat->mode))
|
||||
filetype[0] = 's';
|
||||
filetype = "s";
|
||||
else
|
||||
filetype[0] = 'u';
|
||||
filetype[1] = '\0';
|
||||
filetype = "u";
|
||||
output_string (filetype);
|
||||
output_int64_perms (stat->mode & 07777);
|
||||
|
||||
@@ -683,10 +651,6 @@ show_file (const char *dir, const char *name,
|
||||
|
||||
output_end_line ();
|
||||
|
||||
free (path);
|
||||
free (csum);
|
||||
free (link);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -966,14 +930,3 @@ is_sock (int64_t mode)
|
||||
{
|
||||
return (mode & 0170000) == 0140000;
|
||||
}
|
||||
|
||||
/* String functions. */
|
||||
static void
|
||||
free_strings (char **names)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; names[i] != NULL; ++i)
|
||||
free (names[i]);
|
||||
free (names);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash -
|
||||
# libguestfs
|
||||
# Copyright (C) 2009-2012 Red Hat Inc.
|
||||
# Copyright (C) 2009-2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash -
|
||||
# libguestfs
|
||||
# Copyright (C) 2009-2012 Red Hat Inc.
|
||||
# Copyright (C) 2009-2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -78,6 +78,12 @@ them with separate I<-a> options.
|
||||
The format of the disk image is auto-detected. To override this and
|
||||
force a particular format use the I<--format=..> option.
|
||||
|
||||
=item B<-a URI>
|
||||
|
||||
=item B<--add URI>
|
||||
|
||||
Add a remote disk. See L<guestfish(1)/ADDING REMOTE STORAGE>.
|
||||
|
||||
=item B<-c> URI
|
||||
|
||||
=item B<--connect> URI
|
||||
|
||||
@@ -107,6 +107,12 @@ them with separate I<-a> options.
|
||||
The format of the disk image is auto-detected. To override this and
|
||||
force a particular format use the I<--format=..> option.
|
||||
|
||||
=item B<-a URI>
|
||||
|
||||
=item B<--add URI>
|
||||
|
||||
Add a remote disk. See L<guestfish(1)/ADDING REMOTE STORAGE>.
|
||||
|
||||
=item B<--all>
|
||||
|
||||
Display everything. This is currently the same as specifying these
|
||||
|
||||
@@ -71,8 +71,8 @@ Find regular files modified in the last 24 hours:
|
||||
Find the differences between files in a guest and an earlier snapshot
|
||||
of the same guest.
|
||||
|
||||
virt-ls -lR -a snapshot.img / --uids --time-t > old
|
||||
virt-ls -lR -a current.img / --uids --time-t > new
|
||||
virt-ls -lR -a snapshot.img / --uids > old
|
||||
virt-ls -lR -a current.img / --uids > new
|
||||
diff -u old new | less
|
||||
|
||||
The commands above won't find files where the content has changed but
|
||||
@@ -81,6 +81,12 @@ that, you need to add the I<--checksum> parameter to both C<virt-ls>
|
||||
commands. I<--checksum> can be quite slow since it has to read and
|
||||
compute a checksum of every regular file in the virtual machine.
|
||||
|
||||
The commands above won't show changes in file times. Add I<--time-t>
|
||||
to both C<virt-ls> commands if you want to show all time changes (that
|
||||
includes file access times).
|
||||
|
||||
To diff the content of files, use L<virt-cat(1)> or L<guestfish(1)>.
|
||||
|
||||
=head1 OUTPUT MODES
|
||||
|
||||
C<virt-ls> has four output modes, controlled by different
|
||||
@@ -277,6 +283,12 @@ them with separate I<-a> options.
|
||||
The format of the disk image is auto-detected. To override this and
|
||||
force a particular format use the I<--format=..> option.
|
||||
|
||||
=item B<-a URI>
|
||||
|
||||
=item B<--add URI>
|
||||
|
||||
Add a remote disk. See L<guestfish(1)/ADDING REMOTE STORAGE>.
|
||||
|
||||
=item B<--checksum>
|
||||
|
||||
=item B<--checksum=crc|md5|sha1|sha224|sha256|sha384|sha512>
|
||||
@@ -499,9 +511,6 @@ L<guestfish(1)>,
|
||||
L<virt-cat(1)>,
|
||||
L<virt-copy-out(1)>,
|
||||
L<virt-tar-out(1)>,
|
||||
L<Sys::Guestfs(3)>,
|
||||
L<Sys::Guestfs::Lib(3)>,
|
||||
L<Sys::Virt(3)>,
|
||||
L<http://libguestfs.org/>.
|
||||
|
||||
=head1 AUTHOR
|
||||
@@ -510,4 +519,4 @@ Richard W.M. Jones L<http://people.redhat.com/~rjones/>
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright (C) 2009-2012 Red Hat Inc.
|
||||
Copyright (C) 2009-2013 Red Hat Inc.
|
||||
|
||||
14
cfg.mk
14
cfg.mk
@@ -25,15 +25,17 @@ url_dir_list = \
|
||||
ftp://$(gnu_rel_host)/gnu/coreutils
|
||||
|
||||
# Exclude some filenames.
|
||||
exclude_file_name_regexp--sc_bindtextdomain = ^(daemon|erlang|examples|tests)/
|
||||
exclude_file_name_regexp--sc_error_message_period = ^php/
|
||||
exclude_file_name_regexp--sc_prohibit_always-defined_macros = ^examples/
|
||||
exclude_file_name_regexp--sc_bindtextdomain = ^(daemon|erlang|examples|tests)/|/test-
|
||||
exclude_file_name_regexp--sc_error_message_period = ^(generator|php|po-docs)/
|
||||
exclude_file_name_regexp--sc_prohibit_always-defined_macros = ^examples/|^tests/xml/fake-libvirt-xml\.c|^daemon/guestfsd\.c
|
||||
exclude_file_name_regexp--sc_prohibit_doubled_word = ^po/
|
||||
exclude_file_name_regexp--sc_prohibit_magic_number_exit = ^(po|po-docs)/|\.pod$
|
||||
exclude_file_name_regexp--sc_prohibit_strcmp = ^examples/
|
||||
exclude_file_name_regexp--sc_prohibit_strcmp_and_strncmp = ^examples/
|
||||
exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = ^tests/data/|\.patch$|\.png$|^tests/guests/guest-aux/debian-packages|^tests/guests/guest-aux/minimal-hive
|
||||
exclude_file_name_regexp--sc_prohibit_magic_number_exit = ^(po|po-docs)/|\.pod$|^fuse/guestunmount\.c
|
||||
exclude_file_name_regexp--sc_prohibit_strcmp = ^(examples|po-docs)/|\.pod$
|
||||
exclude_file_name_regexp--sc_prohibit_strcmp_and_strncmp = ^(examples|po-docs)/|\.pod$
|
||||
exclude_file_name_regexp--sc_prohibit_strncpy = ^src/launch-.*\.c$
|
||||
exclude_file_name_regexp--sc_require_config_h = ^examples/|^tests/c-api/test-just-header\.c$
|
||||
exclude_file_name_regexp--sc_require_config_h_first = ^examples/|^tests/c-api/test-just-header\.c$|^python/guestfs-py-byhand\.c$
|
||||
|
||||
# Tests not to run as part of "make distcheck".
|
||||
local-checks-to-skip = \
|
||||
|
||||
29
common-rules.mk
Normal file
29
common-rules.mk
Normal file
@@ -0,0 +1,29 @@
|
||||
# libguestfs
|
||||
# Copyright (C) 2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
# 'common-rules.mk' should be included in every Makefile.am.
|
||||
# cf. 'subdir-rules.mk'
|
||||
|
||||
-include $(top_builddir)/localenv
|
||||
|
||||
# Old RHEL 5 autoconf defines these, but RHEL 5 automake doesn't
|
||||
# create variables for them. So define them here if they're not
|
||||
# defined already.
|
||||
builddir ?= @builddir@
|
||||
abs_builddir ?= @abs_builddir@
|
||||
srcdir ?= @srcdir@
|
||||
abs_srcdir ?= @abs_srcdir@
|
||||
1309
configure.ac
1309
configure.ac
File diff suppressed because it is too large
Load Diff
@@ -5,10 +5,6 @@ autobuild/
|
||||
The autobuild script that we use to build and test the
|
||||
tarballs on Debian and elsewhere.
|
||||
|
||||
guestfsd-in-wine.sh
|
||||
Run a Windows-compiled guestfsd under Wine. Read the
|
||||
instructions at the top of this file carefully.
|
||||
|
||||
intro/ "Slides" for an intro to libguestfs. This is a short (10-15
|
||||
min) talk that I give to introduce the main features of
|
||||
libguestfs. The slides are in the form of a complete
|
||||
@@ -17,7 +13,7 @@ intro/ "Slides" for an intro to libguestfs. This is a short (10-15
|
||||
|
||||
make-check-on-installed.pl
|
||||
This Perl script allows you to run the test suite (ie. 'make
|
||||
check', 'make extra-tests' etc) on an installed RPM. This is
|
||||
check', 'make check-all' etc) on an installed RPM. This is
|
||||
useful for adding another layer of testing to packages before
|
||||
we release them. Note that a checked out copy of the source
|
||||
from git is required. Read the top of the file before using.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash -
|
||||
# libguestfs autobuild script
|
||||
# Copyright (C) 2009-2012 Red Hat Inc.
|
||||
# Copyright (C) 2009-2013 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
#!/bin/bash -
|
||||
# Copyright (C) 2009 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
# INSTRUCTIONS
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# This is a QEMU wrapper script that allows you to run a
|
||||
# Windows-compiled guestfsd.exe (daemon) under Wine from a Linux main
|
||||
# program. You need to read and understand all the instructions below
|
||||
# before use.
|
||||
#
|
||||
# To understand how to compile the daemon for Windows, please read:
|
||||
# http://www.redhat.com/archives/libguestfs/2009-November/msg00255.html
|
||||
#
|
||||
# Adjust the Wine configuration so it can find the libraries, as
|
||||
# described here:
|
||||
# http://fedoraproject.org/wiki/MinGW/Configure_wine
|
||||
#
|
||||
# On Fedora 13 there is a serious bug in Wine. See:
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=533806#c11
|
||||
#
|
||||
# If necessary, adjust the line 'guestfsd=...' below so it points to
|
||||
# the correct location of the guestfsd.exe program. You can use an
|
||||
# absolute path here if you want.
|
||||
guestfsd=daemon/guestfsd.exe
|
||||
#
|
||||
# This script is a QEMU wrapper. It pretends to be qemu as far as
|
||||
# libguestfs programs are concerned. Read this to understand the
|
||||
# purpose of QEMU wrappers:
|
||||
# http://libguestfs.org/guestfs.3.html#qemu_wrappers
|
||||
#
|
||||
# With this script, the qemu program is not actually run. Instead we
|
||||
# pretend to be qemu, parse out the necessary parts of the long
|
||||
# command line that libguestfs passes to qemu, and run the Windows
|
||||
# daemon, under Wine, with the right command line. The Windows daemon
|
||||
# then hopefully connects back to the libguestfs socket, and as far as
|
||||
# the libguestfs program is concerned, it looks like a full appliance
|
||||
# is running.
|
||||
#
|
||||
# To use this script, you must set the environment variable
|
||||
# LIBGUESTFS_QEMU=/path/to/contrib/guestfsd-in-wine.sh (ie. the path
|
||||
# to this script).
|
||||
#
|
||||
# You can then run libguestfs test programs, and (hopefully!) they'll
|
||||
# use the Windows guestfsd.exe, simulating calls using Wine.
|
||||
#
|
||||
# For example from the top build directory:
|
||||
#
|
||||
# LIBGUESTFS_QEMU=contrib/guestfsd-in-wine.sh ./run ./fish/guestfish
|
||||
#
|
||||
# Another suggested environment variable is LIBGUESTFS_DEBUG=1 which
|
||||
# will give you must more detail about what is going on. Also look at
|
||||
# the contents of the log file 'guestfsd-in-wine.log' after each run.
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
# Note that stdout & stderr messages will get eaten by libguestfs
|
||||
# early on in the process. Therefore write log messages to
|
||||
# a log file.
|
||||
exec 5>>guestfsd-in-wine.log
|
||||
echo "Environment:" >&5
|
||||
printenv | grep LIBGUESTFS >&5
|
||||
echo "Command line:" >&5
|
||||
echo " $@" >&5
|
||||
|
||||
# We're called several times, first with -help and -version, and we
|
||||
# have to pretend to be qemu! (At least enough to trick libguestfs).
|
||||
if [ "$1" = "-help" ]; then
|
||||
echo -- " -net user "
|
||||
echo -- " -no-hpet "
|
||||
echo -- " -rtc-td-hack "
|
||||
exit 0
|
||||
elif [ "$1" = "-version" ]; then
|
||||
echo -- "0.0.0"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# The interesting parameter is -append.
|
||||
append=
|
||||
while [ $# -gt 0 ]; do
|
||||
if [ $1 = "-append" ]; then
|
||||
append="$2"
|
||||
shift
|
||||
fi
|
||||
shift
|
||||
done
|
||||
echo "Append parameter:" >&5
|
||||
echo " $append" >&5
|
||||
|
||||
# guestfs_vmchannel parameter.
|
||||
vmchannel_param=$(echo "$append" | grep -Eo 'guestfs_vmchannel=[^[:space:]]+')
|
||||
echo "Vmchannel parameter:" >&5
|
||||
echo " $vmchannel_param" >&5
|
||||
|
||||
# Port number.
|
||||
port=$(echo "$vmchannel_param" | grep -Eo '[[:digit:]]+$')
|
||||
echo "Port number:" >&5
|
||||
echo " $vmchannel_param" >&5
|
||||
|
||||
# Run guestfsd.exe.
|
||||
echo "Command:" >&5
|
||||
echo " $guestfsd -f -v -c tcp:localhost:$port" >&5
|
||||
$guestfsd -f -v -c tcp:127.0.0.1:$port
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user