use dhcpcd

This commit is contained in:
iceBear67
2026-06-22 12:07:41 +08:00
parent 269734b313
commit c4994f4ebf
6 changed files with 12 additions and 8 deletions

View File

@@ -31,7 +31,7 @@ alpine-make-vm-image \
--fs-skel-dir "$OVERLAY_DIR" \ --fs-skel-dir "$OVERLAY_DIR" \
--fs-skel-chown root:root \ --fs-skel-chown root:root \
--script-chroot \ --script-chroot \
--packages "git curl docker cronie dhclient" \ --packages "git curl docker cronie dhcpcd" \
"$IMAGE_FILE" \ "$IMAGE_FILE" \
"$CONFIGURE_SH" | tee $TMP "$CONFIGURE_SH" | tee $TMP

View File

@@ -33,6 +33,10 @@ rc-update add acpid default
rc-update add docker default rc-update add docker default
rc-update add cronie default rc-update add cronie default
step 'Adjust syslog'
sed -i 's/^SYSLOGD_OPTS="\(.*\)"/SYSLOGD_OPTS="\1 -K"/' /etc/conf.d/syslog
grep "SYSLOGD_OPTS" /etc/conf.d/syslog
step 'Clean up APK cache and documents' step 'Clean up APK cache and documents'
rm -rf /var/cache/apk/* || true rm -rf /var/cache/apk/* || true

View File

@@ -1,3 +0,0 @@
interface "eth0" {
supersede routers GATEWAY_ADDRESS;
}

View File

@@ -3,5 +3,8 @@ iface lo inet loopback
auto eth0 auto eth0
iface eth0 inet manual iface eth0 inet manual
post-up dhclient -v eth0 pre-up ip link set dev eth0 up
pre-down dhclient -x eth0 up dhcpcd --nobackground --static routers=GATEWAY_ADDRESS eth0
down dhcpcd --release eth0
post-down ip link set dev eth0 down

View File

@@ -8,5 +8,5 @@ set -euo pipefail
--cmdline "modules=ext4 root=/dev/vda rootfstype=ext4 rw console=hvc0" \ --cmdline "modules=ext4 root=/dev/vda rootfstype=ext4 rw console=hvc0" \
--cpus boot=${CPU_COUNT:-4} \ --cpus boot=${CPU_COUNT:-4} \
--memory size=${MEMORY:-4G},shared=on \ --memory size=${MEMORY:-4G},shared=on \
--net "tap=,mac=,ip=,mask=" --net "tap=,ip=,mac=,mask="
$@ $@

View File

@@ -18,7 +18,7 @@ RUN apk update && apk add alpine-make-vm-image
COPY ./image /kitchen COPY ./image /kitchen
RUN sed -i "s#_REPO_#$CLOUD_CONFIG_REPO#g" /kitchen/overlay/daemon/update-keys.sh && \ RUN sed -i "s#_REPO_#$CLOUD_CONFIG_REPO#g" /kitchen/overlay/daemon/update-keys.sh && \
sed -i "s#_REVISION_#$CLOUD_CONFIG_REVISION#g" /kitchen/overlay/daemon/update-keys.sh && \ sed -i "s#_REVISION_#$CLOUD_CONFIG_REVISION#g" /kitchen/overlay/daemon/update-keys.sh && \
sed -i "s#GATEWAY_ADDRESS#$CLOUD_GATEWAY_ADDRESS#g" /kitchen/overlay/etc/dhcp/dhclient.conf sed -i "s#GATEWAY_ADDRESS#$CLOUD_GATEWAY_ADDRESS#g" /kitchen/overlay/etc/network/interfaces
COPY --from=bubble-builder /build/daemon /bin/bubble COPY --from=bubble-builder /build/daemon /bin/bubble
COPY --from=bubble-builder /build/auth_server /bin/auth-server COPY --from=bubble-builder /build/auth_server /bin/auth-server
RUN --security=insecure \ RUN --security=insecure \