Linux
如何從其掛載的映像中重建 ISO 刪除文件?
我建構了一個 ISO,其中包含例如:
Directory listing of / d--------- 0 0 0 2048 Mar 19 2015 [ 29 02] . d--------- 0 0 0 2048 Mar 19 2015 [ 29 02] .. d--------- 0 0 0 4096 Mar 19 2015 [ 32 02] target-rpms d--------- 0 0 0 2048 Mar 19 2015 [ 34 02] vat Directory listing of /target-rpms/ d--------- 0 0 0 4096 Mar 19 2015 [ 32 02] . d--------- 0 0 0 2048 Mar 19 2015 [ 29 02] .. ---------- 0 0 0 32435902 Mar 18 2015 [ 85 00] file1.rpm ---------- 0 0 0 2055833 Mar 18 2015 [ 15923 00] file2.rpm Directory listing of /vat/ d--------- 0 0 0 2048 Mar 19 2015 [ 44 02] . d--------- 0 0 0 2048 Mar 19 2015 [ 29 02] .. ---------- 0 0 0 0 Apr 20 2015 [ 56633 00] file1.txt
我想從 ISO 掛載的映像中添加/刪除文件,所以我做了:
sudo mount -o loop,ro /full/path/to/file.iso /mounted/path
為了添加文件,我找到了這個方法:
mkdir /path/where/put/addedFile/vat/ cp prova.txt /path/where/put/addedFile/vat/prova.txt mkisofs -o /tmp/test.iso -A test-1.0 -copyright 'Test' -joliet-long -RU -uid 0 -gid 0 -iso-level 4 /mounted/path /path/where/put/addedFile
可行,
mkisofs
將文件合併到目錄中並test.iso
包含所有所需的文件。我需要一些關於如何在沒有的情況下創建的幫助
test.iso
,例如target-rpms/file2.rpm
.我知道我可以使用以下程序來做到這一點:
mkdir /path/where/rebuildIso cp -R /mounted/path /path/where/rebuildIso rm /path/where/rebuildIso/target-rpms/file2.rpm mkisofs -o /tmp/test.iso -A test-1.0 -copyright 'Test' -joliet-long -RU -uid 0 -gid 0 -iso-level 4 /path/where/rebuildIso
但是,由於 iso 維度,我想避免
cp
命令。我在 Red Hat Enterprise Linux AS 第 3 版(Taroon Update 2)上使用 mkisofs 2.01 (i686-pc-linux-gnu)
事實上 mkisofs 2.01 指向 genisoimage:
$ mkisofs --version mkisofs 2.01 is not what you see here. This line is only a fake for too clever GUIs and other frontend applications. In fact, this program is: genisoimage 1.1.11 (Linux)
您
man genisoimage
可以嘗試以下-m
選項:-m glob Exclude files matching glob, a shell wildcard pattern, from being written to CD-ROM. glob may match either the filename component or the full pathname. This option may be used multiple times. For example: genisoimage -o rom -m '*.o' -m core -m foobar would exclude all files ending in `.o', or called core or foobar from the image. Note that if you had a directory called foobar, it too (and of course all its descendants) would be excluded. -exclude-list file A file containing a list of shell wildcards to be excluded. See -m.