Files
bearnet/image/configure.sh
2026-06-16 16:42:28 +08:00

53 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
# configure.sh — runs inside chroot after base install and overlay copy.
# Invoked via alpine-make-vm-image --script-chroot.
set -eu
_step_counter=0
step() {
_step_counter=$(( _step_counter + 1 ))
printf '\n\033[1;36m%d) %s\033[0m\n' $_step_counter "$@" >&2
}
uname -a
step 'Set timezone to UTC'
setup-timezone -z UTC
step 'Set up networking'
# The interfaces file was placed by --fs-skel-dir; link init.d scripts.
ln -sf networking /etc/init.d/net.lo
ln -sf networking /etc/init.d/net.eth0
step 'Adjust rc.conf'
sed -Ei \
-e 's/^[# ](rc_depend_strict)=.*/\1=NO/' \
-e 's/^[# ](rc_logger)=.*/\1=YES/' \
-e 's/^[# ](unicode)=.*/\1=YES/' \
/etc/rc.conf
step 'Enable base services'
rc-update add net.lo boot
rc-update add net.eth0 default
rc-update add acpid default
rc-update add docker default
rc-update add cronie default
step 'Clean up APK cache and documents'
rm -rf /var/cache/apk/* || true
rm -rf \
/usr/share/man \
/usr/share/doc \
/usr/share/info
step 'Setup git user'
git config --global user.email bearnet+keeper@sab.ee
git config --global user.name "B.B.K.K.B.K.K"
adduser -S keeper
mkdir /users
chown keeper /users
echo ''
echo '=== Configure script completed ==='