mirror of
https://github.com/qurator-spk/ocrd-galley.git
synced 2025-07-15 15:59:52 +02:00
⬆ Update qurator_data_lib.sh (Fixes GH-5)
This commit is contained in:
parent
c92b10b984
commit
2f10596d28
1 changed files with 54 additions and 10 deletions
|
@ -1,3 +1,14 @@
|
||||||
|
# ______________________________________
|
||||||
|
#/ always copy the file from \
|
||||||
|
#| mono-repo/qurator_data_lib.sh, never |
|
||||||
|
#\ edit the copy in the project /
|
||||||
|
# --------------------------------------
|
||||||
|
# \ ^__^
|
||||||
|
# \ (oo)\_______
|
||||||
|
# (__)\ )\/\
|
||||||
|
# ||----w |
|
||||||
|
# || ||
|
||||||
|
|
||||||
if [ -z "$BASH" ]; then
|
if [ -z "$BASH" ]; then
|
||||||
echo "qurator_data_lib.sh uses bash features, please make sure to run $0 in bash"
|
echo "qurator_data_lib.sh uses bash features, please make sure to run $0 in bash"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -23,14 +34,31 @@ check_data_subdir() {
|
||||||
}
|
}
|
||||||
|
|
||||||
annex_get() {
|
annex_get() {
|
||||||
|
if [[ "$1" = '--allow_symlinks' ]]; then
|
||||||
|
allow_symlinks=1
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
allow_symlinks=0
|
||||||
|
fi
|
||||||
file_pattern="$1"
|
file_pattern="$1"
|
||||||
|
|
||||||
(
|
(
|
||||||
cd $DATA_SUBDIR
|
cd $DATA_SUBDIR
|
||||||
git annex get $file_pattern
|
git annex get $file_pattern
|
||||||
|
|
||||||
# fsck seems to be necessary to fix the files if we're in a submodule
|
# fsck seems to be necessary to fix the files if we are in a submodule
|
||||||
git annex fsck $file_pattern
|
git annex fsck $file_pattern
|
||||||
|
|
||||||
|
# Check that there are no symlinks = only unlocked files. This is needed for
|
||||||
|
# Docker builds, as we cannot dereference symlinks in a Dockerfile COPY.
|
||||||
|
if [[ $allow_symlinks = 0 ]]; then
|
||||||
|
git ls-files $file_pattern | while read f; do
|
||||||
|
if ! [[ -f "$f" ]]; then
|
||||||
|
echo "$DATA_SUBDIR/$f is not a regular file – Is an unlock needed?"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,9 +86,24 @@ suggest_commands() {
|
||||||
}
|
}
|
||||||
|
|
||||||
handle_data() {
|
handle_data() {
|
||||||
|
if [[ "$1" = '--no-download' ]]; then
|
||||||
|
no_download=1
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
no_download=0
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$FORCE_DOWNLOAD" ]; then
|
if [ -n "$FORCE_DOWNLOAD" ]; then
|
||||||
get_from_web
|
get_from_web
|
||||||
elif ! check_data_subdir; then
|
elif ! check_data_subdir; then
|
||||||
|
if [[ $no_download = 1 ]]; then
|
||||||
|
select choice in "Abort to manually fix $DATA_SUBDIR submodule"; do
|
||||||
|
if [ $REPLY = 1 ]; then
|
||||||
|
suggest_commands
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
select choice in "Abort to manually fix $DATA_SUBDIR submodule" "Download data files from the web"; do
|
select choice in "Abort to manually fix $DATA_SUBDIR submodule" "Download data files from the web"; do
|
||||||
if [ $REPLY = 1 ]; then
|
if [ $REPLY = 1 ]; then
|
||||||
suggest_commands
|
suggest_commands
|
||||||
|
@ -70,6 +113,7 @@ handle_data() {
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
get_from_annex
|
get_from_annex
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue