LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1176|回复: 6

求助:定制Debian的安装CD出错

[复制链接]
发表于 2009-6-1 10:00:08 | 显示全部楼层 |阅读模式
我的大体步骤是参考如下:
http://www.linuxsir.cn/bbs/thread295282.html

由于我想定制lenny,所以修改了一下脚本
  1. #!/bin/bash
  2. # Step 0 : install tools needed
  3. apt-get update
  4. #apt-get install --yes mkisofs debootstrap unionfs-modules-`uname -r`
  5. apt-get install --yes mkisofs debootstrap unionfs-fuse
  6. # Step 1 : make directory
  7. export workdir=/tmp/cdiso1
  8. mkdir -p $workdir/{roiso,rwiso,newiso,scripts,bootstrap}
  9. # Step 2 : download the d-i image and make it(iso) writable with unionfs
  10. cd $workdir
  11. #cp ~/iso/debian-501-i386-netinst.iso .
  12. mount -o loop ~/iso/debian-501-i386-netinst.iso $workdir/roiso
  13. mount -t unionfs -o dirs=$workdir/rwiso=rw:$workdir/roiso/=ro unionfs $workdir/newiso
  14. # Step 3a : download the indices file ( to update the pool)
  15. cd $workdir/scripts/
  16. #wget [url]http://debian.linux.org.tw/debian/indices/override.etch.contrib.gz[/url]
  17. #wget [url]http://debian.linux.org.tw/debian/indices/override.etch.contrib.src.gz[/url]
  18. #wget [url]http://debian.linux.org.tw/debian/indices/override.etch.extra.contrib.gz[/url]
  19. #wget [url]http://debian.linux.org.tw/debian/indices/override.etch.extra.main.gz[/url]
  20. #wget [url]http://debian.linux.org.tw/debian/indices/override.etch.extra.non-free.gz[/url]
  21. #wget [url]http://debian.linux.org.tw/debian/indices/override.etch.main.debian-installer.gz[/url]
  22. #wget [url]http://debian.linux.org.tw/debian/indices/override.etch.main.gz[/url]
  23. #wget [url]http://debian.linux.org.tw/debian/indices/override.etch.main.src.gz[/url]
  24. #wget [url]http://debian.linux.org.tw/debian/indices/override.etch.non-free.gz[/url]
  25. #wget [url]http://debian.linux.org.tw/debian/indices/override.etch.non-free.src.gz[/url]
  26. cp ~/iso/debianoverride/* .
  27. gunzip *.gz
  28. # Step 3b : create the configration for the apt-ftparchive
  29. cd $workdir/scripts/
  30. cp ~/iso/apt.conf .
  31. cp ~/iso/config_binary .
  32. cp ~/iso/config_installer .
  33. # Step 4 : build the bootstrap and download the extra package
  34. #          move the downloaded deb to the d-i ISO 's pool
  35. cd $workdir
  36. #debootstrap etch $workdir/bootstrap [url]http://debian.linux.org.tw/debian/[/url]
  37. debootstrap lenny $workdir/bootstrap [url]http://211.86.156.210:80/debian/[/url]
  38. chroot $workdir/bootstrap apt-get update
  39. chroot $workdir/bootstrap apt-get -y install apt-move
  40. chroot $workdir/bootstrap apt-get clean
  41. chroot $workdir/bootstrap apt-get -y install --download-only eject file sudo vim-tiny console-common kbd locales gdm xfce4 desktop-base x-window-system-core xresprobe
  42. chroot $workdir/bootstrap apt-move update
  43. cp -a $workdir/bootstrap/mirrors/debian/pool $workdir/newiso/
  44. chroot $workdir/bootstrap apt-get clean
  45. # Step 5 : update Release file and indices
  46. cd $workdir/newiso
  47. apt-ftparchive -c $workdir/scripts/apt.conf generate $workdir/scripts/config_installer
  48. apt-ftparchive -c $workdir/scripts/apt.conf generate $workdir/scripts/config_binary
  49. apt-ftparchive -c $workdir/scripts/apt.conf release dists/lenny > ./dists/lenny/Release
  50. # Step 6a : create the preseed.cfg to auto-install the extra packages
  51. cd $workdir/newiso/.disk/
  52. cp ~/iso/preseed.cfg .
  53. # Step 6b : append the boot parameter to include the preseed.cfg
  54. cd $workdir/newiso/isolinux
  55. #sed isolinux.cfg to append : preseed/file=/cdrom/preseed.cfg
  56. cp isolinux.cfg isolinux.cfg.org
  57. sed -e '15,28s:gz:gz preseed/file=/cdrom/.disk/preseed.cfg:g' isolinux.cfg.org > isolinux.cfg
  58. # Step 7 : create the ISO
  59. cd $workdir
  60. mkisofs -o ./cdiso.iso -r -J -l -no-emul-boot -boot-load-size 4 -boot-info-table -b isolinux/isolinux.bin -c isolinux/boot.cat ./newiso/
  61. # Step 8 : clean
  62. umount $workdir/newiso $workdir/roiso
  63. mv cdi.iso ~/iso/
复制代码

//apt.conf 如下:
  1. APT::FTPArchive::Release::Origin "Debian";
  2. APT::FTPArchive::Release::Label "Debian";
  3. APT::FTPArchive::Release::Suite "stable";
  4. APT::FTPArchive::Release::Version "5.0";
  5. APT::FTPArchive::Release::Codename "lenny";
  6. APT::FTPArchive::Release::Architectures "i386";
  7. APT::FTPArchive::Release::Components "main non-free contrib";
  8. APT::FTPArchive::Release::Description "Debian lenny";
复制代码

//config_installer如下:
  1. Dir {
  2.     ArchiveDir "$workdir/newiso/";
  3.     OverrideDir "$workdir/scripts/";
  4.     CacheDir "$workdir/";
  5. };
  6.             
  7. TreeDefault {
  8.     Directory "pool/";
  9. };
  10.                      
  11. BinDirectory "pool/main" {
  12.     Packages "dists/lenny/main/debian-installer/binary-i386/Packages";
  13.     BinOverride "override.lenny.main";
  14.     ExtraOverride "override.lenny.extra.main";
  15. };
  16.                                     
  17. Default {
  18.     Packages {
  19.         Extensions ".udeb";
  20.         Compress ". gzip"
  21.     };
  22.    Contents {
  23.         Compress "gzip"
  24.    };
  25. };
复制代码
//config_binary如下:
  1. Dir {
  2.     ArchiveDir "$workdir/newiso/";
  3.     OverrideDir "$workdir/scripts/";
  4.     CacheDir "$workdir/";
  5. };
  6. TreeDefault {
  7.     Directory "pool/";
  8. };
  9. BinDirectory "pool/main" {
  10.     Packages "dists/lenny/main/binary-i386/Packages";
  11.     BinOverride "override.lenny.main";
  12.     ExtraOverride "override.lenny.extra.main";
  13. };
  14. BinDirectory "pool/contrib" {
  15.     Packages "dists/lenny/contrib/binary-i386/Packages";
  16.     BinOverride "override.lenny.contrib";
  17.     ExtraOverride "override.lenny.extra.contrib";
  18. };
  19. Default {
  20.     Packages {
  21.         Extensions ".deb";
  22.         Compress ". gzip";
  23.     };
  24. Contents {
  25.          Compress "gzip";
  26.      };
  27. };
复制代码
//preseed.cfg如下:
  1. # Individual additional packages to install
  2. d-i pkgsel/include string eject file sudo vim-tiny console-common kbd locales gdm xfce4 desktop-base x-window-system-core xresprobe
  3. tasksel tasksel/first multiselect standard, xfce-desktop
复制代码


//debianoverride文件夹内容如下:
  1. # ls
  2. override.lenny.contrib.gz         override.lenny.main.gz
  3. override.lenny.contrib.src.gz     override.lenny.main.src.gz
  4. override.lenny.extra.contrib.gz   override.lenny.non-free.gz
  5. override.lenny.extra.main.gz      override.lenny.non-free.src.gz
  6. override.lenny.extra.non-free.gz
复制代码


先请教一个脚本问题:
  1. mount -t unionfs -o dirs=$workdir/rwiso=rw:$workdir/roiso/=ro unionfs $workdir/newiso
复制代码
可以换成如下命令吗?请大牛解释一下上一个命令,谢谢
  1. unionfs-fuse dirs=$workdir/rwiso=rw:$workdir/roiso/=ro $workdir/newiso
复制代码

前面的安装步骤都没有问题,主要是后面出错,提示信息如下:
  1. root@ubuntu:/tmp/cdis/newiso# apt-ftparchive -c ../scripts/apt.conf generate ../scripts/config_installer
  2. E: Unable to open $workdir/scripts/override.lenny.main - fopen (2 No such file or directory)
  3. E: Error processing directory pool/main
  4. Done Packages, Starting contents.
  5. Done. 0B in 0 archives. Took 0s
复制代码
//但是明明有的阿
  1. root@ubuntu:/tmp/cdis/newiso# ls ../scripts/
  2. apt.conf                      override.lenny.extra.main
  3. config_binary                 override.lenny.extra.non-free
  4. config_installer              [color=red]override.lenny.main[/color]
  5. override.lenny.contrib        override.lenny.main.src
  6. override.lenny.contrib.src    override.lenny.non-free
  7. override.lenny.extra.contrib  override.lenny.non-free.src
复制代码

小弟十分无解,重新做了一遍还是不行,为什么会出现这样的情况呢?

不知道是不是有人碰到跟我一样的问题

请成功定制过的帮手解决一下,谢谢~~~
 楼主| 发表于 2009-6-3 22:17:40 | 显示全部楼层
哎。。。自己解决了
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-6-4 12:34:51 | 显示全部楼层
现在我修改了一下脚本,可以正常生成安装的iso,但是
debian-installer不能正常识别preseed.cfg,就是不能按照我预先给定的命令安装

请教一下大家 debian的安装过程怎么制定preseed.cfg?

我写的preseed.cfg 如下:

  1. # Individual additional packages to install
  2. d-i pkgsel/include string eject file sudo vim-tiny console-common kbd locales gdm xfce4 desktop-base x-window-system-core xresprobe

  3. #tasksel tasksel/first multiselect standard, xfce-desktop
  4. tasksel tasksel/first multiselect xfce-desktop
复制代码

isolinux.cfg如下:

  1. # D-I config version 1.0
  2. include menu.cfg
  3. default vesamenu.c32
  4. prompt 0
  5. timeout 0
  6. preseed/file=/cdrom/.disk/preseed.cfg
复制代码



但是很奇怪,我安装过程选择了desktop和standart,结果安装的桌面环境还是gnome,无语
生成iso的脚本如下:

  1. #!/bin/bash

  2. # Step 0 : install tools needed

  3. apt-get update
  4. apt-get install --yes mkisofs debootstrap

  5. # Step 1 : make directory

  6. export workdir=/tmp/cdiso
  7. mkdir -p $workdir/{roiso,newiso,scripts,bootstrap}

  8. # Step 2 : download the d-i image and make it(iso) writable with unionfs
  9. cd $workdir

  10. #export http_proxy=http://*.*.*.*:*/
  11. #wget http://cdimage.debian.org/debian-cd/5.0.1/i386/iso-cd/debian-501-i386-netinst.iso
  12. wget http://ftp.hk.debian.org/debian-cd/5.0.0/i386/iso-cd/debian-500-i386-netinst.iso

  13. mount -o loop ./debian-500-i386-netinst.iso $workdir/roiso
  14. rsync -azvb $workdir/roiso/ newiso/
  15. umount roiso/

  16. # Step 3a : download the indices file ( to update the pool)
  17. cd $workdir/scripts/
  18. #export http_proxy=

  19. #wget http://mirrors.163.com/debian/indices/override.lenny.contrib.gz
  20. #wget http://mirrors.163.com/debian/indices/override.lenny.contrib.src.gz
  21. #wget http://mirrors.163.com/debian/indices/override.lenny.extra.contrib.gz
  22. #wget http://mirrors.163.com/debian/indices/override.lenny.extra.main.gz
  23. #wget http://mirrors.163.com/debian/indices/override.lenny.extra.non-free.gz
  24. #wget http://mirrors.163.com/debian/indices/override.lenny.main.gz
  25. #wget http://mirrors.163.com/debian/indices/override.lenny.main.src.gz
  26. #wget http://mirrors.163.com/debian/indices/override.lenny.non-free.gz
  27. #wget http://mirrors.163.com/debian/indices/override.lenny.non-free.src.gz


  28. wget http://ftp.hk.debian.org/debian/indices/override.lenny.contrib.gz
  29. wget http://ftp.hk.debian.org/debian/indices/override.lenny.contrib.src.gz
  30. wget http://ftp.hk.debian.org/debian/indices/override.lenny.extra.contrib.gz
  31. wget http://ftp.hk.debian.org/debian/indices/override.lenny.extra.main.gz
  32. wget http://ftp.hk.debian.org/debian/indices/override.lenny.extra.non-free.gz
  33. wget http://ftp.hk.debian.org/debian/indices/override.lenny.main.gz
  34. wget http://ftp.hk.debian.org/debian/indices/override.lenny.main.src.gz
  35. wget http://ftp.hk.debian.org/debian/indices/override.lenny.non-free.gz
  36. wget http://ftp.hk.debian.org/debian/indices/override.lenny.non-free.src.gz

  37. gunzip *.gz

  38. # Step 3b : create the configration for the apt-ftparchive
  39. cd $workdir/scripts/

  40. cat >>apt.conf <<EOF
  41. APT {
  42.        FTPArchive {
  43.          Release {
  44.              Origin "Debian";
  45.              Label "Debian";
  46.              Suite "stable";
  47.              Version "5.0.0";
  48.              Codename "lenny";
  49.              Architectures "i386";
  50.              Components "main contrib";
  51.              Description "Duxingxia Debian Lenny distribution ";
  52.          };
  53.        };
  54.     };
  55. EOF


  56. cat >>apt-ftparchive-deb.conf <<EOF
  57. Dir {
  58.         ArchiveDir "$workdir/newiso/";
  59.         OverrideDir "$workdir/scripts";
  60.         CacheDir "$workdir";
  61. };

  62. TreeDefault {
  63.         Directory "pool/";

  64. };

  65. BinDirectory "pool/main" {
  66.             Packages "dists/lenny/main/binary-i386/Packages";
  67.             BinOverride "override.lenny.main";
  68.             ExtraOverride "override.lenny.extra.main";
  69. };

  70. BinDirectory "pool/contrib" {
  71.             Packages "dists/lenny/contrib/binary-i386/Packages";
  72.             BinOverride "override.lenny.contrib";
  73.             ExtraOverride "override.lenny.extra.contrib";
  74. };

  75. Default {
  76.         Packages {
  77.                 Extensions ".deb";
  78.                 Compress ". gzip";
  79.         };

  80.         Contents {
  81.                 Compress "gzip";
  82.         };
  83. };
  84. EOF


  85. cat >>apt-ftparchive-udeb.conf <<EOF
  86. Dir {
  87.         ArchiveDir "$workdir/newiso/";
  88.         OverrideDir "$workdir/scripts";
  89.         CacheDir "$workdir";
  90. };
  91.             
  92. TreeDefault {
  93.             Directory "pool/";
  94. };
  95.                      
  96. BinDirectory "pool/main" {        
  97.         Packages "dists/lenny/main/debian-installer/binary-i386/Packages";
  98.             BinOverride "override.lenny.main";
  99.             ExtraOverride "override.lenny.extra.main";
  100. };
  101.                                     
  102. Default {
  103.             Packages {
  104.                 Extensions ".udeb";
  105.                 Compress ". gzip"
  106.             };
  107.            Contents {
  108.                 Compress "gzip"
  109.            };
  110. };
  111. EOF

  112. # Step 4 : build the bootstrap and download the extra package
  113. #          move the downloaded deb to the d-i ISO 's pool

  114. cd $workdir
  115. #debootstrap lenny $workdir/bootstrap http://debian.cn99.com/debian/
  116. debootstrap lenny $workdir/bootstrap http://ftp.hk.debian.org/debian/

  117. chroot $workdir/bootstrap apt-get update
  118. chroot $workdir/bootstrap apt-get -y install apt-move
  119. chroot $workdir/bootstrap apt-get clean
  120. chroot $workdir/bootstrap apt-get -y install --download-only eject file sudo vim-tiny console-common kbd locales gdm xfce4 desktop-base x-window-system-core

  121. xresprobe
  122. chroot $workdir/bootstrap apt-move update

  123. cp -a $workdir/bootstrap/mirrors/debian/pool $workdir/newiso/
  124. chroot $workdir/bootstrap apt-get clean

  125. # Step 5 : update Release file and indices
  126. cd $workdir/newiso
  127. apt-ftparchive -c $workdir/scripts/apt.conf generate $workdir/scripts/apt-ftparchive-udeb.conf
  128. apt-ftparchive -c $workdir/scripts/apt.conf generate $workdir/scripts/apt-ftparchive-deb.conf
  129. apt-ftparchive -c $workdir/scripts/apt.conf release dists/lenny > ./dists/lenny/Release

  130. # Step 6a : create the preseed.cfg to auto-install the extra packages

  131. cd $workdir/newiso/.disk/

  132. cat >>preseed.cfg <<EOF
  133. # Individual additional packages to install
  134. d-i pkgsel/include string eject file sudo vim-tiny console-common kbd locales gdm xfce4 desktop-base x-window-system-core xresprobe

  135. #tasksel tasksel/first multiselect standard, xfce-desktop
  136. tasksel tasksel/first multiselect xfce-desktop

  137. EOF

  138. # Step 6b : append the boot parameter to include the preseed.cfg
  139. cd $workdir/newiso/isolinux
  140. echo "preseed/file=/cdrom/.disk/preseed.cfg" >> isolinux.cfg

  141. # Step 7 : create the ISO
  142. cd $workdir

  143. mkisofs -o ./cdiso.iso -r -J -l -no-emul-boot -boot-load-size 4 -boot-info-table -b isolinux/isolinux.bin -c isolinux/boot.cat ./newiso/

  144. # Step 8 : clean
  145. #mv cdi.iso /home/duxingxia/iso/
  146. #rm -rf $workdir


复制代码
回复 支持 反对

使用道具 举报

发表于 2009-6-4 14:27:04 | 显示全部楼层
你测试是用的光盘安装还是硬盘安装
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-6-4 16:30:12 | 显示全部楼层
我生成iso后用虚拟机安装测试的

结果d-i  的命令行还是不起作用

不知道哪里出错了。。


Post by yjwork;1994039
你测试是用的光盘安装还是硬盘安装
回复 支持 反对

使用道具 举报

发表于 2009-12-30 16:39:22 | 显示全部楼层
不知道楼主的问题解决了没有??
想请教请教!
回复 支持 反对

使用道具 举报

发表于 2009-12-30 19:08:55 | 显示全部楼层
我按照楼主的脚本生成ISO成功了,但是预置文件preseed.cfg不起作用,而且该ISO在虚拟机中进行光盘完整性校验时总是通不过,有没有高手可以指点一下,我将感谢非常!
我用两种方法试验preseed.cfg,一种是将preseed.cfg放在光盘根目录的.disk文件夹中,然后在isolinux/isolinux.cfg中添加
preseed/file=/cdrom/.disk/preseed.cfg
preseed/file/checksum=56bb074c274d8a2c71a88f6839fc12a9
还有一种是直接修改install.386中的initrd.gz,加入preseed.cfg。
结果都不行,郁闷阿
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表