Files

27 lines
546 B
Bash
Executable File

#!/bin/bash
# usage: ./arch_specific.sh ARCH ROOTFS_DIR
#
# Replaces the following arch-specific variables in the rootfs:
#
# Variable x86_64 arm64
# ------------ ------ -------
# ##ARCH_TTY## ttyS0 ttyAMA0
set -o errexit
ARCH="$1"
ROOTFS_DIR="$2"
INITTAB_PATH="${ROOTFS_DIR}/etc/inittab"
TTY=ttyS0
if [[ "$ARCH" == arm64 ]]; then
TTY=ttyAMA0
fi
sed -i "s/##ARCH_TTY##/${TTY}/g" "$INITTAB_PATH"
sed -i "s/##ARCH_TTY##/${TTY}/g" "${ROOTFS_DIR}/.profile"
sed -i "s/root:x:/root::/g" "${ROOTFS_DIR}/etc/passwd"