Offlinework (#2019)
* Delete FORCE_CHECKOUT, IGNORE_UPDATES variables
There are currently two questionable variables.
They are the keys in the structures:
'if [[ $FORCE_CHECKOUT == yes ]]; then' in the function 'fetch_from_repo()'
which is set by default by the script 'main.sh'
'[[ -z $FORCE_CHECKOUT ]] && FORCE_CHECKOUT=yes'
Next in the script 'main.sh'
if [[ $IGNORE_UPDATES != yes ]]; then
display_alert "Downloading sources" "" "info"
fetch_from_repo "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes"
This key has aged. It can't work properly today.
We should always clear the sources before starting the build.
For this reason, these two keys in these places do not make any sense.
You can just delete them.
* Working offline for sources
This is useful when building recursively for multiple platforms,
when some resource on the Internet is frozen.
To do this, I entered a new variable 'OFFLINE_WORK'
* New ability to work in offline mode
* Skip check prepare host
* Add unset OFFLINE_WORK in lib/build-all-ng.sh
Sources, time and host will not be checked
Now you can collect packages without accessing the Internet
This commit is contained in:
parent
c7c2996b06
commit
dcc6e791da
@ -57,7 +57,7 @@ unset LINUXFAMILY LINUXCONFIG KERNELDIR KERNELSOURCE KERNELBRANCH BOOTDIR BOOTSO
|
||||
DEB_STORAGE REPO_STORAGE REPO_CONFIG REPOSITORY_UPDATE PACKAGE_LIST_RELEASE LOCAL_MIRROR COMPILE_ATF \
|
||||
PACKAGE_LIST_DESKTOP_BOARD PACKAGE_LIST_DESKTOP_FAMILY ATF_COMPILE ATFPATCHDIR OFFSET BOOTSOURCEDIR BOOT_USE_BLOBS \
|
||||
BOOT_SOC DDR_BLOB MINILOADER_BLOB BL31_BLOB BOOT_RK3328_USE_AYUFAN_ATF BOOT_USE_BLOBS BOOT_RK3399_LEGACY_HYBRID \
|
||||
BOOT_USE_MAINLINE_ATF BOOT_USE_TPL_SPL_BLOB
|
||||
BOOT_USE_MAINLINE_ATF BOOT_USE_TPL_SPL_BLOB OFFLINE_WORK
|
||||
}
|
||||
|
||||
pack_upload ()
|
||||
|
||||
103
lib/general.sh
103
lib/general.sh
@ -234,6 +234,13 @@ fetch_from_repo()
|
||||
local ref=$3
|
||||
local ref_subdir=$4
|
||||
|
||||
# The 'offline' variable must always be set to 'true' or 'false'
|
||||
if [ "$OFFLINE_WORK" == "yes" ]; then
|
||||
local offline=true
|
||||
else
|
||||
local offline=false
|
||||
fi
|
||||
|
||||
[[ -z $ref || ( $ref != tag:* && $ref != branch:* && $ref != head && $ref != commit:* ) ]] && exit_with_error "Error in configuration"
|
||||
local ref_type=${ref%%:*}
|
||||
if [[ $ref_type == head ]]; then
|
||||
@ -274,37 +281,42 @@ fetch_from_repo()
|
||||
display_alert "Creating local copy"
|
||||
git init -q .
|
||||
git remote add origin $url
|
||||
# Here you need to upload from a new address
|
||||
offline=false
|
||||
fi
|
||||
|
||||
local changed=false
|
||||
|
||||
local local_hash=$(git rev-parse @ 2>/dev/null)
|
||||
# when we work offline we simply return the sources to their original state
|
||||
if ! $offline; then
|
||||
local local_hash=$(git rev-parse @ 2>/dev/null)
|
||||
|
||||
case $ref_type in
|
||||
branch)
|
||||
# TODO: grep refs/heads/$name
|
||||
local remote_hash=$(git ls-remote -h $url "$ref_name" | head -1 | cut -f1)
|
||||
[[ -z $local_hash || $local_hash != $remote_hash ]] && changed=true
|
||||
;;
|
||||
case $ref_type in
|
||||
branch)
|
||||
# TODO: grep refs/heads/$name
|
||||
local remote_hash=$(git ls-remote -h $url "$ref_name" | head -1 | cut -f1)
|
||||
[[ -z $local_hash || $local_hash != $remote_hash ]] && changed=true
|
||||
;;
|
||||
|
||||
tag)
|
||||
local remote_hash=$(git ls-remote -t $url "$ref_name" | cut -f1)
|
||||
if [[ -z $local_hash || $local_hash != $remote_hash ]]; then
|
||||
remote_hash=$(git ls-remote -t $url "$ref_name^{}" | cut -f1)
|
||||
[[ -z $remote_hash || $local_hash != $remote_hash ]] && changed=true
|
||||
fi
|
||||
;;
|
||||
tag)
|
||||
local remote_hash=$(git ls-remote -t $url "$ref_name" | cut -f1)
|
||||
if [[ -z $local_hash || $local_hash != $remote_hash ]]; then
|
||||
remote_hash=$(git ls-remote -t $url "$ref_name^{}" | cut -f1)
|
||||
[[ -z $remote_hash || $local_hash != $remote_hash ]] && changed=true
|
||||
fi
|
||||
;;
|
||||
|
||||
head)
|
||||
local remote_hash=$(git ls-remote $url HEAD | cut -f1)
|
||||
[[ -z $local_hash || $local_hash != $remote_hash ]] && changed=true
|
||||
;;
|
||||
head)
|
||||
local remote_hash=$(git ls-remote $url HEAD | cut -f1)
|
||||
[[ -z $local_hash || $local_hash != $remote_hash ]] && changed=true
|
||||
;;
|
||||
|
||||
commit)
|
||||
[[ -z $local_hash || $local_hash == "@" ]] && changed=true
|
||||
;;
|
||||
commit)
|
||||
[[ -z $local_hash || $local_hash == "@" ]] && changed=true
|
||||
;;
|
||||
esac
|
||||
|
||||
esac
|
||||
fi # offline
|
||||
|
||||
if [[ $changed == true ]]; then
|
||||
|
||||
@ -345,24 +357,19 @@ fetch_from_repo()
|
||||
fi
|
||||
elif [[ -n $(git status -uno --porcelain --ignore-submodules=all) ]]; then
|
||||
# working directory is not clean
|
||||
if [[ $FORCE_CHECKOUT == yes ]]; then
|
||||
display_alert " Cleaning .... " "$(git status -s | wc -l) files"
|
||||
display_alert " Cleaning .... " "$(git status -s | wc -l) files"
|
||||
|
||||
# Return the files that are tracked by git to the initial state.
|
||||
git checkout -f -q HEAD
|
||||
# Return the files that are tracked by git to the initial state.
|
||||
git checkout -f -q HEAD
|
||||
|
||||
# Files that are not tracked by git and were added
|
||||
# when the patch was applied must be removed.
|
||||
git clean -qdf
|
||||
else
|
||||
display_alert "In the source of dirty files: " "$(git status -s | wc -l)"
|
||||
display_alert "The compilation process will probably fail." "You have been warned"
|
||||
display_alert "Skipping checkout"
|
||||
fi
|
||||
# Files that are not tracked by git and were added
|
||||
# when the patch was applied must be removed.
|
||||
git clean -qdf
|
||||
else
|
||||
# working directory is clean, nothing to do
|
||||
display_alert "Up to date"
|
||||
fi
|
||||
|
||||
if [[ -f .gitmodules ]]; then
|
||||
display_alert "Updating submodules" "" "ext"
|
||||
# FML: http://stackoverflow.com/a/17692710
|
||||
@ -816,6 +823,13 @@ prepare_host()
|
||||
{
|
||||
display_alert "Preparing" "host" "info"
|
||||
|
||||
# The 'offline' variable must always be set to 'true' or 'false'
|
||||
if [ "$OFFLINE_WORK" == "yes" ]; then
|
||||
local offline=true
|
||||
else
|
||||
local offline=false
|
||||
fi
|
||||
|
||||
if [[ $(dpkg --print-architecture) != amd64 ]]; then
|
||||
display_alert "Please read documentation to set up proper compilation environment"
|
||||
display_alert "http://www.armbian.com/using-armbian-tools/"
|
||||
@ -891,6 +905,9 @@ prepare_host()
|
||||
SYNC_CLOCK=no
|
||||
fi
|
||||
|
||||
# Skip verification if you are working offline
|
||||
if ! $offline; then
|
||||
|
||||
# warning: apt-cacher-ng will fail if installed and used both on host and in container/chroot environment with shared network
|
||||
# set NO_APT_CACHER=yes to prevent installation errors in such case
|
||||
if [[ $NO_APT_CACHER != yes ]]; then hostdeps="$hostdeps apt-cacher-ng"; fi
|
||||
@ -935,14 +952,6 @@ prepare_host()
|
||||
apt-get install -qq -y --no-install-recommends zlib1g:i386 >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
# enable arm binary format so that the cross-architecture chroot environment will work
|
||||
if [[ $KERNEL_ONLY != yes ]]; then
|
||||
modprobe -q binfmt_misc
|
||||
mountpoint -q /proc/sys/fs/binfmt_misc/ || mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
|
||||
test -e /proc/sys/fs/binfmt_misc/qemu-arm || update-binfmts --enable qemu-arm
|
||||
test -e /proc/sys/fs/binfmt_misc/qemu-aarch64 || update-binfmts --enable qemu-aarch64
|
||||
fi
|
||||
|
||||
# create directory structure
|
||||
mkdir -p $SRC/{cache,output} $USERPATCHES_PATH
|
||||
if [[ -n $SUDO_USER ]]; then
|
||||
@ -997,6 +1006,16 @@ prepare_host()
|
||||
fi
|
||||
done
|
||||
|
||||
fi # check offline
|
||||
|
||||
# enable arm binary format so that the cross-architecture chroot environment will work
|
||||
if [[ $KERNEL_ONLY != yes ]]; then
|
||||
modprobe -q binfmt_misc
|
||||
mountpoint -q /proc/sys/fs/binfmt_misc/ || mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
|
||||
test -e /proc/sys/fs/binfmt_misc/qemu-arm || update-binfmts --enable qemu-arm
|
||||
test -e /proc/sys/fs/binfmt_misc/qemu-aarch64 || update-binfmts --enable qemu-aarch64
|
||||
fi
|
||||
|
||||
[[ ! -f $USERPATCHES_PATH/customize-image.sh ]] && cp $SRC/config/templates/customize-image.sh.template $USERPATCHES_PATH/customize-image.sh
|
||||
|
||||
if [[ ! -f $USERPATCHES_PATH/README ]]; then
|
||||
|
||||
49
lib/main.sh
49
lib/main.sh
@ -43,8 +43,6 @@ backtitle="Armbian building script, http://www.armbian.com | Author: Igor Pecovn
|
||||
# default console if not set
|
||||
[[ -z $CONSOLE_CHAR ]] && export CONSOLE_CHAR="UTF-8"
|
||||
|
||||
[[ -z $FORCE_CHECKOUT ]] && FORCE_CHECKOUT=yes
|
||||
|
||||
# Load libraries
|
||||
# shellcheck source=debootstrap.sh
|
||||
source "${SRC}"/lib/debootstrap.sh # system specific install
|
||||
@ -125,8 +123,16 @@ if [[ -n $REPOSITORY_UPDATE ]]; then
|
||||
|
||||
fi
|
||||
|
||||
# we need dialog to display the menu in case not installed. Other stuff gets installed later
|
||||
prepare_host_basic
|
||||
if [ "$OFFLINE_WORK" == "yes" ]; then
|
||||
echo -e "\n"
|
||||
display_alert "* " "You are working offline."
|
||||
display_alert "* " "Sources, time and host will not be checked"
|
||||
echo -e "\n"
|
||||
sleep 3s
|
||||
else
|
||||
# we need dialog to display the menu in case not installed. Other stuff gets installed later
|
||||
prepare_host_basic
|
||||
fi
|
||||
|
||||
# if KERNEL_ONLY, KERNEL_CONFIGURE, BOARD, BRANCH or RELEASE are not set, display selection menu
|
||||
|
||||
@ -204,7 +210,7 @@ if [[ -z $BOARD ]]; then
|
||||
if [[ $WIP_STATE == supported ]]; then
|
||||
|
||||
[[ $SHOW_WARNING == yes ]] && show_developer_warning
|
||||
STATE_DESCRIPTION=' - \Z1(CSC)\Zn - Community Supported Configuration\n - \Z1(WIP)\Zn - Work In Progress
|
||||
STATE_DESCRIPTION=' - \Z1(CSC)\Zn - Community Supported Configuration\n - \Z1(WIP)\Zn - Work In Progress
|
||||
\n - \Z1(EOS)\Zn - End Of Support\n - \Z1(TVB)\Zn - TV boxes'
|
||||
WIP_STATE=unsupported
|
||||
WIP_BUTTON='matured'
|
||||
@ -265,7 +271,7 @@ if [[ -z $BRANCH ]]; then
|
||||
[[ $BRANCH == dev && $SHOW_WARNING == yes ]] && show_developer_warning
|
||||
|
||||
else
|
||||
[[ $BRANCH == next ]] && KERNEL_TARGET="next"
|
||||
[[ $BRANCH == next ]] && KERNEL_TARGET="next"
|
||||
# next = new legacy. Should stay for backward compatibility, but be removed from menu above
|
||||
# or we left definitions in board configs and only remove menu
|
||||
[[ $KERNEL_TARGET != *$BRANCH* ]] && exit_with_error "Kernel branch not defined for this board" "$BRANCH"
|
||||
@ -389,28 +395,27 @@ do_default() {
|
||||
start=$(date +%s)
|
||||
|
||||
# Check and install dependencies, directory structure and settings
|
||||
# The OFFLINE_WORK variable inside the function
|
||||
prepare_host
|
||||
|
||||
[[ $CLEAN_LEVEL == *sources* ]] && cleaning "sources"
|
||||
|
||||
# ignore updates help on building all images - for internal purposes
|
||||
# fetch_from_repo <url> <dir> <ref> <subdir_flag>
|
||||
if [[ $IGNORE_UPDATES != yes ]]; then
|
||||
display_alert "Downloading sources" "" "info"
|
||||
fetch_from_repo "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes"
|
||||
fetch_from_repo "$KERNELSOURCE" "$KERNELDIR" "$KERNELBRANCH" "yes"
|
||||
if [[ -n $ATFSOURCE ]]; then
|
||||
fetch_from_repo "$ATFSOURCE" "$ATFDIR" "$ATFBRANCH" "yes"
|
||||
fi
|
||||
fetch_from_repo "https://github.com/linux-sunxi/sunxi-tools" "sunxi-tools" "branch:master"
|
||||
fetch_from_repo "https://github.com/armbian/rkbin" "rkbin-tools" "branch:master"
|
||||
fetch_from_repo "https://github.com/MarvellEmbeddedProcessors/A3700-utils-marvell" "marvell-tools" "branch:A3700_utils-armada-18.12"
|
||||
fetch_from_repo "https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git" "marvell-ddr" "branch:mv_ddr-armada-18.12"
|
||||
fetch_from_repo "https://github.com/MarvellEmbeddedProcessors/binaries-marvell" "marvell-binaries" "branch:binaries-marvell-armada-18.12"
|
||||
fetch_from_repo "https://github.com/armbian/odroidc2-blobs" "odroidc2-blobs" "branch:master"
|
||||
fetch_from_repo "https://github.com/armbian/testings" "testing-reports" "branch:master"
|
||||
fetch_from_repo "https://gitlab.com/superna9999/amlogic-boot-fip" "amlogic-boot-fip" "branch:master"
|
||||
display_alert "Downloading sources" "" "info"
|
||||
|
||||
fetch_from_repo "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes"
|
||||
fetch_from_repo "$KERNELSOURCE" "$KERNELDIR" "$KERNELBRANCH" "yes"
|
||||
if [[ -n $ATFSOURCE ]]; then
|
||||
fetch_from_repo "$ATFSOURCE" "$ATFDIR" "$ATFBRANCH" "yes"
|
||||
fi
|
||||
fetch_from_repo "https://github.com/linux-sunxi/sunxi-tools" "sunxi-tools" "branch:master"
|
||||
fetch_from_repo "https://github.com/armbian/rkbin" "rkbin-tools" "branch:master"
|
||||
fetch_from_repo "https://github.com/MarvellEmbeddedProcessors/A3700-utils-marvell" "marvell-tools" "branch:A3700_utils-armada-18.12"
|
||||
fetch_from_repo "https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git" "marvell-ddr" "branch:mv_ddr-armada-18.12"
|
||||
fetch_from_repo "https://github.com/MarvellEmbeddedProcessors/binaries-marvell" "marvell-binaries" "branch:binaries-marvell-armada-18.12"
|
||||
fetch_from_repo "https://github.com/armbian/odroidc2-blobs" "odroidc2-blobs" "branch:master"
|
||||
fetch_from_repo "https://github.com/armbian/testings" "testing-reports" "branch:master"
|
||||
fetch_from_repo "https://gitlab.com/superna9999/amlogic-boot-fip" "amlogic-boot-fip" "branch:master"
|
||||
|
||||
compile_sunxi_tools
|
||||
install_rkbin_tools
|
||||
|
||||
Loading…
Reference in New Issue
Block a user