2015-12-02 20:33:32 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Copyright (c) 2015 Igor Pecovnik, igor.pecovnik@gma**.com
|
|
|
|
#
|
|
|
|
# This file is licensed under the terms of the GNU General Public
|
|
|
|
# License version 2. This program is licensed "as is" without any
|
|
|
|
# warranty of any kind, whether express or implied.
|
|
|
|
#
|
|
|
|
# This file is a part of tool chain https://github.com/igorpecovnik/lib
|
|
|
|
#
|
|
|
|
|
2015-12-18 12:22:42 +03:00
|
|
|
# Functions:
|
|
|
|
# cleaning
|
2016-03-05 21:26:01 +03:00
|
|
|
# exit_with_error
|
2016-03-04 00:00:37 +03:00
|
|
|
# get_package_list_hash
|
2016-08-25 00:51:12 +03:00
|
|
|
# create_sources_list
|
2016-08-11 17:52:37 +03:00
|
|
|
# fetch_from_repo
|
2015-12-18 12:22:42 +03:00
|
|
|
# display_alert
|
|
|
|
# grab_version
|
|
|
|
# fingerprint_image
|
|
|
|
# addtorepo
|
|
|
|
# prepare_host
|
2016-07-26 20:15:23 +03:00
|
|
|
# download_toolchain
|
2015-12-02 20:33:32 +01:00
|
|
|
|
2015-12-10 21:21:52 +03:00
|
|
|
# cleaning <target>
|
|
|
|
#
|
|
|
|
# target: what to clean
|
|
|
|
# "make" - "make clean" for selected kernel and u-boot
|
|
|
|
# "debs" - delete output/debs
|
|
|
|
# "cache" - delete output/cache
|
|
|
|
# "images" - delete output/images
|
|
|
|
# "sources" - delete output/sources
|
|
|
|
#
|
2015-12-02 20:33:32 +01:00
|
|
|
cleaning()
|
|
|
|
{
|
2015-12-10 21:21:52 +03:00
|
|
|
case $1 in
|
2016-05-05 16:49:46 +03:00
|
|
|
debs) # delete output/debs for current branch and family
|
|
|
|
if [[ -d $DEST/debs ]]; then
|
2016-07-27 16:27:29 +03:00
|
|
|
display_alert "Cleaning output/debs for" "$BOARD $BRANCH" "info"
|
2016-03-14 23:39:21 +03:00
|
|
|
# easier than dealing with variable expansion and escaping dashes in file names
|
2016-11-20 16:11:14 +03:00
|
|
|
find $DEST/debs -name "${CHOSEN_UBOOT}_*.deb" -delete
|
|
|
|
find $DEST/debs \( -name "${CHOSEN_KERNEL}_*.deb" -o \
|
|
|
|
-name "${CHOSEN_KERNEL/image/dtb}_*.deb" -o \
|
|
|
|
-name "${CHOSEN_KERNEL/image/headers}_*.deb" -o \
|
|
|
|
-name "${CHOSEN_KERNEL/image/firmware-image}_*.deb" \) -delete
|
|
|
|
[[ -n $RELEASE ]] && rm -f $DEST/debs/$RELEASE/${CHOSEN_ROOTFS}_*.deb
|
2016-03-14 23:39:21 +03:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
2016-07-27 16:27:29 +03:00
|
|
|
extras) # delete output/debs/extra/$RELEASE for all architectures
|
|
|
|
if [[ -n $RELEASE && -d $DEST/debs/extra/$RELEASE ]]; then
|
|
|
|
display_alert "Cleaning output/debs/extra for" "$RELEASE" "info"
|
|
|
|
rm -rf $DEST/debs/extra/$RELEASE
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
2016-05-05 16:49:46 +03:00
|
|
|
alldebs) # delete output/debs
|
2016-07-27 16:27:29 +03:00
|
|
|
[[ -d $DEST/debs ]] && display_alert "Cleaning" "output/debs" "info" && rm -rf $DEST/debs/*
|
2015-12-10 21:21:52 +03:00
|
|
|
;;
|
2015-12-02 20:33:32 +01:00
|
|
|
|
2016-05-05 16:49:46 +03:00
|
|
|
cache) # delete output/cache
|
2017-01-21 16:02:22 +03:00
|
|
|
[[ -d $CACHEDIR ]] && display_alert "Cleaning" "output/cache/rootfs (all)" "info" && find $CACHEDIR/rootfs/ -type f -delete
|
2015-12-10 21:21:52 +03:00
|
|
|
;;
|
2015-12-07 14:32:25 +01:00
|
|
|
|
2016-05-05 16:49:46 +03:00
|
|
|
images) # delete output/images
|
2016-07-27 16:27:29 +03:00
|
|
|
[[ -d $DEST/images ]] && display_alert "Cleaning" "output/images" "info" && rm -rf $DEST/images/*
|
2015-12-10 21:21:52 +03:00
|
|
|
;;
|
|
|
|
|
2016-07-27 16:27:29 +03:00
|
|
|
sources) # delete output/sources and output/buildpkg
|
|
|
|
[[ -d $SOURCES ]] && display_alert "Cleaning" "sources" "info" && rm -rf $SOURCES/* $DEST/buildpkg/*
|
2015-12-10 21:21:52 +03:00
|
|
|
;;
|
2017-01-21 16:02:22 +03:00
|
|
|
|
|
|
|
oldcache)
|
|
|
|
if [[ -d $CACHEDIR/rootfs/ && $(ls -1 $CACHEDIR/rootfs/ | wc -l) -gt 6 ]]; then
|
|
|
|
display_alert "Cleaning" "output/cache/rootfs (old)" "info"
|
|
|
|
(cd $CACHEDIR/rootfs/; ls -t | sed -e "1,6d" | xargs -d '\n' rm -f)
|
|
|
|
fi
|
|
|
|
;;
|
2015-12-10 21:21:52 +03:00
|
|
|
esac
|
|
|
|
}
|
2015-12-07 14:32:25 +01:00
|
|
|
|
2016-03-05 21:26:01 +03:00
|
|
|
# exit_with_error <message> <highlight>
|
|
|
|
#
|
|
|
|
# a way to terminate build process
|
|
|
|
# with verbose error message
|
|
|
|
#
|
|
|
|
|
|
|
|
exit_with_error()
|
|
|
|
{
|
|
|
|
local _file=$(basename ${BASH_SOURCE[1]})
|
|
|
|
local _line=${BASH_LINENO[0]}
|
|
|
|
local _function=${FUNCNAME[1]}
|
|
|
|
local _description=$1
|
|
|
|
local _highlight=$2
|
|
|
|
|
|
|
|
display_alert "ERROR in function $_function" "$_file:$_line" "err"
|
|
|
|
display_alert "$_description" "$_highlight" "err"
|
|
|
|
display_alert "Process terminated" "" "info"
|
2016-07-27 16:27:29 +03:00
|
|
|
# TODO: execute run_after_build here?
|
2016-10-24 18:02:58 +03:00
|
|
|
overlayfs_wrapper "cleanup"
|
2016-12-14 15:17:13 +03:00
|
|
|
# unlock loop device access in case of starvation
|
|
|
|
exec {FD}>/var/lock/armbian-debootstrap-losetup
|
2016-12-14 16:12:13 +03:00
|
|
|
flock -u $FD
|
2016-12-14 15:17:13 +03:00
|
|
|
|
2016-03-05 21:26:01 +03:00
|
|
|
exit -1
|
|
|
|
}
|
|
|
|
|
2016-10-15 00:34:27 +03:00
|
|
|
# get_package_list_hash
|
2016-03-04 00:00:37 +03:00
|
|
|
#
|
2016-10-15 00:34:27 +03:00
|
|
|
# returns md5 hash for current package list and rootfs cache version
|
2016-03-04 00:00:37 +03:00
|
|
|
|
|
|
|
get_package_list_hash()
|
|
|
|
{
|
2016-10-15 00:34:27 +03:00
|
|
|
( printf '%s\n' $PACKAGE_LIST | sort -u; printf '%s\n' $PACKAGE_LIST_EXCLUDE | sort -u; echo "$ROOTFSCACHE_VERSION" ) \
|
|
|
|
| md5sum | cut -d' ' -f 1
|
2016-03-04 00:00:37 +03:00
|
|
|
}
|
|
|
|
|
2016-09-06 17:55:26 +03:00
|
|
|
# create_sources_list <release> <basedir>
|
2016-08-25 00:51:12 +03:00
|
|
|
#
|
2017-01-12 15:31:53 +03:00
|
|
|
# <release>: jessie|xenial
|
2016-09-06 17:55:26 +03:00
|
|
|
# <basedir>: path to root directory
|
2016-08-25 00:51:12 +03:00
|
|
|
#
|
|
|
|
create_sources_list()
|
|
|
|
{
|
|
|
|
local release=$1
|
2016-09-06 17:55:26 +03:00
|
|
|
local basedir=$2
|
|
|
|
[[ -z $basedir ]] && exit_with_error "No basedir passed to create_sources_list"
|
|
|
|
|
2016-08-25 00:51:12 +03:00
|
|
|
case $release in
|
2017-01-12 15:31:53 +03:00
|
|
|
jessie)
|
2016-09-06 17:55:26 +03:00
|
|
|
cat <<-EOF > $basedir/etc/apt/sources.list
|
2016-08-25 00:51:12 +03:00
|
|
|
deb http://${DEBIAN_MIRROR} $release main contrib non-free
|
|
|
|
#deb-src http://${DEBIAN_MIRROR} $release main contrib non-free
|
|
|
|
|
|
|
|
deb http://${DEBIAN_MIRROR} ${release}-updates main contrib non-free
|
|
|
|
#deb-src http://${DEBIAN_MIRROR} ${release}-updates main contrib non-free
|
|
|
|
|
|
|
|
deb http://${DEBIAN_MIRROR} ${release}-backports main contrib non-free
|
|
|
|
#deb-src http://${DEBIAN_MIRROR} ${release}-backports main contrib non-free
|
|
|
|
|
|
|
|
deb http://security.debian.org/ ${release}/updates main contrib non-free
|
|
|
|
#deb-src http://security.debian.org/ ${release}/updates main contrib non-free
|
|
|
|
EOF
|
|
|
|
;;
|
|
|
|
|
2017-01-12 15:31:53 +03:00
|
|
|
xenial)
|
2016-09-06 17:55:26 +03:00
|
|
|
cat <<-EOF > $basedir/etc/apt/sources.list
|
2016-08-25 00:51:12 +03:00
|
|
|
deb http://${UBUNTU_MIRROR} $release main restricted universe multiverse
|
|
|
|
#deb-src http://${UBUNTU_MIRROR} $release main restricted universe multiverse
|
|
|
|
|
|
|
|
deb http://${UBUNTU_MIRROR} ${release}-security main restricted universe multiverse
|
|
|
|
#deb-src http://${UBUNTU_MIRROR} ${release}-security main restricted universe multiverse
|
|
|
|
|
|
|
|
deb http://${UBUNTU_MIRROR} ${release}-updates main restricted universe multiverse
|
|
|
|
#deb-src http://${UBUNTU_MIRROR} ${release}-updates main restricted universe multiverse
|
|
|
|
|
|
|
|
deb http://${UBUNTU_MIRROR} ${release}-backports main restricted universe multiverse
|
|
|
|
#deb-src http://${UBUNTU_MIRROR} ${release}-backports main restricted universe multiverse
|
|
|
|
EOF
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2016-09-18 16:33:36 +02:00
|
|
|
# fetch_from_repo <url> <directory> <ref> <ref_subdir>
|
2016-08-11 17:52:37 +03:00
|
|
|
# <url>: remote repository URL
|
|
|
|
# <directory>: local directory; subdir for branch/tag will be created
|
|
|
|
# <ref>:
|
|
|
|
# branch:name
|
|
|
|
# tag:name
|
2016-08-13 21:15:26 +03:00
|
|
|
# head(*)
|
|
|
|
# commit:hash@depth(**)
|
2016-08-11 17:52:37 +03:00
|
|
|
#
|
2016-08-13 21:15:26 +03:00
|
|
|
# *: Implies ref_subdir=no
|
|
|
|
# **: Not implemented yet
|
2016-08-11 17:52:37 +03:00
|
|
|
# <ref_subdir>: "yes" to create subdirectory for tag or branch name
|
|
|
|
#
|
|
|
|
fetch_from_repo()
|
|
|
|
{
|
|
|
|
local url=$1
|
|
|
|
local dir=$2
|
|
|
|
local ref=$3
|
|
|
|
local ref_subdir=$4
|
|
|
|
|
2016-08-13 21:15:26 +03:00
|
|
|
[[ -z $ref || ( $ref != tag:* && $ref != branch:* && $ref != head ) ]] && exit_with_error "Error in configuration"
|
2016-08-11 17:52:37 +03:00
|
|
|
local ref_type=${ref%%:*}
|
2016-08-13 21:15:26 +03:00
|
|
|
if [[ $ref_type == head ]]; then
|
|
|
|
local ref_name=HEAD
|
|
|
|
else
|
|
|
|
local ref_name=${ref##*:}
|
|
|
|
fi
|
2016-08-11 17:52:37 +03:00
|
|
|
|
|
|
|
display_alert "Checking git sources" "$dir $ref_name" "info"
|
|
|
|
|
|
|
|
# get default remote branch name without cloning
|
|
|
|
# local ref_name=$(git ls-remote --symref $url HEAD | grep -o 'refs/heads/\S*' | sed 's%refs/heads/%%')
|
2016-08-13 21:15:26 +03:00
|
|
|
# for git:// protocol comparing hashes of "git ls-remote -h $url" and "git ls-remote --symref $url HEAD" is needed
|
2016-08-11 17:52:37 +03:00
|
|
|
|
|
|
|
if [[ $ref_subdir == yes ]]; then
|
2016-08-13 21:15:26 +03:00
|
|
|
local workdir=$dir/$ref_name
|
2016-08-11 17:52:37 +03:00
|
|
|
else
|
2016-08-13 21:15:26 +03:00
|
|
|
local workdir=$dir
|
2016-08-11 17:52:37 +03:00
|
|
|
fi
|
2016-08-13 21:15:26 +03:00
|
|
|
mkdir -p $SOURCES/$workdir
|
|
|
|
cd $SOURCES/$workdir
|
2016-08-11 17:52:37 +03:00
|
|
|
|
2017-01-04 18:55:09 +03:00
|
|
|
# check if existing remote URL for the repo or branch does not match current one
|
2017-01-09 18:10:39 +03:00
|
|
|
# may not be supported by older git versions
|
|
|
|
local current_url=$(git remote get-url origin 2>/dev/null)
|
|
|
|
if [[ -n $current_url && $(git rev-parse --is-inside-work-tree 2>/dev/null) == true && \
|
2017-01-04 18:55:09 +03:00
|
|
|
$(git rev-parse --show-toplevel) == $(pwd) && \
|
2017-01-09 18:10:39 +03:00
|
|
|
$current_url != $url ]]; then
|
2017-01-04 18:55:09 +03:00
|
|
|
display_alert "Remote URL does not match, removing existing local copy"
|
|
|
|
rm -rf .git *
|
|
|
|
fi
|
|
|
|
|
2016-08-13 21:15:26 +03:00
|
|
|
if [[ $(git rev-parse --is-inside-work-tree 2>/dev/null) != true || \
|
|
|
|
$(git rev-parse --show-toplevel) != $(pwd) ]]; then
|
2016-08-11 17:52:37 +03:00
|
|
|
display_alert "Creating local copy"
|
|
|
|
git init -q .
|
|
|
|
git remote add origin $url
|
|
|
|
fi
|
|
|
|
|
|
|
|
local changed=false
|
2016-08-13 21:15:26 +03:00
|
|
|
|
|
|
|
local local_hash=$(git rev-parse @ 2>/dev/null)
|
2016-08-11 17:52:37 +03:00
|
|
|
case $ref_type in
|
|
|
|
branch)
|
2016-08-25 00:51:12 +03:00
|
|
|
# TODO: grep refs/heads/$name
|
2016-08-22 16:15:23 +03:00
|
|
|
local remote_hash=$(git ls-remote -h $url "$ref_name" | head -1 | cut -f1)
|
2016-08-13 21:15:26 +03:00
|
|
|
[[ -z $local_hash || $local_hash != $remote_hash ]] && changed=true
|
2016-08-11 17:52:37 +03:00
|
|
|
;;
|
|
|
|
|
|
|
|
tag)
|
2016-08-13 21:15:26 +03:00
|
|
|
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)
|
2016-08-11 17:52:37 +03:00
|
|
|
[[ -z $remote_hash || $local_hash != $remote_hash ]] && changed=true
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
head)
|
2016-08-13 21:15:26 +03:00
|
|
|
local remote_hash=$(git ls-remote $url HEAD | cut -f1)
|
|
|
|
[[ -z $local_hash || $local_hash != $remote_hash ]] && changed=true
|
2016-08-11 17:52:37 +03:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [[ $changed == true ]]; then
|
|
|
|
# remote was updated, fetch and check out updates
|
|
|
|
display_alert "Fetching updates"
|
|
|
|
case $ref_type in
|
|
|
|
branch) git fetch --depth 1 origin $ref_name ;;
|
|
|
|
tag) git fetch --depth 1 origin tags/$ref_name ;;
|
|
|
|
head) git fetch --depth 1 origin HEAD ;;
|
|
|
|
esac
|
|
|
|
display_alert "Checking out"
|
|
|
|
git checkout -f -q FETCH_HEAD
|
2016-08-13 21:15:26 +03:00
|
|
|
elif [[ -n $(git status -uno --porcelain --ignore-submodules=all) ]]; then
|
2016-08-11 17:52:37 +03:00
|
|
|
# working directory is not clean
|
|
|
|
if [[ $FORCE_CHECKOUT == yes ]]; then
|
|
|
|
display_alert "Checking out"
|
|
|
|
git checkout -f -q HEAD
|
|
|
|
else
|
|
|
|
display_alert "Skipping checkout"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
# working directory is clean, nothing to do
|
|
|
|
display_alert "Up to date"
|
|
|
|
fi
|
|
|
|
if [[ -f .gitmodules ]]; then
|
2016-08-13 21:15:26 +03:00
|
|
|
display_alert "Updating submodules" "" "ext"
|
|
|
|
# FML: http://stackoverflow.com/a/17692710
|
|
|
|
for i in $(git config -f .gitmodules --get-regexp path | awk '{ print $2 }'); do
|
|
|
|
cd $SOURCES/$workdir
|
|
|
|
local surl=$(git config -f .gitmodules --get "submodule.$i.url")
|
|
|
|
local sref=$(git config -f .gitmodules --get "submodule.$i.branch")
|
|
|
|
if [[ -n $sref ]]; then
|
|
|
|
sref="branch:$sref"
|
|
|
|
else
|
|
|
|
sref="head"
|
|
|
|
fi
|
|
|
|
fetch_from_repo "$surl" "$workdir/$i" "$sref"
|
|
|
|
done
|
2016-08-11 17:52:37 +03:00
|
|
|
fi
|
|
|
|
} #############################################################################
|
2015-12-02 20:33:32 +01:00
|
|
|
|
|
|
|
display_alert()
|
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
# Let's have unique way of displaying alerts
|
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
{
|
2016-07-21 23:20:45 +03:00
|
|
|
# log function parameters to install.log
|
2016-08-09 21:36:52 +02:00
|
|
|
[[ -n $DEST ]] && echo "Displaying message: $@" >> $DEST/debug/output.log
|
2015-12-24 19:37:34 +03:00
|
|
|
|
2016-07-21 23:20:45 +03:00
|
|
|
local tmp=""
|
|
|
|
[[ -n $2 ]] && tmp="[\e[0;33m $2 \x1B[0m]"
|
2016-05-24 18:12:48 +03:00
|
|
|
|
2016-07-21 23:20:45 +03:00
|
|
|
case $3 in
|
|
|
|
err)
|
|
|
|
echo -e "[\e[0;31m error \x1B[0m] $1 $tmp"
|
|
|
|
;;
|
2016-05-24 18:12:48 +03:00
|
|
|
|
2016-07-21 23:20:45 +03:00
|
|
|
wrn)
|
|
|
|
echo -e "[\e[0;35m warn \x1B[0m] $1 $tmp"
|
|
|
|
;;
|
2016-05-24 18:12:48 +03:00
|
|
|
|
2016-07-21 23:20:45 +03:00
|
|
|
ext)
|
|
|
|
echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0m $tmp"
|
|
|
|
;;
|
2016-05-24 18:12:48 +03:00
|
|
|
|
2016-07-21 23:20:45 +03:00
|
|
|
info)
|
|
|
|
echo -e "[\e[0;32m o.k. \x1B[0m] $1 $tmp"
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
echo -e "[\e[0;32m .... \x1B[0m] $1 $tmp"
|
|
|
|
;;
|
|
|
|
esac
|
2015-12-02 20:33:32 +01:00
|
|
|
}
|
|
|
|
|
2015-12-08 19:25:30 +01:00
|
|
|
#---------------------------------------------------------------------------------------------------------------------------------
|
2016-08-30 19:25:32 +03:00
|
|
|
# grab_version <path>
|
2015-12-08 19:25:30 +01:00
|
|
|
#
|
2016-08-30 19:25:32 +03:00
|
|
|
# <path>: Extract kernel or uboot version from $path/Makefile
|
2015-12-08 19:25:30 +01:00
|
|
|
#---------------------------------------------------------------------------------------------------------------------------------
|
2016-08-30 19:25:32 +03:00
|
|
|
grab_version()
|
2015-12-08 19:25:30 +01:00
|
|
|
{
|
2016-04-18 18:21:43 +03:00
|
|
|
local ver=""
|
2016-08-30 19:25:32 +03:00
|
|
|
for component in VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION; do
|
|
|
|
tmp=$(cat $1/Makefile | grep $component | head -1 | awk '{print $(NF)}' | cut -d '=' -f 2)"#"
|
|
|
|
[[ $tmp != "#" ]] && ver="$ver$tmp"
|
2015-12-08 19:25:30 +01:00
|
|
|
done
|
2016-04-18 18:21:43 +03:00
|
|
|
ver=${ver//#/.}; ver=${ver%.}; ver=${ver//.-/-}
|
2016-08-30 19:25:32 +03:00
|
|
|
echo $ver
|
2015-12-02 20:33:32 +01:00
|
|
|
}
|
|
|
|
|
2016-06-08 18:16:11 +03:00
|
|
|
fingerprint_image()
|
|
|
|
{
|
2015-12-02 20:33:32 +01:00
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------
|
2016-03-17 20:16:26 +01:00
|
|
|
# Saving build summary to the image
|
2015-12-02 20:33:32 +01:00
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------
|
2016-08-30 19:25:32 +03:00
|
|
|
display_alert "Fingerprinting"
|
2016-06-08 18:16:11 +03:00
|
|
|
cat <<-EOF > $1
|
|
|
|
--------------------------------------------------------------------------------
|
2016-08-30 19:25:32 +03:00
|
|
|
Title: Armbian $REVISION ${BOARD^} $DISTRIBUTION $RELEASE $BRANCH
|
2016-06-08 18:16:11 +03:00
|
|
|
Kernel: Linux $VER
|
|
|
|
Build date: $(date +'%d.%m.%Y')
|
2016-09-14 14:39:53 +02:00
|
|
|
Authors: http://www.armbian.com/authors
|
2016-06-08 18:16:11 +03:00
|
|
|
Sources: http://github.com/igorpecovnik/lib
|
2016-09-14 14:39:53 +02:00
|
|
|
Support: http://forum.armbian.com/
|
2016-06-12 22:43:50 +03:00
|
|
|
Changelog: http://www.armbian.com/logbook/
|
2016-07-26 20:15:23 +03:00
|
|
|
Documantation: http://docs.armbian.com/
|
2016-06-08 18:16:11 +03:00
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
$(cat $SRC/lib/LICENSE)
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
EOF
|
2015-12-02 20:33:32 +01:00
|
|
|
}
|
|
|
|
|
2016-07-21 18:25:22 +03:00
|
|
|
addtorepo()
|
2015-12-02 20:33:32 +01:00
|
|
|
{
|
|
|
|
# add all deb files to repository
|
|
|
|
# parameter "remove" dumps all and creates new
|
|
|
|
# function: cycle trough distributions
|
2017-01-12 15:31:53 +03:00
|
|
|
local distributions=("jessie" "xenial")
|
2016-08-30 19:25:32 +03:00
|
|
|
|
2016-07-21 18:25:22 +03:00
|
|
|
for release in "${distributions[@]}"; do
|
2016-08-30 19:25:32 +03:00
|
|
|
|
2015-12-02 20:33:32 +01:00
|
|
|
# let's drop from publish if exits
|
2016-07-21 18:25:22 +03:00
|
|
|
if [[ -n $(aptly publish list -config=config/aptly.conf -raw | awk '{print $(NF)}' | grep $release) ]]; then
|
|
|
|
aptly publish drop -config=config/aptly.conf $release > /dev/null 2>&1
|
2015-12-02 20:33:32 +01:00
|
|
|
fi
|
|
|
|
#aptly db cleanup -config=config/aptly.conf
|
|
|
|
|
2016-07-21 18:25:22 +03:00
|
|
|
if [[ $1 == remove ]]; then
|
2015-12-02 20:33:32 +01:00
|
|
|
# remove repository
|
2016-07-21 18:25:22 +03:00
|
|
|
aptly repo drop -config=config/aptly.conf $release > /dev/null 2>&1
|
2015-12-02 20:33:32 +01:00
|
|
|
aptly db cleanup -config=config/aptly.conf > /dev/null 2>&1
|
|
|
|
fi
|
2016-03-17 20:16:26 +01:00
|
|
|
|
2016-08-09 21:36:52 +02:00
|
|
|
if [[ $1 == replace ]]; then
|
|
|
|
local replace=true
|
2016-08-10 18:53:15 +03:00
|
|
|
else
|
|
|
|
local replace=false
|
2016-08-09 21:36:52 +02:00
|
|
|
fi
|
2016-08-10 18:53:15 +03:00
|
|
|
|
2016-08-09 21:36:52 +02:00
|
|
|
# create local repository if not exist
|
2016-07-21 18:25:22 +03:00
|
|
|
if [[ -z $(aptly repo list -config=config/aptly.conf -raw | awk '{print $(NF)}' | grep $release) ]]; then
|
|
|
|
display_alert "Creating section" "$release" "info"
|
2016-08-11 13:48:44 +03:00
|
|
|
aptly repo create -config=config/aptly.conf -distribution=$release -component=main -comment="Armbian main repository" $release
|
2015-12-02 20:33:32 +01:00
|
|
|
fi
|
2016-08-16 18:51:44 +02:00
|
|
|
if [[ -z $(aptly repo list -config=config/aptly.conf -raw | awk '{print $(NF)}' | grep "^utils") ]]; then
|
|
|
|
aptly repo create -config=config/aptly.conf -distribution=$release -component="utils" -comment="Armbian utilities" utils
|
2016-08-09 21:36:52 +02:00
|
|
|
fi
|
2016-08-11 15:50:59 +02:00
|
|
|
if [[ -z $(aptly repo list -config=config/aptly.conf -raw | awk '{print $(NF)}' | grep "${release}-desktop") ]]; then
|
2016-08-11 13:48:44 +03:00
|
|
|
aptly repo create -config=config/aptly.conf -distribution=$release -component="${release}-desktop" -comment="Armbian desktop" ${release}-desktop
|
2016-08-09 21:36:52 +02:00
|
|
|
fi
|
|
|
|
# create local repository if not exist
|
2016-08-10 18:53:15 +03:00
|
|
|
|
2016-08-09 21:36:52 +02:00
|
|
|
# adding main
|
2016-08-10 09:13:36 +02:00
|
|
|
if find $POT -maxdepth 1 -type f -name "*.deb" 2>/dev/null | grep -q .; then
|
2016-08-09 21:36:52 +02:00
|
|
|
display_alert "Adding to repository $release" "main" "ext"
|
2016-08-11 13:48:44 +03:00
|
|
|
aptly repo add -force-replace=$replace -config=config/aptly.conf $release $POT/*.deb
|
2016-08-10 09:13:36 +02:00
|
|
|
else
|
|
|
|
display_alert "Not adding $release" "main" "wrn"
|
|
|
|
fi
|
2016-08-30 19:25:32 +03:00
|
|
|
|
2016-08-17 21:23:32 +02:00
|
|
|
# adding main distribution packages
|
|
|
|
if find ${POT}${release} -maxdepth 1 -type f -name "*.deb" 2>/dev/null | grep -q .; then
|
|
|
|
display_alert "Adding to repository $release" "main" "ext"
|
|
|
|
aptly repo add -force-replace=$replace -config=config/aptly.conf $release ${POT}${release}/*.deb
|
|
|
|
else
|
|
|
|
display_alert "Not adding $release" "main" "wrn"
|
2016-08-30 19:25:32 +03:00
|
|
|
fi
|
|
|
|
|
2016-08-09 21:36:52 +02:00
|
|
|
# adding utils
|
2016-09-15 13:55:57 +02:00
|
|
|
if find ${POT}extra/utils -maxdepth 1 -type f -name "*.deb" 2>/dev/null | grep -q .; then
|
2016-08-10 18:53:15 +03:00
|
|
|
display_alert "Adding to repository $release" "utils" "ext"
|
2016-09-15 12:50:39 +02:00
|
|
|
aptly repo add -config=config/aptly.conf "utils" ${POT}extra/utils/*.deb
|
2016-08-10 09:13:36 +02:00
|
|
|
else
|
|
|
|
display_alert "Not adding $release" "utils" "wrn"
|
2016-08-09 21:36:52 +02:00
|
|
|
fi
|
2016-08-10 18:53:15 +03:00
|
|
|
|
2016-08-09 21:36:52 +02:00
|
|
|
# adding desktop
|
2016-09-15 13:55:57 +02:00
|
|
|
if find ${POT}extra/${release}-desktop -maxdepth 1 -type f -name "*.deb" 2>/dev/null | grep -q .; then
|
2016-08-09 21:36:52 +02:00
|
|
|
display_alert "Adding to repository $release" "desktop" "ext"
|
2016-09-15 12:49:15 +02:00
|
|
|
aptly repo add -force-replace=$replace -config=config/aptly.conf "${release}-desktop" ${POT}extra/${release}-desktop/*.deb
|
2016-08-10 09:13:36 +02:00
|
|
|
else
|
|
|
|
display_alert "Not adding $release" "desktop" "wrn"
|
2015-12-02 20:33:32 +01:00
|
|
|
fi
|
2016-08-10 18:53:15 +03:00
|
|
|
|
2016-08-10 09:57:35 +02:00
|
|
|
# publish
|
2016-08-16 18:51:44 +02:00
|
|
|
aptly publish -passphrase=$GPG_PASS -origin=Armbian -label=Armbian -config=config/aptly.conf -component=main,utils,${release}-desktop \
|
2016-09-18 16:34:45 +02:00
|
|
|
--distribution=$release repo $release utils ${release}-desktop
|
2016-08-10 09:57:35 +02:00
|
|
|
|
2016-08-11 13:48:44 +03:00
|
|
|
if [[ $? -ne 0 ]]; then
|
2016-08-10 09:13:36 +02:00
|
|
|
display_alert "Publishing failed" "$release" "err"
|
|
|
|
exit 0
|
|
|
|
fi
|
2016-07-21 18:25:22 +03:00
|
|
|
done
|
2016-08-10 18:53:15 +03:00
|
|
|
display_alert "List of local repos" "local" "info"
|
|
|
|
(aptly repo list -config=config/aptly.conf) | egrep packages
|
2016-08-17 21:23:32 +02:00
|
|
|
# serve
|
|
|
|
# aptly -config=config/aptly.conf -listen=":8189" serve
|
2015-12-12 18:35:38 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
# prepare_host
|
|
|
|
#
|
|
|
|
# * checks and installs necessary packages
|
|
|
|
# * creates directory structure
|
|
|
|
# * changes system settings
|
|
|
|
#
|
2016-10-15 00:34:27 +03:00
|
|
|
prepare_host()
|
|
|
|
{
|
2015-12-12 18:35:38 +03:00
|
|
|
display_alert "Preparing" "host" "info"
|
|
|
|
|
2016-05-26 18:42:14 +03:00
|
|
|
if [[ $(dpkg --print-architecture) == arm* ]]; then
|
2016-07-21 23:20:45 +03:00
|
|
|
display_alert "Please read documentation to set up proper compilation environment"
|
|
|
|
display_alert "http://www.armbian.com/using-armbian-tools/"
|
2016-03-05 21:26:01 +03:00
|
|
|
exit_with_error "Running this tool on board itself is not supported"
|
2016-01-08 12:31:46 +03:00
|
|
|
fi
|
|
|
|
|
2016-06-20 18:11:25 +03:00
|
|
|
if [[ $(dpkg --print-architecture) == i386 ]]; then
|
2016-07-21 23:20:45 +03:00
|
|
|
display_alert "Please read documentation to set up proper compilation environment"
|
|
|
|
display_alert "http://www.armbian.com/using-armbian-tools/"
|
|
|
|
display_alert "Running this tool on non-x64 build host in not supported officially" "" "wrn"
|
2016-06-20 18:11:25 +03:00
|
|
|
fi
|
|
|
|
|
2015-12-12 18:35:38 +03:00
|
|
|
# dialog may be used to display progress
|
2016-01-08 12:31:46 +03:00
|
|
|
if [[ $(dpkg-query -W -f='${db:Status-Abbrev}\n' dialog 2>/dev/null) != *ii* ]]; then
|
2016-07-21 23:20:45 +03:00
|
|
|
display_alert "Installing package" "dialog"
|
2015-12-14 17:03:41 +03:00
|
|
|
apt-get install -qq -y --no-install-recommends dialog >/dev/null 2>&1
|
2015-12-12 18:35:38 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
# need lsb_release to decide what to install
|
2016-01-08 12:31:46 +03:00
|
|
|
if [[ $(dpkg-query -W -f='${db:Status-Abbrev}\n' lsb-release 2>/dev/null) != *ii* ]]; then
|
2016-07-21 23:20:45 +03:00
|
|
|
display_alert "Installing package" "lsb-release"
|
2015-12-14 17:03:41 +03:00
|
|
|
apt-get install -qq -y --no-install-recommends lsb-release >/dev/null 2>&1
|
2015-12-12 18:35:38 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
# packages list for host
|
2017-01-18 20:57:37 +03:00
|
|
|
local hostdeps="wget ca-certificates device-tree-compiler pv bc lzop zip binfmt-support build-essential ccache debootstrap ntpdate \
|
2016-01-08 22:23:42 +03:00
|
|
|
gawk gcc-arm-linux-gnueabihf gcc-arm-linux-gnueabi qemu-user-static u-boot-tools uuid-dev zlib1g-dev unzip libusb-1.0-0-dev ntpdate \
|
2016-03-04 12:29:21 +03:00
|
|
|
parted pkg-config libncurses5-dev whiptail debian-keyring debian-archive-keyring f2fs-tools libfile-fcntllock-perl rsync libssl-dev \
|
2016-08-31 11:57:50 +03:00
|
|
|
nfs-kernel-server btrfs-tools gcc-aarch64-linux-gnu ncurses-term p7zip-full dos2unix dosfstools libc6-dev-armhf-cross libc6-dev-armel-cross \
|
2017-01-18 20:57:37 +03:00
|
|
|
libc6-dev-arm64-cross curl gcc-arm-none-eabi libnewlib-arm-none-eabi patchutils python liblz4-tool"
|
2015-12-12 18:35:38 +03:00
|
|
|
|
|
|
|
local codename=$(lsb_release -sc)
|
2016-06-27 13:22:49 +03:00
|
|
|
display_alert "Build host OS release" "${codename:-(unknown)}" "info"
|
2016-09-29 19:42:17 +03:00
|
|
|
if [[ -z $codename || "trusty xenial" != *"$codename"* ]]; then
|
2015-12-12 18:35:38 +03:00
|
|
|
display_alert "Host system support was not tested" "${codename:-(unknown)}" "wrn"
|
2016-09-29 19:42:17 +03:00
|
|
|
display_alert "Please don't ask for support if anything doesn't work"
|
2016-04-03 10:13:13 +02:00
|
|
|
echo -e "Press \e[0;33m<Ctrl-C>\x1B[0m to abort compilation, \e[0;33m<Enter>\x1B[0m to ignore and continue"
|
|
|
|
read
|
2015-12-12 18:35:38 +03:00
|
|
|
fi
|
|
|
|
|
2016-06-30 02:01:30 +03:00
|
|
|
if [[ $codename == xenial ]]; then
|
2016-09-07 19:52:31 +03:00
|
|
|
hostdeps="$hostdeps systemd-container udev distcc libstdc++-arm-none-eabi-newlib gcc-4.9-arm-linux-gnueabihf \
|
|
|
|
gcc-4.9-aarch64-linux-gnu g++-4.9-arm-linux-gnueabihf g++-4.9-aarch64-linux-gnu g++-5-aarch64-linux-gnu \
|
2016-10-25 17:57:57 +03:00
|
|
|
g++-5-arm-linux-gnueabihf lib32stdc++6 libc6-i386 lib32ncurses5 lib32tinfo5 aptly"
|
|
|
|
grep -q i386 <(dpkg --print-foreign-architectures) || dpkg --add-architecture i386
|
2016-07-17 00:43:15 +03:00
|
|
|
if systemd-detect-virt -q -c; then
|
2016-06-30 02:01:30 +03:00
|
|
|
display_alert "Running in container" "$(systemd-detect-virt)" "info"
|
2016-07-06 15:20:22 +03:00
|
|
|
# disable apt-cacher unless NO_APT_CACHER=no is not specified explicitly
|
|
|
|
if [[ $NO_APT_CACHER != no ]]; then
|
2016-07-12 21:18:34 +03:00
|
|
|
display_alert "apt-cacher is disabled, set NO_APT_CACHER=no to override" "" "wrn"
|
2016-07-06 15:20:22 +03:00
|
|
|
NO_APT_CACHER=yes
|
|
|
|
fi
|
2016-10-15 00:34:27 +03:00
|
|
|
CONTAINER_COMPAT=yes
|
2016-06-30 02:01:30 +03:00
|
|
|
fi
|
|
|
|
fi
|
2016-06-19 16:55:03 +03:00
|
|
|
|
2016-07-06 15:20:22 +03:00
|
|
|
# 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
|
|
|
|
|
2015-12-12 18:35:38 +03:00
|
|
|
local deps=()
|
|
|
|
local installed=$(dpkg-query -W -f '${db:Status-Abbrev}|${binary:Package}\n' '*' 2>/dev/null | grep '^ii' | awk -F '|' '{print $2}' | cut -d ':' -f 1)
|
|
|
|
|
2016-05-26 18:42:14 +03:00
|
|
|
for packet in $hostdeps; do
|
2016-04-20 15:38:09 +03:00
|
|
|
if ! grep -q -x -e "$packet" <<< "$installed"; then deps+=("$packet"); fi
|
2015-12-12 18:35:38 +03:00
|
|
|
done
|
|
|
|
|
2016-01-08 12:31:46 +03:00
|
|
|
if [[ ${#deps[@]} -gt 0 ]]; then
|
2016-10-25 17:57:57 +03:00
|
|
|
eval '( apt-get -q update; apt-get -q -y --no-install-recommends install "${deps[@]}" )' \
|
2015-12-12 18:35:38 +03:00
|
|
|
${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/output.log'} \
|
2016-03-27 15:39:08 +02:00
|
|
|
${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Installing ${#deps[@]} host dependencies..." $TTY_Y $TTY_X'} \
|
2015-12-12 18:35:38 +03:00
|
|
|
${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'}
|
2016-09-07 19:52:31 +03:00
|
|
|
# this is needed in case new compilers were installed
|
|
|
|
update-ccache-symlinks
|
2015-12-12 18:35:38 +03:00
|
|
|
fi
|
|
|
|
|
2016-10-25 17:57:57 +03:00
|
|
|
if [[ $codename == xenial && $(dpkg-query -W -f='${db:Status-Abbrev}\n' 'zlib1g:i386' 2>/dev/null) != *ii* ]]; then
|
|
|
|
apt-get install -qq -y --no-install-recommends zlib1g:i386 >/dev/null 2>&1
|
2016-04-14 18:04:28 +03:00
|
|
|
fi
|
|
|
|
|
2015-12-12 18:35:38 +03:00
|
|
|
# enable arm binary format so that the cross-architecture chroot environment will work
|
2016-10-26 16:50:11 +03:00
|
|
|
if [[ $KERNEL_ONLY != yes && ! -d /proc/sys/fs/binfmt_misc ]]; then
|
|
|
|
modprobe -q binfmt_misc || exit_with_error "Kernel does not support binfmt_misc"
|
|
|
|
fi
|
2015-12-12 18:35:38 +03:00
|
|
|
test -e /proc/sys/fs/binfmt_misc/qemu-arm || update-binfmts --enable qemu-arm
|
2016-04-20 15:38:09 +03:00
|
|
|
test -e /proc/sys/fs/binfmt_misc/qemu-aarch64 || update-binfmts --enable qemu-aarch64
|
2015-12-12 18:35:38 +03:00
|
|
|
|
|
|
|
# create directory structure
|
2016-07-09 00:18:41 +03:00
|
|
|
mkdir -p $SOURCES $DEST/debs/extra $DEST/debug $CACHEDIR/rootfs $SRC/userpatches/overlay $SRC/toolchains $SRC/userpatches/patch
|
2015-12-12 18:35:38 +03:00
|
|
|
find $SRC/lib/patch -type d ! -name . | sed "s%lib/patch%userpatches%" | xargs mkdir -p
|
|
|
|
|
2016-06-08 17:48:15 +03:00
|
|
|
# download external Linaro compiler and missing special dependencies since they are needed for certain sources
|
2016-08-11 22:06:05 +03:00
|
|
|
if [[ $codename == xenial ]]; then
|
|
|
|
download_toolchain "https://releases.linaro.org/components/toolchain/binaries/4.9-2016.02/aarch64-linux-gnu/gcc-linaro-4.9-2016.02-x86_64_aarch64-linux-gnu.tar.xz"
|
|
|
|
download_toolchain "https://releases.linaro.org/components/toolchain/binaries/4.9-2016.02/arm-linux-gnueabi/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabi.tar.xz"
|
|
|
|
download_toolchain "https://releases.linaro.org/components/toolchain/binaries/4.9-2016.02/arm-linux-gnueabihf/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf.tar.xz"
|
|
|
|
download_toolchain "https://releases.linaro.org/components/toolchain/binaries/5.2-2015.11-2/arm-linux-gnueabihf/gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf.tar.xz"
|
2016-12-14 16:11:38 +03:00
|
|
|
download_toolchain "https://releases.linaro.org/archive/14.04/components/toolchain/binaries/gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux.tar.xz"
|
|
|
|
download_toolchain "https://releases.linaro.org/components/toolchain/binaries/6.2-2016.11/arm-linux-gnueabihf/gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf.tar.xz"
|
|
|
|
download_toolchain "https://releases.linaro.org/components/toolchain/binaries/6.2-2016.11/aarch64-linux-gnu/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu.tar.xz"
|
2016-08-11 22:06:05 +03:00
|
|
|
fi
|
2016-06-08 17:48:15 +03:00
|
|
|
|
2015-12-22 20:41:43 +03:00
|
|
|
[[ ! -f $SRC/userpatches/customize-image.sh ]] && cp $SRC/lib/scripts/customize-image.sh.template $SRC/userpatches/customize-image.sh
|
|
|
|
|
2016-05-26 18:42:14 +03:00
|
|
|
if [[ ! -f $SRC/userpatches/README ]]; then
|
|
|
|
rm $SRC/userpatches/readme.txt
|
|
|
|
echo 'Please read documentation about customizing build configuration' > $SRC/userpatches/README
|
|
|
|
echo 'http://www.armbian.com/using-armbian-tools/' >> $SRC/userpatches/README
|
|
|
|
fi
|
2016-05-24 18:44:45 +03:00
|
|
|
|
2016-05-26 18:42:14 +03:00
|
|
|
# check free space (basic), doesn't work on Trusty
|
|
|
|
local freespace=$(findmnt --target $SRC -n -o AVAIL -b 2>/dev/null) # in bytes
|
2016-10-25 17:57:57 +03:00
|
|
|
if [[ -n $freespace && $(( $freespace / 1073741824 )) -lt 10 ]]; then
|
|
|
|
display_alert "Low free space left" "$(( $freespace / 1073741824 )) GiB" "wrn"
|
|
|
|
# pause here since dialog-based menu will hide this message otherwise
|
|
|
|
echo -e "Press \e[0;33m<Ctrl-C>\x1B[0m to abort compilation, \e[0;33m<Enter>\x1B[0m to ignore and continue"
|
|
|
|
read
|
|
|
|
fi
|
2015-12-12 18:35:38 +03:00
|
|
|
}
|
2016-07-26 20:15:23 +03:00
|
|
|
|
|
|
|
# download_toolchain <url>
|
|
|
|
#
|
|
|
|
download_toolchain()
|
|
|
|
{
|
|
|
|
local url=$1
|
|
|
|
local filename=${url##*/}
|
|
|
|
local dirname=${filename//.tar.xz}
|
|
|
|
|
|
|
|
if [[ -f $SRC/toolchains/$dirname/.download-complete ]]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd $SRC/toolchains/
|
|
|
|
|
2016-07-27 00:13:11 +03:00
|
|
|
display_alert "Downloading toolchain" "$dirname" "info"
|
2016-07-26 20:15:23 +03:00
|
|
|
curl -Lf --progress-bar $url -o $filename
|
|
|
|
curl -Lf --progress-bar ${url}.asc -o ${filename}.asc
|
|
|
|
|
|
|
|
local verified=false
|
|
|
|
|
|
|
|
display_alert "Verifying"
|
|
|
|
if grep -q 'BEGIN PGP SIGNATURE' ${filename}.asc; then
|
2016-08-28 18:55:31 +03:00
|
|
|
if [[ ! -d $DEST/.gpg ]]; then
|
|
|
|
mkdir -p $DEST/.gpg
|
|
|
|
chmod 700 $DEST/.gpg
|
|
|
|
touch $DEST/.gpg/gpg.conf
|
|
|
|
chmod 600 $DEST/.gpg/gpg.conf
|
|
|
|
fi
|
2016-09-08 15:06:30 +03:00
|
|
|
(gpg --homedir $DEST/.gpg --no-permission-warning --list-keys 8F427EAF || gpg --homedir $DEST/.gpg --no-permission-warning --keyserver keyserver.ubuntu.com --recv-keys 8F427EAF) 2>&1 | tee -a $DEST/debug/output.log
|
|
|
|
gpg --homedir $DEST/.gpg --no-permission-warning --verify --trust-model always -q ${filename}.asc 2>&1 | tee -a $DEST/debug/output.log
|
2016-08-11 21:04:41 +03:00
|
|
|
[[ ${PIPESTATUS[0]} -eq 0 ]] && verified=true
|
2016-07-26 20:15:23 +03:00
|
|
|
else
|
|
|
|
md5sum -c --status ${filename}.asc && verified=true
|
|
|
|
fi
|
|
|
|
if [[ $verified == true ]]; then
|
|
|
|
display_alert "Extracting"
|
2016-07-28 12:33:08 +03:00
|
|
|
tar --overwrite -xf $filename && touch $SRC/toolchains/$dirname/.download-complete
|
2016-07-26 20:15:23 +03:00
|
|
|
display_alert "Download complete" "" "info"
|
|
|
|
else
|
|
|
|
display_alert "Verification failed" "" "wrn"
|
|
|
|
fi
|
|
|
|
}
|