summaryrefslogtreecommitdiffstats
path: root/resources/scripts/helpers/build
diff options
context:
space:
mode:
Diffstat (limited to 'resources/scripts/helpers/build')
-rwxr-xr-xresources/scripts/helpers/build/release/tobuild63
1 files changed, 31 insertions, 32 deletions
diff --git a/resources/scripts/helpers/build/release/tobuild b/resources/scripts/helpers/build/release/tobuild
index c84e634..afe1085 100755
--- a/resources/scripts/helpers/build/release/tobuild
+++ b/resources/scripts/helpers/build/release/tobuild
@@ -23,54 +23,53 @@
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
+version="$(git describe --tags HEAD)"
+versiondir="release/${version}"
+distname="tobuild"
+distdir="${versiondir}/${distname}"
+
printf "Creating source archive for flashrom and bucts\n"
# delete the old data
-rm -Rf tobuild
-rm -f tobuild.tar.xz
+rm -Rf "${distdir}/"
+rm -f "${distdir}.tar.xz"
# this is where they will go
-mkdir tobuild
+mkdir -p "${distdir}/"
# flashrom
-cp -R flashrom/ tobuild/
-cd tobuild/flashrom/
-rm -f flashrom_lenovobios_sst flashrom_lenovobios_macronix
-make clean
-cd ../../
-mkdir tobuild/resources/
-mkdir tobuild/resources/flashrom/
-cp -R resources/flashrom/patch/ tobuild/resources/flashrom/
+cp -R "flashrom/" "${distdir}/"
+rm -f "${distdir}/flashrom/flashrom_lenovobios_sst"
+rm -f "${distdir}/flashrom/flashrom_lenovobios_macronix"
+(cd "${distdir}/flashrom/" && make clean)
+mkdir -p "${distdir}/resources/flashrom/"
+cp -R "resources/flashrom/patch/" "${distdir}/resources/flashrom/"
# bucts
-cp -R bucts tobuild/
-cd tobuild/bucts/
-make clean
-cd ../../
-mkdir tobuild/resources/bucts/
-cp -R resources/bucts/patch/ tobuild/resources/bucts/
+cp -R "bucts/" "${distdir}/"
+(cd "${distdir}/bucts/" && make clean)
+mkdir -p "${distdir}/resources/bucts/"
+cp -R "resources/bucts/patch/" "${distdir}/resources/bucts/"
# the build script will be needed
-cp build tobuild/
+cp build "${distdir}/"
# needed build scripts (helpers)
-mkdir tobuild/resources/scripts/
-mkdir tobuild/resources/scripts/helpers/
-mkdir tobuild/resources/scripts/helpers/build/
-mkdir tobuild/resources/scripts/helpers/build/module/
-mkdir tobuild/resources/scripts/helpers/build/clean/
-cp resources/scripts/helpers/build/clean/bucts tobuild/resources/scripts/helpers/build/clean/
-cp resources/scripts/helpers/build/clean/flashrom tobuild/resources/scripts/helpers/build/clean/
-cp resources/scripts/helpers/build/module/bucts tobuild/resources/scripts/helpers/build/module/
-cp resources/scripts/helpers/build/module/flashrom tobuild/resources/scripts/helpers/build/module/
-cp resources/scripts/misc/powertop.trisquel7 tobuild/
+mkdir -p "${distdir}/resources/scripts/helpers/build/"
+mkdir -p "${distdir}/resources/scripts/helpers/build/module/"
+mkdir -p "${distdir}/resources/scripts/helpers/build/clean/"
+cp "resources/scripts/helpers/build/clean/bucts" "${distdir}/resources/scripts/helpers/build/clean/"
+cp "resources/scripts/helpers/build/clean/flashrom" "${distdir}/resources/scripts/helpers/build/clean/"
+cp "resources/scripts/helpers/build/module/bucts" "${distdir}/resources/scripts/helpers/build/module/"
+cp "resources/scripts/helpers/build/module/flashrom" "${distdir}/resources/scripts/helpers/build/module/"
+cp "resources/scripts/misc/powertop.trisquel7" "${distdir}/"
# that is all. now tar it up
-tar -c tobuild | xz -9e >tobuild.tar.xz
+(cd "${versiondir}/" && tar -c "${distname}/" | xz -9e >"${distname}.tar.xz")
# and delete the directory
-rm -Rf tobuild/
+rm -Rf "${distdir}/"
-printf "Tar archives are stored in release/.\n"
+printf "Tar archive created: %s\n" "${distdir}.tar.xz"
printf "NOTE: don't forget to add ARM binaries for flashrom.\n"
printf "NOTE: don't forget to add i386 binaries for flashrom/bucts.\n"
-printf "The archive tobuild.tar.xz has been created with everything needed to build these utilities.\n\n"
+printf "The archive %s.tar.xz has been created with everything needed to build these utilities.\n\n" "${distname}"