Debian Live 系统其实就是一个可以直接从可移动介质 (CD-ROM 光盘,DVD 光盘,U 盘) 启用的 Debian 系统,或者也可以从网络上的另一台电脑启用,而无需安装。
光盘镜像是由一个名为 live-helper 的工具生成的,它能轻易地创建自定义的 live 系统。
Debian Live 定制性很强,下面简单介绍几项定制内容:
如果你的工作机无法访问官方 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]
syslinux 使用一种特殊的图像格式(RLE 或 LSS),需要用下面的方法准备:
ppmtolss16 '#d0d0d0=7' < splash.ppm > splash.rle
得到 LSS 格式的图像之后,需要:
LH_SYSLINUX_SPLASH="config/binary_syslinux/splash.rle"
然后 lh_clean && lh_build 生成新的镜像。
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 生成新的镜像。
splashy 可以在系统启动时,显示图形化的进度栏。splashy 的定制过程如下:
#!/bin/sh splashy_config -s debian-moreblue || true update-initramfs -u -k all
最后,lh_clean && lh_build 生成新的镜像。
usplash 与 splash 类似,同样可以显示图形化启动进度。由于 splashy 不支持 initramfs,有一部分启动过程无法图形化,而 usplash 能弥补这一缺陷。
最后,lh_clean && lh_build 生成新的镜像。
通常减少 Debian/Linux 系统空间的方法无外乎:1 删除不用的 locale 信息,2 删除 APT 缓存。可以参照上面定制过程,在 config/chroot_local-hooks/ 目录下,创建 hooks 脚本实现。
#!/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
最后 lh_clean && lh_build 生成新的镜像。
fluxbox 是一款小巧的 X Window Manager。生成使用 fluxbox 的 Debian Live 系统的过程如下:
## LH: Fluxbox
#include <standard-x11>
fluxbox gdm
##desktop-base
最后 lh_clean && lh_build 生成新的镜像。
一些参考:/usr/share/live-helper/lists 目录下的文件。定义了 live-helper 怎么理解常见的软件组合。无论是 debian-live 还是普通的 debian 安装,都是使用 debootstrap 完成的基本系统安装,所以应该看 debootstrap 的源码。
作者: dipplum.com