/usr/bin/fd-commit is in fdroidserver 0.7.0-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | #!/bin/bash
#
# fd-commit - part of the F-Droid server tools
# Commits updates to apps, allowing you to edit the commit messages
#
# Copyright (C) 2013-2014 Daniel Marti <mvdan@mvdan.cc>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
commands=()
if [ ! -d metadata ]; then
if [ -d ../metadata ]; then
cd ..
else
echo "No metadata files found!"
exit 2
fi
fi
while read line; do
case "$line" in
*'??'*'metadata/'*'.txt') new=true ;;
*'M'*'metadata/'*'.txt') new=false ;;
*) continue ;;
esac
file=${line##* }
id=${file##*/}
id=${id%.txt*}
if [ $# -gt 0 ]; then
case "$@" in
*" $id "*) ;; # Middle
"$id "*) ;; # Start
*" $id") ;; # End
"$id") ;; # Alone
*) continue ;; # Missing
esac
fi
[ -d metadata/$id ] && extra=metadata/$id || extra=
name= autoname=
while read l; do
case "$l" in
'Auto Name:'*) autoname=${l#*:} ;;
'Name:'*) name=${l#*:} ;;
'Summary:'*) break ;;
esac
done < "$file"
if [ -n "$name" ]; then
fullname="$name"
elif [ -n "$autoname" ]; then
fullname="$autoname"
else
fullname="$id"
fi
if $new; then
message="New app: $fullname"
else
onlybuild=true
newbuild=false
disable=false
while read line; do
case "$line" in
'-Build:'*) onlybuild=false ;;
'+Build:'*)
$newbuild && onlybuild=false
newbuild=true
build=${line#*:}
version=${build%%,*}
build=${build#*,}
vercode=${build%%,*}
;;
'+'*'disable='*)
$newbuild && $onlybuild && disable=true
;;
esac
done < <(git diff HEAD -- "$file")
if $newbuild && $onlybuild; then
if $disable; then
message="Don't update $fullname to $version ($vercode)"
else
message="Update $fullname to $version ($vercode)"
fi
else
message="$fullname:"
fi
fi
message=${message//\"/\\\"}
commands+=("git add -- $file $extra && git commit -m \"$message\" -e -v")
done < <(git status --porcelain metadata)
[ -z "$commands" ] && exit 0
git reset >/dev/null
for cmd in "${commands[@]}"; do
eval "$cmd"
git reset >/dev/null
done
|