File: extract-tarballs

package info (click to toggle)
roundcube-plugins-extra 1.4.10%2B1-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,780 kB
  • sloc: php: 4,711; javascript: 2,238; xml: 120; makefile: 94; sh: 79; awk: 51; python: 43
file content (35 lines) | stat: -rwxr-xr-x 780 bytes parent folder | download | duplicates (2)
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
#!/bin/sh

set -e

. debian/scripts/plugin-functions.sh

if [ "$#" -ge 1 ]; then
	PLUGINS="$@"
else
	PLUGINS="$(get_plugins)"
fi

PREFIX="${USCAN_DESTDIR:-..}/$(get_orig_prefix)"
for plugin in $PLUGINS; do
	DIR="$(get_plugin_dir "$plugin")"
	VERSION="$(get_plugin_field "$plugin" Version)"
	ARCHIVE=
	for ext in .tar.xz .tar.bz2 .tar.gz; do
		if [ -f "$PREFIX-$DIR$ext" ]; then
			ARCHIVE="$PREFIX-$DIR$ext"
			break
		fi
	done
	if [ -z "$ARCHIVE" ]; then
		echo "Unable to find an archive for $plugin." >&2
		exit 1
	fi
	git rm -rq --ignore-unmatch "$DIR"
	mkdir -p "$DIR"
	tar -C "$DIR" --strip-components=1 -axf "$ARCHIVE"
    git add -- "$DIR"
    if ! git diff --quiet --cached -- "$DIR"; then
        git commit -m "Update $plugin to version $VERSION" -- "$DIR"
    fi
done