This commit is contained in:
smart
2025-12-04 18:12:44 +08:00
commit 7f9c9e9fff
5 changed files with 376 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
/iso-build/
/results/
/tmp/
/livemedia.log
/program.log
/virt-install.log

14
add_empty_folders.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
# 保存为 add_empty_folders.sh
echo "正在查找并处理空文件夹..."
# 查找所有空文件夹并创建 .gitkeep
find . -type d -empty | while read dir; do
if [ ! -f "$dir/.gitkeep" ]; then
touch "$dir/.gitkeep"
echo "✅ 已创建: $dir/.gitkeep"
fi
done
echo "处理完成!"

60
build-rocky9-livecd.sh Normal file
View File

@@ -0,0 +1,60 @@
#!/bin/bash
# 定义一些变量,方便修改和管理
BASE_DIR="/home/smart/rocky9-livecd"
RESULTS_DIR="results"
ISO_BUILD_DIR="iso-build" # 新的ISO存放目录
KS_FILE="kickstarts/my.ks"
ISO_NAME="Rocky-9-Custom-LiveCD-LocalRepo-x86_64.iso"
PROJECT_NAME="Rocky Linux 9 Custom LiveCD (Local Repo)"
RELEASE_VER="9"
VOL_ID="Rocky_9_LiveCD_Local"
BOOT_ISO="/home/smart/Rocky-9.7-x86_64-boot.iso"
# 切换到工作目录
cd "${BASE_DIR}" || { echo "错误:无法切换到目录 ${BASE_DIR}"; exit 1; }
# 清理旧的 results 目录
echo "清理旧的 ${RESULTS_DIR} 目录..."
rm -rf "${RESULTS_DIR}"
# 确保 iso-build 目录存在
echo "检查并创建 ${ISO_BUILD_DIR} 目录..."
mkdir -p "${ISO_BUILD_DIR}" || { echo "错误:无法创建目录 ${ISO_BUILD_DIR}"; exit 1; }
echo "开始执行 livemedia-creator..."
sudo livemedia-creator \
--ks "${KS_FILE}" \
--resultdir "${RESULTS_DIR}" \
--tmp tmp \
--make-iso \
--iso-name "${ISO_NAME}" \
--project "${PROJECT_NAME}" \
--releasever "${RELEASE_VER}" \
--volid "${VOL_ID}" \
--iso "${BOOT_ISO}"
# 检查 livemedia-creator 是否成功执行
if [ $? -eq 0 ]; then
echo "livemedia-creator 执行成功。"
# 获取当前时间,格式为 年-月-日-时-分
TIMESTAMP=$(date +"%Y-%m-%d-%H-%M")
NEW_RESULTS_DIR_NAME="${RESULTS_DIR}-${TIMESTAMP}"
echo "${RESULTS_DIR} 移动并重命名为 ${ISO_BUILD_DIR}/${NEW_RESULTS_DIR_NAME}..."
mv "${RESULTS_DIR}" "${ISO_BUILD_DIR}/${NEW_RESULTS_DIR_NAME}"
if [ $? -eq 0 ]; then
echo "操作完成。新的结果目录位于:${ISO_BUILD_DIR}/${NEW_RESULTS_DIR_NAME}"
echo "生成的 ISO 文件通常在 ${ISO_BUILD_DIR}/${NEW_RESULTS_DIR_NAME}/images 目录下。"
else
echo "错误:移动或重命名 ${RESULTS_DIR} 失败。"
exit 1
fi
else
echo "错误livemedia-creator 执行失败。"
exit 1
fi
echo "脚本执行完毕。"

228
kickstarts/my.ks Normal file
View File

@@ -0,0 +1,228 @@
# rocky-live-base.ks
#
lang en_US.UTF-8
keyboard us
timezone US/Eastern
selinux --enforcing
firewall --enabled --service=mdns
xconfig --startxonboot
zerombr
clearpart --all
part / --size 6144 --fstype ext4
# services --enabled=NetworkManager,ModemManager --disabled=sshd
services --enabled=NetworkManager --disabled=sshd
network --bootproto=dhcp --device=link --activate
rootpw --lock --iscrypted locked
shutdown
# # %include fedora-repo.ks
# url --url "http://172.27.175.219/repos/rocky9/BaseOS/x86_64/os/"
# # repo --name="local-rocky9-baseos" --baseurl="http://172.27.175.219/repos/rocky9/BaseOS/x86_64/os/"
# repo --name="local-rocky9-appstream" --baseurl="http://172.27.175.219/repos/rocky9/AppStream/x86_64/os/"
# repo --name="epel" --baseurl="https://download.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm" --install
# 主要安装源 - 你的本地 BaseOS 仓库
url --url "https://mirrors.aliyun.com/rockylinux/9.7/BaseOS/x86_64/os/"
# url --url "http://172.27.175.219/repos/rocky9/Custom/x86_64/os/Packages/"
# 你的本地 AppStream 仓库
repo --name="appstream" --baseurl="https://mirrors.aliyun.com/rockylinux/9.7/AppStream/x86_64/os/"
repo --name="extras" --baseurl="https://mirrors.aliyun.com/rockylinux/9.7/extras/x86_64/os/"
repo --name="epel" --baseurl="https://mirrors.aliyun.com/epel/9/Everything/x86_64/"
repo --name="my-local-repo" --baseurl="http://172.27.175.219/repos/rocky9/Custom/x86_64/os/Packages/"
# repo --name="local-rocky9-appstream" --baseurl="http://172.27.175.219/repos/rocky9/AppStream/x86_64/os/"
# repo --name="my-local-repo" --baseurl="http://172.27.175.219/repos/rocky9/Custom/x86_64/os/Packages/"
# 添加公共 EPEL 仓库 (需要互联网连接)
#repo --name="epel" --baseurl="https://download.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm" --install
# 添加 CRB (CodeReady Builder) 仓库
# CRB 提供了许多开发工具和库,经常是 EPEL 软件包的依赖。强烈建议启用。
# 确保你的构建环境可以访问此公共 URL。
#repo --name="crb" --baseurl="https://download.rockylinux.org/pub/rocky/9/CRB/x86_64/os/"
# --- 添加 Rocky Linux 官方的 Extras 仓库 ---
# 这个仓库通常包含一些官方支持但不在核心 BaseOS 或 AppStream 中的软件包。
# 确保你的构建环境可以访问此公共 URL。
#repo --name="rocky-extras" --baseurl="https://download.rockylinux.org/pub/rocky/9/extras/x86_64/os/"
# --- 添加 Rocky Linux 官方的 Plus 仓库 ---
# Plus 仓库可能包含一些增强功能或特定软件包。
# 确保你的构建环境可以访问此公共 URL。
#repo --name="rocky-plus" --baseurl="https://download.rockylinux.org/pub/rocky/9/plus/x86_64/os/"
%packages
# 基础包
@core
kernel
memtest86+
kernel-modules
kernel-modules-extra
authselect-compat
chrony
cryptsetup
device-mapper-multipath
dosfstools
dracut-network
e2fsprogs
efibootmgr
fcoe-utils
firewalld
glibc-all-langpacks
grub2-efi-x64
grub2-efi-x64-cdboot
grub2-pc
grub2-tools
grub2-tools-efi
grub2-tools-extra
iscsi-initiator-utils
kdump-anaconda-addon
libblockdev-plugins-all
libreport-plugin-bugzilla
lvm2
mdadm
realmd
restore
shim-x64
syslinux-extlinux
teamd
tmux
xfsprogs
# live环境包
anaconda-install-env-deps
anaconda-live
device-mapper-multipath
aajohan-comfortaa-fonts
dracut-live
glibc-all-langpacks
livesys-scripts
# xfce 桌面环境,以及应用
# Thunar
# xfce4-panel
# xfce4-session
# xfce4-settings
# xfce-polkit
# xfce4-appfinder
# xfce4-power-manager
# xfce4-pulseaudio-plugin
# xfce4-screensaver
# xfce4-terminal
# xfce4-about
# xfce4-mount-plugin
# xfconf
# xfdesktop
# xfwm4
# lightdm
# network-manager-applet
# openssh-askpass
# thunar-archive-plugin
# thunar-volman
# tumbler
# # pinentry-gnome3
# mousepad
# ristretto
@Xfce
-gdm
lightdm
xfce4-about
xfce4-mount-plugin
mousepad
ristretto
# 工具
wget
vim
nmap
open-vm-tools
open-vm-tools-desktop
%end
%post
# Enable livesys services
systemctl enable livesys.service
systemctl enable livesys-late.service
systemctl enable vmtoolsd
# enable tmpfs for /tmp
systemctl enable tmp.mount
# make it so that we don't do writing to the overlay for things which
# are just tmpdirs/caches
# note https://bugzilla.redhat.com/show_bug.cgi?id=1135475
cat >> /etc/fstab << EOF
vartmp /var/tmp tmpfs defaults 0 0
EOF
# work around for poor key import UI in PackageKit
rm -f /var/lib/rpm/__db*
echo "Packages within this LiveCD"
rpm -qa --qf '%{size}\t%{name}-%{version}-%{release}.%{arch}\n' |sort -rn
# Note that running rpm recreates the rpm db files which aren't needed or wanted
rm -f /var/lib/rpm/__db*
# go ahead and pre-make the man -k cache (#455968)
/usr/bin/mandb
# make sure there aren't core files lying around
rm -f /core*
# remove random seed, the newly installed instance should make it's own
rm -f /var/lib/systemd/random-seed
# convince readahead not to collect
# FIXME: for systemd
echo 'File created by kickstart. See systemd-update-done.service(8).' \
| tee /etc/.updated >/var/.updated
# Drop the rescue kernel and initramfs, we don't need them on the live media itself.
# See bug 1317709
rm -f /boot/*-rescue*
# Disable network service here, as doing it in the services line
# fails due to RHBZ #1369794
systemctl disable network
# Remove machine-id on pre generated images
rm -f /etc/machine-id
touch /etc/machine-id
%end
%post
# xfce configuration
# create /etc/sysconfig/desktop (needed for installation)
cat > /etc/sysconfig/desktop <<EOF
PREFERRED=/usr/bin/startxfce4
DISPLAYMANAGER=/usr/sbin/lightdm
EOF
# set livesys session type
sed -i 's/^livesys_session=.*/livesys_session="xfce"/' /etc/sysconfig/livesys
%end

68
up+.sh Normal file
View File

@@ -0,0 +1,68 @@
#!/bin/bash
#set -e
##################################################################################################################
# Author : Erik Dubois
# Website : https://www.erikdubois.be
# Website : https://www.alci.online
# Website : https://www.ariser.eu
# Website : https://www.arcolinux.info
# Website : https://www.arcolinux.com
# Website : https://www.arcolinuxd.com
# Website : https://www.arcolinuxb.com
# Website : https://www.arcolinuxiso.com
# Website : https://www.arcolinuxforum.com
##################################################################################################################
#
# DO NOT JUST RUN THIS. EXAMINE AND JUDGE. RUN AT YOUR OWN RISK.
#
##################################################################################################################
#tput setaf 0 = black
#tput setaf 1 = red
#tput setaf 2 = green
#tput setaf 3 = yellow
#tput setaf 4 = dark blue
#tput setaf 5 = purple
#tput setaf 6 = cyan
#tput setaf 7 = gray
#tput setaf 8 = light blue
##################################################################################################################
# reset - commit your changes or stash them before you merge
# git reset --hard - personal alias - grh
echo "Deleting the work folder if one exists"
[ -d work ] && rm -rf work
# checking if I have the latest files from github
echo "Checking for newer files online first"
git pull
# Below command will backup everything inside the project folder
git add --all .
# Give a comment to the commit if you want
echo "####################################"
echo "Write your commit comment!"
echo "####################################"
read input
# Committing to the local repository with a message containing the time details and commit text
git commit -m "$input"
# Push the local files to github
if grep -q main .git/config; then
echo "Using main"
git push -u origin main
fi
if grep -q master .git/config; then
echo "Using master"
git push -u origin master
fi
echo "################################################################"
echo "################### Git Push Done ######################"
echo "################################################################"