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:
25
compile.sh
25
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
|
||||
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"
|
||||
@@ -65,14 +67,12 @@ for p in "$@"; do
|
||||
;;
|
||||
esac
|
||||
|
||||
done
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
|
||||
check_args "$@"
|
||||
|
||||
|
||||
update_src() {
|
||||
|
||||
cd "${SRC}" || exit
|
||||
@@ -83,7 +83,7 @@ update_src() {
|
||||
if [[ -n "${CHANGED_FILES}" ]]; then
|
||||
echo -e "[\e[0;35m warn \x1B[0m] Can't update since you made changes to: \e[0;32m\n${CHANGED_FILES}\x1B[0m"
|
||||
while true; do
|
||||
echo -e "Press \e[0;33m<Ctrl-C>\x1B[0m or \e[0;33mexit\x1B[0m to abort compilation"\
|
||||
echo -e "Press \e[0;33m<Ctrl-C>\x1B[0m or \e[0;33mexit\x1B[0m to abort compilation" \
|
||||
", \e[0;33m<Enter>\x1B[0m to ignore and continue, \e[0;33mdiff\x1B[0m to display changes"
|
||||
read -r
|
||||
if [[ "${REPLY}" == "diff" ]]; then
|
||||
@@ -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