Small fixes
This commit is contained in:
parent
7f66e045be
commit
b7b5d93670
@ -20,6 +20,7 @@
|
||||
#
|
||||
create_chroot()
|
||||
{
|
||||
display_alert "Creating build chroot" "$RELEASE" "info"
|
||||
local target_dir="$1"
|
||||
debootstrap --variant=buildd --arch=$ARCH --foreign \
|
||||
--include=ccache,locales,git,ca-certificates,devscripts,libfile-fcntllock-perl,debhelper,rsync,python3 \
|
||||
@ -39,6 +40,7 @@ create_chroot()
|
||||
printf '#!/bin/sh\nexit 101' > $target_dir/usr/sbin/policy-rc.d
|
||||
chmod 755 $target_dir/usr/sbin/policy-rc.d
|
||||
touch $target_dir/root/.debootstrap-complete
|
||||
display_alert "Debootstrap complete" "$RELEASE" "info"
|
||||
} #############################################################################
|
||||
|
||||
# update_chroot <target_dir>
|
||||
@ -56,7 +58,8 @@ update_chroot()
|
||||
mkdir -p $target_dir/var/lock
|
||||
fi
|
||||
if [[ ! -f $t || $(( ($(date +%s) - $(<$t)) / 86400 )) -gt 2 ]]; then
|
||||
systemd-nspawn -a -q -D $target_dir /bin/bash -c "apt-get -q update; apt-get -q -y upgrade"
|
||||
display_alert "Upgrading packages" "$RELEASE" "info"
|
||||
systemd-nspawn -a -q -D $target_dir /bin/bash -c "apt-get -q update; apt-get -q -y upgrade; apt-get clean"
|
||||
date +%s > $t
|
||||
fi
|
||||
cat <<-'EOF' > $target_dir/root/install-deps.sh
|
||||
@ -75,7 +78,7 @@ chroot_build_packages()
|
||||
{
|
||||
[[ $RELEASE != jessie && $RELEASE != xenial ]] && return
|
||||
|
||||
display_alert "Starting package building process" "$RELEASE"
|
||||
display_alert "Starting package building process" "$RELEASE" "info"
|
||||
|
||||
local target_dir=$DEST/buildpkg/${RELEASE}-${ARCH}
|
||||
# to avoid conflicts between published and self-built packages
|
||||
@ -113,10 +116,10 @@ chroot_build_packages()
|
||||
needs_building=yes
|
||||
fi
|
||||
if [[ $needs_building == no ]]; then
|
||||
display_alert "Packages are up to date" "$package_name"
|
||||
display_alert "Packages are up to date" "$package_name" "info"
|
||||
continue
|
||||
fi
|
||||
display_alert "Building packages" "$package_name"
|
||||
display_alert "Building packages" "$package_name" "info"
|
||||
# create build script
|
||||
cat <<-EOF > $target_dir/root/build.sh
|
||||
#!/bin/bash
|
||||
@ -149,8 +152,6 @@ chroot_build_packages()
|
||||
dpkg-buildpackage -b -uc -us -jauto
|
||||
if [[ \$? -eq 0 ]]; then
|
||||
cd /root/build
|
||||
display_alert "Done building" "$package_name" "ext"
|
||||
ls *.deb
|
||||
# install in chroot if other libraries depend on them
|
||||
if [[ -n "$package_install_chroot" ]]; then
|
||||
display_alert "Installing packages"
|
||||
@ -158,6 +159,8 @@ chroot_build_packages()
|
||||
dpkg -i \${p}_*.deb
|
||||
done
|
||||
fi
|
||||
display_alert "Done building" "$package_name" "ext"
|
||||
ls *.deb
|
||||
mv *.deb /root 2>/dev/null
|
||||
else
|
||||
display_alert "Failed building" "$package_name" "err"
|
||||
@ -199,7 +202,7 @@ fetch_from_repo()
|
||||
local ref_type=${ref%%:*}
|
||||
local ref_name=${ref##*:}
|
||||
|
||||
display_alert "Checking git sources" "$dir $ref_name"
|
||||
display_alert "Checking git sources" "$dir $ref_name" "info"
|
||||
|
||||
# get default remote branch name without cloning
|
||||
# doesn't work with git:// remote URLs
|
||||
@ -215,7 +218,7 @@ fetch_from_repo()
|
||||
|
||||
# this may not work if $SRC is a part of git repository
|
||||
if [[ $(git rev-parse --is-inside-work-tree 2>/dev/null) != true ]]; then
|
||||
display_alert "... creating local copy"
|
||||
display_alert "Creating local copy"
|
||||
git init -q .
|
||||
git remote add origin $url
|
||||
fi
|
||||
@ -245,28 +248,28 @@ fetch_from_repo()
|
||||
|
||||
if [[ $changed == true ]]; then
|
||||
# remote was updated, fetch and check out updates
|
||||
display_alert "... fetching 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"
|
||||
display_alert "Checking out"
|
||||
git checkout -f -q FETCH_HEAD
|
||||
elif [[ -n $(git status -uno --porcelain) ]]; then
|
||||
# working directory is not clean
|
||||
if [[ $FORCE_CHECKOUT == yes ]]; then
|
||||
display_alert "... checking out"
|
||||
display_alert "Checking out"
|
||||
git checkout -f -q HEAD
|
||||
else
|
||||
display_alert "... skipping checkout"
|
||||
display_alert "Skipping checkout"
|
||||
fi
|
||||
else
|
||||
# working directory is clean, nothing to do
|
||||
display_alert "... up to date"
|
||||
display_alert "Up to date"
|
||||
fi
|
||||
if [[ -f .gitmodules ]]; then
|
||||
display_alert "... updating submodules"
|
||||
display_alert "Updating submodules"
|
||||
git submodule update --init --depth 1
|
||||
fi
|
||||
} #############################################################################
|
||||
@ -275,28 +278,9 @@ fetch_from_repo()
|
||||
#
|
||||
chroot_installpackages()
|
||||
{
|
||||
local conf="/tmp/aptly-temp/aptly.conf"
|
||||
local conf=$SRC/lib/config/aptly-temp.conf
|
||||
rm -rf /tmp/aptly-temp/
|
||||
mkdir -p /tmp/aptly-temp/
|
||||
cat <<-'EOF' > $conf
|
||||
{
|
||||
"rootDir": "/tmp/aptly-temp/",
|
||||
"downloadConcurrency": 4,
|
||||
"downloadSpeedLimit": 0,
|
||||
"architectures": [],
|
||||
"dependencyFollowSuggests": false,
|
||||
"dependencyFollowRecommends": false,
|
||||
"dependencyFollowAllVariants": false,
|
||||
"dependencyFollowSource": false,
|
||||
"gpgDisableSign": false,
|
||||
"gpgDisableVerify": false,
|
||||
"downloadSourcePackages": false,
|
||||
"ppaDistributorID": "ubuntu",
|
||||
"ppaCodename": "",
|
||||
"S3PublishEndpoints": {},
|
||||
"SwiftPublishEndpoints": {}
|
||||
}
|
||||
EOF
|
||||
aptly -config=$conf repo create temp
|
||||
# NOTE: this works recursively
|
||||
aptly -config=$conf -force-replace=true repo add temp $DEST/debs/extra/$RELEASE/
|
||||
@ -306,7 +290,7 @@ chroot_installpackages()
|
||||
aptly -config=$conf -listen=":8189" serve &
|
||||
local aptly_pid=$!
|
||||
cp $SRC/lib/extras-buildpkgs/buildpkg.key $CACHEDIR/sdcard/tmp/buildpkg.key
|
||||
cat <<-EOF > $CACHEDIR/sdcard/etc/apt/preferences.d/90-armbian-temp.pref
|
||||
cat <<-'EOF' > $CACHEDIR/sdcard/etc/apt/preferences.d/90-armbian-temp.pref
|
||||
Package: *
|
||||
Pin: origin "localhost"
|
||||
Pin-Priority: 995
|
||||
@ -324,12 +308,12 @@ chroot_installpackages()
|
||||
done
|
||||
cat <<-EOF > $CACHEDIR/sdcard/tmp/install.sh
|
||||
#!/bin/bash
|
||||
cat /tmp/buildpkg.key | apt-key add -
|
||||
apt-get update
|
||||
apt-key add /tmp/buildpkg.key
|
||||
apt-get -q update
|
||||
# uncomment to debug
|
||||
# /bin/bash
|
||||
apt-get install -o Acquire::http::Proxy=\"http://${APT_PROXY_ADDR:-localhost:3142}\" \
|
||||
--show-progress -o DPKG::Progress-Fancy=1 -y $install_list
|
||||
apt-get -q -o Acquire::http::Proxy=\"http://${APT_PROXY_ADDR:-localhost:3142}\" \
|
||||
--show-progress -o DPKG::Progress-Fancy=1 install -y $install_list
|
||||
apt-get clean
|
||||
apt-key del 128290AF
|
||||
rm /etc/apt/sources.list.d/armbian-temp.list /etc/apt/preferences.d/90-armbian-temp.pref /tmp/buildpkg.key
|
||||
|
||||
17
config/aptly-temp.conf
Normal file
17
config/aptly-temp.conf
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"rootDir": "/tmp/aptly-temp/",
|
||||
"downloadConcurrency": 4,
|
||||
"downloadSpeedLimit": 0,
|
||||
"architectures": [],
|
||||
"dependencyFollowSuggests": false,
|
||||
"dependencyFollowRecommends": false,
|
||||
"dependencyFollowAllVariants": false,
|
||||
"dependencyFollowSource": false,
|
||||
"gpgDisableSign": false,
|
||||
"gpgDisableVerify": false,
|
||||
"downloadSourcePackages": false,
|
||||
"ppaDistributorID": "ubuntu",
|
||||
"ppaCodename": "",
|
||||
"S3PublishEndpoints": {},
|
||||
"SwiftPublishEndpoints": {}
|
||||
}
|
||||
56
general.sh
56
general.sh
@ -178,29 +178,33 @@ display_alert()
|
||||
# Let's have unique way of displaying alerts
|
||||
#--------------------------------------------------------------------------------------------------------------------------------
|
||||
{
|
||||
# log function parameters to install.log
|
||||
echo "Displaying message: $@" >> $DEST/debug/output.log
|
||||
# log function parameters to install.log
|
||||
echo "Displaying message: $@" >> $DEST/debug/output.log
|
||||
|
||||
local tmp=""
|
||||
[[ -n $2 ]] && tmp="[\e[0;33m $2 \x1B[0m]"
|
||||
local tmp=""
|
||||
[[ -n $2 ]] && tmp="[\e[0;33m $2 \x1B[0m]"
|
||||
|
||||
case $3 in
|
||||
err)
|
||||
echo -e "[\e[0;31m error \x1B[0m] $1 $tmp"
|
||||
;;
|
||||
case $3 in
|
||||
err)
|
||||
echo -e "[\e[0;31m error \x1B[0m] $1 $tmp"
|
||||
;;
|
||||
|
||||
wrn)
|
||||
echo -e "[\e[0;35m warn \x1B[0m] $1 $tmp"
|
||||
;;
|
||||
wrn)
|
||||
echo -e "[\e[0;35m warn \x1B[0m] $1 $tmp"
|
||||
;;
|
||||
|
||||
ext)
|
||||
echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0m $tmp"
|
||||
;;
|
||||
ext)
|
||||
echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0m $tmp"
|
||||
;;
|
||||
|
||||
*) # info or empty
|
||||
echo -e "[\e[0;32m o.k. \x1B[0m] $1 $tmp"
|
||||
;;
|
||||
esac
|
||||
info)
|
||||
echo -e "[\e[0;32m o.k. \x1B[0m] $1 $tmp"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo -e "[\e[0;32m .... \x1B[0m] $1 $tmp"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------------------
|
||||
@ -293,32 +297,32 @@ prepare_host() {
|
||||
display_alert "Preparing" "host" "info"
|
||||
|
||||
if [[ $(dpkg --print-architecture) == arm* ]]; then
|
||||
display_alert "Please read documentation to set up proper compilation environment" "..." "info"
|
||||
display_alert "http://www.armbian.com/using-armbian-tools/" "..." "info"
|
||||
display_alert "Please read documentation to set up proper compilation environment"
|
||||
display_alert "http://www.armbian.com/using-armbian-tools/"
|
||||
exit_with_error "Running this tool on board itself is not supported"
|
||||
fi
|
||||
|
||||
if [[ $(dpkg --print-architecture) == i386 ]]; then
|
||||
display_alert "Please read documentation to set up proper compilation environment" "..." "info"
|
||||
display_alert "http://www.armbian.com/using-armbian-tools/" "..." "info"
|
||||
display_alert "Running this tool on non-x64 build host in not supported officially" "wrn"
|
||||
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"
|
||||
fi
|
||||
|
||||
# dialog may be used to display progress
|
||||
if [[ $(dpkg-query -W -f='${db:Status-Abbrev}\n' dialog 2>/dev/null) != *ii* ]]; then
|
||||
display_alert "Installing package" "dialog" "info"
|
||||
display_alert "Installing package" "dialog"
|
||||
apt-get install -qq -y --no-install-recommends dialog >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
# wget is needed
|
||||
if [[ $(dpkg-query -W -f='${db:Status-Abbrev}\n' wget 2>/dev/null) != *ii* ]]; then
|
||||
display_alert "Installing package" "wget" "info"
|
||||
display_alert "Installing package" "wget"
|
||||
apt-get install -qq -y --no-install-recommends wget >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
# need lsb_release to decide what to install
|
||||
if [[ $(dpkg-query -W -f='${db:Status-Abbrev}\n' lsb-release 2>/dev/null) != *ii* ]]; then
|
||||
display_alert "Installing package" "lsb-release" "info"
|
||||
display_alert "Installing package" "lsb-release"
|
||||
apt-get install -qq -y --no-install-recommends lsb-release >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user