mirror of
https://github.com/Fishwaldo/build.git
synced 2025-06-18 20:32:15 +00:00
build optimize for upstream (#1713)
* add tuna debian-security mirror Signed-off-by: Zhang Ning <832666+zhangn1985@users.noreply.github.com> * replace apt-get with apt Signed-off-by: Zhang Ning <832666+zhangn1985@users.noreply.github.com> * speed up desktop build Signed-off-by: Zhang Ning <832666+zhangn1985@users.noreply.github.com>
This commit is contained in:
parent
5c7e7c7235
commit
3e38b4b715
8 changed files with 27 additions and 25 deletions
|
@ -18,7 +18,7 @@ Supported build environment is **Ubuntu Bionic 18.04 x64** ([minimal iso image](
|
||||||
|
|
||||||
**Execution**
|
**Execution**
|
||||||
|
|
||||||
apt-get -y install git
|
apt -y install git
|
||||||
git clone https://github.com/armbian/build
|
git clone https://github.com/armbian/build
|
||||||
cd build
|
cd build
|
||||||
./compile.sh
|
./compile.sh
|
||||||
|
|
10
compile.sh
10
compile.sh
|
@ -87,8 +87,8 @@ rm $TMPFILE
|
||||||
# Check for Vagrant
|
# Check for Vagrant
|
||||||
if [[ "$1" == vagrant && -z "$(which vagrant)" ]]; then
|
if [[ "$1" == vagrant && -z "$(which vagrant)" ]]; then
|
||||||
display_alert "Vagrant not installed." "Installing"
|
display_alert "Vagrant not installed." "Installing"
|
||||||
sudo apt-get update
|
sudo apt update
|
||||||
sudo apt-get install -y vagrant virtualbox
|
sudo apt install -y vagrant virtualbox
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$1" == dockerpurge && -f /etc/debian_version ]]; then
|
if [[ "$1" == dockerpurge && -f /etc/debian_version ]]; then
|
||||||
|
@ -116,12 +116,12 @@ if [[ "$1" == docker && -f /etc/debian_version && -z "$(which docker)" ]]; then
|
||||||
do
|
do
|
||||||
[[ ! $(which $i) ]] && install_packages+=$i" "
|
[[ ! $(which $i) ]] && install_packages+=$i" "
|
||||||
done
|
done
|
||||||
[[ -z $install_packages ]] && apt-get update;apt-get install -y -qq --no-install-recommends $install_packages
|
[[ -z $install_packages ]] && apt update;apt install -y -qq --no-install-recommends $install_packages
|
||||||
|
|
||||||
curl -fsSL "https://download.docker.com/linux/$(lsb_release -is | awk '{print tolower($0)}')/gpg" | apt-key add -qq - > /dev/null 2>&1
|
curl -fsSL "https://download.docker.com/linux/$(lsb_release -is | awk '{print tolower($0)}')/gpg" | apt-key add -qq - > /dev/null 2>&1
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
apt-get update
|
apt update
|
||||||
apt-get install -y -qq --no-install-recommends docker-ce
|
apt install -y -qq --no-install-recommends docker-ce
|
||||||
display_alert "Add yourself to docker group to avoid root privileges" "" "wrn"
|
display_alert "Add yourself to docker group to avoid root privileges" "" "wrn"
|
||||||
"$SRC/compile.sh" "$@"
|
"$SRC/compile.sh" "$@"
|
||||||
exit $?
|
exit $?
|
||||||
|
|
|
@ -156,7 +156,7 @@ chroot_build_packages()
|
||||||
local t=$target_dir/root/.update-timestamp
|
local t=$target_dir/root/.update-timestamp
|
||||||
if [[ ! -f $t || $(( ($(date +%s) - $(<$t)) / 86400 )) -gt 7 ]]; then
|
if [[ ! -f $t || $(( ($(date +%s) - $(<$t)) / 86400 )) -gt 7 ]]; then
|
||||||
display_alert "Upgrading packages" "$release/$arch" "info"
|
display_alert "Upgrading packages" "$release/$arch" "info"
|
||||||
systemd-nspawn -a -q -D $target_dir /bin/bash -c "apt-get -q update; apt-get -q -y upgrade; apt-get clean"
|
systemd-nspawn -a -q -D $target_dir /bin/bash -c "apt -q update; apt -q -y upgrade; apt clean"
|
||||||
date +%s > $t
|
date +%s > $t
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -219,8 +219,8 @@ chroot_build_packages()
|
||||||
for packet in $package_builddeps; do grep -q -x -e "\$packet" <<< "\$installed" || deps+=("\$packet"); done
|
for packet in $package_builddeps; do grep -q -x -e "\$packet" <<< "\$installed" || deps+=("\$packet"); done
|
||||||
if [[ \${#deps[@]} -gt 0 ]]; then
|
if [[ \${#deps[@]} -gt 0 ]]; then
|
||||||
display_alert "Installing build dependencies"
|
display_alert "Installing build dependencies"
|
||||||
apt-get -y -q update
|
apt -y -q update
|
||||||
apt-get -y -q --no-install-recommends --show-progress -o DPKG::Progress-Fancy=1 install "\${deps[@]}"
|
apt -y -q --no-install-recommends --show-progress -o DPKG::Progress-Fancy=1 install "\${deps[@]}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
display_alert "Copying sources"
|
display_alert "Copying sources"
|
||||||
|
@ -333,17 +333,17 @@ chroot_installpackages()
|
||||||
cat <<-EOF > "${SDCARD}"/tmp/install.sh
|
cat <<-EOF > "${SDCARD}"/tmp/install.sh
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
[[ "$remote_only" != yes ]] && apt-key add /tmp/buildpkg.key
|
[[ "$remote_only" != yes ]] && apt-key add /tmp/buildpkg.key
|
||||||
apt-get $apt_extra -q update
|
apt $apt_extra -q update
|
||||||
# uncomment to debug
|
# uncomment to debug
|
||||||
# /bin/bash
|
# /bin/bash
|
||||||
# TODO: check if package exists in case new config was added
|
# TODO: check if package exists in case new config was added
|
||||||
#if [[ -n "$remote_only" == yes ]]; then
|
#if [[ -n "$remote_only" == yes ]]; then
|
||||||
# for p in $install_list; do
|
# for p in $install_list; do
|
||||||
# if grep -qE "apt.armbian.com|localhost" <(apt-cache madison \$p); then
|
# if grep -qE "apt.armbian.com|localhost" <(apt-cache madison \$p); then
|
||||||
# if apt-get -s -qq install \$p; then
|
# if apt -s -qq install \$p; then
|
||||||
#fi
|
#fi
|
||||||
apt-get -q $apt_extra --show-progress -o DPKG::Progress-Fancy=1 install -y $install_list
|
apt -q $apt_extra --show-progress -o DPKG::Progress-Fancy=1 install -y $install_list
|
||||||
apt-get clean
|
apt clean
|
||||||
[[ "$remote_only" != yes ]] && apt-key del "925644A6"
|
[[ "$remote_only" != yes ]] && apt-key del "925644A6"
|
||||||
rm /etc/apt/sources.list.d/armbian-temp.list 2>/dev/null
|
rm /etc/apt/sources.list.d/armbian-temp.list 2>/dev/null
|
||||||
rm /etc/apt/preferences.d/90-armbian-temp.pref 2>/dev/null
|
rm /etc/apt/preferences.d/90-armbian-temp.pref 2>/dev/null
|
||||||
|
|
|
@ -252,10 +252,12 @@ esac
|
||||||
|
|
||||||
|
|
||||||
DEBIAN_MIRROR='httpredir.debian.org/debian'
|
DEBIAN_MIRROR='httpredir.debian.org/debian'
|
||||||
|
DEBIAN_SECURTY='http://security.debian.org/'
|
||||||
UBUNTU_MIRROR='ports.ubuntu.com/'
|
UBUNTU_MIRROR='ports.ubuntu.com/'
|
||||||
|
|
||||||
if [[ $DOWNLOAD_MIRROR == china ]] ; then
|
if [[ $DOWNLOAD_MIRROR == china ]] ; then
|
||||||
DEBIAN_MIRROR='mirrors.tuna.tsinghua.edu.cn/debian'
|
DEBIAN_MIRROR='mirrors.tuna.tsinghua.edu.cn/debian'
|
||||||
|
DEBIAN_SECURTY='mirrors.tuna.tsinghua.edu.cn/debian-security'
|
||||||
UBUNTU_MIRROR='mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/'
|
UBUNTU_MIRROR='mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ create_rootfs_cache()
|
||||||
|
|
||||||
# stage: debootstrap base system
|
# stage: debootstrap base system
|
||||||
if [[ $NO_APT_CACHER != yes ]]; then
|
if [[ $NO_APT_CACHER != yes ]]; then
|
||||||
# apt-cacher-ng apt-get proxy parameter
|
# apt-cacher-ng apt proxy parameter
|
||||||
local apt_extra="-o Acquire::http::Proxy=\"http://${APT_PROXY_ADDR:-localhost:3142}\""
|
local apt_extra="-o Acquire::http::Proxy=\"http://${APT_PROXY_ADDR:-localhost:3142}\""
|
||||||
local apt_mirror="http://${APT_PROXY_ADDR:-localhost:3142}/$APT_MIRROR"
|
local apt_mirror="http://${APT_PROXY_ADDR:-localhost:3142}/$APT_MIRROR"
|
||||||
else
|
else
|
||||||
|
@ -194,7 +194,7 @@ create_rootfs_cache()
|
||||||
|
|
||||||
# stage: update packages list
|
# stage: update packages list
|
||||||
display_alert "Updating package list" "$RELEASE" "info"
|
display_alert "Updating package list" "$RELEASE" "info"
|
||||||
eval 'LC_ALL=C LANG=C chroot $SDCARD /bin/bash -c "apt-get -q -y $apt_extra update"' \
|
eval 'LC_ALL=C LANG=C chroot $SDCARD /bin/bash -c "apt -q -y $apt_extra update"' \
|
||||||
${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} \
|
${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} \
|
||||||
${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Updating package lists..." $TTY_Y $TTY_X'} \
|
${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Updating package lists..." $TTY_Y $TTY_X'} \
|
||||||
${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'}
|
${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'}
|
||||||
|
@ -203,7 +203,7 @@ create_rootfs_cache()
|
||||||
|
|
||||||
# stage: upgrade base packages from xxx-updates and xxx-backports repository branches
|
# stage: upgrade base packages from xxx-updates and xxx-backports repository branches
|
||||||
display_alert "Upgrading base packages" "Armbian" "info"
|
display_alert "Upgrading base packages" "Armbian" "info"
|
||||||
eval 'LC_ALL=C LANG=C chroot $SDCARD /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y -q \
|
eval 'LC_ALL=C LANG=C chroot $SDCARD /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt -y -q \
|
||||||
$apt_extra $apt_extra_progress upgrade"' \
|
$apt_extra $apt_extra_progress upgrade"' \
|
||||||
${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} \
|
${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} \
|
||||||
${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Upgrading base packages..." $TTY_Y $TTY_X'} \
|
${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Upgrading base packages..." $TTY_Y $TTY_X'} \
|
||||||
|
@ -222,7 +222,7 @@ create_rootfs_cache()
|
||||||
[[ ${PIPESTATUS[0]} -ne 0 ]] && exit_with_error "Installation of Armbian packages failed"
|
[[ ${PIPESTATUS[0]} -ne 0 ]] && exit_with_error "Installation of Armbian packages failed"
|
||||||
|
|
||||||
# stage: remove downloaded packages
|
# stage: remove downloaded packages
|
||||||
chroot $SDCARD /bin/bash -c "apt-get clean"
|
chroot $SDCARD /bin/bash -c "apt clean"
|
||||||
|
|
||||||
# DEBUG: print free space
|
# DEBUG: print free space
|
||||||
echo -e "\nFree space:"
|
echo -e "\nFree space:"
|
||||||
|
|
|
@ -120,18 +120,18 @@ desktop_postinstall ()
|
||||||
{
|
{
|
||||||
# disable display manager for first run
|
# disable display manager for first run
|
||||||
chroot "${SDCARD}" /bin/bash -c "systemctl --no-reload disable lightdm.service >/dev/null 2>&1"
|
chroot "${SDCARD}" /bin/bash -c "systemctl --no-reload disable lightdm.service >/dev/null 2>&1"
|
||||||
|
chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt update" >> "${DEST}"/debug/install.log
|
||||||
if [[ ${FULL_DESKTOP} == yes ]]; then
|
if [[ ${FULL_DESKTOP} == yes ]]; then
|
||||||
chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get update" >> "${DEST}"/debug/install.log
|
chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt -yqq --no-install-recommends install $PACKAGE_LIST_DESKTOP_FULL" >> "${DEST}"/debug/install.log
|
||||||
chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get update; apt-get -yqq --no-install-recommends install $PACKAGE_LIST_DESKTOP_FULL" >> "${DEST}"/debug/install.log
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n ${PACKAGE_LIST_DESKTOP_BOARD} ]]; then
|
if [[ -n ${PACKAGE_LIST_DESKTOP_BOARD} ]]; then
|
||||||
chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get update; apt-get -yqq --no-install-recommends install $PACKAGE_LIST_DESKTOP_BOARD" >> "${DEST}"/debug/install.log
|
chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt -yqq --no-install-recommends install $PACKAGE_LIST_DESKTOP_BOARD" >> "${DEST}"/debug/install.log
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n ${PACKAGE_LIST_DESKTOP_FAMILY} ]]; then
|
if [[ -n ${PACKAGE_LIST_DESKTOP_FAMILY} ]]; then
|
||||||
chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get update; apt-get -yqq --no-install-recommends install $PACKAGE_LIST_DESKTOP_FAMILY" >> "${DEST}"/debug/install.log
|
chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt -yqq --no-install-recommends install $PACKAGE_LIST_DESKTOP_FAMILY" >> "${DEST}"/debug/install.log
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Compile Turbo Frame buffer for sunxi
|
# Compile Turbo Frame buffer for sunxi
|
||||||
if [[ $LINUXFAMILY == sun* && $BRANCH == default ]]; then
|
if [[ $LINUXFAMILY == sun* && $BRANCH == default ]]; then
|
||||||
|
|
|
@ -144,8 +144,8 @@ create_sources_list()
|
||||||
deb http://${DEBIAN_MIRROR} ${release}-backports 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-src http://${DEBIAN_MIRROR} ${release}-backports main contrib non-free
|
||||||
|
|
||||||
deb http://security.debian.org/ ${release}/updates main contrib non-free
|
deb http://${DEBIAN_SECURTY} ${release}/updates main contrib non-free
|
||||||
#deb-src http://security.debian.org/ ${release}/updates main contrib non-free
|
#deb-src http://${DEBIAN_SECURTY} ${release}/updates main contrib non-free
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ install_deb_chroot()
|
||||||
cp "${package}" "${SDCARD}/root/${name}"
|
cp "${package}" "${SDCARD}/root/${name}"
|
||||||
display_alert "Installing" "$name"
|
display_alert "Installing" "$name"
|
||||||
[[ $NO_APT_CACHER != yes ]] && local apt_extra="-o Acquire::http::Proxy=\"http://${APT_PROXY_ADDR:-localhost:3142}\" -o Acquire::http::Proxy::localhost=\"DIRECT\""
|
[[ $NO_APT_CACHER != yes ]] && local apt_extra="-o Acquire::http::Proxy=\"http://${APT_PROXY_ADDR:-localhost:3142}\" -o Acquire::http::Proxy::localhost=\"DIRECT\""
|
||||||
LC_ALL=C LANG=C chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -yqq \
|
LC_ALL=C LANG=C chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt -yqq \
|
||||||
$apt_extra --no-install-recommends install ./root/$name" >> "${DEST}"/debug/install.log 2>&1
|
$apt_extra --no-install-recommends install ./root/$name" >> "${DEST}"/debug/install.log 2>&1
|
||||||
|
|
||||||
rm -f "${SDCARD}/root/${name}"
|
rm -f "${SDCARD}/root/${name}"
|
||||||
|
|
Loading…
Add table
Reference in a new issue