个人工具
登录
查看“定制Ubuntu安装CD”的源代码 - Ubuntu中文
页面
讨论
查看源代码
历史
搜索
导航
首页
最近更改
随机页面
页面分类
帮助
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息
查看“定制Ubuntu安装CD”的源代码
来自Ubuntu中文
←
定制Ubuntu安装CD
跳转至:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
=== 修改pool目录,增加或删除软件包 === 也许制定您自己的安装CD的主要原因是想改变所安装软件包;特别是您想增加一些包到CD里。这有好几个方法来做到,不需要完全地理解。最容易的事情是建立一个最小的仓库放您想要增加的包,再在制作光盘镜像文件之前合并到光盘文件体系里。这儿棘手的地方是:制作让Debian软件包管理系统知道这个仓库的相关文件;写一个更高版本的Release文件;并签上 GPG 。下面是我所做的。 *. 选定一个文件目录作为您的工作空间;在这个目录里, <pre><nowiki> mkdir -p dists/breezy/extras/binary-i386 pool/extras/ isolinux preseed </nowiki></pre> 把您修改过的isolinux.cfg放在目录isolinux/,把您的preseed文件放在目录preseed里。 Put your modified isolinux.cfg in isolinux/, and your preseed file in preseed/. *. 把您需要的所有额外的包放在目录 pool/extras/ 里。您还需要包括一个新版本的 ubuntu-keyring 包,我将马上解释一下 *. 创建并编辑文件dists/breezy/extras/binary-i386/Release,写入下面的内容: <pre><nowiki> Archive: breezy Version: 5.10 Component: extras Origin: Ubuntu Label: Ubuntu Architecture: i386 </nowiki></pre> *. 把您做的修改这样合并到CD里: a. 挂载您下载的官方ISO文件:<code><nowiki>mount /path/to/iso /some/mountpoint/ -o loop</nowiki></code> b. 把光盘里的全部文件拷贝到某个目录(您会需要1到2G的空间);我用rsync:<code><nowiki>sudo rsync -azvb --delete --backup-dir=/yeowe/usr/cdbuilder/old/ $MOUNT $BUILD</nowiki></code> ( 这儿的 $MOUNT 是挂载点,$BUILD 是额外的包的目录) c. '''最重要的地方'''. 我们将用apt-ftparchive工具来产生软件包相关和更高版本的Release文件。我们还要用GPG来签这个Release文件。安装程序会用包ubuntu-keyring 的公匙来检测签名。但是您的签名不一样。所以您得建立一个新版本的 ubuntu-keyring 包。这做起来很容易,但是要确保正确无误。下面是执行的命令: <pre><nowiki> apt-get source ubuntu-keyring cd ubuntu-keyring--2005.01.11/keyring gpg --import < ubuntu-archive-keyring.gpg gpg --list-keys "Your Name" gpg --export FBB75451 437D05B5 YOURKEYID > ubuntu-archive-keyring.gpg cd .. dpkg-buildpackage -rfakeroot -m"Your Name <your.email@your.host> -k"Your Name <your.email@your.host>" cp ubuntu-keyring*deb $BUILD/pool/extras/ </nowiki></pre> 我们在这里所做的是将2 个ubuntu密钥导入到你的主密钥环,然后将他们一起输出到密钥环来代替你自己的密钥。当你做出如上命令时gpg会告诉你“你的密钥身份”应改为8位的十六进制代码。事实上最好的方法是应该在每次做之前,都复制每一个版本到你的“$阶段”文件结构路径下,让你有永久可行的操作。 OK -- what we've done here is import the 2 Ubuntu keys into your main keyring, then exported them along with your own key into a replacement keyring. "YOURKEYID" should be replaced with the 8-digit hexadecimal code that gpg tells you when you do the --list-keys command above. And really, the best policy would be to do all that first, and copy a version into your $STAGE file structure so that you have it permanently available. Note: If you do not have an existing gpg signing key, use the following code: <pre><nowiki> gpg --gen-key </nowiki></pre> Accept all defaults, select "No expiry", and enter an appropriate passphrase. In order to use apt-ftparchive, we will need to provide it with some defaults. Create the files "apt-ftparchive-deb.conf, "apt-ftparchive-udeb.conf", and "apt-ftparchive-extras.conf" as follows (substitude $BUILD for the absolute path to your BUILD directory, and /path/to/indices to the location of the indices files, which you can download from http://archive.ubuntu.com/ubuntu/indices/ ): <pre><nowiki> apt-ftparchive-deb.conf: Dir { ArchiveDir "$BUILD"; }; TreeDefault { Directory "pool/"; }; BinDirectory "pool/main" { Packages "dists/breezy/main/binary-i386/Packages"; BinOverride "/path/to/indices/override.breezy.main"; ExtraOverride "path/to/indices/override.breezy.extra.main"; }; Default { Packages { Extensions ".deb"; Compress ". gzip"; }; }; Contents { Compress "gzip"; }; </nowiki></pre> <pre><nowiki> apt-ftparchive-udeb.conf: Dir { ArchiveDir "$BUILD"; }; TreeDefault { Directory "pool/"; }; BinDirectory "pool/main" { Packages "dists/breezy/main/debian-installer/binary-i386/Packages"; BinOverride "/path/to/indices/override.breezy.main.debian-installer"; }; Default { Packages { Extensions ".udeb"; Compress ". gzip"; }; }; Contents { Compress "gzip"; }; </nowiki></pre> <pre><nowiki> apt-ftparchive-extras.conf: Dir { ArchiveDir "$BUILD"; }; TreeDefault { Directory "pool/"; }; BinDirectory "pool/extras" { Packages "dists/breezy/extras/binary-i386/Packages"; }; Default { Packages { Extensions ".deb"; Compress ". gzip"; }; }; Contents { Compress "gzip"; }; </nowiki></pre> *. 现在就用apt-ftparchive来创建Packages和Release文件: <pre><nowiki> cd $BUILD sudo apt-ftparchive -c $APTCONF generate /path/to/apt-ftparchive-deb.conf sudo apt-ftparchive -c $APTCONF generate /path/to/apt-ftparchive-udeb.conf sudo apt-ftparchive -c $APTCONF generate /path/to/apt-ftparchive-extras.conf </nowiki></pre> $APTCONF is a file somewhere that looks about like this: <pre><nowiki>APT::FTPArchive::Release::Origin "Ubuntu"; APT::FTPArchive::Release::Label "Ubuntu"; APT::FTPArchive::Release::Suite "breezy"; APT::FTPArchive::Release::Version "5.10"; APT::FTPArchive::Release::Codename "breezy"; APT::FTPArchive::Release::Architectures "i386"; APT::FTPArchive::Release::Components "main restricted extras"; APT::FTPArchive::Release::Description "Ubuntu Breezy"; </nowiki></pre> a. 给Release文件签gpg:<pre><nowiki> sudo gpg --default-key "MY GPG KEY ID" --output $BUILD/dists/breezy/Release.gpg -ba $BUILD/dists/breezy/Release </nowiki></pre> *. Regenerate the md5 checksums:<pre><nowiki> cd $BUILD find . -type f -print0 | xargs -0 md5sum > md5sum.txt </nowiki></pre> *. 现在可以来生成光盘镜像文件: <pre><nowiki> sudo mkisofs -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -hide-rr-moved -o $IMAGE -R $BUILD/ </nowiki></pre> ‘$IMAGE’表示您的光盘镜像文件. *. 最后,可以用cdrecord或其它刻录工具来刻录您的CD了: <pre><nowiki> sudo nice -18 cdrecord dev=ATA:1,1,0 speed=12 --blank=fast -v -gracetime=2 -tao $IMAGE </nowiki></pre> that will burn the image on the second cd drive; if your cd-burner is the first or only cd-drive, change dev argument to ATA``:1,0,0. I '''strongly''' recommend using rewritable media -- I've burned a LOT of coasters on this project. 好了,搞定! 如果谁感兴趣,我写了一个小脚本(很简单)来自动完成这个步骤。我想我正好可以放在这儿 <pre><nowiki> ORIG="/var/www/jigdo/$1-breezy-install-i386.iso" STAGE="/home/matt/LearningExchangeCD/$1/" MOUNT=/mnt/iso/ BUILD="/yeowe/usr/cdbuilder/$1" IMAGE="/yeowe/usr/cdbuilder/$1-learningexchange.iso" APTCONF=/home/matt/LearningExchangeCD/apt.conf sudo umount $MOUNT sudo mount $ORIG $MOUNT -o loop sudo rsync -azvb --delete $MOUNT $BUILD sudo rm -r $BUILD/pool/u/ubuntu-keyring/ sudo rsync -avzb --exclude='*~' --exclude='INSTRUCTIONS.txt' --backup-dir=/yeowe/usr/cdbuilder/old/ --exclude='example-preseed.txt' $STAGE $BUILD sudo rm $BUILD/dists/breezy/Release* for component in main extras; do sudo apt-ftparchive packages "$BUILD/pool/$component/" > "$BUILD/dists/breezy/$component/binary-i386/Packages" gzip -c "$BUILD/dists/breezy/$component/binary-i386/Packages" | \ sudo tee "$BUILD/dists/breezy/$component/binary-i386/Packages.gz" > /dev/null done sudo apt-ftparchive -c $APTCONF release $BUILD/dists/breezy > $BUILD/dists/breezy/Release sudo gpg --output $BUILD/dists/breezy/Release.gpg -ba $BUILD/dists/breezy/Release sudo chown -R root:root $BUILD/isolinux $BUILD/preseed sudo mkisofs -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -hide-rr-moved -o $IMAGE -R $BUILD/ sudo nice -18 cdrecord dev=ATA:1,1,0 speed=12 --blank=fast -v -gracetime=2 -tao $IMAGE </nowiki></pre> [[category:CategoryDocumentation]] [[category:CategoryCleanup]] [[category:UbuntuHelp]]
返回至
定制Ubuntu安装CD
。