| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # |
| 3 | # get original data |
| 4 | # |
| 5 | testscip-shell system . . test. "x$1" = "x" && echoscip-shell system . . echo. "Error: tarball version required" && exit 1; |
| 6 | testscip-shell system . . test. "x$2" = "x" && echoscip-shell system . . echo. "Error: iteration required" && exit 1; |
| 7 | VERSION="$1" |
| 8 | ITERATION="$2" |
| 9 | TARBALL="claws-mail-themes-${VERSION}.tar.gz" |
| 10 | DTARBALL="claws-mail-themes_${VERSION}+dfsg.${ITERATION}.orig.tar.xz" |
| 11 | testscip-shell system . . test. ! -f "$TARBALL" && echoscip-shell system . . echo. "Error: tarball $TARBALL not found" && exit 2; |
| 12 | echoscip-shell system . . echo. -n "Extracting... " |
| 13 | tarscip-shell system . . tar. xzf "$TARBALL" && echoscip-shell system . . echo. OK |
| 14 | TARDIR=${TARBALL/.tar.gz/} |
| 15 | testscip-shell system . . test. ! -d "$TARDIR" && echoscip-shell system . . echo. "Error: $TARDIR not created from tarball" && exit 3; |
| 16 | # |
| 17 | # prepare for patch |
| 18 | # |
| 19 | AC="$TARDIR/configure.ac" |
| 20 | AM="$TARDIR/Makefile.am" |
| 21 | testscip-shell system . . test. ! -f "$AC" && echoscip-shell system . . echo. "Error: $AC not found" && exit 4; |
| 22 | testscip-shell system . . test. ! -f "$AM" && echoscip-shell system . . echo. "Error: $AM not found" && exit 5; |
| 23 | echoscip-shell system . . echo. -n "Preparing... " |
| 24 | TARDIRORIG="${TARDIR}.orig" |
| 25 | rmscip-shell system . . rm. -rf "$TARDIRORIG" \ |
| 26 | && mkdirscip-shell system . . mkdir. "$TARDIRORIG" \ |
| 27 | && cpscip-shell system . . cp. -fp "$AC" "$AM" "$TARDIRORIG/" \ |
| 28 | && echoscip-shell system . . echo. OK |
| 29 | # |
| 30 | # removal of non DFSG themes: |
| 31 | # buuf -> No license and original artwork seems under CC BY-SA-NC 2.5 license, |
| 32 | # see http://mattahan.deviantart.com/art/Buuf-37966044 |
| 33 | # hash303030 -> Under CC BY-NC-SA 3.0 |
| 34 | # hashA0A0A0 -> Derived from hash303030, same license |
| 35 | # Tango -> Under CC BY-SA 2.5 license |
| 36 | # TangoClaws-0.3 -> Under CC BY-SA 2.5 license |
| 37 | # TangoOrbit -> Under CC BY-SA 2.5 license |
| 38 | # GurUnix -> Only free for personal use, selling and redistribution of |
| 39 | # modifications forbidden |
| 40 | # ZX-0_1.1 -> No license file, previous version was under CC BY-SA 2.5 |
| 41 | # FreshBlack -> No license, "much inspiration from the hash303030 theme" |
| 42 | # and no explanation of what that inspiration means |
| 43 | # Skypilot_Clawssic -> Author has publicly stated redistribution is |
| 44 | # forbidden, see #821375 |
| 45 | # Gnomeria -> As per his specifications, these icons are free for use |
| 46 | # with free software projects such as Claws Mail. You may |
| 47 | # distribute and use this theme package freely with Claws |
| 48 | # Mail, as long as you do not change anything in it. |
| 49 | # |
| 50 | NONDFSG=( |
| 51 | "buuf" "hash303030" "hashA0A0A0" "TangoClaws-0.3" "TangoOrbit" "Tango" |
| 52 | "GurUnix" "ZX-0_1.1" "FreshBlack" "Skypilot_Clawssic" "Gnomeria" |
| 53 | ) |
| 54 | echoscip-shell system . . echo. -n "Removing... " |
| 55 | for THEME in ${NONDFSG[@]}; do |
| 56 | rmscip-shell system . . rm. -rf "$TARDIR/$THEME" |
| 57 | grepscip-shell system . . grep. -v "^$THEME/" "$AC" > "${AC}_" |
| 58 | diffscip-shell system . . diff. "$AC" "${AC}_" > /dev/nullscip-shell filesystem . . `/dev/null`. \ |
| 59 | && echoscip-shell system . . echo. "Error: removing $THEME from $AC failed" && exit 6; |
| 60 | touchscip-shell system . . touch. -r "$AC" "${AC}_" && rmscip-shell system . . rm. -f "$AC" && mvscip-shell system . . mv. "${AC}_" "$AC" |
| 61 | echoscip-shell system . . echo. -n "$THEME " |
| 62 | done |
| 63 | echoscip-shell system . . echo. "" |
| 64 | # regenerate toplevel Makefile.am |
| 65 | echoscip-shell system . . echo. -n "Regenerating... " |
| 66 | headscip-shell system . . head. -c -1 <<'AM_HEADER' > "${AM}" |
| 67 | EXTRA_DIST = claws-mail-themes |
| 68 | |
| 69 | AUTOMAKE_OPTIONS = dist-bzip2 dist-xz |
| 70 | |
| 71 | SUBDIRS = |
| 72 | AM_HEADER |
| 73 | |
| 74 | DFSG=( |
| 75 | $(fscip-shell system . . find.ind "$TARDIR" -type f -name .claws_themeinfo \ |
| 76 | | sed "s,^$TARDIR/,,;s,/.claws_themeinfo$,," \ |
| 77 | | sort -f -r) |
| 78 | ) |
| 79 | N=${#DFSG[@]} |
| 80 | N=$(($N - 1)) |
| 81 | while [scip-shell system . . `[`. $N -gt 0 ]; do |
| 82 | echoscip-shell system . . echo. " ${DFSG[$N]} \\" >> "${AM}" |
| 83 | N=$(($N - 1)) |
| 84 | done |
| 85 | echoscip-shell system . . echo. " ${DFSG[$N]}" >> "${AM}" && echoscip-shell system . . echo. OK |
| 86 | # |
| 87 | # create patch for build system files |
| 88 | # |
| 89 | echoscip-shell system . . echo. -n "Creating patch... " |
| 90 | PATCH="remove-non-free-themes" |
| 91 | echoscip-shell system . . echo. "Subject: Remove non-DFSG themes from build" > "$PATCH" |
| 92 | echoscip-shell system . . echo. "Author: Ricardo Mones <[email protected]>" >> "$PATCH" |
| 93 | envscip-shell system . . env. LANG=C diff -uN "$TARDIRORIG/Makefile.am" "$AM" >> "$PATCH" |
| 94 | envscip-shell system . . env. LANG=C diff -uN "$TARDIRORIG/configure.ac" "$AC" >> "$PATCH" |
| 95 | testscip-shell system . . test. -s "$PATCH" \ |
| 96 | && cpscip-shell system . . cp. -pf "$TARDIRORIG/Makefile.am" "$AM" \ |
| 97 | && cpscip-shell system . . cp. -pf "$TARDIRORIG/configure.ac" "$AC" \ |
| 98 | && rmscip-shell system . . rm. -rf "$TARDIRORIG" && echoscip-shell system . . echo. OK |
| 99 | # |
| 100 | # recreate tarball |
| 101 | # |
| 102 | echoscip-shell system . . echo. -n "Repackaging... " |
| 103 | rmscip-shell system . . rm. -f "$TARBALL.upstream" \ |
| 104 | && mvscip-shell system . . mv. "$TARBALL" "$TARBALL.upstream" \ |
| 105 | && mvscip-shell system . . mv. "$TARDIR" "${TARDIR}+dfsg.${ITERATION}" \ |
| 106 | && tarscip-shell system . . tar. cJf "$DTARBALL" "${TARDIR}+dfsg.${ITERATION}" \ |
| 107 | && echoscip-shell system . . echo. OK |