mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
bsp-cli/distro-agnostic: introduce KEEP_ORIGINAL_OS_RELEASE=yes so Debian/Ubuntu PRETTY_NAME is left unchanged in /etc/os-release
- useful when downstream software wants exact Debian OS
This commit is contained in:
@@ -42,14 +42,15 @@ function artifact_armbian-bsp-cli_prepare_version() {
|
||||
"${bootscript_info[bootenv_file_contents]}"
|
||||
"${bootscript_info[has_bootscript]}"
|
||||
"${bootscript_info[has_extlinux]}"
|
||||
"${UBOOT_FW_ENV}" # not included in bootscript
|
||||
"${BOARDFAMILY}" # /etc/armbian-release
|
||||
"${LINUXFAMILY}" # /etc/armbian-release
|
||||
"${IMAGE_TYPE}" # /etc/armbian-release
|
||||
"${BOARD_TYPE}" # /etc/armbian-release
|
||||
"${INITRD_ARCH}" # /etc/armbian-release
|
||||
"${KERNEL_IMAGE_TYPE}" # /etc/armbian-release
|
||||
"${VENDOR}" # /etc/armbian-release
|
||||
"${UBOOT_FW_ENV}" # not included in bootscript
|
||||
"${KEEP_ORIGINAL_OS_RELEASE:-"no"}" # /etc/os-release
|
||||
"${BOARDFAMILY}" # /etc/armbian-release
|
||||
"${LINUXFAMILY}" # /etc/armbian-release
|
||||
"${IMAGE_TYPE}" # /etc/armbian-release
|
||||
"${BOARD_TYPE}" # /etc/armbian-release
|
||||
"${INITRD_ARCH}" # /etc/armbian-release
|
||||
"${KERNEL_IMAGE_TYPE}" # /etc/armbian-release
|
||||
"${VENDOR}" # /etc/armbian-release
|
||||
)
|
||||
declare hash_vars="undetermined"
|
||||
hash_vars="$(echo "${vars_to_hash[@]}" | sha256sum | cut -d' ' -f1)"
|
||||
|
||||
@@ -108,6 +108,13 @@ function compile_armbian-bsp-cli() {
|
||||
postinst_functions+=(board_side_bsp_cli_postinst_update_uboot_bootscript)
|
||||
fi
|
||||
|
||||
if [[ "${KEEP_ORIGINAL_OS_RELEASE:-"no"}" != "yes" ]]; then
|
||||
# add to postinst, to change PRETTY_NAME to Armbian's
|
||||
postinst_functions+=(board_side_bsp_cli_postinst_os_release_armbian)
|
||||
else
|
||||
display_alert "bsp-cli: KEEP_ORIGINAL_OS_RELEASE" "Keeping original /etc/os-release's PRETTY_NAME as original" "info"
|
||||
fi
|
||||
|
||||
# add configuration for setting uboot environment from userspace with: fw_setenv fw_printenv
|
||||
if [[ -n $UBOOT_FW_ENV ]]; then
|
||||
UBOOT_FW_ENV=($(tr ',' ' ' <<< "$UBOOT_FW_ENV"))
|
||||
@@ -321,10 +328,11 @@ function board_side_bsp_cli_postinst_base() {
|
||||
# Source the armbian-release information file
|
||||
[ -f /etc/armbian-release ] && . /etc/armbian-release
|
||||
|
||||
# Read release value from lsb-release, so deploying a bsp-cli package on top of "X" makes it "Armbian X"
|
||||
# Read release value from lsb-release and set it separately as ARMBIAN_PRETTY_NAME
|
||||
# More is done, actually taking over PRETTY_NAME, in separate board_side_bsp_cli_postinst_os_release_armbian()
|
||||
if [ -f /etc/lsb-release ]; then
|
||||
ORIGINAL_DISTRO_RELEASE="$(cat /etc/lsb-release | grep CODENAME | cut -d"=" -f2 | sed 's/.*/\u&/')"
|
||||
sed -i "s/^PRETTY_NAME=.*/PRETTY_NAME=\"${VENDOR} $REVISION ${ORIGINAL_DISTRO_RELEASE}\"/" /etc/os-release
|
||||
echo "ARMBIAN_PRETTY_NAME=\"${VENDOR} ${REVISION} ${ORIGINAL_DISTRO_RELEASE}\"" >> /etc/os-release
|
||||
echo -e "${VENDOR} ${REVISION} ${ORIGINAL_DISTRO_RELEASE} \\l \n" > /etc/issue
|
||||
echo -e "${VENDOR} ${REVISION} ${ORIGINAL_DISTRO_RELEASE}" > /etc/issue.net
|
||||
fi
|
||||
@@ -345,6 +353,17 @@ function board_side_bsp_cli_postinst_base() {
|
||||
fi
|
||||
}
|
||||
|
||||
function board_side_bsp_cli_postinst_os_release_armbian() {
|
||||
# Source the armbian-release information file
|
||||
[ -f /etc/armbian-release ] && . /etc/armbian-release
|
||||
|
||||
# Read release value from lsb-release, so deploying a bsp-cli package on top of "X" makes it "Armbian X"
|
||||
if [ -f /etc/lsb-release ]; then
|
||||
ORIGINAL_DISTRO_RELEASE="$(cat /etc/lsb-release | grep CODENAME | cut -d"=" -f2 | sed 's/.*/\u&/')"
|
||||
sed -i "s/^PRETTY_NAME=.*/PRETTY_NAME=\"${VENDOR} $REVISION ${ORIGINAL_DISTRO_RELEASE}\"/" /etc/os-release
|
||||
fi
|
||||
}
|
||||
|
||||
function board_side_bsp_cli_postinst_finish() {
|
||||
[ ! -f "/etc/network/interfaces" ] && [ -f "/etc/network/interfaces.default" ] && cp /etc/network/interfaces.default /etc/network/interfaces
|
||||
ln -sf /var/run/motd /etc/motd
|
||||
|
||||
@@ -148,7 +148,13 @@ function install_distribution_agnostic() {
|
||||
# change console welcome text
|
||||
echo -e "${VENDOR} ${IMAGE_VERSION:-"${REVISION}"} ${RELEASE^} \\l \n" > "${SDCARD}"/etc/issue
|
||||
echo "${VENDOR} ${IMAGE_VERSION:-"${REVISION}"} ${RELEASE^}" > "${SDCARD}"/etc/issue.net
|
||||
sed -i "s/^PRETTY_NAME=.*/PRETTY_NAME=\"${VENDOR} ${IMAGE_VERSION:-"${REVISION}"} ${RELEASE^}\"/" "${SDCARD}"/etc/os-release
|
||||
|
||||
# Keep, or change to Armbian's PRETTY_NAME in /etc/os-release (this is also done in the bsp-cli postinst)
|
||||
if [[ "${KEEP_ORIGINAL_OS_RELEASE:-"no"}" != "yes" ]]; then
|
||||
sed -i "s/^PRETTY_NAME=.*/PRETTY_NAME=\"${VENDOR} ${IMAGE_VERSION:-"${REVISION}"} ${RELEASE^}\"/" "${SDCARD}"/etc/os-release
|
||||
else
|
||||
display_alert "distro-agnostic: KEEP_ORIGINAL_OS_RELEASE" "Keeping original /etc/os-release's PRETTY_NAME as original" "warn"
|
||||
fi
|
||||
|
||||
# enable few bash aliases enabled in Ubuntu by default to make it even
|
||||
sed "s/#alias ll='ls -l'/alias ll='ls -l'/" -i "${SDCARD}"/etc/skel/.bashrc
|
||||
@@ -400,11 +406,11 @@ function install_distribution_agnostic() {
|
||||
if [[ "${BSPFREEZE:-"no"}" == yes ]]; then
|
||||
display_alert "Freezing Armbian packages" "$BOARD" "info"
|
||||
chroot_sdcard apt-mark hold "${image_artifacts_packages["armbian-plymouth-theme"]}" "${image_artifacts_packages["armbian-zsh"]}" \
|
||||
"${image_artifacts_packages["armbian-config"]}" "${image_artifacts_packages["armbian-bsp-desktop"]}" \
|
||||
"${image_artifacts_packages["armbian-desktop"]}" "${image_artifacts_packages["armbian-bsp-cli"]}" \
|
||||
"${image_artifacts_packages["armbian-firmware"]}" "${image_artifacts_packages["armbian-firmware-full"]}" \
|
||||
"${image_artifacts_packages["linux-headers"]}" "${image_artifacts_packages["linux-dtb"]}" \
|
||||
"${image_artifacts_packages["linux-image"]}" "${image_artifacts_packages["uboot"]}" || true
|
||||
"${image_artifacts_packages["armbian-config"]}" "${image_artifacts_packages["armbian-bsp-desktop"]}" \
|
||||
"${image_artifacts_packages["armbian-desktop"]}" "${image_artifacts_packages["armbian-bsp-cli"]}" \
|
||||
"${image_artifacts_packages["armbian-firmware"]}" "${image_artifacts_packages["armbian-firmware-full"]}" \
|
||||
"${image_artifacts_packages["linux-headers"]}" "${image_artifacts_packages["linux-dtb"]}" \
|
||||
"${image_artifacts_packages["linux-image"]}" "${image_artifacts_packages["uboot"]}" || true
|
||||
fi
|
||||
|
||||
# remove deb files
|
||||
|
||||
Reference in New Issue
Block a user