File: get-orig-source.sh

package info (click to toggle)
s5 1.1.dfsg.2-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,072 kB
  • sloc: javascript: 512; sh: 454; makefile: 47
file content (49 lines) | stat: -rw-r--r-- 1,778 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh

set -e

PKG_NAME="$(dpkg-parsechangelog | awk '/^Source:/ {print $2}')"
UP_VERSION="$(dpkg-parsechangelog | \
    awk '/^Version:/ {gsub(/\.dfsg.*/, "", $2); print $2}')"
DFSG="$(shell dpkg-parsechangelog | \
    awk '/^Version:/ {gsub(/.*.dfsg/, ".dfsg", $2); gsub(/-.*/, "", $2); print $2}')"
ORIG_DIR="$PKG_NAME-$UP_VERSION$DFSG.orig"
ORIG_NAME="${PKG_NAME}_$UP_VERSION$DFSG.orig"
UP_DIR="$(pwd)/../tarballs"
UP_SITE="https://meyerweb.com/eric/tools/s5/v/$UP_VERSION/"
UP_DISTVER="$(printf -- '%s' "$UP_VERSION" | tr -d '.')"
UP_DISTNAME="$PKG_NAME-$UP_DISTVER"
UP_TARBALL="$UP_DISTNAME.zip"
BLANKFILE="$UP_DIR/$UP_DISTNAME/s5-blank.zip"
RM_FILES='ui/i18n'

# Fetch the upstream tarball if needed
echo "up $UP_TARBALL site $UP_SITE orig $ORIG_NAME"
mkdir -p -- "$UP_DIR"
if [ ! -f "$UP_DIR/$UP_TARBALL" ]; then
	echo "Fetching upstream tarball $UP_DIR/$UP_TARBALL"
	(cd "$UP_DIR" && wget -nv -c -- "$UP_SITE$UP_TARBALL")
else
	echo "Upstream tarball $UP_DIR/$UP_TARBALL exists";
fi

# Extract it
# shellcheck disable=SC2115
rm -rf -- "$UP_DIR/$UP_DISTNAME" "$UP_DIR/$ORIG_DIR" "$UP_DIR/blank"
mkdir -- "$UP_DIR/$UP_DISTNAME"
(cd "$UP_DIR/$UP_DISTNAME" && unzip -x "../$UP_TARBALL")

# Do our magic
# shellcheck disable=SC2248
(cd -- "$UP_DIR/$UP_DISTNAME" && rm -rfv -- $RM_FILES)
cp debian/iepngfix.htc "$UP_DIR/$UP_DISTNAME/ui/default/"
mkdir "$UP_DIR/blank"
(cd "$UP_DIR/blank" && unzip -x -- "$BLANKFILE")
cp -- debian/iepngfix.htc "$UP_DIR/blank/s5-blank/ui/default/"
rm -- "$BLANKFILE"
(cd -- "$UP_DIR/blank" && zip -r -- "$BLANKFILE" *)
mv -- "$UP_DIR/$UP_DISTNAME" "$UP_DIR/$ORIG_DIR"

# Create the repackaged tarball
(cd -- "$UP_DIR" && tar -cf - "$ORIG_DIR" | gzip -cn9 > "$ORIG_NAME.tar.gz")
echo "The repackaged source is at $UP_DIR/$ORIG_NAME.tar.gz"