scripts: improve variable escaping

This commit is contained in:
Jan-Tarek Butt 2016-09-24 17:34:14 +02:00 committed by Matthias Schiffer
parent 85c66b3bf8
commit 0f3e660842
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
4 changed files with 14 additions and 14 deletions

View File

@ -15,14 +15,14 @@ trap 'rm -rf "$PATCHDIR"' EXIT
for module in $GLUON_MODULES; do for module in $GLUON_MODULES; do
echo "--- Patching module '$module' ---" echo "--- Patching module '$module' ---"
git clone -s -b base --single-branch "$GLUONDIR"/$module "$PATCHDIR" 2>/dev/null git clone -s -b base --single-branch "$GLUONDIR/$module" "$PATCHDIR" 2>/dev/null
cd "$PATCHDIR" cd "$PATCHDIR"
for patch in "$GLUONDIR"/patches/$module/*.patch; do for patch in "$GLUONDIR/patches/$module"/*.patch; do
git -c user.name='Gluon Patch Manager' -c user.email='gluon@void.example.com' -c commit.gpgsign=false am --whitespace=nowarn --committer-date-is-author-date "$patch" git -c user.name='Gluon Patch Manager' -c user.email='gluon@void.example.com' -c commit.gpgsign=false am --whitespace=nowarn --committer-date-is-author-date "$patch"
done done
cd "$GLUONDIR"/$module cd "$GLUONDIR/$module"
git fetch "$PATCHDIR" 2>/dev/null git fetch "$PATCHDIR" 2>/dev/null
git checkout -B patched FETCH_HEAD git checkout -B patched FETCH_HEAD
git submodule update --init --recursive git submodule update --init --recursive

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
check_command() { check_command() {
which $1 >/dev/null 2>&1 which "$1" >/dev/null 2>&1
} }
if check_command sha512sum; then if check_command sha512sum; then

View File

@ -8,14 +8,14 @@ shopt -s nullglob
for module in $GLUON_MODULES; do for module in $GLUON_MODULES; do
echo "--- Updating patches for module '$module' ---" echo "--- Updating patches for module '$module' ---"
rm -f "$GLUONDIR"/patches/$module/*.patch rm -f "$GLUONDIR"/patches/"$module"/*.patch
mkdir -p "$GLUONDIR"/patches/$module mkdir -p "$GLUONDIR"/patches/"$module"
cd "$GLUONDIR"/$module cd "$GLUONDIR"/"$module"
n=0 n=0
for commit in $(git rev-list --reverse --no-merges base..patched); do for commit in $(git rev-list --reverse --no-merges base..patched); do
let n=n+1 let n=n+1
git show --pretty=format:'From: %an <%ae>%nDate: %aD%nSubject: %B' --no-renames $commit > "$GLUONDIR"/patches/$module/"$(printf '%04u' $n)-$(git show -s --pretty=format:%f $commit).patch" git show --pretty=format:'From: %an <%ae>%nDate: %aD%nSubject: %B' --no-renames "$commit" > "$GLUONDIR/patches/$module/$(printf '%04u' $n)-$(git show -s --pretty=format:%f "$commit").patch"
done done
done done

View File

@ -6,17 +6,17 @@ set -e
for module in $GLUON_MODULES; do for module in $GLUON_MODULES; do
echo "--- Updating module '$module' ---" echo "--- Updating module '$module' ---"
var=$(echo $module | tr '[:lower:]/' '[:upper:]_') var=$(echo "$module" | tr '[:lower:]/' '[:upper:]_')
eval repo=\${${var}_REPO} eval repo=\${${var}_REPO}
eval branch=\${${var}_BRANCH} eval branch=\${${var}_BRANCH}
eval commit=\${${var}_COMMIT} eval commit=\${${var}_COMMIT}
mkdir -p "$GLUONDIR"/$module mkdir -p "$GLUONDIR/$module"
cd "$GLUONDIR"/$module cd "$GLUONDIR/$module"
git init git init
if ! git branch -f base $commit 2>/dev/null; then if ! git branch -f base "$commit" 2>/dev/null; then
git fetch $repo $branch git fetch "$repo" "$branch"
git branch -f base $commit 2>/dev/null git branch -f base "$commit" 2>/dev/null
fi fi
done done