mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
cb5d0d8b99
47776a958b08382d76d69b5df7beed807af168b3 Add linter: Make sure all shell scripts opt out of locale dependence using "export LC_ALL=C" (practicalswift) 3352da8da1243c03fc83ba678d2f5d193bd5a0c2 Add "export LC_ALL=C" to all shell scripts (practicalswift) Pull request description: ~~Make sure `LC_ALL=C` is set when using `grep` range expressions.~~ Make sure `LC_ALL=C` is set in all shell scripts. From the `grep(1)` documentation: > Within a bracket expression, a range expression consists of two characters separated by a hyphen. It matches any single character that sorts between the two characters, inclusive, using the locale's collating sequence and character set. For example, in the default C locale, `[a-d]` is equivalent to `[abcd]`. Many locales sort characters in dictionary order, and in these locales `[a-d]` is typically not equivalent to `[abcd]`; it might be equivalent to `[aBbCcDd]`, for example. To obtain the traditional interpretation of bracket expressions, you can use the C locale by setting the `LC_ALL` environment variable to the value C. Context: [Locale issue found when reviewing #13450](https://github.com/bitcoin/bitcoin/pull/13450/files#r194877736) Tree-SHA512: fd74d2612998f9b49ef9be24410e505d8c842716f84d085157fc7f9799d40e8a7b4969de783afcf99b7fae4f91bbb4559651f7dd6578a6a081a50bdea29f0909
58 lines
1.4 KiB
Bash
Executable File
58 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
|
# Distributed under the MIT software license, see the accompanying
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
export LC_ALL=C
|
|
set -e
|
|
|
|
UNSIGNED="$1"
|
|
SIGNATURE="$2"
|
|
ARCH=x86_64
|
|
ROOTDIR=dist
|
|
TEMPDIR=signed.temp
|
|
OUTDIR=signed-app
|
|
|
|
if [ -z "$UNSIGNED" ]; then
|
|
echo "usage: $0 <unsigned app> <signature>"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -z "$SIGNATURE" ]; then
|
|
echo "usage: $0 <unsigned app> <signature>"
|
|
exit 1
|
|
fi
|
|
|
|
rm -rf ${TEMPDIR} && mkdir -p ${TEMPDIR}
|
|
tar -C ${TEMPDIR} -xf ${UNSIGNED}
|
|
cp -rf "${SIGNATURE}"/* ${TEMPDIR}
|
|
|
|
if [ -z "${PAGESTUFF}" ]; then
|
|
PAGESTUFF=${TEMPDIR}/pagestuff
|
|
fi
|
|
|
|
if [ -z "${CODESIGN_ALLOCATE}" ]; then
|
|
CODESIGN_ALLOCATE=${TEMPDIR}/codesign_allocate
|
|
fi
|
|
|
|
find ${TEMPDIR} -name "*.sign" | while read i; do
|
|
SIZE=`stat -c %s "${i}"`
|
|
TARGET_FILE="`echo "${i}" | sed 's/\.sign$//'`"
|
|
|
|
echo "Allocating space for the signature of size ${SIZE} in ${TARGET_FILE}"
|
|
${CODESIGN_ALLOCATE} -i "${TARGET_FILE}" -a ${ARCH} ${SIZE} -o "${i}.tmp"
|
|
|
|
OFFSET=`${PAGESTUFF} "${i}.tmp" -p | tail -2 | grep offset | sed 's/[^0-9]*//g'`
|
|
if [ -z ${QUIET} ]; then
|
|
echo "Attaching signature at offset ${OFFSET}"
|
|
fi
|
|
|
|
dd if="$i" of="${i}.tmp" bs=1 seek=${OFFSET} count=${SIZE} 2>/dev/null
|
|
mv "${i}.tmp" "${TARGET_FILE}"
|
|
rm "${i}"
|
|
echo "Success."
|
|
done
|
|
mv ${TEMPDIR}/${ROOTDIR} ${OUTDIR}
|
|
rm -rf ${TEMPDIR}
|
|
echo "Signed: ${OUTDIR}"
|