首页 > 开源软件 > 定制 Debian Live

定制 Debian Live

2009年6月20日 dipplum 发表评论 阅读评论

Debian Live 是一款制作可从移动介质直接启动的 Linux 系统的工具,支持生成 iso 镜像,USB 磁盘镜像和 NFS 镜像。

Debian Live 定制性很强,下面简单介绍几项定制内容:

1. 定制 Debian Mirror 地址

如果你的工作机无法访问官方 mirror,一定要通过下面 lh_config 的 5 个参数,配置可以访问的 mirror:

lh_config
            [-m|--mirror-bootstrap URL]
            [--mirror-binary URL]
            [--mirror-binary-security URL]
            [--mirror-chroot URL]
            [--mirror-chroot-security URL]

2. 定制 syslinux splash 图像

syslinux 使用一种特殊的图像格式(RLE 或 LSS),需要用下面的方法准备:

  • 用 GIMP 编辑图像,不要超过 640×400。
  • 设置为 14 Indexed Color。如果图像已经为 Indexed Color,但超过 14 种,应该先转换成 RGB 格式,再转换回 14 Indexed Color
  • 另存为 PPM 格式
  • 使用 syslinux 包中的 ppmtolss16,将 PPM 图像转换成 LSS
  • ppmtolss16 '#d0d0d0=7' < splash.ppm > splash.rle

得到 LSS 格式的图像之后,需要:

  • 放入 config/binary_syslinux/ 下,假设文件名为 splash.rle
  • 同时修改 config/binary,设置:
  • LH_SYSLINUX_SPLASH="config/binary_syslinux/splash.rle"

然后 lh_clean && lh_build 生成新的镜像。

3. 定制默认用户配置

Debian 以及其他 Linux 发行版在创建新用户时,会将 /etc/skel 目录下的所有文件复制到新用户 HOME 目录下。借助这一特色,可以通过将配置文件放在 /etc/skel 目录下,起到默认配置的作用。

Debian Live 系统每次启动时会生成全新用户 HOME 目录,同样会拷贝 /etc/skel 目录下的所有文件。因此需要将配置文件放入 Debian Live 系统的 /etc/skel 目录下。

在 config/chroot_local-includes/ 目录下,创建 etc/skel 子目录,在生成 binary 时,这些文件会自动拷贝到文件系统上。

lh_clean && lh_build 生成新的镜像。

4. 定制 splashy

splashy 可以在系统启动时,显示图形化的进度栏。splashy 的定制过程如下:

  • 创建 config/chroot_local-hooks/01-splash.sh:
  • #!/bin/sh
    splashy_config -s debian-moreblue || true
    update-initramfs -u -k all
  • chmod +x config/chroot_local-hooks/01-splash.sh
  • 修改 config/chroot 文件,LH_PACKAGES 后增加两个包:splashy splashy-themes

最后,lh_clean && lh_build 生成新的镜像。

5. 定制 usplash

usplash 与 splash 类似,同样可以显示图形化启动进度。由于 splashy 不支持 initramfs,有一部分启动过程无法图形化,而 usplash 能弥补这一缺陷。

  • 参照 splashy 前两步,生成同样的 01-splash.sh 可执行脚本
  • 修改config/chroot 文件,LH_PACKAGES 后增加两个包:usplashy usplash-theme-debian
    最后,lh_clean && lh_build 生成新的镜像。

6. 最小化生成 image

通常减少 Debian/Linux 系统空间的方法无外乎:1 删除不用的 locale 信息,2 删除 APT 缓存。可以参照上面定制过程,在 config/chroot_local-hooks/ 目录下,创建 hooks 脚本实现。

  • 首先,修改config/chroot 文件,LH_PACKAGES 后添加 localepurge
  • 创建 config/chroot_local-hooks/99-clean.sh 文件:
  • #!/bin/sh
    rm -r /var/lib/apt/lists/mirror.ivic.org.cn*
    rm -r /var/cache/apt/*.bin
     
    debconf-set-selections <<EOF
    debconf localepurge/nopurge select en, en_US.UTF-8
    debconf localepurge/nopurge seen true
     
    debconf localepurge/mandelete select true
    debconf localepurge/mandelete seen true
     
    debconf localepurge/dontbothernew select false
    debconf localepurge/dontbothernew seen true
     
    debconf localepurge/showfreedspace select true
    debconf localepurge/showfreedspace seen true
     
    debconf localepurge/verbose select false
    debconf localepurge/verbose seen true
     
    debconf localepurge/quickndirtycalc select true
    debconf localepurge/quickndirtycalc seen true
    EOF
     
    dpkg-reconfigure -u -phigh localepurge
  • chmod +x config/chroot_local-hooks/99-clean.sh

最后 lh_clean && lh_build 生成新的镜像。

7. 使用 fluxbox

fluxbox 是一款小巧的 X Window Manager。生成使用 fluxbox 的 Debian Live 系统的过程如下:

  • 修改config/chroot 文件,LH_PACKAGES_LISTS 后添加 fluxbox(替换 xfce/gnome/kde 等)
  • 创建 chroot_local-packageslists/fluxbox,内容如下:
  • ## LH: Fluxbox
    #include <standard-x11>
     
    fluxbox gdm
    ##desktop-base

最后 lh_clean && lh_build 生成新的镜像。

分类: 开源软件 标签: ,
  1. visitor83
    2009年7月2日22:38 | #1

    请问如何客制化安装光盘debian是如何挑包 的

  2. 2009年7月3日05:01 | #2

    你的意思是 Live CD 安装了哪些 debian 包么?
    参见 /usr/share/live-helper/lists 目录下的文件。定义了 live-helper 怎么理解常见的软件组合。

  3. visitor83
    2009年7月3日23:41 | #3

    ok,我现在就是不知道debian installer 是如何生出包的依赖关系以及如何组合包达到一个最小的debian系统,在fedora系列中有anaconda作为安装程序而报选择是使用xml,谢谢你的回答,希望继续讨论

  4. 2009年7月4日05:56 | #4

    无论是 debian-live 还是普通的 debian 安装,都是使用 debootstrap 完成的基本系统安装,所以应该看 debootstrap 的源码。我没怎么研究过 debootstrap,虽然经常用。

  5. visitor83
    2009年7月4日11:51 | #5

    了解, 下载debootstrap源码阅读中,你说的很有指导意义

  6. visitor83
    2009年7月4日11:57 | #6

    了解, 说的很有指导意义,谢了,阅读debootstrap源码中

  7. amraam
    2009年12月23日23:33 | #7

    mirror.ivic.org.cn好眼熟啊……

  8. 2010年1月3日01:15 | #8

    作者你好啊,看了你这个不太明白 希望你能指点一下
    不胜感激
    QQ 234027573
    WLM nxfte@hotmail.com

  1. 本文目前尚无任何 trackbacks 和 pingbacks.
This work by dipplum is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 China Mainland.