1 |
commit: ff473a3eeff36813cbce547dced5c62c2759d2bf |
2 |
Author: Michael Weber <michael <AT> xmw <DOT> de> |
3 |
AuthorDate: Sat Dec 7 22:11:59 2013 +0000 |
4 |
Commit: Michael Weber <xmw <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Dec 7 22:11:59 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/xmw.git;a=commit;h=ff473a3e |
7 |
|
8 |
Initial import |
9 |
|
10 |
Package-Manager: portage-2.2.7 |
11 |
Manifest-Sign-Key: 62EEF090 |
12 |
|
13 |
--- |
14 |
sys-kernel/mkinitrd/ChangeLog | 5 + |
15 |
sys-kernel/mkinitrd/files/mkinitrd-0_p20131207 | 448 ++++++++++++++++++++++++ |
16 |
sys-kernel/mkinitrd/metadata.xml | 8 + |
17 |
sys-kernel/mkinitrd/mkinitrd-0_p20131207.ebuild | 80 +++++ |
18 |
4 files changed, 541 insertions(+) |
19 |
|
20 |
diff --git a/sys-kernel/mkinitrd/ChangeLog b/sys-kernel/mkinitrd/ChangeLog |
21 |
new file mode 100644 |
22 |
index 0000000..2ec7fbe |
23 |
--- /dev/null |
24 |
+++ b/sys-kernel/mkinitrd/ChangeLog |
25 |
@@ -0,0 +1,5 @@ |
26 |
+*mkinitrd-0_p20131207 (07 Dec 2013) |
27 |
+ |
28 |
+ 07 Dec 2013; Michael Weber <xmw@g.o> +files/mkinitrd-0_p20131207, |
29 |
+ +metadata.xml, +mkinitrd-0_p20131207.ebuild: |
30 |
+ Initial import |
31 |
|
32 |
diff --git a/sys-kernel/mkinitrd/files/mkinitrd-0_p20131207 b/sys-kernel/mkinitrd/files/mkinitrd-0_p20131207 |
33 |
new file mode 100644 |
34 |
index 0000000..dd9f5c1 |
35 |
--- /dev/null |
36 |
+++ b/sys-kernel/mkinitrd/files/mkinitrd-0_p20131207 |
37 |
@@ -0,0 +1,448 @@ |
38 |
+#!/usr/bin/python3 |
39 |
+# Michael Weber (xmw at gentoo dot org) 06 Nov 2012 |
40 |
+# TODO use ClosedSytem to copy files |
41 |
+# vim: tabstop=4 expandtab |
42 |
+ |
43 |
+import argparse, glob, os, re, subprocess, sys, tempfile, time |
44 |
+import portage |
45 |
+ |
46 |
+def cat(fn, s, append=None, mode=0o644): |
47 |
+ d = os.path.split(fn)[0] |
48 |
+ if d and not os.path.exists(d): |
49 |
+ os.makedirs(d) |
50 |
+ f = open(fn, 'w' + (append and 'a' or '')) |
51 |
+ f.write(s) |
52 |
+ f.close() |
53 |
+ os.chmod(fn, mode) |
54 |
+ |
55 |
+def sed(src, *opts): |
56 |
+ return subprocess.Popen(['sed'] + list(opts) + [src,], |
57 |
+ stdout=subprocess.PIPE).stdout.read().decode('UTF-8') |
58 |
+ |
59 |
+presets = {} |
60 |
+presets['minimal'] = { |
61 |
+ 'objs': [ |
62 |
+ sys.argv[0], |
63 |
+ '/dev/console', |
64 |
+ '/dev/null', |
65 |
+ '/dev/tty', |
66 |
+ '/etc/fstab', |
67 |
+ '/etc/group', |
68 |
+ '/etc/group', |
69 |
+ '/etc/ld.so.cache', |
70 |
+ '/etc/pam.d/system-auth', |
71 |
+ '/etc/passwd', |
72 |
+ '/etc/passwd', |
73 |
+ '/etc/shadow', |
74 |
+ '/etc/terminfo/l/linux', |
75 |
+ '/etc/terminfo/s/screen', |
76 |
+ '/etc/zsh/z*', |
77 |
+ '/lib', |
78 |
+ '/root/.screenrc', |
79 |
+ '/root/.zshenv', |
80 |
+ '/root/.zshfns/prompt_gentoo_setup', |
81 |
+ '/root/.zshrc', |
82 |
+ '/usr/lib*/zsh/*/zsh/complete.so', |
83 |
+ '/usr/lib*/zsh/*/zsh/compctl.so', |
84 |
+ '/usr/lib*/zsh/*/zsh/terminfo.so', |
85 |
+ '/usr/lib*/zsh/*/zsh/zle.so', |
86 |
+ '/usr/lib*/zsh/*/zsh/zutil.so', |
87 |
+ '/usr/lib*/cracklib_dict.pwd', |
88 |
+ '/usr/lib*/cracklib_dict.pwi', |
89 |
+ '/usr/lib*/zsh/*/zsh/parameter.so', |
90 |
+ '/usr/local/sbin/power-save.sh', |
91 |
+ '/usr/share/zsh/*/functions/Completion/Unix/_git', |
92 |
+ '/usr/share/zsh/*/functions/Completion/compaudit', |
93 |
+ '/usr/share/zsh/*/functions/Completion/compdump', |
94 |
+ '/usr/share/zsh/*/functions/Completion/compinit', |
95 |
+ '/usr/share/zsh/*/functions/Zle/select-word-style', |
96 |
+ '/usr/share/zsh/*/functions/Zle/url-quote-magic', |
97 |
+ 'cat', |
98 |
+ 'cp', |
99 |
+ 'cpio', |
100 |
+ 'cryptsetup', |
101 |
+ 'dmesg', |
102 |
+ 'env', |
103 |
+ 'ethtool', |
104 |
+ 'find', |
105 |
+ 'halt', |
106 |
+ 'id', |
107 |
+ 'ip', |
108 |
+ 'less', |
109 |
+ 'ls', |
110 |
+ 'lvchange', |
111 |
+ 'lvscan', |
112 |
+ 'mdadm', |
113 |
+ 'mkdir', |
114 |
+ 'modprobe', |
115 |
+ 'more', |
116 |
+ 'mount', |
117 |
+ 'mountpoint', |
118 |
+ 'mv', |
119 |
+ 'ps', |
120 |
+ 'readlink', |
121 |
+ 'reboot', |
122 |
+ 'rfkill', |
123 |
+ 'screen', |
124 |
+ 'setsid', |
125 |
+ 'stat', |
126 |
+ 'switch_root', |
127 |
+ 'tftp', |
128 |
+ 'uname', |
129 |
+ 'whoami', |
130 |
+ 'zsh', |
131 |
+ ], |
132 |
+ 'pkgs': [ |
133 |
+ 'sys-apps/sed', |
134 |
+ ], |
135 |
+ 'hooks': [ |
136 |
+ (sed, 'etc/passwd', '-i', '-n', '-e /^root:/p'), |
137 |
+ (sed, 'etc/group', '-i', '-n', '-e /^root:/p'), |
138 |
+ (cat, 'etc/shadow', ''), |
139 |
+ (os.symlink, '/proc/mounts', 'etc/mtab'), |
140 |
+ (cat, 'etc/resolv.conf', """nameserver 2001:4ca0::53:2 |
141 |
+nameserver 129.187.5.1"""), |
142 |
+ (os.symlink, 'root/.zshenv', '.zshenv'), |
143 |
+ #(os.symlink, 'root/.zshrc', '.zshrc'), |
144 |
+ #(os.symlink, 'root/.zshfns', '.zshfns'), |
145 |
+ #(os.symlink, 'root/.histfile', '.histfile'), |
146 |
+ (cat, 'init', """\ |
147 |
+#!/bin/zsh |
148 |
+echo " |
149 |
+ |
150 |
+ |
151 |
+initrd created on %s by xmw.de/dotfiles/mkinitrd.py |
152 |
+kernel $(uname -s -r -m) |
153 |
+modules $(ls /lib/modules) |
154 |
+ |
155 |
+" |
156 |
+trap '{ |
157 |
+ echo |
158 |
+ echo "Something went wrong. Dropping you to a shell." |
159 |
+ echo "Try mount /boot; gzip -cd /boot/initramfs | cpio -i ; exec /init" |
160 |
+ #exec /usr/bin/setsid /bin/zsh -c "exec /bin/zsh </dev/tty1 >/dev/tty1" |
161 |
+ export USER=root |
162 |
+ export HOME=/root |
163 |
+ cd /root |
164 |
+ exec /bin/zsh |
165 |
+}' ZERR |
166 |
+setopt noequals nonomatch |
167 |
+ |
168 |
+mkdir -p /proc /sys /run /dev /mnt/target |
169 |
+mountpoint -q /proc || mount -t proc none /proc |
170 |
+mountpoint -q /sys || mount -t sysfs none /sys |
171 |
+mountpoint -q /run || mount -t tmpfs none /run |
172 |
+mountpoint -q /dev || mount -t devtmpfs none /dev |
173 |
+mkdir -p /dev/pts |
174 |
+mountpoint -q /dev/pts || mount -t devpts -o gid=5,mode=0620 none /dev/pts |
175 |
+ |
176 |
+get() { |
177 |
+ for x in ${(Oa)$(< /proc/cmdline)} ; do |
178 |
+ [ "x${x%%%%=*}" = "x${1}" ] && { echo ${x/*=} ; return } |
179 |
+ done |
180 |
+ echo $2 |
181 |
+} |
182 |
+esr() { |
183 |
+ exec switch_root /mnt/target $(get init /sbin/init) |
184 |
+} |
185 |
+ |
186 |
+if [ -x /usr/local/sbin/power-save.sh ] ; then |
187 |
+ /usr/local/sbin/power-save.sh || true |
188 |
+fi |
189 |
+ |
190 |
+case $(< /proc/sys/kernel/hostname) in |
191 |
+ io) |
192 |
+ echo "Disconnect LAN cable <Enter>" ; read |
193 |
+ ip link set eth0 up |
194 |
+ echo "Reconnect LAN cable <Enter>" ; read |
195 |
+ ip link set eth0 up |
196 |
+ if dmesg | grep -i "Hardware error" ; then |
197 |
+ #stop boot sequence |
198 |
+ false |
199 |
+ fi |
200 |
+ |
201 |
+ mdadm --assemble /dev/md42 /dev/sda /dev/sdb |
202 |
+ cryptsetup --tries 3 luksOpen $(get crypt_dev /dev/md42) $(get crypt_name main) |
203 |
+ mount $(get root /dev/mapper/main) /mnt/target |
204 |
+ ;; |
205 |
+ x) |
206 |
+ cryptsetup --tries 3 luksOpen $(get crypt_dev /dev/sda2) $(get crypt_name main) |
207 |
+ lvscan |
208 |
+ lvchange -a y $(get vg_name main) |
209 |
+ printf "%%d:%%d" $(stat -c "0x%%t 0x%%T" $(readlink -e $(get resume /dev/mapper/main-swap))) > /sys/power/resume |
210 |
+ mount $(get root /dev/mapper/main) /mnt/target |
211 |
+ ;; |
212 |
+ *) |
213 |
+ echo "unkown host $(< /proc/sys/kernel/hostname)" |
214 |
+ echo "define at mkinitrd.py" |
215 |
+ echo "mount root to /mnt/target and run esr" |
216 |
+ ;; |
217 |
+esac |
218 |
+ |
219 |
+esr |
220 |
+""" % (time.ctime()), '', 0o755), |
221 |
+ (lambda: cat('root/.histfile', sed('init', '-e 1d')),), |
222 |
+ (cat, 'root/.zshenv', """\ |
223 |
+PATH=/sbin:/bin:/usr/sbin:/usr/bin |
224 |
+USER=root |
225 |
+HOME=/root |
226 |
+SHELL=/bin/zsh |
227 |
+#setopt noequals nonomatch |
228 |
+alias la='ls -hal' |
229 |
+"""), |
230 |
+ |
231 |
+ |
232 |
+ ] |
233 |
+} |
234 |
+ |
235 |
+presets['full'] = { |
236 |
+ 'objs': presets['minimal']['objs'] + [ |
237 |
+ '/etc/wpa_supplicant/wpa_supplicant.conf', |
238 |
+ ], |
239 |
+ 'pkgs': presets['minimal']['pkgs'] + [ |
240 |
+ 'app-arch/cpio', |
241 |
+ 'app-arch/pbzip2', |
242 |
+ 'app-arch/tar', |
243 |
+ 'app-cdr/cdrtools', |
244 |
+ 'app-editors/nano', |
245 |
+ 'app-misc/pax-utils', |
246 |
+ 'app-misc/screen', |
247 |
+ 'app-shells/zsh', |
248 |
+ 'app-shells/zsh-completion', |
249 |
+ 'dev-util/strace', |
250 |
+ 'dev-util/vbindiff', |
251 |
+ 'net-analyzer/iptraf-ng', |
252 |
+ 'net-analyzer/netcat6', |
253 |
+ 'net-dns/bind-tools', |
254 |
+ 'net-misc/curl', |
255 |
+ 'net-misc/iputils', |
256 |
+ 'net-misc/dhcp', |
257 |
+ 'net-misc/ntp', |
258 |
+ 'net-misc/openssh', |
259 |
+ 'net-misc/rsync', |
260 |
+ 'net-misc/wget', |
261 |
+ 'net-wireless/rfkill', |
262 |
+ 'sys-apps/kmod', |
263 |
+ 'sys-apps/util-linux', |
264 |
+ 'net-wireless/wpa_supplicant', |
265 |
+ 'sys-apps/coreutils', |
266 |
+ 'sys-apps/diffutils', |
267 |
+ 'sys-apps/ethtool', |
268 |
+ 'sys-apps/findutils', |
269 |
+ 'sys-apps/gawk', |
270 |
+ 'sys-apps/grep', |
271 |
+ 'sys-apps/iproute2', |
272 |
+ 'sys-apps/less', |
273 |
+ 'sys-apps/man', |
274 |
+ 'sys-apps/net-tools', |
275 |
+ 'sys-apps/pciutils', |
276 |
+ 'sys-apps/pv', |
277 |
+ 'sys-apps/sed', |
278 |
+ 'sys-apps/shadow', |
279 |
+ 'sys-apps/smartmontools', |
280 |
+ 'sys-apps/sysvinit', |
281 |
+ 'sys-apps/usbutils', |
282 |
+ 'sys-fs/cryptsetup', |
283 |
+ 'sys-fs/ddrescue', |
284 |
+ 'sys-fs/e2fsprogs', |
285 |
+ 'sys-fs/lvm2', |
286 |
+ 'sys-fs/mdadm', |
287 |
+ 'sys-fs/multipath-tools', |
288 |
+ 'sys-fs/xfsprogs', |
289 |
+ 'sys-libs/gpm', |
290 |
+ 'sys-process/htop', |
291 |
+ 'sys-process/procps', |
292 |
+ 'sys-process/psmisc', |
293 |
+ 'www-client/links', |
294 |
+ 'www-client/w3m', |
295 |
+ ], |
296 |
+ 'hooks': presets['minimal']['hooks'] + [ |
297 |
+ (sed, 'etc/wpa_supplicant/wpa_supplicant.conf', '-i', |
298 |
+ '-e', '/\(psk=\|wep_key\)/s:=.*:="":'), |
299 |
+ (cat, 'root/.histfile', "wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -W -B -i wlan0 -P /var/run/wpa_supplicant-wlan0.pid"), |
300 |
+ ] |
301 |
+} |
302 |
+ |
303 |
+ignorelist=( |
304 |
+ '/var/lock/iptraf-ng', |
305 |
+ '/var/lock/iptraf-ng/.keep_net-analyzer_iptraf-ng-0', |
306 |
+ '/var/run/wpa_supplicant', |
307 |
+ '/var/run/wpa_supplicant/.keep_net-wireless_wpa_supplicant-0' |
308 |
+) |
309 |
+ |
310 |
+ |
311 |
+def which(fn): |
312 |
+ for path in os.get_exec_path(): |
313 |
+ if os.path.exists(os.path.join(path, fn)): |
314 |
+ return os.path.join(path, fn) |
315 |
+ |
316 |
+def list_kernels(pwd='/boot'): |
317 |
+ kernels = list(set(map(os.path.realpath, |
318 |
+ map(lambda f: os.path.join(pwd, f), |
319 |
+ filter(lambda f: f.startswith('vmlinu'), os.listdir(pwd)))))) |
320 |
+ return list(map(lambda k: k[1], sorted( |
321 |
+ map(lambda f: (os.lstat(f).st_mtime, f), kernels)))) |
322 |
+ |
323 |
+class ClosedSystem(list): |
324 |
+ SHEBANG_MATCHER=re.compile('^\s*#\s*!\s*([^\s]*)\s*([^\s]*)') |
325 |
+ def __init__(self): |
326 |
+ list.__init__(self) |
327 |
+ self.interpreter = set() |
328 |
+ |
329 |
+ def isElf(fn): |
330 |
+ return open(fn, 'rb').read(5) in (b'\x7fELF\x01', b'\x7fELF\x02') |
331 |
+ |
332 |
+ def needed(fn): |
333 |
+ return filter(None, subprocess.Popen( |
334 |
+ ['scanelf', '-L', '-n', '-q', '-F', '%n #F', fn], |
335 |
+ stdout=subprocess.PIPE |
336 |
+ ).stdout.read().decode("UTF-8").strip().split(',')) |
337 |
+ |
338 |
+ def shebang(fn): |
339 |
+ match=ClosedSystem.SHEBANG_MATCHER.match( |
340 |
+ open(fn, 'rb').read(1000).decode('UTF-8')) |
341 |
+ if not match: |
342 |
+ return () |
343 |
+ if match.group(1) == '/usr/bin/env': |
344 |
+ return '/usr/bin/env', which(match.group(2)) |
345 |
+ return match.group(1), |
346 |
+ |
347 |
+ def append(self, fn): |
348 |
+ if not fn or fn in self: |
349 |
+ return |
350 |
+ if not os.path.isabs(fn): |
351 |
+ self.append(which(fn)) |
352 |
+ return |
353 |
+ if not os.path.exists(fn): |
354 |
+ if fn in ignorelist: |
355 |
+ print('ignore missing ' + fn) |
356 |
+ return |
357 |
+ fns = glob.glob(fn) |
358 |
+ if not fns: |
359 |
+ raise BaseException('file does not exist ' + fn) |
360 |
+ [self.append(fn) for fn in fns] |
361 |
+ return |
362 |
+ |
363 |
+ d, b = os.path.split(fn) |
364 |
+ if b: |
365 |
+ self.append(d) |
366 |
+ fn = os.path.join(os.path.realpath(d), b) |
367 |
+ |
368 |
+ list.append(self, fn) |
369 |
+ if os.path.isdir(fn): |
370 |
+ pass |
371 |
+ elif os.path.islink(fn): |
372 |
+ self.append(os.path.join(os.path.dirname(fn), os.readlink(fn))) |
373 |
+ elif os.path.isfile(fn): |
374 |
+ if ClosedSystem.isElf(fn): |
375 |
+ [self.append(so) for so in ClosedSystem.needed(fn)] |
376 |
+ else: |
377 |
+ if os.stat(fn).st_mode & 0o111: |
378 |
+ interpreter=ClosedSystem.shebang(fn) |
379 |
+ if not len(interpreter): |
380 |
+ print('unable to handle executeable %s' % fn) |
381 |
+ else: |
382 |
+ [self.interpreter.add(i) for i in interpreter] |
383 |
+ else: |
384 |
+ BaseException('unable to handle %s' % fn) |
385 |
+ |
386 |
+if __name__ == '__main__': |
387 |
+ kernels = list_kernels() |
388 |
+ def kernel_version(kernel): |
389 |
+ return os.path.split(os.path.realpath(kernel))[1].split('-', 1)[1] |
390 |
+ def modules_dir(kernel_version): |
391 |
+ return os.path.join('/lib/modules', kernel_version) |
392 |
+ |
393 |
+ parser = argparse.ArgumentParser(description='arch testing', |
394 |
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter) |
395 |
+ parser.add_argument('--preset', default='full', |
396 |
+ choices=presets.keys(), |
397 |
+ help="select file set") |
398 |
+ parser.add_argument('--kernel', default=kernels[-1], |
399 |
+ help="select kernel filename") |
400 |
+ parser.add_argument('--initrd', default='', |
401 |
+ help="select initrd filename") |
402 |
+ parser.add_argument('--chroot', action='store_true', |
403 |
+ help="chroot into target") |
404 |
+ parser.add_argument('--force', action='store_true', |
405 |
+ help="overwrite destination") |
406 |
+ parser.add_argument('--keep', action='store_true', |
407 |
+ help="keep tempdir") |
408 |
+ parser.add_argument('--compressor', default='lzop -9', |
409 |
+ help="kernel compartible initrd compressor (cat,gzip,lzop,bzip2,xz)") |
410 |
+ args = parser.parse_args() |
411 |
+ |
412 |
+ if not os.path.exists(args.kernel): |
413 |
+ print('kernel file %s not found in %s' % \ |
414 |
+ (args.kernel, list_kernels())) |
415 |
+ sys.exit(1) |
416 |
+ if not args.preset in presets.keys(): |
417 |
+ print('preset %s not found in %s' % \ |
418 |
+ (args.preset, sorted(presets.keys()))) |
419 |
+ sys.exit(1) |
420 |
+ args.initrd = args.initrd or ( |
421 |
+ '/boot/initrd.img-' + kernel_version(args.kernel)) |
422 |
+ if not args.force and os.path.exists(args.initrd): |
423 |
+ print('initrd %s already exists' % args.initrd) |
424 |
+ sys.exit(1) |
425 |
+ |
426 |
+ |
427 |
+ print("building preset %s for kernel %s" % (args.preset, args.kernel)) |
428 |
+ print("Target %s" % args.initrd) |
429 |
+ |
430 |
+ system = ClosedSystem() |
431 |
+ |
432 |
+ |
433 |
+ for path, directories, files in os.walk( |
434 |
+ modules_dir(kernel_version(args.kernel))): |
435 |
+ system.append(path) |
436 |
+ [system.append(os.path.join(path, fn)) for fn in files] |
437 |
+ |
438 |
+ [system.append(fn) for fn in presets[args.preset].get('objs', [])] |
439 |
+ |
440 |
+ pkgs = set() |
441 |
+ vartree = portage.db[portage.root]['vartree'] |
442 |
+ missing=[] |
443 |
+ for atom in presets[args.preset].get('pkgs', []): |
444 |
+ cand = vartree.dbapi.match(atom) |
445 |
+ if not cand: |
446 |
+ missing.append(atom) |
447 |
+ else: |
448 |
+ [pkgs.add(c) for c in cand] |
449 |
+ if missing: |
450 |
+ print('package not installed/found: ' + ' '.join(missing)) |
451 |
+ sys.exit(1) |
452 |
+ for cpv in sorted(pkgs): |
453 |
+ link = portage.dblink(cpv.cpv_split[0], '-'.join(cpv.cpv_split[1:]), |
454 |
+ treetype='vartree', vartree=vartree, settings=portage.settings) |
455 |
+ [system.append(os.path.normpath(fn)) for fn in sorted(link.getcontents())] |
456 |
+ |
457 |
+ system.interpreter.difference(set('/usr/bin/python3')) |
458 |
+ print("list of interpreters %s" % sorted(system.interpreter)) |
459 |
+ [system.append(fn) for fn in sorted(system.interpreter)] |
460 |
+ |
461 |
+ tmpdir = tempfile.mkdtemp(prefix='/tmp/mkinitrd.py-') |
462 |
+ os.chdir(tmpdir) |
463 |
+ print('copy %i files to %s' % (len(system), tmpdir)) |
464 |
+ p1 = subprocess.Popen(['tar', 'cC', '/', '--no-recursion'] + system, |
465 |
+ stdout=subprocess.PIPE) |
466 |
+ p2 = subprocess.Popen(['tar', 'xC', tmpdir], stdin=p1.stdout) |
467 |
+ p2.communicate() |
468 |
+ |
469 |
+ print('hooks') |
470 |
+ for hook in presets[args.preset].get('hooks', []): |
471 |
+ print(hook[0]) |
472 |
+ hook[0](*hook[1:]) |
473 |
+ |
474 |
+ if args.chroot: |
475 |
+ os.system('chroot .') |
476 |
+ |
477 |
+ print('compress') |
478 |
+ os.system('find . -print0 | sort | cpio --null -o --format=newc | pv -s $(du -s . | cut -f 1)k | %s > %s' % (args.compressor, args.initrd)) |
479 |
+ if not args.keep: |
480 |
+ os.chdir('..') |
481 |
+ print('remove ' + tmpdir) |
482 |
+ os.system('rm -r ' + tmpdir) |
483 |
+ else: |
484 |
+ print('keep ' + tmpdir) |
485 |
+ |
486 |
|
487 |
diff --git a/sys-kernel/mkinitrd/metadata.xml b/sys-kernel/mkinitrd/metadata.xml |
488 |
new file mode 100644 |
489 |
index 0000000..5b80fb9 |
490 |
--- /dev/null |
491 |
+++ b/sys-kernel/mkinitrd/metadata.xml |
492 |
@@ -0,0 +1,8 @@ |
493 |
+<?xml version="1.0" encoding="UTF-8"?> |
494 |
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
495 |
+<pkgmetadata> |
496 |
+<maintainer> |
497 |
+<email>xmw@g.o</email> |
498 |
+<name>Michael Weber</name> |
499 |
+</maintainer> |
500 |
+</pkgmetadata> |
501 |
|
502 |
diff --git a/sys-kernel/mkinitrd/mkinitrd-0_p20131207.ebuild b/sys-kernel/mkinitrd/mkinitrd-0_p20131207.ebuild |
503 |
new file mode 100644 |
504 |
index 0000000..a1df5b2 |
505 |
--- /dev/null |
506 |
+++ b/sys-kernel/mkinitrd/mkinitrd-0_p20131207.ebuild |
507 |
@@ -0,0 +1,80 @@ |
508 |
+# Copyright 1999-2013 Gentoo Foundation |
509 |
+# Distributed under the terms of the GNU General Public License v2 |
510 |
+# $Header: $ |
511 |
+ |
512 |
+EAPI=5 |
513 |
+ |
514 |
+DESCRIPTION="Create initrd using python" |
515 |
+HOMEPAGE="http://xmw.de" |
516 |
+ |
517 |
+LICENSE="GPL-2" |
518 |
+SLOT="0" |
519 |
+KEYWORDS="~amd64" |
520 |
+IUSE="-minimal" |
521 |
+ |
522 |
+DEPEND="" |
523 |
+RDEPEND=" |
524 |
+ sys-apps/sed |
525 |
+ !minimal? ( |
526 |
+ app-arch/cpio |
527 |
+ app-arch/pbzip2 |
528 |
+ app-arch/tar |
529 |
+ app-cdr/cdrtools |
530 |
+ app-editors/nano |
531 |
+ app-misc/pax-utils |
532 |
+ app-misc/screen |
533 |
+ app-shells/zsh |
534 |
+ app-shells/zsh-completion |
535 |
+ dev-util/strace |
536 |
+ dev-util/vbindiff |
537 |
+ net-analyzer/iptraf-ng |
538 |
+ net-analyzer/netcat6 |
539 |
+ net-dns/bind-tools |
540 |
+ net-misc/curl |
541 |
+ net-misc/iputils |
542 |
+ net-misc/dhcp |
543 |
+ net-misc/ntp |
544 |
+ net-misc/openssh |
545 |
+ net-misc/rsync |
546 |
+ net-misc/wget |
547 |
+ net-wireless/rfkill |
548 |
+ sys-apps/kmod |
549 |
+ sys-apps/util-linux |
550 |
+ net-wireless/wpa_supplicant |
551 |
+ sys-apps/coreutils |
552 |
+ sys-apps/diffutils |
553 |
+ sys-apps/ethtool |
554 |
+ sys-apps/findutils |
555 |
+ sys-apps/gawk |
556 |
+ sys-apps/grep |
557 |
+ sys-apps/iproute2 |
558 |
+ sys-apps/less |
559 |
+ sys-apps/man |
560 |
+ sys-apps/net-tools |
561 |
+ sys-apps/pciutils |
562 |
+ sys-apps/pv |
563 |
+ sys-apps/sed |
564 |
+ sys-apps/shadow |
565 |
+ sys-apps/smartmontools |
566 |
+ sys-apps/sysvinit |
567 |
+ sys-apps/usbutils |
568 |
+ sys-fs/cryptsetup |
569 |
+ sys-fs/ddrescue |
570 |
+ sys-fs/e2fsprogs |
571 |
+ sys-fs/lvm2 |
572 |
+ sys-fs/mdadm |
573 |
+ sys-fs/multipath-tools |
574 |
+ sys-fs/xfsprogs |
575 |
+ sys-libs/gpm |
576 |
+ sys-process/htop |
577 |
+ sys-process/procps |
578 |
+ sys-process/psmisc |
579 |
+ www-client/links |
580 |
+ www-client/w3m |
581 |
+ )" |
582 |
+ |
583 |
+S=${WORKDIR} |
584 |
+ |
585 |
+src_install() { |
586 |
+ newsbin "${FILESDIR}"/${P} ${PN}.py |
587 |
+} |