前回のxorrisoの簡単な使い方に続き、
メディアを指定するオプション
xorrisoでは-devオプションで操作するメディアを指定します。このオプションでは"-dev /dev/
"-dev"オプションに存在しないファイルを指定した場合は、
複数の光学ドライブ間で内容をコピーしたり、
たとえば、
ISOイメージへファイルを追加するオプション
前回簡単に触れたように、
ISOイメージに書き出すファイルやディレクトリを指定するために、
以下、
-addオプション
-addオプションに関するmanページの記述は以下の通りです。参考のために私訳を付けておきます。
-add pathspec [...] | disk_path [***] Insert the given files or directory trees from filesystem into the ISO image. If -pathspecs is set to "on" or "as_mkisofs" then pattern expansion is always disabled and character '=' has a special meaning. It separates the ISO image path from the disk path: iso_rr_path=disk_path
指定されたファイルやディレクトリツリーをファイルシステムからISOイメージに書き出す。-pathspecsオプションに"on"か"as_
-addオプションは、
手元のNHKフォルダに
$ ls -l NHK 合計 251,658,240 -rw-r--r--+ 1 kojima users 5,485,197 6月 12日 11:10 ラジオ英会話_2017_04_001.m4a -rw-r--r--+ 1 kojima users 5,485,197 6月 12日 11:10 ラジオ英会話_2017_04_002.m4a -rw-r--r--+ 1 kojima users 5,485,449 6月 12日 11:10 ラジオ英会話_2017_04_003.m4a ...
これらのファイルをISOイメージ上の"ラジオ英会話"ディレクトリに書き出したい場合、
$ xorriso -dev disc01.iso -pathspecs on -add ラジオ英会話=NHK GNU xorriso 1.4.6 : RockRidge filesystem manipulator, libburnia project. Drive current: -dev 'disc01.iso' Media current: stdio file, overwriteable Media status : is blank Media summary: 0 sessions, 0 data blocks, 0 data, 122g free Added to ISO image: directory '/ラジオ英会話'='/home/kojima/NHK' xorriso : UPDATE : 21 files added in 1 seconds xorriso : UPDATE : Writing: 5488s 10.2% fifo 0% buf 50% ...
"iso_
$ xorriso -dev disc01.iso -pathspecs on \ -add episode01.m4a=NHK/ラジオ英会話_2017_04_001.m4a \ episode02.m4a=NHK/ラジオ英会話_2017_04_002.m4a \ episode03.m4a=NHK/ラジオ英会話_2017_04_003.m4a GNU xorriso 1.4.6 : RockRidge filesystem manipulator, libburnia project. xorriso : NOTE : Loading ISO image tree from LBA 0 xorriso : UPDATE : 41 nodes read in 1 seconds Drive current: -dev 'disc01.iso' Media current: stdio file, overwriteable Media status : is written , is appendable Media summary: 1 session, 107186 data blocks, 209m data, 122g free Volume id : 'ISOIMAGE' Added to ISO image: file '/episode01.m4a'='/home/kojima/NHK/ラジオ英会話_2017_04_001.m4a' Added to ISO image: file '/episode02.m4a'='/home/kojima/NHK/ラジオ英会話_2017_04_002.m4a' ...
書き出したISOイメージの内容を確認するには、
$ xorriso -dev disc01.iso -find GNU xorriso 1.4.6 : RockRidge filesystem manipulator, libburnia project. xorriso : NOTE : Loading ISO image tree from LBA 0 ... '.' './episode01.m4a' './episode02.m4a' './episode03.m4a' './ラジオ英会話' './ラジオ英会話/ラジオ英会話_2017_04_001.m4a' './ラジオ英会話/ラジオ英会話_2017_04_002.m4a' ...
-cprオプション
-cprはシェルから使える"cp -r"と同様の機能を持ったオプションです。このオプションのmanページの記述は以下の通りです。
-cpr disk_path [***] iso_rr_path Insert the given files or directory trees from filesystem into the ISO image. The rules for generating the ISO addresses are similar as with shell command cp -r. Nevertheless, directories of the iso_rr_path are created if necessary. Especially a not yet existing iso_rr_path will be handled as directory if multiple disk_paths are present. The leafnames of the multiple disk_paths will be grafted under that directory as would be done with an existing directory. If a single disk_path is present then a non-existing iso_rr_path will get the same type as the disk_path.
ファイルシステム上にある指定したファイルやディレクトリツリーをISOイメージに書き出す。ISOイメージ上のファイル名生成ルールはシェルコマンドのcp -rと同様だが、
-cprオプションを使えば、
このオプションを使えば、
$ xorisso -dev disc02.iso -disk_pattern on \ -cpr NHK/ラジオ英会話_2017_04* 2017_04 -- \ -cpr NHK/ラジオ英会話_2017_05* 2017_05 -- \ ... Added to ISO image: file '/2017_04/ラジオ英会話_2017_04_001.m4a'='/home/kojima/NHK/ラジオ英会話_2017_04_001.m4a' Added to ISO image: file '/2017_04/ラジオ英会話_2017_04_002.m4a'='/home/kojima/NHK/ラジオ英会話_2017_04_002.m4a' ... Added to ISO image: file '/2017_05/ラジオ英会話_2017_05_001.m4a'='/home/kojima/NHK/ラジオ英会話_2017_05_001.m4a' Added to ISO image: file '/2017_05/ラジオ英会話_2017_05_002.m4a'='/home/kojima/NHK/ラジオ英会話_2017_05_002.m4a' ...
-mapオプション
"-add"オプションのiso_
-map disk_path iso_rr_path Insert file object disk_path into the ISO image as iso_rr_path. If disk_path is a directory then its whole sub tree is inserted into the ISO image.
disk_
-addオプションの場合は"iso_
たいてい"-map"で間に合うので使う機会は少ないものの、
-map_single disk_path iso_rr_path Like -map, but if disk_path is a directory then its sub tree is not inserted.
-map と似た動作だが、
先に紹介したファイル名を変更して書き出す例は、
$ xorriso -dev disc03.iso \ -map NHK/ラジオ英会話_2017_04_001.m4a episode01.m4a \ -map NHK/ラジオ英会話_2017_04_002.m4a episode02.m4a \ -map NHK/ラジオ英会話_2017_04_003.m4a episode03.m4a
"-map"オプションの場合、
-map_l disk_prefix iso_rr_prefix disk_path Perform -map with each of the disk_path parameters. iso_rr_path will be composed from disk_path by replacing disk_prefix by iso_rr_prefix.
-mapをdisk_
このオプションを使って、
$ xorriso -dev disc03.iso -disk_pattern on \ -map_l NHK/ラジオ英会話_2017_04_0 episode_ NHK/ラジオ英会話_2017_04*.m4a -- ... Drive current: -dev 'disc03.iso' Media current: stdio file, overwriteable Added to ISO image: file '/episode_01.m4a'='/home/kojima/NHK/ラジオ英会話_2017_04_001.m4a' Added to ISO image: file '/episode_02.m4a'='/home/kojima/NHK/ラジオ英会話_2017_04_002.m4a' Added to ISO image: file '/episode_03.m4a'='/home/kojima/NHK/ラジオ英会話_2017_04_003.m4a' ...
この例では、
-map_
$ xorriso -dev disc03.iso -disk_pattern on \ -map_l NHK/ラジオ英会話_2017_04_0 2017_04/episode_ NHK/ラジオ英会話_2017_04*.m4a -- \ -map_l NHK/ラジオ英会話_2017_05_0 2017_05/episode_ NHK/ラジオ英会話_2017_05*.m4a -- ... xorriso : UPDATE : 20 nodes read in 1 seconds Drive current: -dev 'disc03.iso' Added to ISO image: file '/2017_04/episode_01.m4a'='/home/kojima/NHK/ラジオ英会話_2017_04_001.m4a' Added to ISO image: file '/2017_04/episode_02.m4a'='/home/kojima/NHK/ラジオ英会話_2017_04_002.m4a' ... Added to ISO image: file '/2017_05/episode_01.m4a'='/home/kojima/NHK/ラジオ英会話_2017_05_001.m4a' Added to ISO image: file '/2017_05/episode_02.m4a'='/home/kojima/NHK/ラジオ英会話_2017_05_002.m4a' ...
ISOイメージ内のファイルを操作するオプション
xorrisoでは、
ファイルやディレクトリを削除する-rm、
ここに示したオプションは、
注意しなければいけないのは、
ネット経由でISOイメージを配布する際のように、
その際は-indevに古いISOイメージ、
この問題を回避するためには、
$ xorriso -indev old_disc.iso -outdev new_disc.iso -alter_date a +0 / --
この処理は作成済みのISOイメージを光学メディアに書き出す際にも必要で、
一方、
今回、
本連載が紹介するのはそのうちのごく一部の機能だけなので、