为玩客云替换网络服务程序为 systemd-networkd

修复修改 mac 地址无法自动获取 ip 问题
This commit is contained in:
mofeng-git 2024-10-20 11:01:22 +00:00
parent f5bebbc43f
commit 2929a925a2

View File

@ -5,7 +5,7 @@ BOOTFS=/tmp/bootfs
ROOTFS=/tmp/rootfs ROOTFS=/tmp/rootfs
OUTPUTDIR=/mnt/sda1/output OUTPUTDIR=/mnt/sda1/output
LOOPDEV=/dev/loop10 LOOPDEV=/dev/loop10
DATE=241004 DATE=241018
export LC_ALL=C export LC_ALL=C
write_meta() { write_meta() {
@ -108,7 +108,7 @@ config_cumebox2_file() {
} }
instal_one-kvm() { instal_one-kvm() {
#$1 arch;$2 "gpio" or "video1" #$1 arch; $2 deivce: "gpio" or "video1"; $3 network: "systemd-networkd",default is network-manager
sudo chroot --userspec "root:root" $ROOTFS bash -c " \ sudo chroot --userspec "root:root" $ROOTFS bash -c " \
df -h \ df -h \
&& apt update \ && apt update \
@ -122,14 +122,15 @@ instal_one-kvm() {
python3-serial python3-zstandard python3-dbus-next \ python3-serial python3-zstandard python3-dbus-next \
&& apt install -y nginx python3-pip python3-dev python3-build net-tools tesseract-ocr tesseract-ocr-eng tesseract-ocr-chi-sim \ && apt install -y nginx python3-pip python3-dev python3-build net-tools tesseract-ocr tesseract-ocr-eng tesseract-ocr-chi-sim \
git gpiod libxkbcommon0 build-essential janus-dev libssl-dev libffi-dev libevent-dev libjpeg-dev libbsd-dev libudev-dev \ git gpiod libxkbcommon0 build-essential janus-dev libssl-dev libffi-dev libevent-dev libjpeg-dev libbsd-dev libudev-dev \
pkg-config libx264-dev libyuv-dev libasound2-dev libsndfile-dev libspeexdsp-dev cpufrequtils iptables " pkg-config libx264-dev libyuv-dev libasound2-dev libsndfile-dev libspeexdsp-dev cpufrequtils iptables network-manager \
&& rm -rf /var/lib/apt/lists/* "
if [ "$1" = "armhf" ]; then if [ "$3" = "systemd-networkd" ]; then
sudo chroot --userspec "root:root" $ROOTFS bash -c " \ sudo chroot --userspec "root:root" $ROOTFS bash -c " \
rm -rf /var/lib/apt/lists/* " echo -e '[Match]\nName=eth0\n\n[Network]\nDHCP=yes\n\n[Link]\nMACAddress=B6:AE:B3:21:42:0C' > /etc/systemd/network/99-eth0.network \
else && systemctl mask NetworkManager \
sudo chroot --userspec "root:root" $ROOTFS bash -c " \ && systemctl unmask systemd-networkd \
apt install -y network-manager && rm -rf /var/lib/apt/lists/* " && systemctl enable systemd-networkd systemd-resolved "
fi fi
sudo chroot --userspec "root:root" $ROOTFS bash -c " \ sudo chroot --userspec "root:root" $ROOTFS bash -c " \
pip3 config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple \ pip3 config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple \
@ -218,7 +219,7 @@ case $1 in
onecloud_rootfs onecloud_rootfs
mount_rootfs mount_rootfs
config_file $1 config_file $1
instal_one-kvm armhf gpio instal_one-kvm armhf gpio systemd-networkd
write_meta $1 write_meta $1
umount_rootfs umount_rootfs
pack_img_onecloud pack_img_onecloud