mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
run shellfmt on compile.sh
This commit is contained in:
19
compile.sh
19
compile.sh
@@ -16,7 +16,10 @@
|
||||
SRC="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
|
||||
|
||||
# check for whitespace in ${SRC} and exit for safety reasons
|
||||
grep -q "[[:space:]]" <<<"${SRC}" && { echo "\"${SRC}\" contains whitespace. Not supported. Aborting." >&2 ; exit 1 ; }
|
||||
grep -q "[[:space:]]" <<< "${SRC}" && {
|
||||
echo "\"${SRC}\" contains whitespace. Not supported. Aborting." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
cd "${SRC}" || exit
|
||||
|
||||
@@ -30,7 +33,7 @@ fi
|
||||
if [[ -f "${SRC}"/lib/import-functions.sh ]]; then
|
||||
|
||||
# Declare this folder as safe
|
||||
if ! grep -q 2>/dev/null "directory = \*" "$HOME/.gitconfig"; then
|
||||
if ! grep -q "directory = \*" "$HOME/.gitconfig" 2> /dev/null; then
|
||||
git config --global --add safe.directory "*"
|
||||
fi
|
||||
|
||||
@@ -46,15 +49,14 @@ else
|
||||
fi
|
||||
|
||||
# Add the variables needed at the beginning of the path
|
||||
check_args ()
|
||||
{
|
||||
check_args() {
|
||||
|
||||
for p in "$@"; do
|
||||
|
||||
case "${p%=*}" in
|
||||
LIB_TAG)
|
||||
# Take a variable if the branch exists locally
|
||||
if [ "${p#*=}" == "$(git branch | \
|
||||
if [ "${p#*=}" == "$(git branch |
|
||||
gawk -v b="${p#*=}" '{if ( $NF == b ) {print $NF}}')" ]; then
|
||||
echo -e "[\e[0;35m warn \x1B[0m] Setting $p"
|
||||
eval "$p"
|
||||
@@ -69,10 +71,8 @@ done
|
||||
|
||||
}
|
||||
|
||||
|
||||
check_args "$@"
|
||||
|
||||
|
||||
update_src() {
|
||||
|
||||
cd "${SRC}" || exit
|
||||
@@ -104,7 +104,6 @@ update_src() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
TMPFILE=$(mktemp)
|
||||
chmod 644 "${TMPFILE}"
|
||||
{
|
||||
@@ -128,10 +127,8 @@ if [[ $(systemd-detect-virt) == 'none' ]]; then
|
||||
|
||||
fi
|
||||
|
||||
|
||||
rm "${TMPFILE}"
|
||||
|
||||
|
||||
if [[ "${EUID}" == "0" ]] || [[ "${1}" == "vagrant" ]]; then
|
||||
:
|
||||
elif [[ "${1}" == docker || "${1}" == dockerpurge || "${1}" == docker-shell ]] && grep -q "$(whoami)" <(getent group docker); then
|
||||
@@ -208,11 +205,9 @@ if [[ "${1}" == docker && -f /etc/debian_version && -z "$(command -v docker)" ]]
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# Create userpatches directory if not exists
|
||||
mkdir -p "${SRC}"/userpatches
|
||||
|
||||
|
||||
# Create example configs if none found in userpatches
|
||||
if ! ls "${SRC}"/userpatches/{config-default.conf,config-docker.conf,config-vagrant.conf} 1> /dev/null 2>&1; then
|
||||
|
||||
|
||||
Reference in New Issue
Block a user