download: Allow keeping .git dirs with NODELETE=git
Keeping the git repositories is useful while development, e.g. to avoid git cloning repositories over and over again while debugging download scripts. Setting the NODELETE environment variable keeps the blobs and the git repositories. Allow a slightly finer-tuned version of this where we can keep only the git-related files by setting the variable to "git". Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
This commit is contained in:
parent
21e1bcb99c
commit
12dc2140af
13
download
13
download
|
@ -6,6 +6,7 @@
|
||||||
# Copyright (C) 2015 Patrick "P. J." McDermott <pj@pehjota.net>
|
# Copyright (C) 2015 Patrick "P. J." McDermott <pj@pehjota.net>
|
||||||
# Copyright (C) 2015, 2016 Klemens Nanni <contact@autoboot.org>
|
# Copyright (C) 2015, 2016 Klemens Nanni <contact@autoboot.org>
|
||||||
# Copyright (C) 2022, Caleb La Grange <thonkpeasant@protonmail.com>
|
# Copyright (C) 2022, Caleb La Grange <thonkpeasant@protonmail.com>
|
||||||
|
# Copyright (C) 2022 Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -31,8 +32,12 @@ set -u -e
|
||||||
# set this when you want to modify each coreboot tree
|
# set this when you want to modify each coreboot tree
|
||||||
# for example, you want to test custom patches
|
# for example, you want to test custom patches
|
||||||
# NODELETE= ./download coreboot
|
# NODELETE= ./download coreboot
|
||||||
|
deletegit="true"
|
||||||
deleteblobs="true"
|
deleteblobs="true"
|
||||||
[ "x${NODELETE+set}" = 'xset' ] && deleteblobs="false"
|
if [ "x${NODELETE+set}" = 'xset' ]; then
|
||||||
|
[ "x${NODELETE:-all}" = "xgit" ] && deletegit="false"
|
||||||
|
[ "x${NODELETE:-all}" = "xall" ] && deleteblobs="false" && deletegit="false"
|
||||||
|
fi
|
||||||
|
|
||||||
rm -f "build_error"
|
rm -f "build_error"
|
||||||
|
|
||||||
|
@ -89,6 +94,8 @@ if [ "${program}" = "all" ]; then
|
||||||
if [ -f "${downloadProgram}" ]; then
|
if [ -f "${downloadProgram}" ]; then
|
||||||
if [ "${deleteblobs}" = "false" ]; then
|
if [ "${deleteblobs}" = "false" ]; then
|
||||||
NODELETE= "${downloadProgram}"
|
NODELETE= "${downloadProgram}"
|
||||||
|
elif [ "${deletegit}" = "false" ]; then
|
||||||
|
NODELETE=git "${downloadProgram}"
|
||||||
else
|
else
|
||||||
"${downloadProgram}"
|
"${downloadProgram}"
|
||||||
fi
|
fi
|
||||||
|
@ -103,12 +110,16 @@ fi
|
||||||
if [ $# -lt 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
if [ "${deleteblobs}" = "false" ]; then
|
if [ "${deleteblobs}" = "false" ]; then
|
||||||
NODELETE= "${download}/${program}"
|
NODELETE= "${download}/${program}"
|
||||||
|
elif [ "${deletegit}" = "false" ]; then
|
||||||
|
NODELETE=git "${download}/${program}"
|
||||||
else
|
else
|
||||||
"${download}/${program}"
|
"${download}/${program}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ "${deleteblobs}" = "false" ]; then
|
if [ "${deleteblobs}" = "false" ]; then
|
||||||
NODELETE= "${download}/${program}" $@
|
NODELETE= "${download}/${program}" $@
|
||||||
|
elif [ "${deletegit}" = "false" ]; then
|
||||||
|
NODELETE=git "${download}/${program}" $@
|
||||||
else
|
else
|
||||||
"${download}/${program}" $@
|
"${download}/${program}" $@
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
# helper script: download coreboot
|
# helper script: download coreboot
|
||||||
#
|
#
|
||||||
# Copyright (C) 2014, 2015, 2016, 2020, 2021 Leah Rowe <info@minifree.org>
|
# Copyright (C) 2014, 2015, 2016, 2020, 2021 Leah Rowe <info@minifree.org>
|
||||||
|
# Copyright (C) 2022 Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -64,8 +65,12 @@ fi
|
||||||
# set this when you want to modify each coreboot tree
|
# set this when you want to modify each coreboot tree
|
||||||
# for example, you want to test custom patches
|
# for example, you want to test custom patches
|
||||||
# NODELETE= ./download coreboot
|
# NODELETE= ./download coreboot
|
||||||
|
deletegit="true"
|
||||||
deleteblobs="true"
|
deleteblobs="true"
|
||||||
[ "x${NODELETE+set}" = 'xset' ] && deleteblobs="false"
|
if [ "x${NODELETE+set}" = 'xset' ]; then
|
||||||
|
[ "x${NODELETE:-all}" = "xgit" ] && deletegit="false"
|
||||||
|
[ "x${NODELETE:-all}" = "xall" ] && deleteblobs="false" && deletegit="false"
|
||||||
|
fi
|
||||||
|
|
||||||
# Error handling is extreme in this script.
|
# Error handling is extreme in this script.
|
||||||
# This script handles the internet, and Git. Both are inherently unreliable.
|
# This script handles the internet, and Git. Both are inherently unreliable.
|
||||||
|
@ -239,9 +244,11 @@ rm -f resources/coreboot/*/seen
|
||||||
rm -f "build_error"
|
rm -f "build_error"
|
||||||
printf "\n\n"
|
printf "\n\n"
|
||||||
if [ "${deleteblobs}" = "true" ]; then
|
if [ "${deleteblobs}" = "true" ]; then
|
||||||
|
if [ "${deletegit}" = "true" ]; then
|
||||||
rm -Rf coreboot/coreboot/
|
rm -Rf coreboot/coreboot/
|
||||||
rm -Rf coreboot/.git* coreboot/*/.git* coreboot/*/3rdparty/*/.git*
|
rm -Rf coreboot/.git* coreboot/*/.git* coreboot/*/3rdparty/*/.git*
|
||||||
rm -Rf coreboot/*/util/nvidia/cbootimage/.git*
|
rm -Rf coreboot/*/util/nvidia/cbootimage/.git*
|
||||||
|
fi
|
||||||
for cbdir in coreboot/*; do
|
for cbdir in coreboot/*; do
|
||||||
if [ ! -d "${cbdir}" ]; then continue; fi
|
if [ ! -d "${cbdir}" ]; then continue; fi
|
||||||
cbtree="${cbdir##coreboot/}"
|
cbtree="${cbdir##coreboot/}"
|
||||||
|
|
|
@ -25,9 +25,13 @@ set -u -e
|
||||||
|
|
||||||
# set this when you want to modify each u-boot tree
|
# set this when you want to modify each u-boot tree
|
||||||
# for example, you want to test custom patches
|
# for example, you want to test custom patches
|
||||||
# NODELETE= ./download coreboot
|
# NODELETE= ./download u-boot
|
||||||
|
deletegit="true"
|
||||||
deleteblobs="true"
|
deleteblobs="true"
|
||||||
[ "x${NODELETE+set}" = 'xset' ] && deleteblobs="false"
|
if [ "x${NODELETE+set}" = 'xset' ]; then
|
||||||
|
[ "x${NODELETE:-all}" = "xgit" ] && deletegit="false"
|
||||||
|
[ "x${NODELETE:-all}" = "xall" ] && deleteblobs="false" && deletegit="false"
|
||||||
|
fi
|
||||||
|
|
||||||
# Error handling is extreme in this script.
|
# Error handling is extreme in this script.
|
||||||
# This script handles the internet, and Git. Both are inherently unreliable.
|
# This script handles the internet, and Git. Both are inherently unreliable.
|
||||||
|
@ -305,7 +309,9 @@ download_uboot_board()
|
||||||
printf "\n\n"
|
printf "\n\n"
|
||||||
|
|
||||||
if [ "${deleteblobs}" = "true" ]; then
|
if [ "${deleteblobs}" = "true" ]; then
|
||||||
|
if [ "${deletegit}" = "true" ]; then
|
||||||
rm -rf "${ubtree}"/.git* "${ubtree}"/*/.git*
|
rm -rf "${ubtree}"/.git* "${ubtree}"/*/.git*
|
||||||
|
fi
|
||||||
blobslist="$(print_blobs_list_path "${board}")"
|
blobslist="$(print_blobs_list_path "${board}")"
|
||||||
for blob_path in $(strip_comments "${blobslist}"); do
|
for blob_path in $(strip_comments "${blobslist}"); do
|
||||||
if echo "${blob_path}" | \
|
if echo "${blob_path}" | \
|
||||||
|
@ -347,7 +353,7 @@ if [ $# -eq 0 ] ; then
|
||||||
download_uboot_board "${board}"
|
download_uboot_board "${board}"
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "${deleteblobs}" = "true" ]; then
|
if [ "${deletegit}" = "true" ]; then
|
||||||
rm -rf u-boot/u-boot/ u-boot/.git*
|
rm -rf u-boot/u-boot/ u-boot/.git*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -396,7 +402,7 @@ elif [ $# -eq 1 ] ; then
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "${deleteblobs}" = "true" ]; then
|
if [ "${deletegit}" = "true" ]; then
|
||||||
rm -rf u-boot/u-boot/ u-boot/.git*
|
rm -rf u-boot/u-boot/ u-boot/.git*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue