Shellcheck fixes 3 (#2054)

* lib/general.sh: Lint via shellcheck

* lib/compilation-prepare.sh: Lint via shellcheck
This commit is contained in:
Manuel Rüger
2020-06-24 02:15:20 +02:00
committed by GitHub
parent 752f4ddc7e
commit 68b6d2ead0
2 changed files with 329 additions and 315 deletions

View File

@@ -1,3 +1,5 @@
#!/bin/bash
#
# Copyright (c) 2015 Igor Pecovnik, igor.pecovnik@gma**.com # Copyright (c) 2015 Igor Pecovnik, igor.pecovnik@gma**.com
# #
# This file is licensed under the terms of the GNU General Public # This file is licensed under the terms of the GNU General Public
@@ -18,54 +20,54 @@ compilation_prepare()
# Maintaining one from central location starting with 5.3+ # Maintaining one from central location starting with 5.3+
# Temporally set for new "default->legacy,next->current" family naming # Temporally set for new "default->legacy,next->current" family naming
if linux-version compare $version ge 5.6; then if linux-version compare "${version}" ge 5.6; then
display_alert "Adjusting" "packaging" "info" display_alert "Adjusting" "packaging" "info"
cd ${SRC}/cache/sources/${LINUXSOURCEDIR} cd "${SRC}/cache/sources/${LINUXSOURCEDIR}" || exit
process_patch_file "${SRC}/patch/misc/general-packaging-5.6.y.patch" "applying" process_patch_file "${SRC}/patch/misc/general-packaging-5.6.y.patch" "applying"
else else
if linux-version compare $version ge 5.3; then if linux-version compare "${version}" ge 5.3; then
display_alert "Adjusting" "packaging" "info" display_alert "Adjusting" "packaging" "info"
cd ${SRC}/cache/sources/${LINUXSOURCEDIR} cd "${SRC}/cache/sources/${LINUXSOURCEDIR}" || exit
process_patch_file "${SRC}/patch/misc/general-packaging-5.3.y.patch" "applying" process_patch_file "${SRC}/patch/misc/general-packaging-5.3.y.patch" "applying"
fi fi
fi fi
if [[ $version == "4.19."* ]] && [[ "$LINUXFAMILY" == sunxi* || "$LINUXFAMILY" == meson64 || \ if [[ "${version}" == "4.19."* ]] && [[ "$LINUXFAMILY" == sunxi* || "$LINUXFAMILY" == meson64 || \
"$LINUXFAMILY" == mvebu64 || "$LINUXFAMILY" == mt7623 || "$LINUXFAMILY" == mvebu ]]; then "$LINUXFAMILY" == mvebu64 || "$LINUXFAMILY" == mt7623 || "$LINUXFAMILY" == mvebu ]]; then
display_alert "Adjustin" "packaging" "info" display_alert "Adjustin" "packaging" "info"
cd ${SRC}/cache/sources/${LINUXSOURCEDIR} cd "${SRC}/cache/sources/${LINUXSOURCEDIR}" || exit
process_patch_file "${SRC}/patch/misc/general-packaging-4.19.y.patch" "applying" process_patch_file "${SRC}/patch/misc/general-packaging-4.19.y.patch" "applying"
fi fi
if [[ $version == "4.14."* ]] && [[ "$LINUXFAMILY" == s5p6818 || "$LINUXFAMILY" == mvebu64 || \ if [[ "${version}" == "4.14."* ]] && [[ "$LINUXFAMILY" == s5p6818 || "$LINUXFAMILY" == mvebu64 || \
"$LINUXFAMILY" == imx7d || "$LINUXFAMILY" == odroidxu4 || "$LINUXFAMILY" == mvebu ]]; then "$LINUXFAMILY" == imx7d || "$LINUXFAMILY" == odroidxu4 || "$LINUXFAMILY" == mvebu ]]; then
display_alert "Adjustin" "packaging" "info" display_alert "Adjustin" "packaging" "info"
cd ${SRC}/cache/sources/${LINUXSOURCEDIR} cd "${SRC}/cache/sources/${LINUXSOURCEDIR}" || exit
process_patch_file "${SRC}/patch/misc/general-packaging-4.14.y.patch" "applying" process_patch_file "${SRC}/patch/misc/general-packaging-4.14.y.patch" "applying"
fi fi
if [[ $version == "4.4."* || $version == "4.9."* ]] && \ if [[ "${version}" == "4.4."* || "${version}" == "4.9."* ]] && \
[[ "$LINUXFAMILY" == rockpis || "$LINUXFAMILY" == rk3399 ]]; then [[ "$LINUXFAMILY" == rockpis || "$LINUXFAMILY" == rk3399 ]]; then
display_alert "Adjustin" "packaging" "info" display_alert "Adjustin" "packaging" "info"
cd ${SRC}/cache/sources/${LINUXSOURCEDIR} cd "${SRC}/cache/sources/${LINUXSOURCEDIR}" || exit
process_patch_file "${SRC}/patch/misc/general-packaging-4.4.y-rk3399.patch" "applying" process_patch_file "${SRC}/patch/misc/general-packaging-4.4.y-rk3399.patch" "applying"
fi fi
if [[ $version == "4.4."* ]] && [[ "$LINUXFAMILY" == rockchip64 ]]; then if [[ "${version}" == "4.4."* ]] && [[ "$LINUXFAMILY" == rockchip64 ]]; then
display_alert "Adjustin" "packaging" "info" display_alert "Adjustin" "packaging" "info"
cd ${SRC}/cache/sources/${LINUXSOURCEDIR} cd "${SRC}/cache/sources/${LINUXSOURCEDIR}" || exit
process_patch_file "${SRC}/patch/misc/general-packaging-4.4.y-rockchip64.patch" "applying" process_patch_file "${SRC}/patch/misc/general-packaging-4.4.y-rockchip64.patch" "applying"
fi fi
if [[ $version == "4.4."* ]] && [[ "$LINUXFAMILY" == rockchip || "$LINUXFAMILY" == rk322x ]]; then if [[ "${version}" == "4.4."* ]] && [[ "$LINUXFAMILY" == rockchip || "$LINUXFAMILY" == rk322x ]]; then
display_alert "Adjustin" "packaging" "info" display_alert "Adjustin" "packaging" "info"
cd ${SRC}/cache/sources/${LINUXSOURCEDIR} cd "${SRC}/cache/sources/${LINUXSOURCEDIR}" || exit
process_patch_file "${SRC}/patch/misc/general-packaging-4.4.y.patch" "applying" process_patch_file "${SRC}/patch/misc/general-packaging-4.4.y.patch" "applying"
fi fi
if [[ $version == "4.9."* ]] && [[ "$LINUXFAMILY" == meson64 || "$LINUXFAMILY" == odroidc4 ]]; then if [[ "${version}" == "4.9."* ]] && [[ "$LINUXFAMILY" == meson64 || "$LINUXFAMILY" == odroidc4 ]]; then
display_alert "Adjustin" "packaging" "info" display_alert "Adjustin" "packaging" "info"
cd ${SRC}/cache/sources/${LINUXSOURCEDIR} cd "${SRC}/cache/sources/${LINUXSOURCEDIR}" || exit
process_patch_file "${SRC}/patch/misc/general-packaging-4.9.y.patch" "applying" process_patch_file "${SRC}/patch/misc/general-packaging-4.9.y.patch" "applying"
fi fi
@@ -73,7 +75,7 @@ compilation_prepare()
# mac80211 wireless driver injection features from Kali Linux # mac80211 wireless driver injection features from Kali Linux
# #
if linux-version compare $version ge 5.4; then if linux-version compare "${version}" ge 5.4; then
display_alert "Adding" "Wireless package injections for mac80211 compatible chipsets" "info" display_alert "Adding" "Wireless package injections for mac80211 compatible chipsets" "info"
process_patch_file "${SRC}/patch/misc/kali-wifi-injection-1.patch" "applying" process_patch_file "${SRC}/patch/misc/kali-wifi-injection-1.patch" "applying"
@@ -85,21 +87,22 @@ compilation_prepare()
# #
# Older versions have AUFS support with a patch # Older versions have AUFS support with a patch
if linux-version compare $version ge 5.1 && linux-version compare $version le 5.8 && [ "$AUFS" == yes ]; then if linux-version compare "${version}" ge 5.1 && linux-version compare "${version}" le 5.8 && [ "$AUFS" == yes ]; then
# attach to specifics tag or branch # attach to specifics tag or branch
local aufstag=$(echo ${version} | cut -f 1-2 -d ".") local aufstag
aufstag=$(echo "${version}" | cut -f 1-2 -d ".")
# manual overrides # manual overrides
if linux-version compare $version ge 5.4.3 && linux-version compare $version le 5.5 ; then aufstag="5.4.3"; fi if linux-version compare "${version}" ge 5.4.3 && linux-version compare "${version}" le 5.5 ; then aufstag="5.4.3"; fi
# check if Mr. Okajima already made a branch for this version # check if Mr. Okajima already made a branch for this version
git ls-remote --exit-code --heads https://github.com/sfjro/aufs5-standalone aufs${aufstag} >/dev/null git ls-remote --exit-code --heads https://github.com/sfjro/aufs5-standalone "aufs${aufstag}" >/dev/null
if [ "$?" -ne "0" ]; then if [ "$?" -ne "0" ]; then
# then use rc branch # then use rc branch
aufstag="5.x-rcN" aufstag="5.x-rcN"
git ls-remote --exit-code --heads https://github.com/sfjro/aufs5-standalone aufs${aufstag} >/dev/null git ls-remote --exit-code --heads https://github.com/sfjro/aufs5-standalone "aufs${aufstag}" >/dev/null
fi fi
if [ "$?" -eq "0" ]; then if [ "$?" -eq "0" ]; then
@@ -107,13 +110,13 @@ compilation_prepare()
display_alert "Adding" "AUFS ${aufstag}" "info" display_alert "Adding" "AUFS ${aufstag}" "info"
local aufsver="branch:aufs${aufstag}" local aufsver="branch:aufs${aufstag}"
fetch_from_repo "https://github.com/sfjro/aufs5-standalone" "aufs5" "branch:${aufsver}" "yes" fetch_from_repo "https://github.com/sfjro/aufs5-standalone" "aufs5" "branch:${aufsver}" "yes"
cd ${SRC}/cache/sources/${LINUXSOURCEDIR} cd "${SRC}/cache/sources/${LINUXSOURCEDIR}" || exit
process_patch_file "${SRC}/cache/sources/aufs5/${aufsver#*:}/aufs5-kbuild.patch" "applying" process_patch_file "${SRC}/cache/sources/aufs5/${aufsver#*:}/aufs5-kbuild.patch" "applying"
process_patch_file "${SRC}/cache/sources/aufs5/${aufsver#*:}/aufs5-base.patch" "applying" process_patch_file "${SRC}/cache/sources/aufs5/${aufsver#*:}/aufs5-base.patch" "applying"
process_patch_file "${SRC}/cache/sources/aufs5/${aufsver#*:}/aufs5-mmap.patch" "applying" process_patch_file "${SRC}/cache/sources/aufs5/${aufsver#*:}/aufs5-mmap.patch" "applying"
process_patch_file "${SRC}/cache/sources/aufs5/${aufsver#*:}/aufs5-standalone.patch" "applying" process_patch_file "${SRC}/cache/sources/aufs5/${aufsver#*:}/aufs5-standalone.patch" "applying"
cp -R ${SRC}/cache/sources/aufs5/${aufsver#*:}/{Documentation,fs} . cp -R "${SRC}/cache/sources/aufs5/${aufsver#*:}"/{Documentation,fs} .
cp ${SRC}/cache/sources/aufs5/${aufsver#*:}/include/uapi/linux/aufs_type.h include/uapi/linux/ cp "${SRC}/cache/sources/aufs5/${aufsver#*:}"/include/uapi/linux/aufs_type.h include/uapi/linux/
fi fi
fi fi
@@ -122,7 +125,7 @@ compilation_prepare()
# WireGuard VPN for Linux 3.10 - 5.5 # WireGuard VPN for Linux 3.10 - 5.5
if linux-version compare $version ge 3.10 && linux-version compare $version le 5.5 && [ "${WIREGUARD}" == yes ]; then if linux-version compare "${version}" ge 3.10 && linux-version compare "${version}" le 5.5 && [ "${WIREGUARD}" == yes ]; then
# attach to specifics tag or branch # attach to specifics tag or branch
local wirever="branch:master" local wirever="branch:master"
@@ -130,23 +133,23 @@ compilation_prepare()
display_alert "Adding" "WireGuard VPN for Linux 3.10 - 5.5 ${wirever} " "info" display_alert "Adding" "WireGuard VPN for Linux 3.10 - 5.5 ${wirever} " "info"
fetch_from_repo "https://git.zx2c4.com/wireguard-linux-compat" "wireguard" "${wirever}" "yes" fetch_from_repo "https://git.zx2c4.com/wireguard-linux-compat" "wireguard" "${wirever}" "yes"
cd ${SRC}/cache/sources/${LINUXSOURCEDIR} cd "${SRC}/cache/sources/${LINUXSOURCEDIR}" || exit
rm -rf ${SRC}/cache/sources/${LINUXSOURCEDIR}/net/wireguard rm -rf "${SRC}/cache/sources/${LINUXSOURCEDIR}/net/wireguard"
cp -R ${SRC}/cache/sources/wireguard/${wirever#*:}/src/ ${SRC}/cache/sources/${LINUXSOURCEDIR}/net/wireguard cp -R "${SRC}/cache/sources/wireguard/${wirever#*:}/src/" "${SRC}/cache/sources/${LINUXSOURCEDIR}/net/wireguard"
sed -i "/^obj-\\\$(CONFIG_NETFILTER).*+=/a obj-\$(CONFIG_WIREGUARD) += wireguard/" \ sed -i "/^obj-\\\$(CONFIG_NETFILTER).*+=/a obj-\$(CONFIG_WIREGUARD) += wireguard/" \
${SRC}/cache/sources/${LINUXSOURCEDIR}/net/Makefile "${SRC}/cache/sources/${LINUXSOURCEDIR}/net/Makefile"
sed -i "/^if INET\$/a source \"net/wireguard/Kconfig\"" \ sed -i "/^if INET\$/a source \"net/wireguard/Kconfig\"" \
${SRC}/cache/sources/${LINUXSOURCEDIR}/net/Kconfig "${SRC}/cache/sources/${LINUXSOURCEDIR}/net/Kconfig"
# remove duplicates # remove duplicates
[[ $(cat ${SRC}/cache/sources/${LINUXSOURCEDIR}/net/Makefile | grep wireguard | wc -l) -gt 1 ]] && \ [[ $(grep -c wireguard "${SRC}/cache/sources/${LINUXSOURCEDIR}/net/Makefile") -gt 1 ]] && \
sed -i '0,/wireguard/{/wireguard/d;}' ${SRC}/cache/sources/${LINUXSOURCEDIR}/net/Makefile sed -i '0,/wireguard/{/wireguard/d;}' "${SRC}/cache/sources/${LINUXSOURCEDIR}/net/Makefile"
[[ $(cat ${SRC}/cache/sources/${LINUXSOURCEDIR}/net/Kconfig | grep wireguard | wc -l) -gt 1 ]] && \ [[ $(grep -c wireguard "${SRC}/cache/sources/${LINUXSOURCEDIR}/net/Kconfig") -gt 1 ]] && \
sed -i '0,/wireguard/{/wireguard/d;}' ${SRC}/cache/sources/${LINUXSOURCEDIR}/net/Kconfig sed -i '0,/wireguard/{/wireguard/d;}' "${SRC}/cache/sources/${LINUXSOURCEDIR}/net/Kconfig"
# headers workaround # headers workaround
display_alert "Patching WireGuard" "Applying workaround for headers compilation" "info" display_alert "Patching WireGuard" "Applying workaround for headers compilation" "info"
sed -i '/mkdir -p "$destdir"/a mkdir -p "$destdir"/net/wireguard; \ sed -i '/mkdir -p "$destdir"/a mkdir -p "$destdir"/net/wireguard; \
touch "$destdir"/net/wireguard/{Kconfig,Makefile} # workaround for Wireguard' \ touch "$destdir"/net/wireguard/{Kconfig,Makefile} # workaround for Wireguard' \
${SRC}/cache/sources/${LINUXSOURCEDIR}/scripts/package/builddeb "${SRC}/cache/sources/${LINUXSOURCEDIR}/scripts/package/builddeb"
fi fi
@@ -155,7 +158,7 @@ compilation_prepare()
# Wireless drivers for Realtek 8189ES chipsets # Wireless drivers for Realtek 8189ES chipsets
if linux-version compare $version ge 3.14 && [ "$EXTRAWIFI" == yes ]; then if linux-version compare "${version}" ge 3.14 && [ "$EXTRAWIFI" == yes ]; then
# attach to specifics tag or branch # attach to specifics tag or branch
local rtl8189esver="branch:master" local rtl8189esver="branch:master"
@@ -163,22 +166,22 @@ compilation_prepare()
display_alert "Adding" "Wireless drivers for Realtek 8189ES chipsets ${rtl8189esver}" "info" display_alert "Adding" "Wireless drivers for Realtek 8189ES chipsets ${rtl8189esver}" "info"
fetch_from_repo "https://github.com/jwrdegoede/rtl8189ES_linux" "rtl8189es" "${rtl8189esver}" "yes" fetch_from_repo "https://github.com/jwrdegoede/rtl8189ES_linux" "rtl8189es" "${rtl8189esver}" "yes"
cd ${SRC}/cache/sources/${LINUXSOURCEDIR} cd "${SRC}/cache/sources/${LINUXSOURCEDIR}" || exit
rm -rf ${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8189es rm -rf "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8189es"
mkdir -p ${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8189es/ mkdir -p "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8189es/"
cp -R ${SRC}/cache/sources/rtl8189es/${rtl8189esver#*:}/{core,hal,include,os_dep,platform} \ cp -R "${SRC}/cache/sources/rtl8189es/${rtl8189esver#*:}"/{core,hal,include,os_dep,platform} \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8189es "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8189es"
# Makefile # Makefile
cp ${SRC}/cache/sources/rtl8189es/${rtl8189esver#*:}/Makefile \ cp "${SRC}/cache/sources/rtl8189es/${rtl8189esver#*:}/Makefile" \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8189es/Makefile "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8189es/Makefile"
cp ${SRC}/cache/sources/rtl8189es/${rtl8189esver#*:}/Kconfig \ cp "${SRC}/cache/sources/rtl8189es/${rtl8189esver#*:}/Kconfig" \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8189es/Kconfig "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8189es/Kconfig"
# Add to section Makefile # Add to section Makefile
echo "obj-\$(CONFIG_RTL8189ES) += rtl8189es/" >> $SRC/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Makefile echo "obj-\$(CONFIG_RTL8189ES) += rtl8189es/" >> "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Makefile"
sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl8189es\/Kconfig"' \ sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl8189es\/Kconfig"' \
$SRC/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Kconfig "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Kconfig"
fi fi
@@ -187,7 +190,7 @@ compilation_prepare()
# Wireless drivers for Realtek 8189FS chipsets # Wireless drivers for Realtek 8189FS chipsets
if linux-version compare $version ge 3.14 && [ "$EXTRAWIFI" == yes ]; then if linux-version compare "${version}" ge 3.14 && [ "$EXTRAWIFI" == yes ]; then
# attach to specifics tag or branch # attach to specifics tag or branch
local rtl8189fsver="branch:rtl8189fs" local rtl8189fsver="branch:rtl8189fs"
@@ -195,22 +198,22 @@ compilation_prepare()
display_alert "Adding" "Wireless drivers for Realtek 8189FS chipsets ${rtl8189fsver}" "info" display_alert "Adding" "Wireless drivers for Realtek 8189FS chipsets ${rtl8189fsver}" "info"
fetch_from_repo "https://github.com/jwrdegoede/rtl8189ES_linux" "rtl8189fs" "${rtl8189fsver}" "yes" fetch_from_repo "https://github.com/jwrdegoede/rtl8189ES_linux" "rtl8189fs" "${rtl8189fsver}" "yes"
cd ${SRC}/cache/sources/${LINUXSOURCEDIR} cd "${SRC}/cache/sources/${LINUXSOURCEDIR}" || exit
rm -rf ${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8189fs rm -rf "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8189fs"
mkdir -p ${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8189fs/ mkdir -p "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8189fs/"
cp -R ${SRC}/cache/sources/rtl8189fs/${rtl8189fsver#*:}/{core,hal,include,os_dep,platform} \ cp -R "${SRC}/cache/sources/rtl8189fs/${rtl8189fsver#*:}"/{core,hal,include,os_dep,platform} \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8189fs "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8189fs"
# Makefile # Makefile
cp ${SRC}/cache/sources/rtl8189fs/${rtl8189fsver#*:}/Makefile \ cp "${SRC}/cache/sources/rtl8189fs/${rtl8189fsver#*:}/Makefile" \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8189fs/Makefile "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8189fs/Makefile"
cp ${SRC}/cache/sources/rtl8189fs/${rtl8189fsver#*:}/Kconfig \ cp "${SRC}/cache/sources/rtl8189fs/${rtl8189fsver#*:}/Kconfig" \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8189fs/Kconfig "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8189fs/Kconfig"
# Add to section Makefile # Add to section Makefile
echo "obj-\$(CONFIG_RTL8189FS) += rtl8189fs/" >> $SRC/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Makefile echo "obj-\$(CONFIG_RTL8189FS) += rtl8189fs/" >> "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Makefile"
sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl8189fs\/Kconfig"' \ sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl8189fs\/Kconfig"' \
$SRC/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Kconfig "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Kconfig"
fi fi
@@ -219,7 +222,7 @@ compilation_prepare()
# Wireless drivers for Realtek 8811, 8812, 8814 and 8821 chipsets # Wireless drivers for Realtek 8811, 8812, 8814 and 8821 chipsets
if linux-version compare $version ge 3.14 && [ "$EXTRAWIFI" == yes ]; then if linux-version compare "${version}" ge 3.14 && [ "$EXTRAWIFI" == yes ]; then
# attach to specifics tag or branch # attach to specifics tag or branch
local rtl8812auver="branch:v5.6.4.2" local rtl8812auver="branch:v5.6.4.2"
@@ -227,22 +230,22 @@ compilation_prepare()
display_alert "Adding" "Wireless drivers for Realtek 8811, 8812, 8814 and 8821 chipsets ${rtl8812auver}" "info" display_alert "Adding" "Wireless drivers for Realtek 8811, 8812, 8814 and 8821 chipsets ${rtl8812auver}" "info"
fetch_from_repo "https://github.com/aircrack-ng/rtl8812au" "rtl8812au" "${rtl8812auver}" "yes" fetch_from_repo "https://github.com/aircrack-ng/rtl8812au" "rtl8812au" "${rtl8812auver}" "yes"
cd ${SRC}/cache/sources/${LINUXSOURCEDIR} cd "${SRC}/cache/sources/${LINUXSOURCEDIR}" || exit
rm -rf ${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8812au rm -rf "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8812au"
mkdir -p ${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8812au/ mkdir -p "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8812au/"
cp -R ${SRC}/cache/sources/rtl8812au/${rtl8812auver#*:}/{core,hal,include,os_dep,platform} \ cp -R "${SRC}/cache/sources/rtl8812au/${rtl8812auver#*:}"/{core,hal,include,os_dep,platform} \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8812au "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8812au"
# Makefile # Makefile
cp ${SRC}/cache/sources/rtl8812au/${rtl8812auver#*:}/Makefile \ cp "${SRC}/cache/sources/rtl8812au/${rtl8812auver#*:}/Makefile" \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8812au/Makefile "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8812au/Makefile"
cp ${SRC}/cache/sources/rtl8812au/${rtl8812auver#*:}/Kconfig \ cp "${SRC}/cache/sources/rtl8812au/${rtl8812auver#*:}/Kconfig" \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8812au/Kconfig "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8812au/Kconfig"
# Add to section Makefile # Add to section Makefile
echo "obj-\$(CONFIG_88XXAU) += rtl8812au/" >> $SRC/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Makefile echo "obj-\$(CONFIG_88XXAU) += rtl8812au/" >> "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Makefile"
sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl8812au\/Kconfig"' \ sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl8812au\/Kconfig"' \
$SRC/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Kconfig "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Kconfig"
fi fi
@@ -250,28 +253,28 @@ compilation_prepare()
# Wireless drivers for Xradio XR819 chipsets # Wireless drivers for Xradio XR819 chipsets
if linux-version compare $version ge 4.19 && [[ "$LINUXFAMILY" == sunxi* ]] && [[ "$EXTRAWIFI" == yes ]]; then if linux-version compare "${version}" ge 4.19 && [[ "$LINUXFAMILY" == sunxi* ]] && [[ "$EXTRAWIFI" == yes ]]; then
display_alert "Adding" "Wireless drivers for Xradio XR819 chipsets" "info" display_alert "Adding" "Wireless drivers for Xradio XR819 chipsets" "info"
fetch_from_repo "https://github.com/karabek/xradio" "xradio" "branch:master" "yes" fetch_from_repo "https://github.com/karabek/xradio" "xradio" "branch:master" "yes"
cd ${SRC}/cache/sources/${LINUXSOURCEDIR} cd "${SRC}/cache/sources/${LINUXSOURCEDIR}" || exit
rm -rf ${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/xradio rm -rf "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/xradio"
mkdir -p ${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/xradio/ mkdir -p "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/xradio/"
cp ${SRC}/cache/sources/xradio/master/*.{h,c} \ cp "${SRC}"/cache/sources/xradio/master/*.{h,c} \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/xradio/ "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/xradio/"
# Makefile # Makefile
cp ${SRC}/cache/sources/xradio/master/Makefile \ cp "${SRC}/cache/sources/xradio/master/Makefile" \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/xradio/Makefile "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/xradio/Makefile"
cp ${SRC}/cache/sources/xradio/master/Kconfig \ cp "${SRC}/cache/sources/xradio/master/Kconfig" \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/xradio/Kconfig "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/xradio/Kconfig"
# Add to section Makefile # Add to section Makefile
echo "obj-\$(CONFIG_WLAN_VENDOR_XRADIO) += xradio/" \ echo "obj-\$(CONFIG_WLAN_VENDOR_XRADIO) += xradio/" \
>> $SRC/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Makefile >> "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Makefile"
sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/xradio\/Kconfig"' \ sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/xradio\/Kconfig"' \
$SRC/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Kconfig "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Kconfig"
fi fi
@@ -280,7 +283,7 @@ compilation_prepare()
# Wireless drivers for Realtek RTL8811CU and RTL8821C chipsets # Wireless drivers for Realtek RTL8811CU and RTL8821C chipsets
if linux-version compare $version ge 3.14 && [ "$EXTRAWIFI" == yes ]; then if linux-version compare "${version}" ge 3.14 && [ "$EXTRAWIFI" == yes ]; then
# attach to specifics tag or branch # attach to specifics tag or branch
local rtl8811cuver="commit:2bebdb9a35c1d9b6e6a928e371fa39d5fcec8a62" local rtl8811cuver="commit:2bebdb9a35c1d9b6e6a928e371fa39d5fcec8a62"
@@ -288,30 +291,30 @@ compilation_prepare()
display_alert "Adding" "Wireless drivers for Realtek RTL8811CU and RTL8821C chipsets ${rtl8811cuver}" "info" display_alert "Adding" "Wireless drivers for Realtek RTL8811CU and RTL8821C chipsets ${rtl8811cuver}" "info"
fetch_from_repo "https://github.com/brektrou/rtl8821CU" "rtl8811cu" "${rtl8811cuver}" "yes" fetch_from_repo "https://github.com/brektrou/rtl8821CU" "rtl8811cu" "${rtl8811cuver}" "yes"
cd ${SRC}/cache/sources/${LINUXSOURCEDIR} cd "${SRC}/cache/sources/${LINUXSOURCEDIR}" || exit
rm -rf ${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8811cu rm -rf "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8811cu"
mkdir -p ${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8811cu/ mkdir -p "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8811cu/"
cp -R ${SRC}/cache/sources/rtl8811cu/${rtl8811cuver#*:}/{core,hal,include,os_dep,platform,rtl8821c.mk} \ cp -R "${SRC}/cache/sources/rtl8811cu/${rtl8811cuver#*:}"/{core,hal,include,os_dep,platform,rtl8821c.mk} \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8811cu "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8811cu"
# Makefile # Makefile
cp ${SRC}/cache/sources/rtl8811cu/${rtl8811cuver#*:}/Makefile \ cp "${SRC}/cache/sources/rtl8811cu/${rtl8811cuver#*:}/Makefile" \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8811cu/Makefile "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8811cu/Makefile"
cp ${SRC}/cache/sources/rtl8811cu/${rtl8811cuver#*:}/Kconfig \ cp "${SRC}/cache/sources/rtl8811cu/${rtl8811cuver#*:}/Kconfig" \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8811cu/Kconfig "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8811cu/Kconfig"
# Disable debug # Disable debug
sed -i "s/^CONFIG_RTW_DEBUG.*/CONFIG_RTW_DEBUG = n/" \ sed -i "s/^CONFIG_RTW_DEBUG.*/CONFIG_RTW_DEBUG = n/" \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8811cu/Makefile "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8811cu/Makefile"
# Address ARM related bug https://github.com/aircrack-ng/rtl8812au/issues/233 # Address ARM related bug https://github.com/aircrack-ng/rtl8812au/issues/233
sed -i "s/^CONFIG_MP_VHT_HW_TX_MODE.*/CONFIG_MP_VHT_HW_TX_MODE = n/" \ sed -i "s/^CONFIG_MP_VHT_HW_TX_MODE.*/CONFIG_MP_VHT_HW_TX_MODE = n/" \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8811cu/Makefile "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8811cu/Makefile"
# Add to section Makefile # Add to section Makefile
echo "obj-\$(CONFIG_RTL8821CU) += rtl8811cu/" >> $SRC/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Makefile echo "obj-\$(CONFIG_RTL8821CU) += rtl8811cu/" >> "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Makefile"
sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl8811cu\/Kconfig"' \ sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl8811cu\/Kconfig"' \
$SRC/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Kconfig "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Kconfig"
fi fi
@@ -320,34 +323,34 @@ compilation_prepare()
# Wireless drivers for Realtek 8188EU 8188EUS and 8188ETV chipsets # Wireless drivers for Realtek 8188EU 8188EUS and 8188ETV chipsets
if linux-version compare $version ge 3.14 && [ "$EXTRAWIFI" == yes ]; then if linux-version compare "${version}" ge 3.14 && [ "$EXTRAWIFI" == yes ]; then
# attach to specifics tag or branch # attach to specifics tag or branch
local rtl8188euver="branch:v5.7.6.1" local rtl8188euver="branch:v5.7.6.1"
display_alert "Adding" "Wireless drivers for Realtek 8188EU 8188EUS and 8188ETV chipsets ${rtl8811euver}" "info" display_alert "Adding" "Wireless drivers for Realtek 8188EU 8188EUS and 8188ETV chipsets ${rtl8188euver}" "info"
fetch_from_repo "https://github.com/aircrack-ng/rtl8188eus" "rtl8188eu" "${rtl8188euver}" "yes" fetch_from_repo "https://github.com/aircrack-ng/rtl8188eus" "rtl8188eu" "${rtl8188euver}" "yes"
cd ${SRC}/cache/sources/${LINUXSOURCEDIR} cd "${SRC}/cache/sources/${LINUXSOURCEDIR}" || exit
rm -rf ${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8188eu rm -rf "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8188eu"
mkdir -p ${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8188eu/ mkdir -p "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8188eu/"
cp -R ${SRC}/cache/sources/rtl8188eu/${rtl8188euver#*:}/{core,hal,include,os_dep,platform} \ cp -R "${SRC}/cache/sources/rtl8188eu/${rtl8188euver#*:}"/{core,hal,include,os_dep,platform} \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8188eu "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8188eu"
# Makefile # Makefile
cp ${SRC}/cache/sources/rtl8188eu/${rtl8188euver#*:}/Makefile \ cp "${SRC}/cache/sources/rtl8188eu/${rtl8188euver#*:}/Makefile" \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8188eu/Makefile "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8188eu/Makefile"
cp ${SRC}/cache/sources/rtl8188eu/${rtl8188euver#*:}/Kconfig \ cp "${SRC}/cache/sources/rtl8188eu/${rtl8188euver#*:}/Kconfig" \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8188eu/Kconfig "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8188eu/Kconfig"
# Disable debug # Disable debug
sed -i "s/^CONFIG_RTW_DEBUG.*/CONFIG_RTW_DEBUG = n/" \ sed -i "s/^CONFIG_RTW_DEBUG.*/CONFIG_RTW_DEBUG = n/" \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8188eu/Makefile "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8188eu/Makefile"
# Add to section Makefile # Add to section Makefile
echo "obj-\$(CONFIG_RTL8188EU) += rtl8188eu/" >> $SRC/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Makefile echo "obj-\$(CONFIG_RTL8188EU) += rtl8188eu/" >> "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Makefile"
sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl8188eu\/Kconfig"' \ sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl8188eu\/Kconfig"' \
$SRC/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Kconfig "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Kconfig"
# kernel 5.6 -> # kernel 5.6 ->
process_patch_file "${SRC}/patch/misc/wireless-rtl8188eu.patch" "applying" process_patch_file "${SRC}/patch/misc/wireless-rtl8188eu.patch" "applying"
@@ -359,7 +362,7 @@ compilation_prepare()
# Wireless drivers for Realtek 88x2bu chipsets # Wireless drivers for Realtek 88x2bu chipsets
if linux-version compare $version ge 3.14 && [ "$EXTRAWIFI" == yes ]; then if linux-version compare "${version}" ge 3.14 && [ "$EXTRAWIFI" == yes ]; then
# attach to specifics tag or branch # attach to specifics tag or branch
local rtl88x2buver="branch:5.6.1_30362.20181109_COEX20180928-6a6a" local rtl88x2buver="branch:5.6.1_30362.20181109_COEX20180928-6a6a"
@@ -367,26 +370,26 @@ compilation_prepare()
display_alert "Adding" "Wireless drivers for Realtek 88x2bu chipsets ${rtl88x2buver}" "info" display_alert "Adding" "Wireless drivers for Realtek 88x2bu chipsets ${rtl88x2buver}" "info"
fetch_from_repo "https://github.com/cilynx/rtl88x2bu" "rtl88x2bu" "${rtl88x2buver}" "yes" fetch_from_repo "https://github.com/cilynx/rtl88x2bu" "rtl88x2bu" "${rtl88x2buver}" "yes"
cd ${SRC}/cache/sources/${LINUXSOURCEDIR} cd "${SRC}/cache/sources/${LINUXSOURCEDIR}" || exit
rm -rf ${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl88x2bu rm -rf "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl88x2bu"
mkdir -p ${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl88x2bu/ mkdir -p "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl88x2bu/"
cp -R ${SRC}/cache/sources/rtl88x2bu/${rtl88x2buver#*:}/{core,hal,include,os_dep,platform,halmac.mk,rtl8822b.mk} \ cp -R "${SRC}/cache/sources/rtl88x2bu/${rtl88x2buver#*:}"/{core,hal,include,os_dep,platform,halmac.mk,rtl8822b.mk} \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl88x2bu "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl88x2bu"
# Makefile # Makefile
cp ${SRC}/cache/sources/rtl88x2bu/${rtl88x2buver#*:}/Makefile \ cp "${SRC}/cache/sources/rtl88x2bu/${rtl88x2buver#*:}/Makefile" \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl88x2bu/Makefile "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl88x2bu/Makefile"
cp ${SRC}/cache/sources/rtl88x2bu/${rtl88x2buver#*:}/Kconfig \ cp "${SRC}/cache/sources/rtl88x2bu/${rtl88x2buver#*:}/Kconfig" \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl88x2bu/Kconfig "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl88x2bu/Kconfig"
# Adjust path # Adjust path
sed -i 's/include $(src)\/rtl8822b.mk /include $(TopDIR)\/drivers\/net\/wireless\/rtl88x2bu\/rtl8822b.mk/' \ sed -i 's/include $(src)\/rtl8822b.mk /include $(TopDIR)\/drivers\/net\/wireless\/rtl88x2bu\/rtl8822b.mk/' \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl88x2bu/Makefile "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl88x2bu/Makefile"
# Add to section Makefile # Add to section Makefile
echo "obj-\$(CONFIG_RTL8822BU) += rtl88x2bu/" >> $SRC/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Makefile echo "obj-\$(CONFIG_RTL8822BU) += rtl88x2bu/" >> "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Makefile"
sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl88x2bu\/Kconfig"' \ sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl88x2bu\/Kconfig"' \
$SRC/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Kconfig "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Kconfig"
fi fi
@@ -395,7 +398,7 @@ compilation_prepare()
# Wireless drivers for Realtek 8723DS chipsets # Wireless drivers for Realtek 8723DS chipsets
if linux-version compare $version ge 5.0 && [ "$EXTRAWIFI" == yes ]; then if linux-version compare "${version}" ge 5.0 && [ "$EXTRAWIFI" == yes ]; then
# attach to specifics tag or branch # attach to specifics tag or branch
local rtl8723dsver="branch:master" local rtl8723dsver="branch:master"
@@ -403,26 +406,26 @@ compilation_prepare()
display_alert "Adding" "Wireless drivers for Realtek 8723DS chipsets ${rtl8723dsver}" "info" display_alert "Adding" "Wireless drivers for Realtek 8723DS chipsets ${rtl8723dsver}" "info"
fetch_from_repo "https://github.com/lwfinger/rtl8723ds" "rtl8723ds" "${rtl8723dsver}" "yes" fetch_from_repo "https://github.com/lwfinger/rtl8723ds" "rtl8723ds" "${rtl8723dsver}" "yes"
cd ${SRC}/cache/sources/${LINUXSOURCEDIR} cd "${SRC}/cache/sources/${LINUXSOURCEDIR}" || exit
rm -rf ${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8723ds rm -rf "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8723ds"
mkdir -p ${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8723ds/ mkdir -p "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8723ds/"
cp -R ${SRC}/cache/sources/rtl8723ds/${rtl8723dsver#*:}/{core,hal,include,os_dep,platform} \ cp -R "${SRC}/cache/sources/rtl8723ds/${rtl8723dsver#*:}"/{core,hal,include,os_dep,platform} \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8723ds "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8723ds"
# Makefile # Makefile
cp ${SRC}/cache/sources/rtl8723ds/${rtl8723dsver#*:}/Makefile \ cp "${SRC}/cache/sources/rtl8723ds/${rtl8723dsver#*:}/Makefile" \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8723ds/Makefile "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8723ds/Makefile"
cp ${SRC}/cache/sources/rtl8723ds/${rtl8723dsver#*:}/Kconfig \ cp "${SRC}/cache/sources/rtl8723ds/${rtl8723dsver#*:}/Kconfig" \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8723ds/Kconfig "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8723ds/Kconfig"
# Disable debug # Disable debug
sed -i "s/^CONFIG_RTW_DEBUG.*/CONFIG_RTW_DEBUG = n/" \ sed -i "s/^CONFIG_RTW_DEBUG.*/CONFIG_RTW_DEBUG = n/" \
${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8723ds/Makefile "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/rtl8723ds/Makefile"
# Add to section Makefile # Add to section Makefile
echo "obj-\$(CONFIG_RTL8723DS) += rtl8723ds/" >> $SRC/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Makefile echo "obj-\$(CONFIG_RTL8723DS) += rtl8723ds/" >> "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Makefile"
sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl8723ds\/Kconfig"' \ sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl8723ds\/Kconfig"' \
$SRC/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Kconfig "${SRC}/cache/sources/${LINUXSOURCEDIR}/drivers/net/wireless/Kconfig"
fi fi

View File

@@ -1,3 +1,5 @@
#!/bin/bash
#
# Copyright (c) 2015 Igor Pecovnik, igor.pecovnik@gma**.com # Copyright (c) 2015 Igor Pecovnik, igor.pecovnik@gma**.com
# #
# This file is licensed under the terms of the GNU General Public # This file is licensed under the terms of the GNU General Public
@@ -38,50 +40,50 @@ cleaning()
{ {
case $1 in case $1 in
debs) # delete ${DEB_STORAGE} for current branch and family debs) # delete ${DEB_STORAGE} for current branch and family
if [[ -d ${DEB_STORAGE} ]]; then if [[ -d "${DEB_STORAGE}" ]]; then
display_alert "Cleaning ${DEB_STORAGE} for" "$BOARD $BRANCH" "info" display_alert "Cleaning ${DEB_STORAGE} for" "$BOARD $BRANCH" "info"
# easier than dealing with variable expansion and escaping dashes in file names # easier than dealing with variable expansion and escaping dashes in file names
find ${DEB_STORAGE} -name "${CHOSEN_UBOOT}_*.deb" -delete find "${DEB_STORAGE}" -name "${CHOSEN_UBOOT}_*.deb" -delete
find ${DEB_STORAGE} \( -name "${CHOSEN_KERNEL}_*.deb" -o \ find "${DEB_STORAGE}" \( -name "${CHOSEN_KERNEL}_*.deb" -o \
-name "armbian-*.deb" -o \ -name "armbian-*.deb" -o \
-name "${CHOSEN_KERNEL/image/dtb}_*.deb" -o \ -name "${CHOSEN_KERNEL/image/dtb}_*.deb" -o \
-name "${CHOSEN_KERNEL/image/headers}_*.deb" -o \ -name "${CHOSEN_KERNEL/image/headers}_*.deb" -o \
-name "${CHOSEN_KERNEL/image/source}_*.deb" -o \ -name "${CHOSEN_KERNEL/image/source}_*.deb" -o \
-name "${CHOSEN_KERNEL/image/firmware-image}_*.deb" \) -delete -name "${CHOSEN_KERNEL/image/firmware-image}_*.deb" \) -delete
[[ -n $RELEASE ]] && rm -f ${DEB_STORAGE}/$RELEASE/${CHOSEN_ROOTFS}_*.deb [[ -n $RELEASE ]] && rm -f "${DEB_STORAGE}/${RELEASE}/${CHOSEN_ROOTFS}"_*.deb
[[ -n $RELEASE ]] && rm -f ${DEB_STORAGE}/$RELEASE/armbian-desktop-${RELEASE}_*.deb [[ -n $RELEASE ]] && rm -f "${DEB_STORAGE}/${RELEASE}/armbian-desktop-${RELEASE}"_*.deb
fi fi
;; ;;
extras) # delete ${DEB_STORAGE}/extra/$RELEASE for all architectures extras) # delete ${DEB_STORAGE}/extra/$RELEASE for all architectures
if [[ -n $RELEASE && -d ${DEB_STORAGE}/extra/$RELEASE ]]; then if [[ -n $RELEASE && -d ${DEB_STORAGE}/extra/$RELEASE ]]; then
display_alert "Cleaning ${DEB_STORAGE}/extra for" "$RELEASE" "info" display_alert "Cleaning ${DEB_STORAGE}/extra for" "$RELEASE" "info"
rm -rf ${DEB_STORAGE}/extra/$RELEASE rm -rf "${DEB_STORAGE}/extra/${RELEASE}"
fi fi
;; ;;
alldebs) # delete output/debs alldebs) # delete output/debs
[[ -d ${DEB_STORAGE} ]] && display_alert "Cleaning" "${DEB_STORAGE}" "info" && rm -rf ${DEB_STORAGE}/* [[ -d "${DEB_STORAGE}" ]] && display_alert "Cleaning" "${DEB_STORAGE}" "info" && rm -rf "${DEB_STORAGE}"/*
;; ;;
cache) # delete output/cache cache) # delete output/cache
[[ -d $SRC/cache/rootfs ]] && display_alert "Cleaning" "rootfs cache (all)" "info" && find $SRC/cache/rootfs -type f -delete [[ -d "${SRC}"/cache/rootfs ]] && display_alert "Cleaning" "rootfs cache (all)" "info" && find "${SRC}"/cache/rootfs -type f -delete
;; ;;
images) # delete output/images images) # delete output/images
[[ -d $DEST/images ]] && display_alert "Cleaning" "output/images" "info" && rm -rf $DEST/images/* [[ -d "${DEST}"/images ]] && display_alert "Cleaning" "output/images" "info" && rm -rf "${DEST}"/images/*
;; ;;
sources) # delete output/sources and output/buildpkg sources) # delete output/sources and output/buildpkg
[[ -d $SRC/cache/sources ]] && display_alert "Cleaning" "sources" "info" && rm -rf $SRC/cache/sources/* $DEST/buildpkg/* [[ -d "${SRC}"/cache/sources ]] && display_alert "Cleaning" "sources" "info" && rm -rf "${SRC}"/cache/sources/* "${DEST}"/buildpkg/*
;; ;;
oldcache) # remove old `cache/rootfs` except for the newest 8 files oldcache) # remove old `cache/rootfs` except for the newest 8 files
if [[ -d $SRC/cache/rootfs && $(ls -1 $SRC/cache/rootfs/*.lz4 2> /dev/null | wc -l) -gt ${ROOTFS_CACHE_MAX} ]]; then if [[ -d "${SRC}"/cache/rootfs && $(ls -1 "${SRC}"/cache/rootfs/*.lz4 2> /dev/null | wc -l) -gt "${ROOTFS_CACHE_MAX}" ]]; then
display_alert "Cleaning" "rootfs cache (old)" "info" display_alert "Cleaning" "rootfs cache (old)" "info"
(cd $SRC/cache/rootfs; ls -t *.lz4 | sed -e "1,${ROOTFS_CACHE_MAX}d" | xargs -d '\n' rm -f) (cd "${SRC}"/cache/rootfs; ls -t *.lz4 | sed -e "1,${ROOTFS_CACHE_MAX}d" | xargs -d '\n' rm -f)
# Remove signatures if they are present. We use them for internal purpose # Remove signatures if they are present. We use them for internal purpose
(cd $SRC/cache/rootfs; ls -t *.asc | sed -e "1,${ROOTFS_CACHE_MAX}d" | xargs -d '\n' rm -f) (cd "${SRC}"/cache/rootfs; ls -t *.asc | sed -e "1,${ROOTFS_CACHE_MAX}d" | xargs -d '\n' rm -f)
fi fi
;; ;;
esac esac
@@ -95,11 +97,12 @@ cleaning()
exit_with_error() exit_with_error()
{ {
local _file=$(basename ${BASH_SOURCE[1]}) local _file
local _line=${BASH_LINENO[0]} local _line=${BASH_LINENO[0]}
local _function=${FUNCNAME[1]} local _function=${FUNCNAME[1]}
local _description=$1 local _description=$1
local _highlight=$2 local _highlight=$2
_file=$(basename "${BASH_SOURCE[1]}")
display_alert "ERROR in function $_function" "$_file:$_line" "err" display_alert "ERROR in function $_function" "$_file:$_line" "err"
display_alert "$_description" "$_highlight" "err" display_alert "$_description" "$_highlight" "err"
@@ -108,9 +111,9 @@ exit_with_error()
overlayfs_wrapper "cleanup" overlayfs_wrapper "cleanup"
# unlock loop device access in case of starvation # unlock loop device access in case of starvation
exec {FD}>/var/lock/armbian-debootstrap-losetup exec {FD}>/var/lock/armbian-debootstrap-losetup
flock -u $FD flock -u "${FD}"
exit -1 exit 255
} }
# get_package_list_hash # get_package_list_hash
@@ -119,7 +122,7 @@ exit_with_error()
get_package_list_hash() get_package_list_hash()
{ {
( printf '%s\n' $PACKAGE_LIST | sort -u; printf '%s\n' $PACKAGE_LIST_EXCLUDE | sort -u; echo "$1" ) \ ( printf '%s\n' "${PACKAGE_LIST}" | sort -u; printf '%s\n' "${PACKAGE_LIST_EXCLUDE}" | sort -u; echo "${1}" ) \
| md5sum | cut -d' ' -f 1 | md5sum | cut -d' ' -f 1
} }
@@ -136,7 +139,7 @@ create_sources_list()
case $release in case $release in
stretch|buster|bullseye) stretch|buster|bullseye)
cat <<-EOF > $basedir/etc/apt/sources.list cat <<-EOF > "${basedir}"/etc/apt/sources.list
deb http://${DEBIAN_MIRROR} $release main contrib non-free deb http://${DEBIAN_MIRROR} $release main contrib non-free
#deb-src http://${DEBIAN_MIRROR} $release main contrib non-free #deb-src http://${DEBIAN_MIRROR} $release main contrib non-free
@@ -152,7 +155,7 @@ create_sources_list()
;; ;;
xenial|bionic|eoan|focal) xenial|bionic|eoan|focal)
cat <<-EOF > $basedir/etc/apt/sources.list cat <<-EOF > "${basedir}"/etc/apt/sources.list
deb http://${UBUNTU_MIRROR} $release main restricted universe multiverse deb http://${UBUNTU_MIRROR} $release main restricted universe multiverse
#deb-src http://${UBUNTU_MIRROR} $release main restricted universe multiverse #deb-src http://${UBUNTU_MIRROR} $release main restricted universe multiverse
@@ -171,7 +174,7 @@ create_sources_list()
# workaround for Chromium by downloading it from Debian # workaround for Chromium by downloading it from Debian
if [[ $release == focal || $release == eoan ]]; then if [[ $release == focal || $release == eoan ]]; then
cat <<-EOF > $basedir/etc/apt/preferences.d/chromium.pref cat <<-EOF > "${basedir}"/etc/apt/preferences.d/chromium.pref
# Note: 2 blank lines are required between entries # Note: 2 blank lines are required between entries
Package: * Package: *
Pin: release a=${release} Pin: release a=${release}
@@ -188,7 +191,7 @@ create_sources_list()
Pin-Priority: 700 Pin-Priority: 700
EOF EOF
cat <<-EOF > $basedir/etc/apt/sources.list.d/debian.list cat <<-EOF > "${basedir}"/etc/apt/sources.list.d/debian.list
deb http://${DEBIAN_MIRROR} stable main deb http://${DEBIAN_MIRROR} stable main
deb http://${DEBIAN_MIRROR} stable-updates main deb http://${DEBIAN_MIRROR} stable-updates main
deb http://${DEBIAN_MIRROR}-security stable/updates main deb http://${DEBIAN_MIRROR}-security stable/updates main
@@ -200,18 +203,18 @@ create_sources_list()
# stage: add armbian repository and install key # stage: add armbian repository and install key
if [[ $DOWNLOAD_MIRROR == "china" ]]; then if [[ $DOWNLOAD_MIRROR == "china" ]]; then
echo "deb http://mirrors.tuna.tsinghua.edu.cn/armbian $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > $SDCARD/etc/apt/sources.list.d/armbian.list echo "deb http://mirrors.tuna.tsinghua.edu.cn/armbian $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${SDCARD}"/etc/apt/sources.list.d/armbian.list
else else
echo "deb http://apt.armbian.com $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > $SDCARD/etc/apt/sources.list.d/armbian.list echo "deb http://apt.armbian.com $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${SDCARD}"/etc/apt/sources.list.d/armbian.list
fi fi
# add local package server if defined. Suitable for development # add local package server if defined. Suitable for development
[[ -n $LOCAL_MIRROR ]] && echo "deb http://$LOCAL_MIRROR $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" >> $SDCARD/etc/apt/sources.list.d/armbian.list [[ -n $LOCAL_MIRROR ]] && echo "deb http://$LOCAL_MIRROR $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" >> "${SDCARD}"/etc/apt/sources.list.d/armbian.list
display_alert "Adding Armbian repository and authentication key" "/etc/apt/sources.list.d/armbian.list" "info" display_alert "Adding Armbian repository and authentication key" "/etc/apt/sources.list.d/armbian.list" "info"
cp $SRC/config/armbian.key $SDCARD cp "${SRC}"/config/armbian.key "${SDCARD}"
chroot $SDCARD /bin/bash -c "cat armbian.key | apt-key add - > /dev/null 2>&1" chroot "${SDCARD}" /bin/bash -c "cat armbian.key | apt-key add - > /dev/null 2>&1"
rm $SDCARD/armbian.key rm "${SDCARD}"/armbian.key
} }
# fetch_from_repo <url> <directory> <ref> <ref_subdir> # fetch_from_repo <url> <directory> <ref> <ref_subdir>
@@ -261,10 +264,10 @@ fetch_from_repo()
local workdir=$dir local workdir=$dir
fi fi
mkdir -p $SRC/cache/sources/$workdir 2>/dev/null || \ mkdir -p "${SRC}/cache/sources/${workdir}" 2>/dev/null || \
exit_with_error "No path or no write permission" "$SRC/cache/sources/$workdir" exit_with_error "No path or no write permission" "${SRC}/cache/sources/${workdir}"
cd $SRC/cache/sources/$workdir cd "${SRC}/cache/sources/${workdir}" || exit
# check if existing remote URL for the repo or branch does not match current one # check if existing remote URL for the repo or branch does not match current one
# may not be supported by older git versions # may not be supported by older git versions
@@ -274,13 +277,13 @@ fetch_from_repo()
if [[ "$(git rev-parse --git-dir 2>/dev/null)" == ".git" && \ if [[ "$(git rev-parse --git-dir 2>/dev/null)" == ".git" && \
"$url" != "$(git remote get-url origin 2>/dev/null)" ]]; then "$url" != "$(git remote get-url origin 2>/dev/null)" ]]; then
display_alert "Remote URL does not match, removing existing local copy" display_alert "Remote URL does not match, removing existing local copy"
rm -rf .git * rm -rf .git ./*
fi fi
if [[ "$(git rev-parse --git-dir 2>/dev/null)" != ".git" ]]; then if [[ "$(git rev-parse --git-dir 2>/dev/null)" != ".git" ]]; then
display_alert "Creating local copy" display_alert "Creating local copy"
git init -q . git init -q .
git remote add origin $url git remote add origin "${url}"
# Here you need to upload from a new address # Here you need to upload from a new address
offline=false offline=false
fi fi
@@ -289,26 +292,30 @@ fetch_from_repo()
# when we work offline we simply return the sources to their original state # when we work offline we simply return the sources to their original state
if ! $offline; then if ! $offline; then
local local_hash=$(git rev-parse @ 2>/dev/null) local local_hash
local_hash=$(git rev-parse @ 2>/dev/null)
case $ref_type in case $ref_type in
branch) branch)
# TODO: grep refs/heads/$name # TODO: grep refs/heads/$name
local remote_hash=$(git ls-remote -h $url "$ref_name" | head -1 | cut -f1) local remote_hash
[[ -z $local_hash || $local_hash != $remote_hash ]] && changed=true remote_hash=$(git ls-remote -h "${url}" "$ref_name" | head -1 | cut -f1)
[[ -z $local_hash || "${local_hash}" != "${remote_hash}" ]] && changed=true
;; ;;
tag) tag)
local remote_hash=$(git ls-remote -t $url "$ref_name" | cut -f1) local remote_hash
if [[ -z $local_hash || $local_hash != $remote_hash ]]; then remote_hash=$(git ls-remote -t "${url}" "$ref_name" | cut -f1)
remote_hash=$(git ls-remote -t $url "$ref_name^{}" | cut -f1) if [[ -z $local_hash || "${local_hash}" != "${remote_hash}" ]]; then
[[ -z $remote_hash || $local_hash != $remote_hash ]] && changed=true remote_hash=$(git ls-remote -t "${url}" "$ref_name^{}" | cut -f1)
[[ -z $remote_hash || "${local_hash}" != "${remote_hash}" ]] && changed=true
fi fi
;; ;;
head) head)
local remote_hash=$(git ls-remote $url HEAD | cut -f1) local remote_hash
[[ -z $local_hash || $local_hash != $remote_hash ]] && changed=true remote_hash=$(git ls-remote "${url}" HEAD | cut -f1)
[[ -z $local_hash || "${local_hash}" != "${remote_hash}" ]] && changed=true
;; ;;
commit) commit)
@@ -323,22 +330,22 @@ fetch_from_repo()
# remote was updated, fetch and check out updates # remote was updated, fetch and check out updates
display_alert "Fetching updates" display_alert "Fetching updates"
case $ref_type in case $ref_type in
branch) git fetch --depth 1 origin $ref_name ;; branch) git fetch --depth 1 origin "${ref_name}" ;;
tag) git fetch --depth 1 origin tags/$ref_name ;; tag) git fetch --depth 1 origin tags/"${ref_name}" ;;
head) git fetch --depth 1 origin HEAD ;; head) git fetch --depth 1 origin HEAD ;;
esac esac
# commit type needs support for older git servers that doesn't support fetching id directly # commit type needs support for older git servers that doesn't support fetching id directly
if [[ $ref_type == commit ]]; then if [[ $ref_type == commit ]]; then
git fetch --depth 1 origin $ref_name git fetch --depth 1 origin "${ref_name}"
# cover old type # cover old type
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
display_alert "Commit checkout not supported on this repository. Doing full clone." "" "wrn" display_alert "Commit checkout not supported on this repository. Doing full clone." "" "wrn"
git pull git pull
git checkout -fq $ref_name git checkout -fq "${ref_name}"
display_alert "Checkout out to" "$(git --no-pager log -2 --pretty=format:"$ad%s [%an]" | head -1)" "info" display_alert "Checkout out to" "$(git --no-pager log -2 --pretty=format:"$ad%s [%an]" | head -1)" "info"
else else
@@ -374,9 +381,10 @@ fetch_from_repo()
display_alert "Updating submodules" "" "ext" display_alert "Updating submodules" "" "ext"
# FML: http://stackoverflow.com/a/17692710 # FML: http://stackoverflow.com/a/17692710
for i in $(git config -f .gitmodules --get-regexp path | awk '{ print $2 }'); do for i in $(git config -f .gitmodules --get-regexp path | awk '{ print $2 }'); do
cd $SRC/cache/sources/$workdir cd "${SRC}/cache/sources/${workdir}" || exit
local surl=$(git config -f .gitmodules --get "submodule.$i.url") local surl sref
local sref=$(git config -f .gitmodules --get "submodule.$i.branch") surl=$(git config -f .gitmodules --get "submodule.$i.url")
sref=$(git config -f .gitmodules --get "submodule.$i.branch")
if [[ -n $sref ]]; then if [[ -n $sref ]]; then
sref="branch:$sref" sref="branch:$sref"
else else
@@ -393,7 +401,7 @@ fetch_from_repo()
display_alert() display_alert()
{ {
# log function parameters to install.log # log function parameters to install.log
[[ -n $DEST ]] && echo "Displaying message: $@" >> $DEST/debug/output.log [[ -n "${DEST}" ]] && echo "Displaying message: $@" >> "${DEST}"/debug/output.log
local tmp="" local tmp=""
[[ -n $2 ]] && tmp="[\e[0;33m $2 \x1B[0m]" [[ -n $2 ]] && tmp="[\e[0;33m $2 \x1B[0m]"
@@ -428,7 +436,7 @@ display_alert()
fingerprint_image() fingerprint_image()
{ {
display_alert "Fingerprinting" display_alert "Fingerprinting"
cat <<-EOF > $1 cat <<-EOF > "${1}"
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Title: Armbian $REVISION ${BOARD^} $DISTRIBUTION $RELEASE $BRANCH Title: Armbian $REVISION ${BOARD^} $DISTRIBUTION $RELEASE $BRANCH
Kernel: Linux $VER Kernel: Linux $VER
@@ -442,7 +450,7 @@ fingerprint_image()
EOF EOF
if [ -n "$2" ]; then if [ -n "$2" ]; then
cat <<-EOF >> $1 cat <<-EOF >> "${1}"
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Partitioning configuration: Partitioning configuration:
Root partition type: $ROOTFS_TYPE Root partition type: $ROOTFS_TYPE
@@ -465,9 +473,9 @@ fingerprint_image()
EOF EOF
fi fi
cat <<-EOF >> $1 cat <<-EOF >> "${1}"
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
$(cat $SRC/LICENSE) $(cat "${SRC}"/LICENSE)
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
EOF EOF
} }
@@ -482,7 +490,7 @@ function distro_menu ()
for i in "${!distro_name[@]}" for i in "${!distro_name[@]}"
do do
if [[ $i == $1 ]]; then if [[ "${i}" == "${1}" ]]; then
if [[ "${distro_support[$i]}" != "supported" && $EXPERT != "yes" ]]; then if [[ "${distro_support[$i]}" != "supported" && $EXPERT != "yes" ]]; then
: :
else else
@@ -505,16 +513,17 @@ adding_packages()
# add deb files to repository if they are not already there # add deb files to repository if they are not already there
display_alert "Checking and adding to repository $release" "$3" "ext" display_alert "Checking and adding to repository $release" "$3" "ext"
for f in ${DEB_STORAGE}$2/*.deb for f in "${DEB_STORAGE}${2}"/*.deb
do do
local name=$(dpkg-deb -I $f | grep Package | awk '{print $2}') local name version arch
local version=$(dpkg-deb -I $f | grep Version | awk '{print $2}') name=$(dpkg-deb -I "${f}" | grep Package | awk '{print $2}')
local arch=$(dpkg-deb -I $f | grep Architecture | awk '{print $2}') version=$(dpkg-deb -I "${f}" | grep Version | awk '{print $2}')
arch=$(dpkg-deb -I "${f}" | grep Architecture | awk '{print $2}')
# add if not already there # add if not already there
aptly repo search -architectures=$arch -config=${SCRIPTPATH}config/${REPO_CONFIG} $1 'Name (% '$name'), $Version (='$version'), $Architecture (='$arch')' &>/dev/null aptly repo search -architectures="${arch}" -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${1}" 'Name (% '${name}'), $Version (='${version}'), $Architecture (='${arch}')' &>/dev/null
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
display_alert "Adding" "$name" "info" display_alert "Adding" "$name" "info"
aptly repo add -force-replace=true -config=${SCRIPTPATH}config/${REPO_CONFIG} $1 ${f} &>/dev/null aptly repo add -force-replace=true -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${1}" "${f}" &>/dev/null
fi fi
done done
@@ -538,74 +547,75 @@ addtorepo()
local forceoverwrite="" local forceoverwrite=""
# let's drop from publish if exits # let's drop from publish if exits
if [[ -n $(aptly publish list -config=${SCRIPTPATH}config/${REPO_CONFIG} -raw | awk '{print $(NF)}' | grep $release) ]]; then if [[ -n $(aptly publish list -config="${SCRIPTPATH}config/${REPO_CONFIG}" -raw | awk '{print $(NF)}' | grep "${release}") ]]; then
aptly publish drop -config=${SCRIPTPATH}config/${REPO_CONFIG} $release > /dev/null 2>&1 aptly publish drop -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}" > /dev/null 2>&1
fi fi
# create local repository if not exist # create local repository if not exist
if [[ -z $(aptly repo list -config=${SCRIPTPATH}config/${REPO_CONFIG} -raw | awk '{print $(NF)}' | grep $release) ]]; then if [[ -z $(aptly repo list -config="${SCRIPTPATH}config/${REPO_CONFIG}" -raw | awk '{print $(NF)}' | grep "${release}") ]]; then
display_alert "Creating section" "$release" "info" display_alert "Creating section" "$release" "info"
aptly repo create -config=${SCRIPTPATH}config/${REPO_CONFIG} -distribution=$release -component="main" \ aptly repo create -config="${SCRIPTPATH}config/${REPO_CONFIG}" -distribution="${release}" -component="main" \
-comment="Armbian main repository" ${release} >/dev/null -comment="Armbian main repository" "${release}" >/dev/null
fi fi
if [[ -z $(aptly repo list -config=${SCRIPTPATH}config/${REPO_CONFIG} -raw | awk '{print $(NF)}' | grep "^utils") ]]; then if [[ -z $(aptly repo list -config="${SCRIPTPATH}config/${REPO_CONFIG}" -raw | awk '{print $(NF)}' | grep "^utils") ]]; then
aptly repo create -config=${SCRIPTPATH}config/${REPO_CONFIG} -distribution=$release -component="utils" \ aptly repo create -config="${SCRIPTPATH}config/${REPO_CONFIG}" -distribution="${release}" -component="utils" \
-comment="Armbian utilities (backwards compatibility)" utils >/dev/null -comment="Armbian utilities (backwards compatibility)" utils >/dev/null
fi fi
if [[ -z $(aptly repo list -config=${SCRIPTPATH}config/${REPO_CONFIG} -raw | awk '{print $(NF)}' | grep "${release}-utils") ]]; then if [[ -z $(aptly repo list -config="${SCRIPTPATH}config/${REPO_CONFIG}" -raw | awk '{print $(NF)}' | grep "${release}-utils") ]]; then
aptly repo create -config=${SCRIPTPATH}config/${REPO_CONFIG} -distribution=$release -component="${release}-utils" \ aptly repo create -config="${SCRIPTPATH}config/${REPO_CONFIG}" -distribution="${release}" -component="${release}-utils" \
-comment="Armbian ${release} utilities" ${release}-utils >/dev/null -comment="Armbian ${release} utilities" "${release}-utils" >/dev/null
fi fi
if [[ -z $(aptly repo list -config=${SCRIPTPATH}config/${REPO_CONFIG} -raw | awk '{print $(NF)}' | grep "${release}-desktop") ]]; then if [[ -z $(aptly repo list -config="${SCRIPTPATH}config/${REPO_CONFIG}" -raw | awk '{print $(NF)}' | grep "${release}-desktop") ]]; then
aptly repo create -config=${SCRIPTPATH}config/${REPO_CONFIG} -distribution=$release -component="${release}-desktop" \ aptly repo create -config="${SCRIPTPATH}config/${REPO_CONFIG}" -distribution="${release}" -component="${release}-desktop" \
-comment="Armbian ${release} desktop" ${release}-desktop >/dev/null -comment="Armbian ${release} desktop" "${release}-desktop" >/dev/null
fi fi
# adding main # adding main
if find ${DEB_STORAGE}/ -maxdepth 1 -type f -name "*.deb" 2>/dev/null | grep -q .; then if find "${DEB_STORAGE}"/ -maxdepth 1 -type f -name "*.deb" 2>/dev/null | grep -q .; then
adding_packages "$release" "" "main" adding_packages "$release" "" "main"
else else
aptly repo add -config=${SCRIPTPATH}config/${REPO_CONFIG} $release ${SCRIPTPATH}config/templates/example.deb >/dev/null aptly repo add -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}" "${SCRIPTPATH}config/templates/example.deb" >/dev/null
fi fi
local COMPONENTS="main" local COMPONENTS="main"
# adding main distribution packages # adding main distribution packages
if find ${DEB_STORAGE}/${release} -maxdepth 1 -type f -name "*.deb" 2>/dev/null | grep -q .; then if find "${DEB_STORAGE}/${release}" -maxdepth 1 -type f -name "*.deb" 2>/dev/null | grep -q .; then
adding_packages "$release" "/${release}" "release" adding_packages "$release" "/${release}" "release"
else else
# workaround - add dummy package to not trigger error # workaround - add dummy package to not trigger error
aptly repo add -config=${SCRIPTPATH}config/${REPO_CONFIG} $release ${SCRIPTPATH}config/templates/example.deb >/dev/null aptly repo add -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}" "${SCRIPTPATH}config/templates/example.deb" >/dev/null
fi fi
# adding release-specific utils # adding release-specific utils
if find ${DEB_STORAGE}/extra/${release}-utils -maxdepth 1 -type f -name "*.deb" 2>/dev/null | grep -q .; then if find "${DEB_STORAGE}/extra/${release}-utils" -maxdepth 1 -type f -name "*.deb" 2>/dev/null | grep -q .; then
adding_packages "${release}-utils" "/extra/${release}-utils" "release utils" adding_packages "${release}-utils" "/extra/${release}-utils" "release utils"
else else
aptly repo add -config=${SCRIPTPATH}config/${REPO_CONFIG} "${release}-utils" ${SCRIPTPATH}config/templates/example.deb >/dev/null aptly repo add -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}-utils" "${SCRIPTPATH}config/templates/example.deb" >/dev/null
fi fi
COMPONENTS="${COMPONENTS} ${release}-utils" COMPONENTS="${COMPONENTS} ${release}-utils"
# adding desktop # adding desktop
if find ${DEB_STORAGE}/extra/${release}-desktop -maxdepth 1 -type f -name "*.deb" 2>/dev/null | grep -q .; then if find "${DEB_STORAGE}/extra/${release}-desktop" -maxdepth 1 -type f -name "*.deb" 2>/dev/null | grep -q .; then
adding_packages "${release}-desktop" "/extra/${release}-desktop" "desktop" adding_packages "${release}-desktop" "/extra/${release}-desktop" "desktop"
else else
# workaround - add dummy package to not trigger error # workaround - add dummy package to not trigger error
aptly repo add -config=${SCRIPTPATH}config/${REPO_CONFIG} "${release}-desktop" ${SCRIPTPATH}config/templates/example.deb >/dev/null aptly repo add -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}-desktop" "${SCRIPTPATH}config/templates/example.deb" >/dev/null
fi fi
COMPONENTS="${COMPONENTS} ${release}-desktop" COMPONENTS="${COMPONENTS} ${release}-desktop"
local mainnum=$(aptly repo show -with-packages -config=${SCRIPTPATH}config/${REPO_CONFIG} $release | grep "Number of packages" | awk '{print $NF}') local mainnum utilnum desknum
local utilnum=$(aptly repo show -with-packages -config=${SCRIPTPATH}config/${REPO_CONFIG} ${release}-desktop | grep "Number of packages" | awk '{print $NF}') mainnum=$(aptly repo show -with-packages -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}" | grep "Number of packages" | awk '{print $NF}')
local desknum=$(aptly repo show -with-packages -config=${SCRIPTPATH}config/${REPO_CONFIG} ${release}-utils | grep "Number of packages" | awk '{print $NF}') utilnum=$(aptly repo show -with-packages -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}-desktop" | grep "Number of packages" | awk '{print $NF}')
desknum=$(aptly repo show -with-packages -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}-utils" | grep "Number of packages" | awk '{print $NF}')
if [ $mainnum -gt 0 ] && [ $utilnum -gt 0 ] && [ $desknum -gt 0 ]; then if [ $mainnum -gt 0 ] && [ $utilnum -gt 0 ] && [ $desknum -gt 0 ]; then
# publish # publish
aptly publish -force-overwrite -passphrase=$GPG_PASS -origin=Armbian -label=Armbian -config=${SCRIPTPATH}config/${REPO_CONFIG} -component=${COMPONENTS// /,} \ aptly publish -force-overwrite -passphrase="${GPG_PASS}" -origin=Armbian -label=Armbian -config="${SCRIPTPATH}config/${REPO_CONFIG}" -component="${COMPONENTS// /,}" \
--distribution=$release repo $release ${COMPONENTS//main/} >/dev/null --distribution="${release}" repo "${release}" "${COMPONENTS//main/}" >/dev/null
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
display_alert "Publishing failed" "$release" "err" display_alert "Publishing failed" "${release}" "err"
errors=$((errors+1)) errors=$((errors+1))
exit 0 exit 0
fi fi
@@ -618,18 +628,18 @@ addtorepo()
# cleanup # cleanup
display_alert "Cleaning repository" "${DEB_STORAGE}" "info" display_alert "Cleaning repository" "${DEB_STORAGE}" "info"
aptly db cleanup -config=${SCRIPTPATH}config/${REPO_CONFIG} aptly db cleanup -config="${SCRIPTPATH}config/${REPO_CONFIG}"
# display what we have # display what we have
echo "" echo ""
display_alert "List of local repos" "local" "info" display_alert "List of local repos" "local" "info"
(aptly repo list -config=${SCRIPTPATH}config/${REPO_CONFIG}) | egrep packages (aptly repo list -config="${SCRIPTPATH}config/${REPO_CONFIG}") | grep -E packages
# remove debs if no errors found # remove debs if no errors found
if [[ $errors -eq 0 ]]; then if [[ $errors -eq 0 ]]; then
if [[ "$2" == "delete" ]]; then if [[ "$2" == "delete" ]]; then
display_alert "Purging incoming debs" "all" "ext" display_alert "Purging incoming debs" "all" "ext"
find ${DEB_STORAGE} -name "*.deb" -type f -delete find "${DEB_STORAGE}" -name "*.deb" -type f -delete
fi fi
else else
display_alert "There were some problems $err_txt" "leaving incoming directory intact" "err" display_alert "There were some problems $err_txt" "leaving incoming directory intact" "err"
@@ -646,18 +656,18 @@ repo-manipulate() {
serve) serve)
# display repository content # display repository content
display_alert "Serving content" "common utils" "ext" display_alert "Serving content" "common utils" "ext"
aptly serve -listen=$(ip -f inet addr | grep -Po 'inet \K[\d.]+' | grep -v 127.0.0.1 | head -1):8080 -config="${SCRIPTPATH}"config/${REPO_CONFIG} aptly serve -listen=$(ip -f inet addr | grep -Po 'inet \K[\d.]+' | grep -v 127.0.0.1 | head -1):8080 -config="${SCRIPTPATH}config/${REPO_CONFIG}"
exit 0 exit 0
;; ;;
show) show)
# display repository content # display repository content
for release in "${DISTROS[@]}"; do for release in "${DISTROS[@]}"; do
display_alert "Displaying repository contents for" "$release" "ext" display_alert "Displaying repository contents for" "$release" "ext"
aptly repo show -with-packages -config="${SCRIPTPATH}"config/${REPO_CONFIG} "${release}" | tail -n +7 aptly repo show -with-packages -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}" | tail -n +7
aptly repo show -with-packages -config="${SCRIPTPATH}"config/${REPO_CONFIG} "${release}-desktop" | tail -n +7 aptly repo show -with-packages -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}-desktop" | tail -n +7
done done
display_alert "Displaying repository contents for" "common utils" "ext" display_alert "Displaying repository contents for" "common utils" "ext"
aptly repo show -with-packages -config="${SCRIPTPATH}"config/${REPO_CONFIG} utils | tail -n +7 aptly repo show -with-packages -config="${SCRIPTPATH}config/${REPO_CONFIG}" utils | tail -n +7
echo "done." echo "done."
exit 0 exit 0
;; ;;
@@ -667,10 +677,10 @@ repo-manipulate() {
while true; do while true; do
LIST=() LIST=()
for release in "${DISTROS[@]}"; do for release in "${DISTROS[@]}"; do
LIST+=( $(aptly repo show -with-packages -config="${SCRIPTPATH}"config/${REPO_CONFIG} "${release}" | tail -n +7) ) LIST+=( $(aptly repo show -with-packages -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}" | tail -n +7) )
LIST+=( $(aptly repo show -with-packages -config="${SCRIPTPATH}"config/${REPO_CONFIG} "${release}-desktop" | tail -n +7) ) LIST+=( $(aptly repo show -with-packages -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}-desktop" | tail -n +7) )
done done
LIST+=( $(aptly repo show -with-packages -config="${SCRIPTPATH}"config/${REPO_CONFIG} utils | tail -n +7) ) LIST+=( $(aptly repo show -with-packages -config="${SCRIPTPATH}config/${REPO_CONFIG}" utils | tail -n +7) )
LIST=( $(echo "${LIST[@]}" | tr ' ' '\n' | sort -u)) LIST=( $(echo "${LIST[@]}" | tr ' ' '\n' | sort -u))
new_list=() new_list=()
# create a human readable menu # create a human readable menu
@@ -687,10 +697,10 @@ repo-manipulate() {
exec 3>&- exec 3>&-
if [[ $exitstatus -eq 0 ]]; then if [[ $exitstatus -eq 0 ]]; then
for release in "${DISTROS[@]}"; do for release in "${DISTROS[@]}"; do
aptly repo remove -config="${SCRIPTPATH}"config/${REPO_CONFIG} "${release}" "$TARGET_VERSION" aptly repo remove -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}" "$TARGET_VERSION"
aptly repo remove -config="${SCRIPTPATH}"config/${REPO_CONFIG} "${release}-desktop" "$TARGET_VERSION" aptly repo remove -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}-desktop" "$TARGET_VERSION"
done done
aptly repo remove -config="${SCRIPTPATH}"config/${REPO_CONFIG} "utils" "$TARGET_VERSION" aptly repo remove -config="${SCRIPTPATH}config/${REPO_CONFIG}" "utils" "$TARGET_VERSION"
else else
exit 1 exit 1
fi fi
@@ -709,16 +719,16 @@ repo-manipulate() {
repo-remove-old-packages "$release" "armhf" "5" repo-remove-old-packages "$release" "armhf" "5"
repo-remove-old-packages "$release" "arm64" "5" repo-remove-old-packages "$release" "arm64" "5"
repo-remove-old-packages "$release" "all" "5" repo-remove-old-packages "$release" "all" "5"
aptly -config="${SCRIPTPATH}"config/${REPO_CONFIG} -passphrase="${GPG_PASS}" publish update "${release}" > /dev/null 2>&1 aptly -config="${SCRIPTPATH}config/${REPO_CONFIG}" -passphrase="${GPG_PASS}" publish update "${release}" > /dev/null 2>&1
done done
exit 0 exit 0
;; ;;
purgesource) purgesource)
for release in "${DISTROS[@]}"; do for release in "${DISTROS[@]}"; do
aptly repo remove -config=${SCRIPTPATH}config/${REPO_CONFIG} ${release} 'Name (% *-source*)' aptly repo remove -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}" 'Name (% *-source*)'
aptly -config="${SCRIPTPATH}"config/${REPO_CONFIG} -passphrase="${GPG_PASS}" publish update "${release}" > /dev/null 2>&1 aptly -config="${SCRIPTPATH}config/${REPO_CONFIG}" -passphrase="${GPG_PASS}" publish update "${release}" > /dev/null 2>&1
done done
aptly db cleanup -config=${SCRIPTPATH}config/${REPO_CONFIG} > /dev/null 2>&1 aptly db cleanup -config="${SCRIPTPATH}config/${REPO_CONFIG}" > /dev/null 2>&1
exit 0 exit 0
;; ;;
*) *)
@@ -745,7 +755,7 @@ repo-remove-old-packages() {
local arch=$2 local arch=$2
local keep=$3 local keep=$3
for pkg in $(aptly repo search -config="${SCRIPTPATH}"config/${REPO_CONFIG} "${repo}" "Architecture ($arch)" | grep -v "ERROR: no results" | sort -rV); do for pkg in $(aptly repo search -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${repo}" "Architecture ($arch)" | grep -v "ERROR: no results" | sort -rV); do
local pkg_name local pkg_name
pkg_name=$(echo "${pkg}" | cut -d_ -f1) pkg_name=$(echo "${pkg}" | cut -d_ -f1)
if [ "$pkg_name" != "$cur_pkg" ]; then if [ "$pkg_name" != "$cur_pkg" ]; then
@@ -757,7 +767,7 @@ repo-remove-old-packages() {
((count+=1)) ((count+=1))
if [[ $count -gt $keep ]]; then if [[ $count -gt $keep ]]; then
pkg_version=$(echo "${pkg}" | cut -d_ -f2) pkg_version=$(echo "${pkg}" | cut -d_ -f2)
aptly repo remove -config="${SCRIPTPATH}"config/${REPO_CONFIG} "${repo}" "Name ($pkg_name), Version (<= $pkg_version)" aptly repo remove -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${repo}" "Name ($pkg_name), Version (<= $pkg_version)"
deleted='yes' deleted='yes'
fi fi
done done
@@ -921,9 +931,9 @@ prepare_host()
# distribution packages are buggy, download from author # distribution packages are buggy, download from author
if [[ ! -f /etc/apt/sources.list.d/aptly.list ]]; then if [[ ! -f /etc/apt/sources.list.d/aptly.list ]]; then
display_alert "Updating from external repository" "aptly" "info" display_alert "Updating from external repository" "aptly" "info"
if [ x"" != x$http_proxy ]; then if [ x"" != x"${http_proxy}" ]; then
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --keyserver-options http-proxy=$http_proxy --recv-keys ED75B5A4483DA07C >/dev/null 2>&1 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --keyserver-options http-proxy="${http_proxy}" --recv-keys ED75B5A4483DA07C >/dev/null 2>&1
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --keyserver-options http-proxy=$http_proxy --recv-keys ED75B5A4483DA07C >/dev/null 2>&1 apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --keyserver-options http-proxy="${http_proxy}" --recv-keys ED75B5A4483DA07C >/dev/null 2>&1
else else
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys ED75B5A4483DA07C >/dev/null 2>&1 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys ED75B5A4483DA07C >/dev/null 2>&1
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys ED75B5A4483DA07C >/dev/null 2>&1 apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys ED75B5A4483DA07C >/dev/null 2>&1
@@ -937,14 +947,14 @@ prepare_host()
display_alert "Installing build dependencies" display_alert "Installing build dependencies"
apt-get -q update apt-get -q update
apt-get -y upgrade apt-get -y upgrade
apt-get -q -y --no-install-recommends install -o Dpkg::Options::='--force-confold' "${deps[@]}" | tee -a $DEST/debug/hostdeps.log apt-get -q -y --no-install-recommends install -o Dpkg::Options::='--force-confold' "${deps[@]}" | tee -a "${DEST}"/debug/hostdeps.log
update-ccache-symlinks update-ccache-symlinks
fi fi
# sync clock # sync clock
if [[ $SYNC_CLOCK != no ]]; then if [[ $SYNC_CLOCK != no ]]; then
display_alert "Syncing clock" "host" "info" display_alert "Syncing clock" "host" "info"
ntpdate -s ${NTP_SERVER:- pool.ntp.org} ntpdate -s "${NTP_SERVER:- pool.ntp.org}"
fi fi
if [[ $(dpkg-query -W -f='${db:Status-Abbrev}\n' 'zlib1g:i386' 2>/dev/null) != *ii* ]]; then if [[ $(dpkg-query -W -f='${db:Status-Abbrev}\n' 'zlib1g:i386' 2>/dev/null) != *ii* ]]; then
@@ -952,16 +962,16 @@ prepare_host()
fi fi
# create directory structure # create directory structure
mkdir -p $SRC/{cache,output} $USERPATCHES_PATH mkdir -p "${SRC}"/{cache,output} "${USERPATCHES_PATH}"
if [[ -n $SUDO_USER ]]; then if [[ -n $SUDO_USER ]]; then
chgrp --quiet sudo cache output $USERPATCHES_PATH chgrp --quiet sudo cache output "${USERPATCHES_PATH}"
# SGID bit on cache/sources breaks kernel dpkg packaging # SGID bit on cache/sources breaks kernel dpkg packaging
chmod --quiet g+w,g+s output $USERPATCHES_PATH chmod --quiet g+w,g+s output "${USERPATCHES_PATH}"
# fix existing permissions # fix existing permissions
find $SRC/output $USERPATCHES_PATH -type d ! -group sudo -exec chgrp --quiet sudo {} \; find "${SRC}"/output "${USERPATCHES_PATH}" -type d ! -group sudo -exec chgrp --quiet sudo {} \;
find $SRC/output $USERPATCHES_PATH -type d ! -perm -g+w,g+s -exec chmod --quiet g+w,g+s {} \; find "${SRC}"/output "${USERPATCHES_PATH}" -type d ! -perm -g+w,g+s -exec chmod --quiet g+w,g+s {} \;
fi fi
mkdir -p $DEST/debs-beta/extra $DEST/debs/extra $DEST/{config,debug,patch} $USERPATCHES_PATH/overlay $SRC/cache/{sources,hash,toolchains,utility,rootfs} $SRC/.tmp mkdir -p "${DEST}"/debs-beta/extra "${DEST}"/debs/extra "${DEST}"/{config,debug,patch} "${USERPATCHES_PATH}"/overlay "${SRC}"/cache/{sources,hash,toolchains,utility,rootfs} "${SRC}"/.tmp
display_alert "Checking for external GCC compilers" "" "info" display_alert "Checking for external GCC compilers" "" "info"
# download external Linaro compiler and missing special dependencies since they are needed for certain sources # download external Linaro compiler and missing special dependencies since they are needed for certain sources
@@ -990,8 +1000,8 @@ prepare_host()
download_and_verify "_toolchains" "${toolchain##*/}" download_and_verify "_toolchains" "${toolchain##*/}"
done done
rm -rf $SRC/cache/toolchains/*.tar.xz* rm -rf "${SRC}"/cache/toolchains/*.tar.xz*
local existing_dirs=( $(ls -1 $SRC/cache/toolchains) ) local existing_dirs=( $(ls -1 "${SRC}"/cache/toolchains) )
for dir in ${existing_dirs[@]}; do for dir in ${existing_dirs[@]}; do
local found=no local found=no
for toolchain in ${toolchains[@]}; do for toolchain in ${toolchains[@]}; do
@@ -1001,7 +1011,7 @@ prepare_host()
done done
if [[ $found == no ]]; then if [[ $found == no ]]; then
display_alert "Removing obsolete toolchain" "$dir" display_alert "Removing obsolete toolchain" "$dir"
rm -rf $SRC/cache/toolchains/$dir rm -rf "${SRC}/cache/toolchains/${dir}"
fi fi
done done
@@ -1015,19 +1025,19 @@ prepare_host()
test -e /proc/sys/fs/binfmt_misc/qemu-aarch64 || update-binfmts --enable qemu-aarch64 test -e /proc/sys/fs/binfmt_misc/qemu-aarch64 || update-binfmts --enable qemu-aarch64
fi fi
[[ ! -f $USERPATCHES_PATH/customize-image.sh ]] && cp $SRC/config/templates/customize-image.sh.template $USERPATCHES_PATH/customize-image.sh [[ ! -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 if [[ ! -f "${USERPATCHES_PATH}"/README ]]; then
rm -f $USERPATCHES_PATH/readme.txt rm -f "${USERPATCHES_PATH}"/readme.txt
echo 'Please read documentation about customizing build configuration' > $USERPATCHES_PATH/README echo 'Please read documentation about customizing build configuration' > "${USERPATCHES_PATH}"/README
echo 'http://www.armbian.com/using-armbian-tools/' >> $USERPATCHES_PATH/README echo 'http://www.armbian.com/using-armbian-tools/' >> "${USERPATCHES_PATH}"/README
# create patches directory structure under USERPATCHES_PATH # create patches directory structure under USERPATCHES_PATH
find $SRC/patch -maxdepth 2 -type d ! -name . | sed "s%/.*patch%/$USERPATCHES_PATH%" | xargs mkdir -p find "${SRC}"/patch -maxdepth 2 -type d ! -name . | sed "s%/.*patch%/$USERPATCHES_PATH%" | xargs mkdir -p
fi fi
# check free space (basic) # check free space (basic)
local freespace=$(findmnt --target $SRC -n -o AVAIL -b 2>/dev/null) # in bytes local freespace=$(findmnt --target "${SRC}" -n -o AVAIL -b 2>/dev/null) # in bytes
if [[ -n $freespace && $(( $freespace / 1073741824 )) -lt 10 ]]; then if [[ -n $freespace && $(( $freespace / 1073741824 )) -lt 10 ]]; then
display_alert "Low free space left" "$(( $freespace / 1073741824 )) GiB" "wrn" display_alert "Low free space left" "$(( $freespace / 1073741824 )) GiB" "wrn"
# pause here since dialog-based menu will hide this message otherwise # pause here since dialog-based menu will hide this message otherwise
@@ -1063,12 +1073,12 @@ WEBSEED=(
fi fi
for toolchain in ${WEBSEED[@]}; do for toolchain in ${WEBSEED[@]}; do
# use only live # use only live
if [[ `wget -S --spider $toolchain$1 2>&1 >/dev/null | grep 'HTTP/1.1 200 OK'` ]]; then if [[ $(wget -S --spider "${toolchain}${1}" 2>&1 >/dev/null | grep 'HTTP/1.1 200 OK') ]]; then
text=$text" "$toolchain$1 text="${text} ${toolchain}${1}"
fi fi
done done
text="${text:1}" text="${text:1}"
echo $text echo "${text}"
} }
@@ -1079,7 +1089,7 @@ download_and_verify()
local remotedir=$1 local remotedir=$1
local filename=$2 local filename=$2
local localdir=$SRC/cache/${remotedir//_} local localdir="${SRC}"/cache/${remotedir//_}
local dirname=${filename//.tar.xz} local dirname=${filename//.tar.xz}
if [[ $DOWNLOAD_MIRROR == china ]]; then if [[ $DOWNLOAD_MIRROR == china ]]; then
@@ -1092,19 +1102,19 @@ download_and_verify()
return return
fi fi
cd ${localdir} cd "${localdir}" || exit
# use local control file # use local control file
if [[ -f $SRC/config/torrents/${filename}.asc ]]; then if [[ -f "${SRC}"/config/torrents/${filename}.asc ]]; then
local torrent=$SRC/config/torrents/${filename}.torrent local torrent="${SRC}"/config/torrents/${filename}.torrent
ln -s $SRC/config/torrents/${filename}.asc ${localdir}/${filename}.asc ln -s "${SRC}/config/torrents/${filename}.asc" "${localdir}/${filename}.asc"
elif [[ ! `wget -S --spider ${server}${remotedir}/${filename}.asc 2>&1 >/dev/null | grep 'HTTP/1.1 200 OK'` ]]; then elif [[ ! $(wget -S --spider "${server}${remotedir}/${filename}.asc" 2>&1 >/dev/null | grep 'HTTP/1.1 200 OK') ]]; then
return return
else else
# download control file # download control file
local torrent=${server}torrent/${filename}.torrent local torrent=${server}torrent/${filename}.torrent
aria2c --download-result=hide --disable-ipv6=true --summary-interval=0 --console-log-level=error --auto-file-renaming=false \ aria2c --download-result=hide --disable-ipv6=true --summary-interval=0 --console-log-level=error --auto-file-renaming=false \
--continue=false --allow-overwrite=true --dir=${localdir} $(webseed "$remotedir/${filename}.asc") -o "${filename}.asc" --continue=false --allow-overwrite=true --dir="${localdir}" "$(webseed "$remotedir/${filename}.asc")" -o "${filename}.asc"
[[ $? -ne 0 ]] && display_alert "Failed to download control file" "" "wrn" [[ $? -ne 0 ]] && display_alert "Failed to download control file" "" "wrn"
fi fi
@@ -1115,75 +1125,75 @@ download_and_verify()
local ariatorrent="--summary-interval=0 --auto-save-interval=0 --seed-time=0 --bt-stop-timeout=15 --console-log-level=error \ local ariatorrent="--summary-interval=0 --auto-save-interval=0 --seed-time=0 --bt-stop-timeout=15 --console-log-level=error \
--allow-overwrite=true --download-result=hide --rpc-save-upload-metadata=false --auto-file-renaming=false \ --allow-overwrite=true --download-result=hide --rpc-save-upload-metadata=false --auto-file-renaming=false \
--file-allocation=trunc --continue=true ${torrent} \ --file-allocation=trunc --continue=true ${torrent} \
--dht-file-path=$SRC/cache/.aria2/dht.dat --disable-ipv6=true --stderr --follow-torrent=mem --dir=${localdir}" --dht-file-path=${SRC}/cache/.aria2/dht.dat --disable-ipv6=true --stderr --follow-torrent=mem --dir=${localdir}"
# exception. It throws error if dht.dat file does not exists. Error suppress needed only at first download. # exception. It throws error if dht.dat file does not exists. Error suppress needed only at first download.
if [[ -f $SRC/cache/.aria2/dht.dat ]]; then if [[ -f "${SRC}"/cache/.aria2/dht.dat ]]; then
aria2c ${ariatorrent} aria2c "${ariatorrent}"
else else
aria2c ${ariatorrent} &> $DEST/debug/torrent.log aria2c "${ariatorrent}" &> "${DEST}"/debug/torrent.log
fi fi
# mark complete # mark complete
[[ $? -eq 0 ]] && touch ${localdir}/${filename}.complete [[ $? -eq 0 ]] && touch "${localdir}/${filename}.complete"
fi fi
# direct download if torrent fails # direct download if torrent fails
if [[ ! -f ${localdir}/${filename}.complete ]]; then if [[ ! -f "${localdir}/${filename}.complete" ]]; then
if [[ `wget -S --spider ${server}${remotedir}/${filename} 2>&1 >/dev/null \ if [[ $(wget -S --spider "${server}${remotedir}/${filename}" 2>&1 >/dev/null \
| grep 'HTTP/1.1 200 OK'` ]]; then | grep 'HTTP/1.1 200 OK') ]]; then
display_alert "downloading using http(s) network" "$filename" display_alert "downloading using http(s) network" "$filename"
aria2c --download-result=hide --rpc-save-upload-metadata=false --console-log-level=error \ aria2c --download-result=hide --rpc-save-upload-metadata=false --console-log-level=error \
--dht-file-path=$SRC/cache/.aria2/dht.dat --disable-ipv6=true --summary-interval=0 --auto-file-renaming=false --dir=${localdir} $(webseed "$remotedir/$filename") -o ${filename} --dht-file-path="${SRC}"/cache/.aria2/dht.dat --disable-ipv6=true --summary-interval=0 --auto-file-renaming=false --dir="${localdir}" "$(webseed "${remotedir}/${filename}")" -o "${filename}"
# mark complete # mark complete
[[ $? -eq 0 ]] && touch ${localdir}/${filename}.complete && echo "" [[ $? -eq 0 ]] && touch "${localdir}/${filename}.complete" && echo ""
fi fi
fi fi
if [[ -f ${localdir}/${filename}.asc ]]; then if [[ -f ${localdir}/${filename}.asc ]]; then
if grep -q 'BEGIN PGP SIGNATURE' ${localdir}/${filename}.asc; then if grep -q 'BEGIN PGP SIGNATURE' "${localdir}/${filename}.asc"; then
if [[ ! -d $SRC/cache/.gpg ]]; then if [[ ! -d "${SRC}"/cache/.gpg ]]; then
mkdir -p $SRC/cache/.gpg mkdir -p "${SRC}"/cache/.gpg
chmod 700 $SRC/cache/.gpg chmod 700 "${SRC}"/cache/.gpg
touch $SRC/cache/.gpg/gpg.conf touch "${SRC}"/cache/.gpg/gpg.conf
chmod 600 $SRC/cache/.gpg/gpg.conf chmod 600 "${SRC}"/cache/.gpg/gpg.conf
fi fi
# Verify archives with Linaro and Armbian GPG keys # Verify archives with Linaro and Armbian GPG keys
if [ x"" != x$http_proxy ]; then if [ x"" != x"${http_proxy}" ]; then
(gpg --homedir $SRC/cache/.gpg --no-permission-warning --list-keys 8F427EAF >> $DEST/debug/output.log 2>&1\ (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 8F427EAF >> "${DEST}"/debug/output.log 2>&1\
|| gpg --homedir $SRC/cache/.gpg --no-permission-warning \ || gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning \
--keyserver hkp://keyserver.ubuntu.com:80 --keyserver-options http-proxy=$http_proxy \ --keyserver hkp://keyserver.ubuntu.com:80 --keyserver-options http-proxy="${http_proxy}" \
--recv-keys 8F427EAF >> $DEST/debug/output.log 2>&1) --recv-keys 8F427EAF >> "${DEST}"/debug/output.log 2>&1)
(gpg --homedir $SRC/cache/.gpg --no-permission-warning --list-keys 9F0E78D5 >> $DEST/debug/output.log 2>&1\ (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 9F0E78D5 >> "${DEST}"/debug/output.log 2>&1\
|| gpg --homedir $SRC/cache/.gpg --no-permission-warning \ || gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning \
--keyserver hkp://keyserver.ubuntu.com:80 --keyserver-options http-proxy=$http_proxy \ --keyserver hkp://keyserver.ubuntu.com:80 --keyserver-options http-proxy="${http_proxy}" \
--recv-keys 9F0E78D5 >> $DEST/debug/output.log 2>&1) --recv-keys 9F0E78D5 >> "${DEST}"/debug/output.log 2>&1)
else else
(gpg --homedir $SRC/cache/.gpg --no-permission-warning --list-keys 8F427EAF >> $DEST/debug/output.log 2>&1\ (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 8F427EAF >> "${DEST}"/debug/output.log 2>&1\
|| gpg --homedir $SRC/cache/.gpg --no-permission-warning \ || gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning \
--keyserver hkp://keyserver.ubuntu.com:80 \ --keyserver hkp://keyserver.ubuntu.com:80 \
--recv-keys 8F427EAF >> $DEST/debug/output.log 2>&1) --recv-keys 8F427EAF >> "${DEST}"/debug/output.log 2>&1)
(gpg --homedir $SRC/cache/.gpg --no-permission-warning --list-keys 9F0E78D5 >> $DEST/debug/output.log 2>&1\ (gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --list-keys 9F0E78D5 >> "${DEST}"/debug/output.log 2>&1\
|| gpg --homedir $SRC/cache/.gpg --no-permission-warning \ || gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning \
--keyserver hkp://keyserver.ubuntu.com:80 \ --keyserver hkp://keyserver.ubuntu.com:80 \
--recv-keys 9F0E78D5 >> $DEST/debug/output.log 2>&1) --recv-keys 9F0E78D5 >> "${DEST}"/debug/output.log 2>&1)
fi fi
gpg --homedir $SRC/cache/.gpg --no-permission-warning --verify \ gpg --homedir "${SRC}"/cache/.gpg --no-permission-warning --verify \
--trust-model always -q ${localdir}/${filename}.asc >> $DEST/debug/output.log 2>&1 --trust-model always -q "${localdir}/${filename}.asc" >> "${DEST}"/debug/output.log 2>&1
[[ ${PIPESTATUS[0]} -eq 0 ]] && verified=true && display_alert "Verified" "PGP" "info" [[ ${PIPESTATUS[0]} -eq 0 ]] && verified=true && display_alert "Verified" "PGP" "info"
else else
md5sum -c --status ${localdir}/${filename}.asc && verified=true && display_alert "Verified" "MD5" "info" md5sum -c --status "${localdir}/${filename}.asc" && verified=true && display_alert "Verified" "MD5" "info"
fi fi
@@ -1191,8 +1201,8 @@ download_and_verify()
if [[ "${filename:(-6)}" == "tar.xz" ]]; then if [[ "${filename:(-6)}" == "tar.xz" ]]; then
display_alert "decompressing" display_alert "decompressing"
pv -p -b -r -c -N "[ .... ] ${filename}" $filename | xz -dc | tar xp --xattrs --no-same-owner --overwrite pv -p -b -r -c -N "[ .... ] ${filename}" "${filename}" | xz -dc | tar xp --xattrs --no-same-owner --overwrite
[[ $? -eq 0 ]] && touch ${localdir}/$dirname/.download-complete [[ $? -eq 0 ]] && touch "${localdir}/${dirname}/.download-complete"
fi fi
else else
exit_with_error "verification failed" exit_with_error "verification failed"
@@ -1206,8 +1216,9 @@ download_and_verify()
show_developer_warning() show_developer_warning()
{ {
local temp_rc=$(mktemp) local temp_rc
cat <<-'EOF' > $temp_rc temp_rc=$(mktemp)
cat <<-'EOF' > "${temp_rc}"
screen_color = (WHITE,RED,ON) screen_color = (WHITE,RED,ON)
EOF EOF
local warn_text="You are switching to the \Z1EXPERT MODE\Zn local warn_text="You are switching to the \Z1EXPERT MODE\Zn
@@ -1222,8 +1233,8 @@ show_developer_warning()
- Forum posts related to dev kernel, CSC, WIP and EOS boards - Forum posts related to dev kernel, CSC, WIP and EOS boards
should be created in the \Z2\"Community forums\"\Zn section should be created in the \Z2\"Community forums\"\Zn section
" "
DIALOGRC=$temp_rc dialog --title "Expert mode warning" --backtitle "$backtitle" --colors --defaultno --no-label "I do not agree" \ DIALOGRC=$temp_rc dialog --title "Expert mode warning" --backtitle "${backtitle}" --colors --defaultno --no-label "I do not agree" \
--yes-label "I understand and agree" --yesno "$warn_text" $TTY_Y $TTY_X --yes-label "I understand and agree" --yesno "$warn_text" "${TTY_Y}" "${TTY_X}"
[[ $? -ne 0 ]] && exit_with_error "Error switching to the expert mode" [[ $? -ne 0 ]] && exit_with_error "Error switching to the expert mode"
SHOW_WARNING=no SHOW_WARNING=no
} }