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 119 120 121 122 123 124 125 126 127 128
|
#!/bin/sh
PACKAGE_NAME=3dldf
set -e
set -u
usage() {
echo "Usage: repack --upstream-version <ver> <downloaded file>"
exit 1
}
if [ "$#" != "3" ]; then
usage
fi
if [ "$1" != "--upstream-version" ]; then
usage
fi
if [ ! -f "$3" ]; then
if [ -n "$3" ]; then
echo "$3 doesn't exist"
fi
usage
fi
UPSTREAM_VERSION="$2"
UPSTREAM_TARBALLZZ="$3"
DEBIAN_SUFFIX="+dfsg"
DEBIAN_UVERSION=${UPSTREAM_VERSION}${DEBIAN_SUFFIX}
DEBIAN_ROOTFOLDERNAME="${PACKAGE_NAME}-${DEBIAN_UVERSION}.orig"
DEBIAN_TARBALLXZ="$(dirname $UPSTREAM_TARBALLZZ)/${PACKAGE_NAME}_${DEBIAN_UVERSION}.orig.tar.xz"
REPACK_TMPDIR=`mktemp -d ./repackXXXXXX`
REPACK_TMPDIR=$(readlink -f "$REPACK_TMPDIR")
trap "/bin/rm -rf \"$REPACK_TMPDIR\"" QUIT INT EXIT
message() {
echo
echo "-- -- $1"
echo
}
message "Repackaging $UPSTREAM_TARBALLZZ"
UPSTREAM_ROOTFOLDER="${REPACK_TMPDIR}/unpacked"
mkdir "${UPSTREAM_ROOTFOLDER}"
tar -C "${UPSTREAM_ROOTFOLDER}" -xf "${UPSTREAM_TARBALLZZ}" || unzip -d "${UPSTREAM_ROOTFOLDER}" "${UPSTREAM_TARBALLZZ}"
if [ `ls -1 "${UPSTREAM_ROOTFOLDER}" | wc -l` -eq 1 ]; then
UPSTREAM_ROOTFOLDER="${UPSTREAM_ROOTFOLDER}/`ls -1 "${UPSTREAM_ROOTFOLDER}"`"
fi
DEBIAN_ROOTFOLDER="${REPACK_TMPDIR}/${DEBIAN_ROOTFOLDERNAME}"
## repack
set -f
REPACK_WORKING_FOLDER=$(pwd)
cd "${UPSTREAM_ROOTFOLDER}"
####. "${REPACK_WORKING_FOLDER}/debian/repack.local"
## ripe non-free material
rm --verbose --force --recursive doc
## wipe out
rm --verbose --force examples/wave_2.mp.bak
rm --verbose --force examples/wave_1.mp.bak
rm --verbose --force src/lib3dldflb.c
rm --verbose --force reconfig.sh
## clean up
rm --verbose --force examples/Makefile.in
rm --verbose --force src/prbsnflx.c++
rm --verbose --force src/Makefile.in
rm --verbose --force m4/lt~obsolete.m4
rm --verbose --force m4/ltsugar.m4
rm --verbose --force m4/ltoptions.m4
rm --verbose --force m4/ltversion.m4
rm --verbose --force m4/libtool.m4
rm --verbose --force aclocal.m4
rm --verbose --force config.h.in
rm --verbose --force Makefile.in
rm --verbose --force depcomp
rm --verbose --force install-sh
rm --verbose --force ltmain.sh
rm --verbose --force missing
rm --verbose --force ylwrap
rm --verbose --force compile
rm --verbose --force config.sub
rm --verbose --force config.guess
rm --verbose --force configure
rm --verbose --force INSTALL
## remove exectable bit for source files
find examples -name '*.mp' -exec chmod --changes a-x \{\} \;
find examples -name '*.txt' -exec chmod --changes a-x \{\} \;
find src -name '*.web' -exec chmod --changes a-x \{\} \;
find src -name '*.w' -exec chmod --changes a-x \{\} \;
find src -name '*.l++' -exec chmod --changes a-x \{\} \;
find src -name '*.ldf' -exec chmod --changes a-x \{\} \;
find src -name '*.mp' -exec chmod --changes a-x \{\} \;
find src -name '*.tex' -exec chmod --changes a-x \{\} \;
find src -name '*.bas' -exec chmod --changes a-x \{\} \;
find src -name '*.txt' -exec chmod --changes a-x \{\} \;
chmod --changes a-x ChangeLog
#:
cd ${REPACK_WORKING_FOLDER}
set +f
## end
mv "${UPSTREAM_ROOTFOLDER}" "${DEBIAN_ROOTFOLDER}"
REPACK_TARBALL="${REPACK_TMPDIR}/repacked.tar"
REPACK_TARBALLXZ="${REPACK_TARBALL}.xz"
( cd "${REPACK_TMPDIR}" && \
find -L "${DEBIAN_ROOTFOLDERNAME}" -xdev -type f -o -type d -print | sort | \
tar -T- --owner=root --group=root --mode=a+rX --create --file "${REPACK_TARBALL}" \
)
xz -9e < "${REPACK_TARBALL}" > "${REPACK_TARBALLXZ}"
mv "${REPACK_TARBALLXZ}" "${DEBIAN_TARBALLXZ}"
message "Testing ${DEBIAN_TARBALLXZ}"
xz --verbose --test "${DEBIAN_TARBALLXZ}"
message "Printing information about ${DEBIAN_TARBALLXZ}"
xz --verbose --list "${DEBIAN_TARBALLXZ}"
message "Quitting"
##
## eos
|