mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
Effectively remove Ubuntu PRO ads by adding fake package
This commit is contained in:
@@ -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
|
||||
}
|
||||
@@ -18,6 +18,7 @@ function armbian_register_artifacts() {
|
||||
["uboot"]="uboot"
|
||||
["firmware"]="firmware"
|
||||
["full_firmware"]="full_firmware"
|
||||
["fake_ubuntu_advantage_tools"]="fake_ubuntu_advantage_tools"
|
||||
|
||||
# tar.zst
|
||||
["rootfs"]="rootfs"
|
||||
|
||||
@@ -44,6 +44,8 @@ function armbian_register_commands() {
|
||||
["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 +71,7 @@ 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}"
|
||||
["rootfs"]="WHAT='rootfs' ${common_cli_artifact_vars}"
|
||||
|
||||
["oras-upload"]="ORAS_OPERATION='upload'"
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -43,6 +43,8 @@ function main_default_build_packages() {
|
||||
fi
|
||||
fi
|
||||
|
||||
artifacts_to_build+=("fake_ubuntu_advantage_tools")
|
||||
|
||||
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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
# This file is/was autogenerated by lib/tools/gen-library.sh; don't modify manually
|
||||
|
||||
# no errors tolerated. invoked before each sourced file to make sure.
|
||||
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
|
||||
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
|
||||
set -o errtrace # trace ERR through - enabled
|
||||
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
|
||||
### lib/functions/artifacts/artifact-fake-ubuntu-advantage-tools.sh
|
||||
# shellcheck source=lib/functions/artifacts/artifact-fake-ubuntu-advantage-tools.sh
|
||||
source "${SRC}"/lib/functions/artifacts/artifact-fake-ubuntu-advantage-tools.sh
|
||||
|
||||
# no errors tolerated. invoked before each sourced file to make sure.
|
||||
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
|
||||
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
|
||||
@@ -37,15 +46,6 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
|
||||
# shellcheck source=lib/functions/artifacts/artifact-rootfs.sh
|
||||
source "${SRC}"/lib/functions/artifacts/artifact-rootfs.sh
|
||||
|
||||
# no errors tolerated. invoked before each sourced file to make sure.
|
||||
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
|
||||
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
|
||||
set -o errtrace # trace ERR through - enabled
|
||||
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
|
||||
### lib/functions/artifacts/artifact-uboot.sh
|
||||
# shellcheck source=lib/functions/artifacts/artifact-uboot.sh
|
||||
source "${SRC}"/lib/functions/artifacts/artifact-uboot.sh
|
||||
|
||||
# no errors tolerated. invoked before each sourced file to make sure.
|
||||
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
|
||||
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
|
||||
@@ -64,6 +64,15 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
|
||||
# shellcheck source=lib/functions/artifacts/artifacts-registry.sh
|
||||
source "${SRC}"/lib/functions/artifacts/artifacts-registry.sh
|
||||
|
||||
# no errors tolerated. invoked before each sourced file to make sure.
|
||||
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
|
||||
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
|
||||
set -o errtrace # trace ERR through - enabled
|
||||
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
|
||||
### lib/functions/artifacts/artifact-uboot.sh
|
||||
# shellcheck source=lib/functions/artifacts/artifact-uboot.sh
|
||||
source "${SRC}"/lib/functions/artifacts/artifact-uboot.sh
|
||||
|
||||
# no errors tolerated. invoked before each sourced file to make sure.
|
||||
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
|
||||
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
|
||||
@@ -325,6 +334,15 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
|
||||
# shellcheck source=lib/functions/compilation/packages/armbian-config-deb.sh
|
||||
source "${SRC}"/lib/functions/compilation/packages/armbian-config-deb.sh
|
||||
|
||||
# no errors tolerated. invoked before each sourced file to make sure.
|
||||
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
|
||||
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
|
||||
set -o errtrace # trace ERR through - enabled
|
||||
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
|
||||
### lib/functions/compilation/packages/fake_ubuntu_advantage_tools-deb.sh
|
||||
# shellcheck source=lib/functions/compilation/packages/fake_ubuntu_advantage_tools-deb.sh
|
||||
source "${SRC}"/lib/functions/compilation/packages/fake_ubuntu_advantage_tools-deb.sh
|
||||
|
||||
# no errors tolerated. invoked before each sourced file to make sure.
|
||||
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
|
||||
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
|
||||
@@ -550,6 +568,15 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
|
||||
# shellcheck source=lib/functions/general/extensions.sh
|
||||
source "${SRC}"/lib/functions/general/extensions.sh
|
||||
|
||||
# no errors tolerated. invoked before each sourced file to make sure.
|
||||
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
|
||||
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
|
||||
set -o errtrace # trace ERR through - enabled
|
||||
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
|
||||
### lib/functions/general/github-actions.sh
|
||||
# shellcheck source=lib/functions/general/github-actions.sh
|
||||
source "${SRC}"/lib/functions/general/github-actions.sh
|
||||
|
||||
# no errors tolerated. invoked before each sourced file to make sure.
|
||||
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
|
||||
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
|
||||
@@ -568,15 +595,6 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
|
||||
# shellcheck source=lib/functions/general/git.sh
|
||||
source "${SRC}"/lib/functions/general/git.sh
|
||||
|
||||
# no errors tolerated. invoked before each sourced file to make sure.
|
||||
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
|
||||
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
|
||||
set -o errtrace # trace ERR through - enabled
|
||||
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
|
||||
### lib/functions/general/github-actions.sh
|
||||
# shellcheck source=lib/functions/general/github-actions.sh
|
||||
source "${SRC}"/lib/functions/general/github-actions.sh
|
||||
|
||||
# no errors tolerated. invoked before each sourced file to make sure.
|
||||
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
|
||||
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
|
||||
|
||||
Reference in New Issue
Block a user