summaryrefslogtreecommitdiffstats
path: root/resources/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'resources/scripts')
-rwxr-xr-xresources/scripts/helpers/build/release/util150
1 files changed, 64 insertions, 86 deletions
diff --git a/resources/scripts/helpers/build/release/util b/resources/scripts/helpers/build/release/util
index d7c6e6d..b42dff8 100755
--- a/resources/scripts/helpers/build/release/util
+++ b/resources/scripts/helpers/build/release/util
@@ -25,8 +25,6 @@
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
-printf "Generating the release archives\n"
-
arch="unknown"
if [ $(uname -i) = "i686" ] || [ $(uname -m) = "i686" ]
then
@@ -43,172 +41,152 @@ else
exit 1
fi
-# ### Version information for this release
-# ----------------------------------------------------------------------------------------------------------------------------
-
-# create file showing the commit ID from git for this archive.
-cat .git/refs/heads/master > commitid
-
-# ### Delete old archives before continuing
-# ----------------------------------------------------------------------------------------------------------------------------
-
-printf "Deleting the old release archives\n"
-rm -f libreboot_*.tar.xz
-rm -Rf release/
+version="$(git describe --tags HEAD)"
+versiondir="release/${version}"
+distname="libreboot_${version}_util"
+distdir="${versiondir}/${distname}"
-# ### Create the release/ directory where the archives will go
-# ----------------------------------------------------------------------------------------------------------------------------
+printf "Creating utility archive (static executables)\n"
-# create directory for the release
-mkdir release/
+# delete the old data
+rm -Rf "${distdir}/"
+rm -f "${distdir}.tar.xz"
-# ### Prepare libreboot_util archive ready for release
-# ----------------------------------------------------------------------------------------------------------------------------
+# this is where they will go
+mkdir -p "${distdir}/"
-printf "Generating libreboot_util.tar.xz\n"
-
-mkdir libreboot_util
+# include version information
+printf '%s\n' "${version}" >"${distdir}/version"
# --------------
# BUC.TS related
# --------------
# X60/T60: BUC.TS utility is needed to flash libreboot while Lenovo BIOS is running
# Include it statically compiled
-cp -R bucts bucts_
+cp -R "bucts" "bucts_/"
# make it statically compile
./build module bucts static
-mkdir libreboot_util/bucts/
-mkdir libreboot_util/bucts/"$arch"/
-mv bucts/bucts libreboot_util/bucts/"$arch"/
-rm -Rf bucts/
-mv bucts_/ bucts/
+mkdir -p "${distdir}/bucts/${arch}/"
+mv "bucts/bucts" "${distdir}/bucts/${arch}/"
+rm -Rf "bucts/"
+mv "bucts_/" "bucts/"
# ----------------
# Flashrom related
# ----------------
# Flashrom is used to install libreboot on supported targets
# Include it statically compiled
-cp -R flashrom flashrom_
+cp -R "flashrom/" "flashrom_/"
# make it statically compile
./build module flashrom static
-mkdir libreboot_util/flashrom
-cd flashrom/
-mkdir ../libreboot_util/flashrom/"$arch"
-mv flashrom ../libreboot_util/flashrom/"$arch"
-mv flashrom_lenovobios_sst ../libreboot_util/flashrom/"$arch"
-mv flashrom_lenovobios_macronix ../libreboot_util/flashrom/"$arch"
-cd ../
-rm -Rf flashrom
-mv flashrom_ flashrom
+mkdir -p "${distdir}/flashrom/${arch}/"
+mv "flashrom/flashrom" "${distdir}/flashrom/${arch}/"
+mv "flashrom/flashrom_lenovobios_sst" "${distdir}/flashrom/${arch}/"
+mv "flashrom/flashrom_lenovobios_macronix" "${distdir}/flashrom/${arch}/"
+rm -Rf "flashrom/"
+mv "flashrom_/" "flashrom/"
# ----------------
# cbfstool related
# ----------------
# build cbfstool, compiled (statically linked) and include the binary
-cd coreboot/util/
-cp -R cbfstool cbfstool_
-cd cbfstool/
+
+mkdir -p "${distdir}/cbfstool/${arch}/"
+
+cd "coreboot/util/"
+cp -R "cbfstool" "cbfstool_/"
+cd "cbfstool/"
make clean
make SHARED=0 CC='gcc -static'
-mkdir ../../../libreboot_util/cbfstool
-mkdir ../../../libreboot_util/cbfstool/"$arch"
-mv cbfstool ../../../libreboot_util/cbfstool/"$arch"/
+mv "cbfstool" "../../../${distdir}/cbfstool/${arch}/"
if [ "$arch" = "x86_64" ]
then
# Now build 32-bit binaries
make clean
make SHARED=0 CC='gcc -static -m32'
- mkdir ../../../libreboot_util/cbfstool/i686
- mv cbfstool ../../../libreboot_util/cbfstool/i686/
+ mkdir "../../../${distdir}/cbfstool/i686"
+ mv "cbfstool" "../../../${distdir}/cbfstool/i686/"
fi
# cross-compile for ARM
make clean
make SHARED=0 CC='arm-linux-gnueabi-gcc -static'
-mkdir ../../../libreboot_util/cbfstool/armv7l
-mv cbfstool ../../../libreboot_util/cbfstool/armv7l/
+mkdir "../../../${distdir}/cbfstool/armv7l/"
+mv "cbfstool" "../../../${distdir}/cbfstool/armv7l/"
cd ../
-rm -Rf cbfstool
-mv cbfstool_ cbfstool
+rm -Rf "cbfstool/"
+mv "cbfstool_/" "cbfstool/"
cd ../../
# ----------------
# ich9deblob related
# ----------------
# build ich9deblob, compiled (statically linked) and include the binary
-cd resources/utilities/
-cp -R ich9deblob ich9deblob_
-cd ich9deblob/
+
+mkdir -p "${distdir}/ich9deblob/${arch}"
+
+cd "resources/utilities/"
+cp -R "ich9deblob" "ich9deblob_/"
+cd "ich9deblob/"
make clean
make SHARED=0 CC='gcc -static'
-mkdir ../../../libreboot_util/ich9deblob
-mkdir ../../../libreboot_util/ich9deblob/"$arch"
-mv ich9deblob ../../../libreboot_util/ich9deblob/"$arch"/
-mv ich9gen ../../../libreboot_util/ich9deblob/"$arch"/
-mv demefactory ../../../libreboot_util/ich9deblob/"$arch"/
+mv "ich9deblob" "../../../${distdir}/ich9deblob/${arch}/"
+mv "ich9gen" "../../../${distdir}/ich9deblob/${arch}/"
+mv "demefactory" "../../../${distdir}/ich9deblob/${arch}/"
if [ "$arch" = "x86_64" ]
then
# Now build 32-bit binaries
make clean
make SHARED=0 CC='gcc -static -m32'
- mkdir ../../../libreboot_util/ich9deblob/i686
- mv ich9deblob ../../../libreboot_util/ich9deblob/i686/
- mv ich9gen ../../../libreboot_util/ich9deblob/i686/
- mv demefactory ../../../libreboot_util/ich9deblob/i686/
+ mkdir "../../../${distdir}/ich9deblob/i686/"
+ mv "ich9deblob" "../../../${distdir}/ich9deblob/i686/"
+ mv "ich9gen" "../../../${distdir}/ich9deblob/i686/"
+ mv "demefactory" "../../../${distdir}/ich9deblob/i686/"
fi
# cross-compile for ARM
make clean
make SHARED=0 CC='arm-linux-gnueabi-gcc -static'
-mkdir ../../../libreboot_util/ich9deblob/armv7l
-mv ich9deblob ../../../libreboot_util/ich9deblob/armv7l/
-mv ich9gen ../../../libreboot_util/ich9deblob/armv7l/
-mv demefactory ../../../libreboot_util/ich9deblob/armv7l/
+mkdir "../../../${distdir}/ich9deblob/armv7l"
+mv "ich9deblob" "../../../${distdir}/ich9deblob/armv7l/"
+mv "ich9gen" "../../../${distdir}/ich9deblob/armv7l/"
+mv "demefactory" "../../../${distdir}/ich9deblob/armv7l/"
-cd ../
-rm -Rf ich9deblob
-mv ich9deblob_ ich9deblob
-cd ../../
+cd "../"
+rm -Rf "ich9deblob/"
+mv "ich9deblob_/" "ich9deblob/"
+cd "../../"
# -------------
# Miscellaneous
# -------------
# Flashing script
-cp flash libreboot_util/
+cp "flash" "${distdir}/"
# for changing the GRUB background
-cp resources/scripts/misc/grub-background libreboot_util/
+cp "resources/scripts/misc/grub-background" "${distdir}/"
printf "\n\n"
# ### Create the release tarballs
# ----------------------------------------------------------------------------------------------------------------------------
-# mention the commit ID (libreboot, git) in the release archives
-cat commitid > libreboot_util/commitid
-
-printf "Compressing libreboot_util/ into libreboot_util.tar.xz\n"
+printf "Compressing %s/ into %s.tar.xz\n" "${distdir}" "${distdir}.tar.xz"
# create lzma compressed util archive
-tar -c libreboot_util | xz -9e >libreboot_util.tar.xz
-
-# Move the archives to the release directory
-mv libreboot_util.tar.xz release/
+(cd "${versiondir}/" && tar -c "${distname}" | xz -9e >"${distname}.tar.xz")
-# Create a symlink to the commitid file, in release/
-cat commitid > release/commitid
-
-printf "\n\n"
+printf "done\n\n"
# ### Delete the uncompressed release directories
# ----------------------------------------------------------------------------------------------------------------------------
# The uncompressed archives are no longer needed
-rm -Rf libreboot_util
+rm -Rf "${distdir}/"
# ------------------- DONE ----------------------