Michael Grote
5e88bf3f74
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
Signed-off-by: Michael Grote <michael.grote@posteo.de>
43 lines
861 B
Bash
Executable file
43 lines
861 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# Update all git directories below current directory or specified directory
|
|
|
|
# Skips directories that contain a file called .ignore
|
|
|
|
HIGHLIGHT="\e[01;34m"
|
|
NORMAL='\e[00m'
|
|
|
|
function update {
|
|
local d="$1"
|
|
if [ -d "$d" ]; then
|
|
if [ -e "$d/.ignore" ]; then
|
|
echo -e "\n${HIGHLIGHT}Ignoring $d${NORMAL}"
|
|
else
|
|
cd "$d" || exit > /dev/null
|
|
if [ -d ".git" ]; then
|
|
echo -e "\n${HIGHLIGHT}Updating pwd$NORMAL"
|
|
git add .
|
|
git stash
|
|
git pull
|
|
else
|
|
# shellcheck disable=SC2035
|
|
scan *
|
|
fi
|
|
cd .. > /dev/null
|
|
fi
|
|
fi
|
|
#echo "Exiting update: pwd=pwd"
|
|
}
|
|
|
|
function scan {
|
|
#echo "pwd"
|
|
for x in "$@"; do
|
|
update "$x"
|
|
done
|
|
}
|
|
|
|
if [ "$1" != "" ]; then cd "$1" || exit > /dev/null; fi
|
|
|
|
echo -e "${HIGHLIGHT}Scanning ${PWD}${NORMAL}"
|
|
# shellcheck disable=SC2035
|
|
scan *
|