live-build 配置脚本
bash
#!/bin/sh
# CentOS 7.9 系统的 live-build 配置脚本
set -e
echo "I: create configuration"
export LB_BOOTSTRAP_INCLUDE="yum-utils"
lb config \
--mirror-bootstrap "https://vault.centos.org/centos/7.9.2009/os/x86_64/" \
--mirror-chroot "https://vault.centos.org/centos/7.9.2009/os/x86_64/" \
--mirror-chroot-security "https://vault.centos.org/centos/7.9.2009/updates/x86_64/" \
--mirror-binary "https://vault.centos.org/centos/7.9.2009/os/x86_64/" \
--mirror-binary-security "https://vault.centos.org/centos/7.9.2009/updates/x86_64/" \
--apt-indices false \
--apt-recommends false \
--apt-secure false \
--architectures x86_64 \
--archive-areas 'main contrib non-free' \
--backports false \
--binary-filesystem ext4 \
--binary-images tar \
--bootappend-live "hostname=centos username=flexmi" \
--bootstrap-qemu-arch x86_64 \
--bootstrap-qemu-static /usr/bin/qemu-x86_64-static \
--cache false \
--chroot-filesystem none \
--compression gzip \
--distribution centos7 \
--gzip-options '-9 --rsyncable' \
--iso-publisher 'Your Name; http://www.yourwebsite.com/; your-email@example.com' \
--iso-volume 'CentOS 7.9 $(date +%Y%m%d-%H:%M)' \
--linux-flavours none \
--linux-packages none \
--mode centos \
--security true \
--system normal \
--updates true
安装必要工具
确保你已经安装了 livecd-tools
和 createrepo
bash
sudo yum install livecd-tools createrepo
Live系统编译脚本
bash
# CentOS 7.9 Live CD Build Makefile
BUILD_NUMBER?=1
BASEIMG=centos7.9
IMAGEPREFIX=$(BASEIMG)-date +%Y%m%d-$(BUILD_NUMBER)
LOGFILE=$(IMAGEPREFIX).build-log.txt
CONFIGFILE=$(IMAGEPREFIX).ks.cfg
ISOFILE=$(IMAGEPREFIX).iso
MD5SUMSFILE=$(IMAGEPREFIX).md5sums.txt
SHA1SUMSFILE=$(IMAGEPREFIX).sha1sums.txt
all:
set -e; \
sudo livecd-creator --config=ks.cfg --fslabel=$(IMAGEPREFIX) 2>&1 | tee $(LOGFILE); \
if [ -f $(ISOFILE) ]; then \
md5sum $(LOGFILE) $(CONFIGFILE) $(ISOFILE) > $(MD5SUMSFILE); \
sha1sum $(LOGFILE) $(CONFIGFILE) $(ISOFILE) > $(SHA1SUMSFILE); \
fi
clean:
rm -f $(BASEIMG)-*
rm -rf config