diff --git a/lib/functions/artifacts/artifact-armbian-bsp-cli.sh b/lib/functions/artifacts/artifact-armbian-bsp-cli.sh new file mode 100644 index 000000000..7638bd627 --- /dev/null +++ b/lib/functions/artifacts/artifact-armbian-bsp-cli.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash +# +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com +# +# This file is a part of the Armbian Build Framework +# https://github.com/armbian/build/ + +function artifact_armbian-bsp-cli_prepare_version() { + artifact_version="undetermined" # outer scope + artifact_version_reason="undetermined" # outer scope + + declare short_hash_size=4 + + declare fake_unchanging_base_version="1" + + # get the hashes of the lib/ bash sources involved... + declare hash_files="undetermined" + calculate_hash_for_files "${SRC}"/lib/functions/bsp/armbian-bsp-cli-deb.sh + declare bash_hash="${hash_files}" + declare bash_hash_short="${bash_hash:0:${short_hash_size}}" + + # outer scope + artifact_version="${artifact_prefix_version}${fake_unchanging_base_version}-B${bash_hash_short}" + + declare -a reasons=( + "Armbian armbian-bsp-cli" + "framework bash hash \"${bash_hash}\"" + ) + + artifact_version_reason="${reasons[*]}" # outer scope + + artifact_map_packages=( + ["armbian-bsp-cli"]="armbian-bsp-cli" + ) + + artifact_map_debs=( + ["armbian-bsp-cli"]="armbian-bsp-cli-${BOARD}${EXTRA_BSP_NAME}_${artifact_version}_${ARCH}.deb" + ) + + artifact_name="armbian-bsp-cli" + artifact_type="deb" + artifact_base_dir="${DEB_STORAGE}" + artifact_final_file="${DEB_STORAGE}/armbian-bsp-cli-${BOARD}${EXTRA_BSP_NAME}_${artifact_version}_${ARCH}.deb" + + return 0 +} + +function artifact_armbian-bsp-cli_build_from_sources() { + LOG_SECTION="compile_armbian-bsp-cli" do_with_logging compile_armbian-bsp-cli +} + +function artifact_armbian-bsp-cli_cli_adapter_pre_run() { + declare -g ARMBIAN_COMMAND_REQUIRE_BASIC_DEPS="yes" # Require prepare_host_basic to run before the command. + + # "gimme root on a Linux machine" + cli_standard_relaunch_docker_or_sudo +} + +function artifact_armbian-bsp-cli_cli_adapter_config_prep() { + use_board="no" prep_conf_main_minimal_ni < /dev/null # no stdin for this, so it bombs if tries to be interactive. +} + +function artifact_armbian-bsp-cli_get_default_oci_target() { + artifact_oci_target_base="ghcr.io/armbian/cache-packages/" +} + +function artifact_armbian-bsp-cli_is_available_in_local_cache() { + is_artifact_available_in_local_cache +} + +function artifact_armbian-bsp-cli_is_available_in_remote_cache() { + is_artifact_available_in_remote_cache +} + +function artifact_armbian-bsp-cli_obtain_from_remote_cache() { + obtain_artifact_from_remote_cache +} + +function artifact_armbian-bsp-cli_deploy_to_remote_cache() { + upload_artifact_to_oci +} diff --git a/lib/functions/artifacts/artifact-armbian-bsp-desktop.sh b/lib/functions/artifacts/artifact-armbian-bsp-desktop.sh new file mode 100644 index 000000000..c13010df9 --- /dev/null +++ b/lib/functions/artifacts/artifact-armbian-bsp-desktop.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash +# +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com +# +# This file is a part of the Armbian Build Framework +# https://github.com/armbian/build/ + +function artifact_armbian-bsp-desktop_prepare_version() { + artifact_version="undetermined" # outer scope + artifact_version_reason="undetermined" # outer scope + + declare short_hash_size=4 + + declare fake_unchanging_base_version="1" + + # get the hashes of the lib/ bash sources involved... + declare hash_files="undetermined" + calculate_hash_for_files "${SRC}"/lib/functions/bsp/armbian-bsp-desktop-deb.sh + declare bash_hash="${hash_files}" + declare bash_hash_short="${bash_hash:0:${short_hash_size}}" + + # outer scope + artifact_version="${artifact_prefix_version}${fake_unchanging_base_version}-B${bash_hash_short}" + + declare -a reasons=( + "Armbian armbian-bsp-desktop" + "framework bash hash \"${bash_hash}\"" + ) + + artifact_version_reason="${reasons[*]}" # outer scope + + artifact_map_packages=( + ["armbian-bsp-desktop"]="armbian-bsp-desktop" + ) + + artifact_map_debs=( + ["armbian-bsp-desktop"]="armbian-bsp-desktop-${BOARD}_${artifact_version}_${ARCH}.deb" + ) + + artifact_name="armbian-bsp-desktop" + artifact_type="deb" + artifact_base_dir="${DEB_STORAGE}" + artifact_final_file="${DEB_STORAGE}/${RELEASE}/armbian-bsp-desktop-${BOARD}_${artifact_version}_${ARCH}.deb" + + return 0 +} + +function artifact_armbian-bsp-desktop_build_from_sources() { + LOG_SECTION="compile_armbian-bsp-desktop" do_with_logging compile_armbian-bsp-desktop +} + +function artifact_armbian-bsp-desktop_cli_adapter_pre_run() { + declare -g ARMBIAN_COMMAND_REQUIRE_BASIC_DEPS="yes" # Require prepare_host_basic to run before the command. + + # "gimme root on a Linux machine" + cli_standard_relaunch_docker_or_sudo +} + +function artifact_armbian-bsp-desktop_cli_adapter_config_prep() { + use_board="no" prep_conf_main_minimal_ni < /dev/null # no stdin for this, so it bombs if tries to be interactive. +} + +function artifact_armbian-bsp-desktop_get_default_oci_target() { + artifact_oci_target_base="ghcr.io/armbian/cache-packages/" +} + +function artifact_armbian-bsp-desktop_is_available_in_local_cache() { + is_artifact_available_in_local_cache +} + +function artifact_armbian-bsp-desktop_is_available_in_remote_cache() { + is_artifact_available_in_remote_cache +} + +function artifact_armbian-bsp-desktop_obtain_from_remote_cache() { + obtain_artifact_from_remote_cache +} + +function artifact_armbian-bsp-desktop_deploy_to_remote_cache() { + upload_artifact_to_oci +} diff --git a/lib/functions/artifacts/artifact-armbian-config.sh b/lib/functions/artifacts/artifact-armbian-config.sh new file mode 100644 index 000000000..3b9e110b5 --- /dev/null +++ b/lib/functions/artifacts/artifact-armbian-config.sh @@ -0,0 +1,95 @@ +#!/usr/bin/env bash +# +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com +# +# This file is a part of the Armbian Build Framework +# https://github.com/armbian/build/ + +function artifact_armbian-config_prepare_version() { + artifact_version="undetermined" # outer scope + artifact_version_reason="undetermined" # outer scope + + local ARMBIAN_CONFIG_SOURCE="${ARMBIAN_CONFIG_SOURCE:-"https://github.com/armbian/config"}" + local ARMBIAN_CONFIG_BRANCH="branch:${ARMBIAN_CONFIG_BRANCH:-"master"}" + + debug_var ARMBIAN_CONFIG_SOURCE + debug_var ARMBIAN_CONFIG_BRANCH + + declare short_hash_size=4 + + declare -A GIT_INFO_ARMBIAN_CONFIG=([GIT_SOURCE]="${ARMBIAN_CONFIG_SOURCE}" [GIT_REF]="${ARMBIAN_CONFIG_BRANCH}") + run_memoized GIT_INFO_ARMBIAN_CONFIG "git2info" memoized_git_ref_to_info + debug_dict GIT_INFO_ARMBIAN_CONFIG + + declare fake_unchanging_base_version="1" + + declare short_sha1="${GIT_INFO_ARMBIAN_CONFIG[SHA1]:0:${short_hash_size}}" + + # get the hashes of the lib/ bash sources involved... + declare hash_files="undetermined" + calculate_hash_for_files "${SRC}"/lib/functions/compilation/packages/armbian-config-deb.sh + declare bash_hash="${hash_files}" + declare bash_hash_short="${bash_hash:0:${short_hash_size}}" + + # outer scope + artifact_version="${artifact_prefix_version}${fake_unchanging_base_version}-SA${short_sha1}-B${bash_hash_short}" + + declare -a reasons=( + "Armbian armbian-config git revision \"${GIT_INFO_ARMBIAN_CONFIG[SHA1]}\"" + "framework bash hash \"${bash_hash}\"" + ) + + artifact_version_reason="${reasons[*]}" # outer scope + + artifact_map_packages=( + ["armbian-config"]="armbian-config" + ) + + artifact_map_debs=( + ["armbian-config"]="armbian-config_${artifact_version}_all.deb" + ) + + artifact_name="armbian-config" + artifact_type="deb" + artifact_base_dir="${DEB_STORAGE}" + artifact_final_file="${DEB_STORAGE}/armbian-config_${artifact_version}_all.deb" + + return 0 +} + +function artifact_armbian-config_build_from_sources() { + LOG_SECTION="compile_armbian-config" do_with_logging compile_armbian-config +} + +function artifact_armbian-config_cli_adapter_pre_run() { + declare -g ARMBIAN_COMMAND_REQUIRE_BASIC_DEPS="yes" # Require prepare_host_basic to run before the command. + + # "gimme root on a Linux machine" + cli_standard_relaunch_docker_or_sudo +} + +function artifact_armbian-config_cli_adapter_config_prep() { + use_board="no" prep_conf_main_minimal_ni < /dev/null # no stdin for this, so it bombs if tries to be interactive. +} + +function artifact_armbian-config_get_default_oci_target() { + artifact_oci_target_base="ghcr.io/armbian/cache-packages/" +} + +function artifact_armbian-config_is_available_in_local_cache() { + is_artifact_available_in_local_cache +} + +function artifact_armbian-config_is_available_in_remote_cache() { + is_artifact_available_in_remote_cache +} + +function artifact_armbian-config_obtain_from_remote_cache() { + obtain_artifact_from_remote_cache +} + +function artifact_armbian-config_deploy_to_remote_cache() { + upload_artifact_to_oci +} diff --git a/lib/functions/artifacts/artifact-armbian-desktop.sh b/lib/functions/artifacts/artifact-armbian-desktop.sh new file mode 100644 index 000000000..60832c0ef --- /dev/null +++ b/lib/functions/artifacts/artifact-armbian-desktop.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash +# +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com +# +# This file is a part of the Armbian Build Framework +# https://github.com/armbian/build/ + +function artifact_armbian-desktop_prepare_version() { + artifact_version="undetermined" # outer scope + artifact_version_reason="undetermined" # outer scope + + declare short_hash_size=4 + + declare fake_unchanging_base_version="1" + + # get the hashes of the lib/ bash sources involved... + declare hash_files="undetermined" + calculate_hash_for_files "${SRC}"/lib/functions/bsp/armbian-desktop-deb.sh + declare bash_hash="${hash_files}" + declare bash_hash_short="${bash_hash:0:${short_hash_size}}" + + # outer scope + artifact_version="${artifact_prefix_version}${fake_unchanging_base_version}-B${bash_hash_short}" + + declare -a reasons=( + "Armbian armbian-desktop" + "framework bash hash \"${bash_hash}\"" + ) + + artifact_version_reason="${reasons[*]}" # outer scope + + artifact_map_packages=( + ["armbian-desktop"]="armbian-desktop" + ) + + artifact_map_debs=( + ["armbian-desktop"]="armbian-desktop-${CHOSEN_DESKTOP}_${artifact_version}_all.deb" + ) + + artifact_name="armbian-desktop" + artifact_type="deb" + artifact_base_dir="${DEB_STORAGE}" + artifact_final_file="${DEB_STORAGE}/${RELEASE}/${CHOSEN_DESKTOP}_${artifact_version}_all.deb" + + return 0 +} + +function artifact_armbian-desktop_build_from_sources() { + LOG_SECTION="compile_armbian-desktop" do_with_logging compile_armbian-desktop +} + +function artifact_armbian-desktop_cli_adapter_pre_run() { + declare -g ARMBIAN_COMMAND_REQUIRE_BASIC_DEPS="yes" # Require prepare_host_basic to run before the command. + + # "gimme root on a Linux machine" + cli_standard_relaunch_docker_or_sudo +} + +function artifact_armbian-desktop_cli_adapter_config_prep() { + use_board="no" prep_conf_main_minimal_ni < /dev/null # no stdin for this, so it bombs if tries to be interactive. +} + +function artifact_armbian-desktop_get_default_oci_target() { + artifact_oci_target_base="ghcr.io/armbian/cache-packages/" +} + +function artifact_armbian-desktop_is_available_in_local_cache() { + is_artifact_available_in_local_cache +} + +function artifact_armbian-desktop_is_available_in_remote_cache() { + is_artifact_available_in_remote_cache +} + +function artifact_armbian-desktop_obtain_from_remote_cache() { + obtain_artifact_from_remote_cache +} + +function artifact_armbian-desktop_deploy_to_remote_cache() { + upload_artifact_to_oci +} diff --git a/lib/functions/artifacts/artifact-armbian-plymouth-theme.sh b/lib/functions/artifacts/artifact-armbian-plymouth-theme.sh new file mode 100644 index 000000000..d8ae8b401 --- /dev/null +++ b/lib/functions/artifacts/artifact-armbian-plymouth-theme.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash +# +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com +# +# This file is a part of the Armbian Build Framework +# https://github.com/armbian/build/ + +function artifact_armbian-plymouth-theme_prepare_version() { + artifact_version="undetermined" # outer scope + artifact_version_reason="undetermined" # outer scope + + declare short_hash_size=4 + + declare fake_unchanging_base_version="1" + + # get the hashes of the lib/ bash sources involved... + declare hash_files="undetermined" + calculate_hash_for_files "${SRC}"/lib/functions/compilation/packages/armbian-plymouth-theme-deb.sh + declare bash_hash="${hash_files}" + declare bash_hash_short="${bash_hash:0:${short_hash_size}}" + + # outer scope + artifact_version="${artifact_prefix_version}-B${bash_hash_short}" + + declare -a reasons=( + "Armbian armbian-plymouth-theme" + "framework bash hash \"${bash_hash}\"" + ) + + artifact_version_reason="${reasons[*]}" # outer scope + + artifact_map_packages=( + ["armbian-plymouth-theme"]="armbian-plymouth-theme" + ) + + artifact_map_debs=( + ["armbian-plymouth-theme"]="armbian-plymouth-theme_${artifact_version}_all.deb" + ) + + artifact_name="armbian-plymouth-theme" + artifact_type="deb" + artifact_base_dir="${DEB_STORAGE}" + artifact_final_file="${DEB_STORAGE}/armbian-plymouth-theme_${artifact_version}_all.deb" + + return 0 +} + +function artifact_armbian-plymouth-theme_build_from_sources() { + LOG_SECTION="compile_armbian-plymouth-theme" do_with_logging compile_armbian-plymouth-theme +} + +function artifact_armbian-plymouth-theme_cli_adapter_pre_run() { + declare -g ARMBIAN_COMMAND_REQUIRE_BASIC_DEPS="yes" # Require prepare_host_basic to run before the command. + + # "gimme root on a Linux machine" + cli_standard_relaunch_docker_or_sudo +} + +function artifact_armbian-plymouth-theme_cli_adapter_config_prep() { + use_board="no" prep_conf_main_minimal_ni < /dev/null # no stdin for this, so it bombs if tries to be interactive. +} + +function artifact_armbian-plymouth-theme_get_default_oci_target() { + artifact_oci_target_base="ghcr.io/armbian/cache-packages/" +} + +function artifact_armbian-plymouth-theme_is_available_in_local_cache() { + is_artifact_available_in_local_cache +} + +function artifact_armbian-plymouth-theme_is_available_in_remote_cache() { + is_artifact_available_in_remote_cache +} + +function artifact_armbian-plymouth-theme_obtain_from_remote_cache() { + obtain_artifact_from_remote_cache +} + +function artifact_armbian-plymouth-theme_deploy_to_remote_cache() { + upload_artifact_to_oci +} diff --git a/lib/functions/artifacts/artifact-armbian-zsh.sh b/lib/functions/artifacts/artifact-armbian-zsh.sh new file mode 100644 index 000000000..1f170580d --- /dev/null +++ b/lib/functions/artifacts/artifact-armbian-zsh.sh @@ -0,0 +1,95 @@ +#!/usr/bin/env bash +# +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com +# +# This file is a part of the Armbian Build Framework +# https://github.com/armbian/build/ + +function artifact_armbian-zsh_prepare_version() { + artifact_version="undetermined" # outer scope + artifact_version_reason="undetermined" # outer scope + + local ARMBIAN_ZSH_SOURCE="${ARMBIAN_ZSH_SOURCE:-"https://github.com/ohmyzsh/ohmyzsh"}" + local ARMBIAN_ZSH_BRANCH="branch:${ARMBIAN_ZSH_BRANCH:-"master"}" + + debug_var ARMBIAN_ZSH_SOURCE + debug_var ARMBIAN_ZSH_BRANCH + + declare short_hash_size=4 + + declare -A GIT_INFO_ARMBIAN_ZSH=([GIT_SOURCE]="${ARMBIAN_ZSH_SOURCE}" [GIT_REF]="${ARMBIAN_ZSH_BRANCH}") + run_memoized GIT_INFO_ARMBIAN_ZSH "git2info" memoized_git_ref_to_info + debug_dict GIT_INFO_ARMBIAN_ZSH + + declare fake_unchanging_base_version="1" + + declare short_sha1="${GIT_INFO_ARMBIAN_ZSH[SHA1]:0:${short_hash_size}}" + + # get the hashes of the lib/ bash sources involved... + declare hash_files="undetermined" + calculate_hash_for_files "${SRC}"/lib/functions/compilation/packages/armbian-zsh-deb.sh + declare bash_hash="${hash_files}" + declare bash_hash_short="${bash_hash:0:${short_hash_size}}" + + # outer scope + artifact_version="${artifact_prefix_version}${fake_unchanging_base_version}-SA${short_sha1}-B${bash_hash_short}" + + declare -a reasons=( + "Armbian armbian-zsh git revision \"${GIT_INFO_ARMBIAN_ZSH[SHA1]}\"" + "framework bash hash \"${bash_hash}\"" + ) + + artifact_version_reason="${reasons[*]}" # outer scope + + artifact_map_packages=( + ["armbian-zsh"]="armbian-zsh" + ) + + artifact_map_debs=( + ["armbian-zsh"]="armbian-zsh_${artifact_version}_all.deb" + ) + + artifact_name="armbian-zsh" + artifact_type="deb" + artifact_base_dir="${DEB_STORAGE}" + artifact_final_file="${DEB_STORAGE}/armbian-zsh_${artifact_version}_all.deb" + + return 0 +} + +function artifact_armbian-zsh_build_from_sources() { + LOG_SECTION="compile_armbian-zsh" do_with_logging compile_armbian-zsh +} + +function artifact_armbian-zsh_cli_adapter_pre_run() { + declare -g ARMBIAN_COMMAND_REQUIRE_BASIC_DEPS="yes" # Require prepare_host_basic to run before the command. + + # "gimme root on a Linux machine" + cli_standard_relaunch_docker_or_sudo +} + +function artifact_armbian-zsh_cli_adapter_config_prep() { + use_board="no" prep_conf_main_minimal_ni < /dev/null # no stdin for this, so it bombs if tries to be interactive. +} + +function artifact_armbian-zsh_get_default_oci_target() { + artifact_oci_target_base="ghcr.io/armbian/cache-packages/" +} + +function artifact_armbian-zsh_is_available_in_local_cache() { + is_artifact_available_in_local_cache +} + +function artifact_armbian-zsh_is_available_in_remote_cache() { + is_artifact_available_in_remote_cache +} + +function artifact_armbian-zsh_obtain_from_remote_cache() { + obtain_artifact_from_remote_cache +} + +function artifact_armbian-zsh_deploy_to_remote_cache() { + upload_artifact_to_oci +} diff --git a/lib/functions/artifacts/artifact-fake-ubuntu-advantage-tools.sh b/lib/functions/artifacts/artifact-fake-ubuntu-advantage-tools.sh new file mode 100644 index 000000000..e425a3073 --- /dev/null +++ b/lib/functions/artifacts/artifact-fake-ubuntu-advantage-tools.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash +# +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com +# +# This file is a part of the Armbian Build Framework +# https://github.com/armbian/build/ + +function artifact_fake_ubuntu_advantage_tools_prepare_version() { + artifact_version="undetermined" # outer scope + artifact_version_reason="undetermined" # outer scope + + declare short_hash_size=4 + + declare fake_unchanging_base_version="1" + + # get the hashes of the lib/ bash sources involved... + declare hash_files="undetermined" + calculate_hash_for_files "${SRC}"/lib/functions/compilation/packages/fake_ubuntu_advantage_tools-deb.sh + declare bash_hash="${hash_files}" + declare bash_hash_short="${bash_hash:0:${short_hash_size}}" + + # outer scope + artifact_version="${artifact_prefix_version}${fake_unchanging_base_version}-B${bash_hash_short}" + + declare -a reasons=( + "Armbian fake-ubuntu-advantage-tools" + "framework bash hash \"${bash_hash}\"" + ) + + artifact_version_reason="${reasons[*]}" # outer scope + + artifact_map_packages=( + ["fake-ubuntu-advantage-tools"]="fake-ubuntu-advantage-tools" + ) + + artifact_map_debs=( + ["fake-ubuntu-advantage-tools"]="fake-ubuntu-advantage-tools_${artifact_version}_all.deb" + ) + + artifact_name="fake-ubuntu-advantage-tools" + artifact_type="deb" + artifact_base_dir="${DEB_STORAGE}" + artifact_final_file="${DEB_STORAGE}/fake-ubuntu-advantage-tools_${artifact_version}_all.deb" + + return 0 +} + +function artifact_fake_ubuntu_advantage_tools_build_from_sources() { + LOG_SECTION="compile_fake_ubuntu_advantage_tools" do_with_logging compile_fake_ubuntu_advantage_tools +} + +function artifact_fake_ubuntu_advantage_tools_cli_adapter_pre_run() { + declare -g ARMBIAN_COMMAND_REQUIRE_BASIC_DEPS="yes" # Require prepare_host_basic to run before the command. + + # "gimme root on a Linux machine" + cli_standard_relaunch_docker_or_sudo +} + +function artifact_fake_ubuntu_advantage_tools_cli_adapter_config_prep() { + use_board="no" prep_conf_main_minimal_ni < /dev/null # no stdin for this, so it bombs if tries to be interactive. +} + +function artifact_fake_ubuntu_advantage_tools_get_default_oci_target() { + artifact_oci_target_base="ghcr.io/armbian/cache-packages/" +} + +function artifact_fake_ubuntu_advantage_tools_is_available_in_local_cache() { + is_artifact_available_in_local_cache +} + +function artifact_fake_ubuntu_advantage_tools_is_available_in_remote_cache() { + is_artifact_available_in_remote_cache +} + +function artifact_fake_ubuntu_advantage_tools_obtain_from_remote_cache() { + obtain_artifact_from_remote_cache +} + +function artifact_fake_ubuntu_advantage_tools_deploy_to_remote_cache() { + upload_artifact_to_oci +} diff --git a/lib/functions/artifacts/artifacts-registry.sh b/lib/functions/artifacts/artifacts-registry.sh index 994652abf..a95058dce 100644 --- a/lib/functions/artifacts/artifacts-registry.sh +++ b/lib/functions/artifacts/artifacts-registry.sh @@ -18,6 +18,13 @@ function armbian_register_artifacts() { ["uboot"]="uboot" ["firmware"]="firmware" ["full_firmware"]="full_firmware" + ["fake_ubuntu_advantage_tools"]="fake_ubuntu_advantage_tools" + ["armbian-config"]="armbian-config" + ["armbian-zsh"]="armbian-zsh" + ["armbian-plymouth-theme"]="armbian-plymouth-theme" + ["armbian-bsp-cli"]="armbian-bsp-cli" + ["armbian-bsp-desktop"]="armbian-bsp-desktop" + ["armbian-desktop"]="armbian-desktop" # tar.zst ["rootfs"]="rootfs" diff --git a/lib/functions/bsp/bsp-cli.sh b/lib/functions/bsp/armbian-bsp-cli-deb.sh similarity index 96% rename from lib/functions/bsp/bsp-cli.sh rename to lib/functions/bsp/armbian-bsp-cli-deb.sh index f26bc1923..4c76aae40 100644 --- a/lib/functions/bsp/bsp-cli.sh +++ b/lib/functions/bsp/armbian-bsp-cli-deb.sh @@ -7,7 +7,12 @@ # This file is a part of the Armbian Build Framework # https://github.com/armbian/build/ -function create_board_package() { +function compile_armbian-bsp-cli() { + : "${artifact_version:?artifact_version is not set}" + + declare -g BSP_CLI_PACKAGE_NAME="armbian-bsp-cli-${BOARD}${EXTRA_BSP_NAME}" + declare -g BSP_CLI_PACKAGE_FULLNAME="${BSP_CLI_PACKAGE_NAME}_${artifact_version}_${ARCH}" + display_alert "Creating board support package for CLI" "$CHOSEN_ROOTFS" "info" declare cleanup_id="" bsptempdir="" @@ -63,7 +68,7 @@ function create_board_package() { # Depends: fping is needed for armbianmonitor to upload armbian-hardware-monitor.log cat <<- EOF > "${destination}"/DEBIAN/control Package: ${BSP_CLI_PACKAGE_NAME} - Version: $REVISION + Version: ${artifact_version} Architecture: $ARCH Maintainer: $MAINTAINER <$MAINTAINERMAIL> Installed-Size: 1 @@ -298,7 +303,7 @@ function create_board_package() { BOARDFAMILY=${BOARDFAMILY} BUILD_REPOSITORY_URL=${BUILD_REPOSITORY_URL} BUILD_REPOSITORY_COMMIT=${BUILD_REPOSITORY_COMMIT} - VERSION=$REVISION + VERSION=${artifact_version} LINUXFAMILY=$LINUXFAMILY ARCH=$ARCHITECTURE IMAGE_TYPE=$IMAGE_TYPE @@ -330,9 +335,10 @@ function create_board_package() { find "${destination}" ! -type l -print0 2> /dev/null | xargs -0r chmod 'go=rX,u+rw,a-s' # create board DEB file - fakeroot_dpkg_deb_build "${destination}" "${destination}.deb" - mkdir -p "${DEB_STORAGE}/" - run_host_command_logged rsync --remove-source-files -r "${destination}.deb" "${DEB_STORAGE}/" + fakeroot_dpkg_deb_build "${destination}" "${DEB_STORAGE}" +#"${destination}.deb" +# mkdir -p "${DEB_STORAGE}/" +# run_host_command_logged rsync --remove-source-files -r "${destination}.deb" "${DEB_STORAGE}/" done_with_temp_dir "${cleanup_id}" # changes cwd to "${SRC}" and fires the cleanup function early diff --git a/lib/functions/bsp/armbian-bsp-desktop-deb.sh b/lib/functions/bsp/armbian-bsp-desktop-deb.sh new file mode 100644 index 000000000..c7fd0702c --- /dev/null +++ b/lib/functions/bsp/armbian-bsp-desktop-deb.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash +# +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com +# +# This file is a part of the Armbian Build Framework +# https://github.com/armbian/build/ + +function compile_armbian-bsp-desktop() { + : "${artifact_version:?artifact_version is not set}" + + display_alert "Creating board support package for desktop" "${package_name}" "info" + + local package_name="${BSP_DESKTOP_PACKAGE_FULLNAME}" + declare cleanup_id="" tmp_dir="" + prepare_temp_dir_in_workdir_and_schedule_cleanup "bsp-desktop2" cleanup_id tmp_dir # namerefs + + local destination=${tmp_dir}/${BOARD}/${BSP_DESKTOP_PACKAGE_FULLNAME} + rm -rf "${destination}" + mkdir -p "${destination}"/DEBIAN + + copy_all_packages_files_for "bsp-desktop" + + # set up control file + cat <<- EOF > "${destination}"/DEBIAN/control + Package: armbian-bsp-desktop-${BOARD} + Version: ${artifact_version} + Architecture: $ARCH + Maintainer: $MAINTAINER <$MAINTAINERMAIL> + Installed-Size: 1 + Section: xorg + Priority: optional + Provides: armbian-bsp-desktop, armbian-bsp-desktop-${BOARD} + Depends: ${BSP_CLI_PACKAGE_NAME} + Description: Armbian Board Specific Packages for desktop users using $ARCH ${BOARD} machines + EOF + + # Recreating the DEBIAN/postinst file + echo "#!/bin/bash -e" > "${destination}/DEBIAN/postinst" + echo "${AGGREGATED_DESKTOP_BSP_POSTINST}" >> "${destination}/DEBIAN/postinst" + echo "exit 0" >> "${destination}/DEBIAN/postinst" + chmod 755 "${destination}"/DEBIAN/postinst + + # Armbian create_desktop_package scripts + mkdir -p "${destination}"/etc/armbian + # @TODO: error information? This is very likely to explode.... + eval "${AGGREGATED_DESKTOP_BSP_PREPARE}" + + mkdir -p "${DEB_STORAGE}/${RELEASE}" + cd "${destination}" || exit_with_error "Failed to cd to ${destination}" + cd .. + fakeroot_dpkg_deb_build "${destination}" "${DEB_STORAGE}/${RELEASE}" + + done_with_temp_dir "${cleanup_id}" # changes cwd to "${SRC}" and fires the cleanup function early +} diff --git a/lib/functions/bsp/armbian-desktop-deb.sh b/lib/functions/bsp/armbian-desktop-deb.sh new file mode 100644 index 000000000..0b06b2b89 --- /dev/null +++ b/lib/functions/bsp/armbian-desktop-deb.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +# +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com +# +# This file is a part of the Armbian Build Framework +# https://github.com/armbian/build/ + +function compile_armbian-desktop() { + : "${artifact_version:?artifact_version is not set}" + + # produced by aggregation.py + display_alert "bsp-desktop: AGGREGATED_PACKAGES_DESKTOP_COMMA" "'${AGGREGATED_PACKAGES_DESKTOP_COMMA}'" "debug" + + declare cleanup_id="" tmp_dir="" + prepare_temp_dir_in_workdir_and_schedule_cleanup "bsp-desktop" cleanup_id tmp_dir # namerefs + + declare destination="${tmp_dir}/${BOARD}/${CHOSEN_DESKTOP}_${artifact_version}_all" + rm -rf "${destination}" + mkdir -p "${destination}"/DEBIAN + + # set up control file + cat <<- EOF > "${destination}"/DEBIAN/control + Package: ${CHOSEN_DESKTOP} + Version: ${artifact_version} + Architecture: all + Maintainer: $MAINTAINER <$MAINTAINERMAIL> + Installed-Size: 1 + Section: xorg + Priority: optional + Recommends: ${AGGREGATED_PACKAGES_DESKTOP_COMMA}, armbian-bsp-desktop + Provides: ${CHOSEN_DESKTOP}, armbian-${RELEASE}-desktop + Conflicts: gdm3 + Description: Armbian desktop for ${DISTRIBUTION} ${RELEASE} + EOF + + # Recreating the DEBIAN/postinst file + echo "#!/bin/bash -e" > "${destination}/DEBIAN/postinst" + echo "${AGGREGATED_DESKTOP_POSTINST}" >> "${destination}/DEBIAN/postinst" + echo "exit 0" >> "${destination}/DEBIAN/postinst" + chmod 755 "${destination}"/DEBIAN/postinst + + # Armbian create_desktop_package scripts + mkdir -p "${destination}"/etc/armbian + # @TODO: error information? This is very likely to explode.... + eval "${AGGREGATED_DESKTOP_CREATE_DESKTOP_PACKAGE}" + + display_alert "Building desktop package" "${CHOSEN_DESKTOP}_${artifact_version}_all" "info" + + mkdir -p "${DEB_STORAGE}/${RELEASE}" + #cd "${destination}" || exit_with_error "Failed to cd to ${destination}" + #cd .. + fakeroot_dpkg_deb_build "${destination}" "${DEB_STORAGE}/${RELEASE}" + + done_with_temp_dir "${cleanup_id}" # changes cwd to "${SRC}" and fires the cleanup function early +} diff --git a/lib/functions/bsp/bsp-desktop.sh b/lib/functions/bsp/bsp-desktop.sh deleted file mode 100644 index a96733f39..000000000 --- a/lib/functions/bsp/bsp-desktop.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env bash -# -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com -# -# This file is a part of the Armbian Build Framework -# https://github.com/armbian/build/ - -function create_desktop_package() { - # produced by aggregation.py - display_alert "bsp-desktop: AGGREGATED_PACKAGES_DESKTOP_COMMA" "'${AGGREGATED_PACKAGES_DESKTOP_COMMA}'" "debug" - - declare cleanup_id="" tmp_dir="" - prepare_temp_dir_in_workdir_and_schedule_cleanup "bsp-desktop" cleanup_id tmp_dir # namerefs - - declare destination="${tmp_dir}/${BOARD}/${CHOSEN_DESKTOP}_${REVISION}_all" - rm -rf "${destination}" - mkdir -p "${destination}"/DEBIAN - - # set up control file - cat <<- EOF > "${destination}"/DEBIAN/control - Package: ${CHOSEN_DESKTOP} - Version: $REVISION - Architecture: all - Maintainer: $MAINTAINER <$MAINTAINERMAIL> - Installed-Size: 1 - Section: xorg - Priority: optional - Recommends: ${AGGREGATED_PACKAGES_DESKTOP_COMMA}, armbian-bsp-desktop - Provides: ${CHOSEN_DESKTOP}, armbian-${RELEASE}-desktop - Conflicts: gdm3 - Description: Armbian desktop for ${DISTRIBUTION} ${RELEASE} - EOF - - # Recreating the DEBIAN/postinst file - echo "#!/bin/bash -e" > "${destination}/DEBIAN/postinst" - echo "${AGGREGATED_DESKTOP_POSTINST}" >> "${destination}/DEBIAN/postinst" - echo "exit 0" >> "${destination}/DEBIAN/postinst" - chmod 755 "${destination}"/DEBIAN/postinst - - # Armbian create_desktop_package scripts - mkdir -p "${destination}"/etc/armbian - # @TODO: error information? This is very likely to explode.... - eval "${AGGREGATED_DESKTOP_CREATE_DESKTOP_PACKAGE}" - - display_alert "Building desktop package" "${CHOSEN_DESKTOP}_${REVISION}_all" "info" - - mkdir -p "${DEB_STORAGE}/${RELEASE}" - cd "${destination}" || exit_with_error "Failed to cd to ${destination}" - cd .. - fakeroot_dpkg_deb_build "${destination}" "${DEB_STORAGE}/${RELEASE}/${CHOSEN_DESKTOP}_${REVISION}_all.deb" - - done_with_temp_dir "${cleanup_id}" # changes cwd to "${SRC}" and fires the cleanup function early -} - -function create_bsp_desktop_package() { - display_alert "Creating board support package for desktop" "${package_name}" "info" - - local package_name="${BSP_DESKTOP_PACKAGE_FULLNAME}" - declare cleanup_id="" tmp_dir="" - prepare_temp_dir_in_workdir_and_schedule_cleanup "bsp-desktop2" cleanup_id tmp_dir # namerefs - - local destination=${tmp_dir}/${BOARD}/${BSP_DESKTOP_PACKAGE_FULLNAME} - rm -rf "${destination}" - mkdir -p "${destination}"/DEBIAN - - copy_all_packages_files_for "bsp-desktop" - - # set up control file - cat <<- EOF > "${destination}"/DEBIAN/control - Package: armbian-bsp-desktop-${BOARD} - Version: $REVISION - Architecture: $ARCH - Maintainer: $MAINTAINER <$MAINTAINERMAIL> - Installed-Size: 1 - Section: xorg - Priority: optional - Provides: armbian-bsp-desktop, armbian-bsp-desktop-${BOARD} - Depends: ${BSP_CLI_PACKAGE_NAME} - Description: Armbian Board Specific Packages for desktop users using $ARCH ${BOARD} machines - EOF - - # Recreating the DEBIAN/postinst file - echo "#!/bin/bash -e" > "${destination}/DEBIAN/postinst" - echo "${AGGREGATED_DESKTOP_BSP_POSTINST}" >> "${destination}/DEBIAN/postinst" - echo "exit 0" >> "${destination}/DEBIAN/postinst" - chmod 755 "${destination}"/DEBIAN/postinst - - # Armbian create_desktop_package scripts - mkdir -p "${destination}"/etc/armbian - # @TODO: error information? This is very likely to explode.... - eval "${AGGREGATED_DESKTOP_BSP_PREPARE}" - - mkdir -p "${DEB_STORAGE}/${RELEASE}" - cd "${destination}" || exit_with_error "Failed to cd to ${destination}" - cd .. - fakeroot_dpkg_deb_build "${destination}" "${DEB_STORAGE}/${RELEASE}/${package_name}.deb" - - done_with_temp_dir "${cleanup_id}" # changes cwd to "${SRC}" and fires the cleanup function early -} diff --git a/lib/functions/cli/commands.sh b/lib/functions/cli/commands.sh index 6355c213a..21cad2720 100644 --- a/lib/functions/cli/commands.sh +++ b/lib/functions/cli/commands.sh @@ -39,11 +39,19 @@ function armbian_register_commands() { ["rootfs"]="artifact" ["firmware"]="artifact" ["firmware-full"]="artifact" + ["armbian-config"]="artifact" + ["armbian-zsh"]="artifact" + ["armbian-plymouth-theme"]="artifact" + ["armbian-bsp-cli"]="artifact" + ["armbian-bsp-desktop"]="artifact" + ["armbian-desktop"]="artifact" ["kernel"]="artifact" ["kernel-config"]="artifact" ["u-boot"]="artifact" ["uboot"]="artifact" + ["fake_ubuntu_advantage_tools"]="fake_ubuntu_advantage_tools" + ["undecided"]="undecided" # implemented in cli_undecided_pre_run and cli_undecided_run - relaunches either build or docker ) @@ -69,6 +77,13 @@ function armbian_register_commands() { ["u-boot"]="WHAT='uboot' ${common_cli_artifact_vars}" ["firmware"]="WHAT='firmware' ${common_cli_artifact_vars}" ["firmware-full"]="WHAT='full_firmware' ${common_cli_artifact_vars}" + ["fake-ubuntu-advantage-tools"]="WHAT='fake-ubuntu-advantage-tools' ${common_cli_artifact_vars}" + ["armbian-config"]="WHAT='armbian-config' ${common_cli_artifact_vars}" + ["armbian-zsh"]="WHAT='armbian-zsh' ${common_cli_artifact_vars}" + ["armbian-plymouth-theme"]="WHAT='armbian-plymouth-theme' ${common_cli_artifact_vars}" + ["armbian-bsp-cli"]="WHAT='armbian-bsp-cli' ${common_cli_artifact_vars}" + ["armbian-bsp-desktop"]="WHAT='armbian-bsp-desktop' ${common_cli_artifact_vars}" + ["armbian-desktop"]="WHAT='armbian-desktop' ${common_cli_artifact_vars}" ["rootfs"]="WHAT='rootfs' ${common_cli_artifact_vars}" ["oras-upload"]="ORAS_OPERATION='upload'" diff --git a/lib/functions/compilation/packages/armbian-config-deb.sh b/lib/functions/compilation/packages/armbian-config-deb.sh index bc300ccb0..5f9e05fe7 100644 --- a/lib/functions/compilation/packages/armbian-config-deb.sh +++ b/lib/functions/compilation/packages/armbian-config-deb.sh @@ -8,30 +8,43 @@ # https://github.com/armbian/build/ compile_armbian-config() { + : "${artifact_version:?artifact_version is not set}" + + display_alert "Generating armbian-config package" "@host" "info" declare cleanup_id="" tmp_dir="" prepare_temp_dir_in_workdir_and_schedule_cleanup "deb-armbian-config" cleanup_id tmp_dir # namerefs - declare armbian_config_dir="armbian-config_${REVISION}_all" - display_alert "Building deb" "armbian-config" "info" + declare armbian_config_dir="armbian-config" + mkdir -p "${tmp_dir}/${armbian_config_dir}" + + local ARMBIAN_CONFIG_GIT_SOURCE="${ARMBIAN_FIRMWARE_GIT_SOURCE:-"https://github.com/armbian/config"}" + local ARMBIAN_CONFIG_GIT_BRANCH="${ARMBIAN_FIRMWARE_GIT_BRANCH:-"master"}" fetch_from_repo "https://github.com/armbian/config" "armbian-config" "branch:master" + # this is also not getting any updates fetch_from_repo "https://github.com/dylanaraps/neofetch" "neofetch" "tag:7.1.0" + # Fetch Armbian config from git. + declare fetched_revision + do_checkout="no" fetch_from_repo "${ARMBIAN_CONFIG_GIT_SOURCE}" "armbian-config-git" "branch:${ARMBIAN_CONFIG_GIT_BRANCH}" + declare -r armbian_firmware_git_sha1="${fetched_revision}" + # @TODO: move this to where it is actually used; not everyone needs to pull this in fetch_from_repo "$GITHUB_SOURCE/complexorganizations/wireguard-manager" "wireguard-manager" "branch:main" mkdir -p "${tmp_dir}/${armbian_config_dir}"/{DEBIAN,usr/bin/,usr/sbin/,usr/lib/armbian-config/} + cd "${tmp_dir}/${armbian_config_dir}" || exit_with_error "can't change directory" + # set up control file - cat <<- END > "${tmp_dir}/${armbian_config_dir}"/DEBIAN/control + cat <<- END > DEBIAN/control Package: armbian-config - Version: $REVISION + Version: ${artifact_version} Architecture: all Maintainer: $MAINTAINER <$MAINTAINERMAIL> Replaces: armbian-bsp, neofetch - Depends: bash, iperf3, psmisc, curl, bc, expect, dialog, pv, zip, \ - debconf-utils, unzip, build-essential, html2text, html2text, dirmngr, software-properties-common, debconf, jq + Depends: bash, iperf3, psmisc, curl, bc, expect, dialog, pv, zip, debconf-utils, unzip, build-essential, html2text, html2text, dirmngr, software-properties-common, debconf, jq Recommends: armbian-bsp Suggests: libpam-google-authenticator, qrencode, network-manager, sunxi-tools Section: utils @@ -55,9 +68,7 @@ compile_armbian-config() { ln -sf /usr/sbin/armbian-config "${tmp_dir}/${armbian_config_dir}"/usr/bin/armbian-config ln -sf /usr/sbin/softy "${tmp_dir}/${armbian_config_dir}"/usr/bin/softy - fakeroot_dpkg_deb_build "${tmp_dir}/${armbian_config_dir}" - - run_host_command_logged rsync --remove-source-files -r "${tmp_dir}/${armbian_config_dir}.deb" "${DEB_STORAGE}/" + fakeroot_dpkg_deb_build "${tmp_dir}/${armbian_config_dir}" "${DEB_STORAGE}" done_with_temp_dir "${cleanup_id}" # changes cwd to "${SRC}" and fires the cleanup function early diff --git a/lib/functions/compilation/packages/plymouth-deb.sh b/lib/functions/compilation/packages/armbian-plymouth-theme-deb.sh similarity index 84% rename from lib/functions/compilation/packages/plymouth-deb.sh rename to lib/functions/compilation/packages/armbian-plymouth-theme-deb.sh index 72597b5b9..a4590cdd0 100644 --- a/lib/functions/compilation/packages/plymouth-deb.sh +++ b/lib/functions/compilation/packages/armbian-plymouth-theme-deb.sh @@ -7,20 +7,23 @@ # This file is a part of the Armbian Build Framework # https://github.com/armbian/build/ -compile_plymouth_theme_armbian() { +compile_armbian-plymouth-theme() { + : "${artifact_version:?artifact_version is not set}" declare cleanup_id="" tmp_dir="" prepare_temp_dir_in_workdir_and_schedule_cleanup "deb-armbian-plymouth-theme" cleanup_id tmp_dir # namerefs - declare plymouth_theme_armbian_dir=armbian-plymouth-theme_${REVISION}_all - display_alert "Building deb" "armbian-plymouth-theme" "info" + declare plymouth_theme_armbian_dir="armbian-plymouth-theme" + mkdir -p "${tmp_dir}/${plymouth_theme_armbian_dir}" run_host_command_logged mkdir -p "${tmp_dir}/${plymouth_theme_armbian_dir}"/{DEBIAN,usr/share/plymouth/themes/armbian} + cd "${tmp_dir}/${plymouth_theme_armbian_dir}" || exit_with_error "can't change directory" + # set up control file - cat <<- END > "${tmp_dir}/${plymouth_theme_armbian_dir}"/DEBIAN/control + cat <<- END > DEBIAN/control Package: armbian-plymouth-theme - Version: $REVISION + Version: ${artifact_version} Architecture: all Maintainer: $MAINTAINER <$MAINTAINERMAIL> Depends: plymouth, plymouth-themes @@ -52,9 +55,7 @@ compile_plymouth_theme_armbian() { run_host_command_logged cp "${SRC}"/packages/plymouth-theme-armbian/armbian.plymouth \ "${tmp_dir}/${plymouth_theme_armbian_dir}"/usr/share/plymouth/themes/armbian/ - fakeroot_dpkg_deb_build "${tmp_dir}/${plymouth_theme_armbian_dir}" - - run_host_command_logged rsync --remove-source-files -rq "${tmp_dir}/${plymouth_theme_armbian_dir}.deb" "${DEB_STORAGE}/" + fakeroot_dpkg_deb_build "${tmp_dir}/${plymouth_theme_armbian_dir}" "${DEB_STORAGE}" done_with_temp_dir "${cleanup_id}" # changes cwd to "${SRC}" and fires the cleanup function early } diff --git a/lib/functions/compilation/packages/zsh-deb.sh b/lib/functions/compilation/packages/armbian-zsh-deb.sh similarity index 88% rename from lib/functions/compilation/packages/zsh-deb.sh rename to lib/functions/compilation/packages/armbian-zsh-deb.sh index 5731ab016..a7f9ee45a 100644 --- a/lib/functions/compilation/packages/zsh-deb.sh +++ b/lib/functions/compilation/packages/armbian-zsh-deb.sh @@ -8,21 +8,25 @@ # https://github.com/armbian/build/ compile_armbian-zsh() { + : "${artifact_version:?artifact_version is not set}" + declare cleanup_id="" tmp_dir="" prepare_temp_dir_in_workdir_and_schedule_cleanup "deb-zsh" cleanup_id tmp_dir # namerefs - declare armbian_zsh_dir="armbian-zsh_${REVISION}_all" - display_alert "Building deb" "armbian-zsh" "info" + declare armbian_zsh_dir="armbian-zsh" + mkdir -p "${tmp_dir}/${armbian_zsh_dir}" fetch_from_repo "$GITHUB_SOURCE/ohmyzsh/ohmyzsh" "oh-my-zsh" "branch:master" fetch_from_repo "$GITHUB_SOURCE/mroth/evalcache" "evalcache" "branch:master" mkdir -p "${tmp_dir}/${armbian_zsh_dir}"/{DEBIAN,etc/skel/,etc/oh-my-zsh/,/etc/skel/.oh-my-zsh/cache} + cd "${tmp_dir}/${armbian_zsh_dir}" || exit_with_error "can't change directory" + # set up control file - cat <<- END > "${tmp_dir}/${armbian_zsh_dir}"/DEBIAN/control + cat <<- END > DEBIAN/control Package: armbian-zsh - Version: $REVISION + Version: ${artifact_version} Architecture: all Maintainer: $MAINTAINER <$MAINTAINERMAIL> Depends: zsh, tmux @@ -32,7 +36,7 @@ compile_armbian-zsh() { END # set up post install script - cat <<- END > "${tmp_dir}/${armbian_zsh_dir}"/DEBIAN/postinst + cat <<- END > DEBIAN/postinst #!/bin/sh # copy cache directory if not there yet @@ -75,9 +79,7 @@ compile_armbian-zsh() { chmod 755 "${tmp_dir}/${armbian_zsh_dir}"/DEBIAN/postinst - fakeroot_dpkg_deb_build "${tmp_dir}/${armbian_zsh_dir}" - - run_host_command_logged rsync --remove-source-files -r "${tmp_dir}/${armbian_zsh_dir}.deb" "${DEB_STORAGE}/" + fakeroot_dpkg_deb_build "${tmp_dir}/${armbian_zsh_dir}" "${DEB_STORAGE}" done_with_temp_dir "${cleanup_id}" # changes cwd to "${SRC}" and fires the cleanup function early } diff --git a/lib/functions/compilation/packages/fake_ubuntu_advantage_tools-deb.sh b/lib/functions/compilation/packages/fake_ubuntu_advantage_tools-deb.sh new file mode 100644 index 000000000..ab5e58a40 --- /dev/null +++ b/lib/functions/compilation/packages/fake_ubuntu_advantage_tools-deb.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +# +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com +# +# This file is a part of the Armbian Build Framework +# https://github.com/armbian/build/ + +function compile_fake_ubuntu_advantage_tools() { + : "${artifact_version:?artifact_version is not set}" + + display_alert "Generating fake ubuntu advantage tools package" "@host" "info" + + declare cleanup_id="" fw_temp_dir="" + prepare_temp_dir_in_workdir_and_schedule_cleanup "deb-fake_ubuntu_advantage_tools" cleanup_id fw_temp_dir # namerefs + + declare fw_dir="fake_ubuntu_advantage_tools" + mkdir -p "${fw_temp_dir}/${fw_dir}" + + cd "${fw_temp_dir}/${fw_dir}" || exit_with_error "can't change directory" + + # set up control file + mkdir -p DEBIAN + cat <<- END > DEBIAN/control + Package: fake-ubuntu-advantage-tools + Version: ${artifact_version} + Architecture: all + Maintainer: $MAINTAINER <$MAINTAINERMAIL> + Installed-Size: 1 + Conflicts: ubuntu-advantage-tools + Breaks: ubuntu-advantage-tools + Provides: ubuntu-advantage-tools (= 65535) + Description: Ban ubuntu-advantage-tools while satisfying ubuntu-minimal dependency + END + + cd "${fw_temp_dir}" || exit_with_error "can't change directory" + + # package, directly to DEB_STORAGE; full version might be very big for tmpfs. + display_alert "Building fake Ubuntu advantage tools package" "fake_ubuntu_advantage_tools" "info" + fakeroot_dpkg_deb_build "fake_ubuntu_advantage_tools" "${DEB_STORAGE}" + + done_with_temp_dir "${cleanup_id}" # changes cwd to "${SRC}" and fires the cleanup function early +} diff --git a/lib/functions/main/build-packages.sh b/lib/functions/main/build-packages.sh index 7cf85b0ca..08fc0ff51 100644 --- a/lib/functions/main/build-packages.sh +++ b/lib/functions/main/build-packages.sh @@ -8,6 +8,7 @@ # https://github.com/armbian/build/ function main_default_build_packages() { + # early cleaning for sources, since fetch_and_build_host_tools() uses it. if [[ "${CLEAN_LEVEL}" == *sources* ]]; then LOG_SECTION="cleaning_early_sources" do_with_logging general_cleaning "sources" @@ -24,9 +25,7 @@ function main_default_build_packages() { done fi - ### NEW / Artifact system - - # Determine which artifacts to build. + # determine which artifacts to build. declare -a artifacts_to_build=() if [[ "${BOOTCONFIG}" != "none" ]]; then artifacts_to_build+=("uboot") @@ -43,6 +42,23 @@ function main_default_build_packages() { fi fi + artifacts_to_build+=("fake_ubuntu_advantage_tools") + + artifacts_to_build+=("armbian-config") + artifacts_to_build+=("armbian-zsh") + artifacts_to_build+=("armbian-plymouth-theme") + + if [[ -n "${RELEASE}" ]]; then + # Further packages require aggregation + assert_requires_aggregation + + artifacts_to_build+=("armbian-bsp-cli") + if [[ -n "${DESKTOP_ENVIRONMENT}" ]]; then + artifacts_to_build+=("armbian-desktop") + artifacts_to_build+=("armbian-bsp-desktop") + fi + fi + display_alert "Artifacts to build:" "${artifacts_to_build[*]}" "debug" # For each artifact, try to obtain them from the local cache, remote cache, or build them. @@ -68,52 +84,9 @@ function main_default_build_packages() { debug_dict image_artifacts_packages debug_dict image_artifacts_debs - ### OLD / Legacy / Needs conversion to new artifact system @TODO - - # Compile armbian-config if packed .deb does not exist or use the one from repository - if [[ ! -f ${DEB_STORAGE}/armbian-config_${REVISION}_all.deb ]]; then - if [[ "${REPOSITORY_INSTALL}" != *armbian-config* ]]; then - LOG_SECTION="compile_armbian-config" do_with_logging compile_armbian-config - fi - fi - - # Compile armbian-zsh if packed .deb does not exist or use the one from repository - if [[ ! -f ${DEB_STORAGE}/armbian-zsh_${REVISION}_all.deb ]]; then - if [[ "${REPOSITORY_INSTALL}" != *armbian-zsh* ]]; then - LOG_SECTION="compile_armbian-zsh" do_with_logging compile_armbian-zsh - fi - fi - - # Compile plymouth-theme-armbian if packed .deb does not exist or use the one from repository - if [[ ! -f ${DEB_STORAGE}/plymouth-theme-armbian_${REVISION}_all.deb ]]; then - if [[ "${REPOSITORY_INSTALL}" != *plymouth-theme-armbian* ]]; then - LOG_SECTION="compile_plymouth_theme_armbian" do_with_logging compile_plymouth_theme_armbian - fi - fi - overlayfs_wrapper "cleanup" reset_uid_owner "${DEB_STORAGE}" - # Further packages require aggregation (BSPs use aggregated stuff, etc) - assert_requires_aggregation # Bombs if aggregation has not run - - # create board support package - if [[ -n "${RELEASE}" && ! -f "${DEB_STORAGE}/${BSP_CLI_PACKAGE_FULLNAME}.deb" && "${REPOSITORY_INSTALL}" != *armbian-bsp-cli* ]]; then - LOG_SECTION="create_board_package" do_with_logging create_board_package - fi - - # create desktop package - if [[ -n "${RELEASE}" && "${DESKTOP_ENVIRONMENT}" && ! -f "${DEB_STORAGE}/$RELEASE/${CHOSEN_DESKTOP}_${REVISION}_all.deb" && "${REPOSITORY_INSTALL}" != *armbian-desktop* ]]; then - LOG_SECTION="create_desktop_package" do_with_logging create_desktop_package - fi - if [[ -n "${RELEASE}" && "${DESKTOP_ENVIRONMENT}" && ! -f "${DEB_STORAGE}/${RELEASE}/${BSP_DESKTOP_PACKAGE_FULLNAME}.deb" && "${REPOSITORY_INSTALL}" != *armbian-bsp-desktop* ]]; then - LOG_SECTION="create_bsp_desktop_package" do_with_logging create_bsp_desktop_package - fi - - # Reset owner of DEB_STORAGE, if needed. Might be a lot of packages there, but such is life. - # @TODO: might be needed also during 'cleanup': if some package fails, the previous package might be left owned by root. - reset_uid_owner "${DEB_STORAGE}" - # At this point, the WORKDIR should be clean. Add debug info. debug_tmpfs_show_usage "AFTER ALL PKGS BUILT" } diff --git a/lib/functions/main/config-prepare.sh b/lib/functions/main/config-prepare.sh index ea668fb17..6748f41cc 100644 --- a/lib/functions/main/config-prepare.sh +++ b/lib/functions/main/config-prepare.sh @@ -190,8 +190,8 @@ function config_post_main() { ATFSOURCEDIR="${ATFDIR}/$(branch2dir "${ATFBRANCH}")" fi - declare -g BSP_CLI_PACKAGE_NAME="armbian-bsp-cli-${BOARD}${EXTRA_BSP_NAME}" - declare -g BSP_CLI_PACKAGE_FULLNAME="${BSP_CLI_PACKAGE_NAME}_${REVISION}_${ARCH}" +# declare -g BSP_CLI_PACKAGE_NAME="armbian-bsp-cli-${BOARD}${EXTRA_BSP_NAME}" +# declare -g BSP_CLI_PACKAGE_FULLNAME="${BSP_CLI_PACKAGE_NAME}_${REVISION}_${ARCH}" declare -g BSP_DESKTOP_PACKAGE_NAME="armbian-bsp-desktop-${BOARD}${EXTRA_BSP_NAME}" declare -g BSP_DESKTOP_PACKAGE_FULLNAME="${BSP_DESKTOP_PACKAGE_NAME}_${REVISION}_${ARCH}" diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh index b183375a6..8038b6a77 100644 --- a/lib/functions/rootfs/distro-agnostic.sh +++ b/lib/functions/rootfs/distro-agnostic.sh @@ -361,61 +361,33 @@ function install_distribution_agnostic() { fi # install board support packages - if [[ "${REPOSITORY_INSTALL}" != *bsp* ]]; then - install_deb_chroot "${DEB_STORAGE}/${BSP_CLI_PACKAGE_FULLNAME}.deb" - else - install_deb_chroot "${CHOSEN_ROOTFS}" "remote" # @TODO: rpardini: err.... what? - fi + install_deb_chroot "${DEB_STORAGE}/${image_artifacts_debs["armbian-bsp"]}" # install armbian-desktop - if [[ "${REPOSITORY_INSTALL}" != *armbian-desktop* ]]; then - if [[ $BUILD_DESKTOP == yes ]]; then - install_deb_chroot "${DEB_STORAGE}/${RELEASE}/${CHOSEN_DESKTOP}_${REVISION}_all.deb" - install_deb_chroot "${DEB_STORAGE}/${RELEASE}/${BSP_DESKTOP_PACKAGE_FULLNAME}.deb" - # install display manager and PACKAGE_LIST_DESKTOP_FULL packages if enabled per board - desktop_postinstall - fi - else - if [[ $BUILD_DESKTOP == yes ]]; then - install_deb_chroot "${CHOSEN_DESKTOP}" "remote" - # install display manager and PACKAGE_LIST_DESKTOP_FULL packages if enabled per board - desktop_postinstall - fi + if [[ $BUILD_DESKTOP == yes ]]; then + install_deb_chroot "${DEB_STORAGE}/${image_artifacts_debs["armbian-desktop"]}" + install_deb_chroot "${DEB_STORAGE}/${image_artifacts_debs["armbian-bsp-desktop"]}" + # install display manager and PACKAGE_LIST_DESKTOP_FULL packages if enabled per board + desktop_postinstall fi # install armbian-config if [[ "${PACKAGE_LIST_RM}" != *armbian-config* ]]; then - if [[ "${REPOSITORY_INSTALL}" != *armbian-config* ]]; then - if [[ $BUILD_MINIMAL != yes ]]; then - install_deb_chroot "${DEB_STORAGE}/armbian-config_${REVISION}_all.deb" - fi - else - if [[ $BUILD_MINIMAL != yes ]]; then - install_deb_chroot "armbian-config" "remote" - fi + if [[ $BUILD_MINIMAL != yes ]]; then + install_deb_chroot "${DEB_STORAGE}/${image_artifacts_debs["armbian-config"]}" fi fi # install armbian-zsh if [[ "${PACKAGE_LIST_RM}" != *armbian-zsh* ]]; then - if [[ "${REPOSITORY_INSTALL}" != *armbian-zsh* ]]; then - if [[ $BUILD_MINIMAL != yes ]]; then - install_deb_chroot "${DEB_STORAGE}/armbian-zsh_${REVISION}_all.deb" - fi - else - if [[ $BUILD_MINIMAL != yes ]]; then - install_deb_chroot "armbian-zsh" "remote" - fi + if [[ $BUILD_MINIMAL != yes ]]; then + install_deb_chroot "${DEB_STORAGE}/${image_artifacts_debs["armbian-config"]}" fi fi - # install plymouth-theme-armbian + # install armbian-plymouth-theme if [[ $PLYMOUTH == yes ]]; then - if [[ "${REPOSITORY_INSTALL}" != *plymouth-theme-armbian* ]]; then - install_deb_chroot "${DEB_STORAGE}/armbian-plymouth-theme_${REVISION}_all.deb" - else - install_deb_chroot "armbian-plymouth-theme" "remote" - fi + install_deb_chroot "${DEB_STORAGE}/${image_artifacts_debs["armbian-plymouth-theme"]}" fi # install wireguard tools diff --git a/lib/functions/rootfs/distro-specific.sh b/lib/functions/rootfs/distro-specific.sh index 3394301bd..6bdf47c51 100644 --- a/lib/functions/rootfs/distro-specific.sh +++ b/lib/functions/rootfs/distro-specific.sh @@ -49,7 +49,12 @@ function install_distribution_specific() { # disable conflicting services disable_systemd_service_sdcard ondemand.service - ;; + + # Remove Ubuntu APT spamming + install_deb_chroot "${DEB_STORAGE}/${image_artifacts_debs["fake_ubuntu_advantage_tools"]}" + truncate --size=0 "${SDCARD}"/etc/apt/apt.conf.d/20apt-esm-hook.conf + + ;; esac # Basic Netplan config. Let NetworkManager/networkd manage all devices on this system