Shell script compliance

This commit is contained in:
Wetitpig 2019-02-12 16:23:21 +08:00 committed by Leonid Pliushch
parent 42c3826b07
commit d50c847f11
25 changed files with 134 additions and 134 deletions

View File

@ -11,13 +11,13 @@ test -f $HOME/.termuxrc && . $HOME/.termuxrc
: ${TERMUX_INSTALL_DEPS:="-s"}
# Set TERMUX_INSTALL_DEPS to -s unless set to -i
_show_usage () {
_show_usage() {
echo "Usage: ./build-all.sh [-a ARCH] [-d] [-i] [-o DIR]"
echo "Build all packages."
echo " -a The architecture to build for: aarch64(default), arm, i686, x86_64 or all."
echo " -d Build with debug symbols."
echo " -i Build dependencies."
echo " -o Specify deb directory. Default: debs/."
echo " -a The architecture to build for: aarch64(default), arm, i686, x86_64 or all."
echo " -d Build with debug symbols."
echo " -i Build dependencies."
echo " -o Specify deb directory. Default: debs/."
exit 1
}
@ -53,7 +53,7 @@ if [ -e $BUILDSTATUS_FILE ]; then
echo "Continuing build-all from: $BUILDSTATUS_FILE"
fi
exec > >(tee -a $BUILDALL_DIR/ALL.out)
exec > >(tee -a $BUILDALL_DIR/ALL.out)
exec 2> >(tee -a $BUILDALL_DIR/ALL.err >&2)
trap "echo ERROR: See $BUILDALL_DIR/\${package}.err" ERR
@ -68,8 +68,8 @@ for package_path in `cat $BUILDORDER_FILE`; do
echo -n "Building $package... "
BUILD_START=`date "+%s"`
bash -x $BUILDSCRIPT -a $TERMUX_ARCH $TERMUX_DEBUG \
${TERMUX_DEBDIR+-o $TERMUX_DEBDIR} $TERMUX_INSTALL_DEPS $package \
> $BUILDALL_DIR/${package}.out 2> $BUILDALL_DIR/${package}.err
${TERMUX_DEBDIR+-o $TERMUX_DEBDIR} $TERMUX_INSTALL_DEPS $package \
> $BUILDALL_DIR/${package}.out 2> $BUILDALL_DIR/${package}.err
BUILD_END=`date "+%s"`
BUILD_SECONDS=$(( $BUILD_END - $BUILD_START ))
echo "done in $BUILD_SECONDS"

View File

@ -40,7 +40,7 @@ termux_download() {
if [ "$CHECKSUM" != "SKIP_CHECKSUM" ]; then
if [ "$CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then
>&2 printf "Wrong checksum for %s:\nExpected: %s\nActual: %s\n" \
"$URL" "$CHECKSUM" "$ACTUAL_CHECKSUM"
"$URL" "$CHECKSUM" "$ACTUAL_CHECKSUM"
exit 1
fi
else
@ -234,7 +234,7 @@ termux_setup_cmake() {
local TERMUX_CMAKE_FOLDER=$TERMUX_COMMON_CACHEDIR/cmake-$TERMUX_CMAKE_VERSION
if [ ! -d "$TERMUX_CMAKE_FOLDER" ]; then
termux_download https://cmake.org/files/v$TERMUX_CMAKE_MAJORVESION/$TERMUX_CMAKE_TARNAME \
"$TERMUX_CMAKE_TARFILE" \
"$TERMUX_CMAKE_TARFILE" \
563a39e0a7c7368f81bfa1c3aff8b590a0617cdfe51177ddc808f66cc0866c76
rm -Rf "$TERMUX_PKG_TMPDIR/cmake-${TERMUX_CMAKE_VERSION}-Linux-x86_64"
tar xf "$TERMUX_CMAKE_TARFILE" -C "$TERMUX_PKG_TMPDIR"
@ -247,7 +247,7 @@ termux_setup_cmake() {
# First step is to handle command-line arguments. Not to be overridden by packages.
termux_step_handle_arguments() {
_show_usage () {
_show_usage() {
echo "Usage: ./build-package.sh [-a ARCH] [-d] [-D] [-f] [-i] [-I] [-q] [-s] [-o DIR] PACKAGE"
echo "Build a package by creating a .deb file in the debs/ folder."
echo " -a The architecture to build for: aarch64(default), arm, i686, x86_64 or all."
@ -734,7 +734,7 @@ termux_step_extract_package() {
# Hook for packages to act just after the package has been extracted.
# Invoked in $TERMUX_PKG_SRCDIR.
termux_step_post_extract_package() {
return
return
}
# Optional host build. Not to be overridden by packages.
@ -913,11 +913,11 @@ termux_step_setup_toolchain() {
# starting from Android 5), not older as the NDK headers claim.
for file in zconf.h zlib.h; do
curl -o usr/include/$file \
https://raw.githubusercontent.com/madler/zlib/v1.2.8/$file
https://raw.githubusercontent.com/madler/zlib/v1.2.8/$file
done
unset file
cd $_TERMUX_TOOLCHAIN_TMPDIR/include/c++/4.9.x
sed "s%\@TERMUX_HOST_PLATFORM\@%${TERMUX_HOST_PLATFORM}%g" $TERMUX_SCRIPTDIR/ndk-patches/*.cpppatch | patch -p1
sed "s%\@TERMUX_HOST_PLATFORM\@%${TERMUX_HOST_PLATFORM}%g" $TERMUX_SCRIPTDIR/ndk-patches/*.cpppatch | patch -p1
# Fix relative path in gcc/g++ script:
sed -i "s%\`dirname \$0\`/../../../../%$NDK/toolchains/%g" $_TERMUX_TOOLCHAIN_TMPDIR/bin/${TERMUX_HOST_PLATFORM}-gcc
sed -i "s%\`dirname \$0\`/../../../../%$NDK/toolchains/%g" $_TERMUX_TOOLCHAIN_TMPDIR/bin/${TERMUX_HOST_PLATFORM}-g++
@ -1277,7 +1277,7 @@ termux_step_massage() {
# Remove world permissions and add write permissions.
# The -f flag is used to suppress warnings about dangling symlinks (such
# as ones to /system/... which may not exist on the build machine):
find . -exec chmod -f u+w,g-rwx,o-rwx \{\} \;
find . -exec chmod -f u+w,g-rwx,o-rwx \{\} \;
if [ "$TERMUX_DEBUG" = "" ]; then
# Strip binaries. file(1) may fail for certain unusual files, so disable pipefail.

View File

@ -6,14 +6,14 @@ TERMUX_PKG_BUILD_IN_SRC=yes
TERMUX_PKG_PLATFORM_INDEPENDENT=true
termux_step_make_install() {
mkdir -p $TERMUX_PREFIX/share/ant/lib
mkdir -p $TERMUX_PREFIX/share/ant/lib
for jar in ant ant-launcher; do
$TERMUX_DX \
--dex \
--output=$TERMUX_PREFIX/share/ant/lib/${jar}.jar \
lib/${jar}.jar
done
for jar in ant ant-launcher; do
$TERMUX_DX \
--dex \
--output=$TERMUX_PREFIX/share/ant/lib/${jar}.jar \
lib/${jar}.jar
done
install $TERMUX_PKG_BUILDER_DIR/ant $TERMUX_PREFIX/bin/ant
perl -p -i -e "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" $TERMUX_PREFIX/bin/ant

View File

@ -1,6 +1,6 @@
# Status: Termux currently uses openssl. Transitioning to libressl
# is tempting, but on hold for now to see how widespread
# the adoption of libressl in Linux distributions is.
# is tempting, but on hold for now to see how widespread
# the adoption of libressl in Linux distributions is.
TERMUX_PKG_HOMEPAGE=http://www.libressl.org/
TERMUX_PKG_DESCRIPTION="Library implementing the TLS protocol as well as general purpose cryptography functions"
TERMUX_PKG_DEPENDS="ca-certificates"

View File

@ -42,9 +42,9 @@ termux_step_post_configure() {
}
termux_step_create_debscripts() {
echo "#!$TERMUX_PREFIX/bin/sh" >> postinst
echo "#!$TERMUX_PREFIX/bin/sh" >> postinst
echo "if [ ! -e $TERMUX_ANDROID_HOME/.alpine-smime/.pwd/MasterPassword.crt ] && [ ! -e $HOME/.alpine-smime/.pwd/MasterPassword.key ]; then" >> postinst
echo "echo 'warning making a passwordless masterpasword file'" >> postinst
echo "echo 'warning making a passwordless masterpasword file'" >> postinst
echo "mkdir -p \$HOME/.alpine-smime/public \$HOME/.alpine-smime/.pwd \$HOME/.alpine-smime/private \$HOME/.alpine-smime/ca" >> postinst
echo "openssl req -x509 -newkey rsa:2048 -keyout \$HOME/.alpine-smime/.pwd/MasterPassword.key -out \$HOME/.alpine-smime/.pwd/MasterPassword.crt -days 10000 -nodes -subj '/C=US/ST=dont/L=use/O=this Name/OU=for/CN=anything.com.termux'" >> postinst
echo "touch \$HOME/.pine-passfile" >> postinst

View File

@ -23,14 +23,14 @@ termux_step_post_massage() {
mkdir -p "$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/var/cache/apk"
ln -sfr \
"$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/var/cache/apk" \
"$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/etc/apk/cache"
"$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/var/cache/apk" \
"$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/etc/apk/cache"
}
termux_step_create_debscripts() {
{
echo "#!$TERMUX_PREFIX/bin/sh"
echo "touch $TERMUX_PREFIX/etc/apk/world"
echo "#!$TERMUX_PREFIX/bin/sh"
echo "touch $TERMUX_PREFIX/etc/apk/world"
} > ./postinst
chmod 755 postinst
}

View File

@ -8,6 +8,6 @@ TERMUX_PKG_KEEP_STATIC_LIBRARIES=true
TERMUX_PKG_NO_DEVELSPLIT=true
termux_step_post_make_install() {
cp libargp.a $TERMUX_PREFIX/lib
cp $TERMUX_PKG_SRCDIR/argp.h $TERMUX_PREFIX/include
cp libargp.a $TERMUX_PREFIX/lib
cp $TERMUX_PKG_SRCDIR/argp.h $TERMUX_PREFIX/include
}

View File

@ -25,13 +25,13 @@ termux_step_post_make_install() {
termux_step_create_debscripts() {
{
echo "#!$TERMUX_PREFIX/bin/sh"
echo "mkdir -p $TERMUX_PREFIX/etc/dropbear"
echo "for a in rsa dss ecdsa; do"
echo " KEYFILE=$TERMUX_PREFIX/etc/dropbear/dropbear_\${a}_host_key"
echo " test ! -f \$KEYFILE && dropbearkey -t \$a -f \$KEYFILE"
echo "done"
echo "exit 0"
echo "#!$TERMUX_PREFIX/bin/sh"
echo "mkdir -p $TERMUX_PREFIX/etc/dropbear"
echo "for a in rsa dss ecdsa; do"
echo " KEYFILE=$TERMUX_PREFIX/etc/dropbear/dropbear_\${a}_host_key"
echo " test ! -f \$KEYFILE && dropbearkey -t \$a -f \$KEYFILE"
echo "done"
echo "exit 0"
} > postinst
chmod 0755 postinst
}

View File

@ -27,23 +27,23 @@ termux_step_pre_configure() {
}
termux_step_post_configure() {
# Hack to compile first version of libpurple-ciphers.la
cp $TERMUX_PREFIX/lib/libxml2.so $TERMUX_PREFIX/lib/libpurple.so
# Hack to compile first version of libpurple-ciphers.la
cp $TERMUX_PREFIX/lib/libxml2.so $TERMUX_PREFIX/lib/libpurple.so
cd $TERMUX_PKG_BUILDDIR/libpurple/ciphers
make libpurple-ciphers.la
cd ..
make libpurple.la
cd $TERMUX_PKG_BUILDDIR/libpurple/ciphers
make libpurple-ciphers.la
cd ..
make libpurple.la
# Put a more proper version in lib:
cp .libs/libpurple.so $TERMUX_PREFIX/lib/
# Put a more proper version in lib:
cp .libs/libpurple.so $TERMUX_PREFIX/lib/
make clean
make clean
}
termux_step_post_make_install() {
cd $TERMUX_PREFIX/lib
for lib in jabber oscar ymsg; do
ln -f -s purple-2/lib${lib}.so .
done
cd $TERMUX_PREFIX/lib
for lib in jabber oscar ymsg; do
ln -f -s purple-2/lib${lib}.so .
done
}

View File

@ -9,9 +9,9 @@ TERMUX_PKG_BUILD_IN_SRC=yes
TERMUX_PKG_PLATFORM_INDEPENDENT=yes
termux_step_make_install() {
python2 setup.py install --prefix=$TERMUX_PREFIX --force
python2 setup.py install --prefix=$TERMUX_PREFIX --force
}
termux_step_post_massage() {
find . -path '*.pyc' -delete
find . -path '*.pyc' -delete
}

View File

@ -27,10 +27,10 @@ termux_step_post_make_install() {
mv $BIN_BINARY $LIBEXEC_BINARY
local FFMPEG_LIBS="" lib
for lib in avcodec avfilter avformat avutil postproc swresample swscale; do
if [ -n "$FFMPEG_LIBS" ]; then FFMPEG_LIBS+=":"; fi
FFMPEG_LIBS+="$TERMUX_PREFIX/lib/lib${lib}.so"
done
for lib in avcodec avfilter avformat avutil postproc swresample swscale; do
if [ -n "$FFMPEG_LIBS" ]; then FFMPEG_LIBS+=":"; fi
FFMPEG_LIBS+="$TERMUX_PREFIX/lib/lib${lib}.so"
done
cat << EOF > $BIN_BINARY
#!/bin/sh

View File

@ -12,9 +12,9 @@ termux_step_make_install() {
# In which case we need to bump version and checksum used.
termux_download https://cgit.freedesktop.org/libreoffice/dictionaries/plain/ru_RU/ru_RU.aff \
$TERMUX_PREFIX/share/hunspell/ru_RU.aff \
709cf9b41208961226e995a3ab75a2da834aaf4f9707cb87cbb37d4943b6a50d
709cf9b41208961226e995a3ab75a2da834aaf4f9707cb87cbb37d4943b6a50d
termux_download https://cgit.freedesktop.org/libreoffice/dictionaries/plain/ru_RU/ru_RU.dic \
$TERMUX_PREFIX/share/hunspell/ru_RU.dic \
c0d81126b0a905ccc6fd891c923b43d39b4ce449da5a333859229354c510168f
c0d81126b0a905ccc6fd891c923b43d39b4ce449da5a333859229354c510168f
touch $TERMUX_PREFIX/share/hunspell/ru_RU.{aff,dic}
}

View File

@ -11,7 +11,7 @@ termux_step_make_install() {
mkdir -p $TERMUX_PREFIX/share/man/man1
make -C lib install # this installs libiconv.{a,la} which the below install task needs:
make -C src install
rm $TERMUX_PREFIX/lib/libiconv.{a,la}
# .. and the man page:
cp $TERMUX_PKG_SRCDIR/man/iconv.1 $TERMUX_PREFIX/share/man/man1/
rm $TERMUX_PREFIX/lib/libiconv.{a,la}
# .. and the man page:
cp $TERMUX_PKG_SRCDIR/man/iconv.1 $TERMUX_PREFIX/share/man/man1/
}

View File

@ -13,11 +13,11 @@ termux_step_make() {
export GOARCH=${TERMUX_ARCH}
if [ "${TERMUX_ARCH}" = "aarch64" ]; then
export GOARCH="arm64"
export GOARCH="arm64"
elif [ "${TERMUX_ARCH}" = "i686" ]; then
export GOARCH="386"
export GOARCH="386"
elif [ "${TERMUX_ARCH}" = "x86_64" ]; then
export GOARCH="amd64"
export GOARCH="amd64"
fi
mkdir -p "${GOPATH}/src/github.com/ipfs"

View File

@ -2,9 +2,9 @@ TERMUX_PKG_HOMEPAGE=http://www.hboehm.info/gc/
TERMUX_PKG_DESCRIPTION="Library providing the Boehm-Demers-Weiser conservative garbage collector"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_VERSION=(8.0.2
7.6.8)
7.6.8)
TERMUX_PKG_SHA256=(4e8ca4b5b72a3a27971daefaa9b621f0a716695b23baa40b7eac78de2eeb51cb
1d6a279edf81767e74d2ad2c9fce09459bc65f12c6525a40b0cb3e53c089f665)
1d6a279edf81767e74d2ad2c9fce09459bc65f12c6525a40b0cb3e53c089f665)
TERMUX_PKG_SRCURL=(https://github.com/ivmai/bdwgc/releases/download/v$TERMUX_PKG_VERSION/gc-$TERMUX_PKG_VERSION.tar.gz
https://github.com/ivmai/libatomic_ops/releases/download/v${TERMUX_PKG_VERSION[1]}/libatomic_ops-${TERMUX_PKG_VERSION[1]}.tar.gz)
TERMUX_PKG_RM_AFTER_INSTALL="share/gc"

View File

@ -10,8 +10,8 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS="ac_cv_lib_elf_elf_begin=no"
termux_step_pre_configure() {
if [ "$TERMUX_ARCH" = arm ]; then
# Fix issue with make on arm hanging at least under cmake:
# https://github.com/termux/termux-packages/issues/2983
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" ac_cv_func_pselect=no"
# Fix issue with make on arm hanging at least under cmake:
# https://github.com/termux/termux-packages/issues/2983
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" ac_cv_func_pselect=no"
fi
}

View File

@ -17,6 +17,6 @@ termux_step_pre_configure() {
termux_step_create_debscripts() {
echo "#!$TERMUX_PREFIX/bin/sh" > postinst
echo "mkdir -p $TERMUX_PREFIX/var/mlocate/" >> postinst
echo "exit 0" >> postinst
chmod 0755 postinst
echo "exit 0" >> postinst
chmod 0755 postinst
}

View File

@ -99,10 +99,10 @@ termux_step_create_debscripts() {
echo "chmod 700 \$HOME/.ssh" >> postinst
echo "chmod 600 \$HOME/.ssh/authorized_keys" >> postinst
echo "" >> postinst
echo "for a in rsa dsa ecdsa ed25519; do" >> postinst
echo " KEYFILE=$TERMUX_PREFIX/etc/ssh/ssh_host_\${a}_key" >> postinst
echo " test ! -f \$KEYFILE && ssh-keygen -N '' -t \$a -f \$KEYFILE" >> postinst
echo "done" >> postinst
echo "exit 0" >> postinst
chmod 0755 postinst
echo "for a in rsa dsa ecdsa ed25519; do" >> postinst
echo " KEYFILE=$TERMUX_PREFIX/etc/ssh/ssh_host_\${a}_key" >> postinst
echo " test ! -f \$KEYFILE && ssh-keygen -N '' -t \$a -f \$KEYFILE" >> postinst
echo "done" >> postinst
echo "exit 0" >> postinst
chmod 0755 postinst
}

View File

@ -3,23 +3,23 @@
# Check if accidentaly executed instead of sourced:
if echo "$0" | grep -q source-ssh-agent; then
echo "source-ssh-agent: Do not execute directly - source me instead!"
exit 1
echo "source-ssh-agent: Do not execute directly - source me instead!"
exit 1
fi
export SSH_AUTH_SOCK=$PREFIX/tmp/ssh-agent
start_agent() {
rm -f $SSH_AUTH_SOCK
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add
rm -f $SSH_AUTH_SOCK
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add
}
MESSAGE=`ssh-add -L 2>&1`
if [ "$MESSAGE" = 'Could not open a connection to your authentication agent.' -o \
"$MESSAGE" = 'Error connecting to agent: Connection refused' -o \
"$MESSAGE" = 'Error connecting to agent: No such file or directory' ]; then
start_agent
start_agent
elif [ "$MESSAGE" = "The agent has no identities." ]; then
ssh-add
ssh-add
fi

View File

@ -2,11 +2,11 @@ TERMUX_PKG_HOMEPAGE=https://www.perl.org/
TERMUX_PKG_DESCRIPTION="Capable, feature-rich programming language"
TERMUX_PKG_LICENSE="Artistic-License-2.0"
TERMUX_PKG_VERSION=(5.28.1
1.2.1)
1.2.1)
TERMUX_PKG_SHA256=(3ebf85fe65df2ee165b22596540b7d5d42f84d4b72d84834f74e2e0b8956c347
8b706bc688ddf71b62d649bde72f648669f18b37fe0c54ec6201142ca3943498)
8b706bc688ddf71b62d649bde72f648669f18b37fe0c54ec6201142ca3943498)
TERMUX_PKG_SRCURL=(http://www.cpan.org/src/5.0/perl-${TERMUX_PKG_VERSION}.tar.gz
https://github.com/arsv/perl-cross/releases/download/${TERMUX_PKG_VERSION[1]}/perl-cross-${TERMUX_PKG_VERSION[1]}.tar.gz)
https://github.com/arsv/perl-cross/releases/download/${TERMUX_PKG_VERSION[1]}/perl-cross-${TERMUX_PKG_VERSION[1]}.tar.gz)
TERMUX_PKG_BUILD_IN_SRC="yes"
TERMUX_MAKE_PROCESSES=1
TERMUX_PKG_RM_AFTER_INSTALL="bin/perl${TERMUX_PKG_VERSION}"

View File

@ -49,10 +49,10 @@ termux_step_host_build() {
# We need a host-built Parser/pgen binary, copied into cross-compile build in termux_step_post_configure() below
$TERMUX_PKG_SRCDIR/configure
make Parser/pgen
# We need a python$_MAJOR_VERSION binary to be picked up by configure check:
# We need a python$_MAJOR_VERSION binary to be picked up by configure check:
make
rm -f python$_MAJOR_VERSION # Remove symlink if already exists to get a newer timestamp
ln -s python python$_MAJOR_VERSION
rm -f python$_MAJOR_VERSION # Remove symlink if already exists to get a newer timestamp
ln -s python python$_MAJOR_VERSION
}
termux_step_post_configure() {
@ -80,8 +80,8 @@ termux_step_post_make_install() {
mv 2to3 2to3-${_MAJOR_VERSION}
mv pydoc pydoc${_MAJOR_VERSION}
ln -sf pydoc${_MAJOR_VERSION} pydoc2)
# Restore path which termux_step_host_build messed with
export PATH=$TERMUX_ORIG_PATH
# Restore path which termux_step_host_build messed with
export PATH=$TERMUX_ORIG_PATH
}
termux_step_post_massage() {

View File

@ -15,9 +15,9 @@ termux_step_pre_configure() {
}
#termux_step_configure() {
# From socat_buildscript_for_android.sh in socat source:
# From socat_buildscript_for_android.sh in socat source:
#./configure --host --disable-unix --disable-openssl --prefix=$TERMUX_PREFIX
# Replace misconfigured values in config.h and enable PTY functions
# Replace misconfigured values in config.h and enable PTY functions
#mv config.h config.old
#cat config.old \
#| sed 's/CRDLY_SHIFT.*/CRDLY_SHIFT 9/' \
@ -26,7 +26,7 @@ termux_step_pre_configure() {
#| sed 's/\/\* #undef HAVE_OPENPTY \*\//#define HAVE_OPENPTY 1/' \
#| sed 's/\/\* #undef HAVE_GRANTPT \*\//#define HAVE_GRANTPT 1/' \
#> config.h
# Enable openpty() in Makefile
# Enable openpty() in Makefile
#mv Makefile Makefile.old
#cat Makefile.old | sed 's/error.c/error.c openpty.c/' > Makefile
#}

View File

@ -53,7 +53,7 @@ fi
existing_dirs=""
for dir in $(echo "$UPDATED_FILES" | grep -oP "packages/[a-z0-9+._-]+" | sort | uniq); do
if [ -d "$REPO_DIR/$dir" ]; then
existing_dirs+=" $dir"
existing_dirs+=" $dir"
fi
done
PACKAGE_DIRS="$existing_dirs"
@ -72,11 +72,11 @@ fi
## or '--upload'.
if [ $# -ge 1 ]; then
if [ "$1" = "--upload" ]; then
exec "$REPO_DIR/scripts/bintray-add-package.sh" --path "$DEBS_DIR" $PACKAGE_NAMES
exec "$REPO_DIR/scripts/bintray-add-package.sh" --path "$DEBS_DIR" $PACKAGE_NAMES
else
TERMUX_ARCH="$1"
unset BINTRAY_USERNAME
unset BINTRAY_API_KEY
TERMUX_ARCH="$1"
unset BINTRAY_USERNAME
unset BINTRAY_API_KEY
fi
else
TERMUX_ARCH="aarch64"

View File

@ -27,14 +27,14 @@ docker start $CONTAINER_NAME > /dev/null 2> /dev/null || {
--tty \
$IMAGE_NAME
if [ "$UNAME" != Darwin ]; then
if [ $(id -u) -ne 1000 -a $(id -u) -ne 0 ]
then
echo "Changed builder uid/gid... (this may take a while)"
docker exec --tty $CONTAINER_NAME chown -R $(id -u) $HOME
docker exec --tty $CONTAINER_NAME chown -R $(id -u) /data
docker exec --tty $CONTAINER_NAME usermod -u $(id -u) builder
docker exec --tty $CONTAINER_NAME groupmod -g $(id -g) builder
fi
if [ $(id -u) -ne 1000 -a $(id -u) -ne 0 ]
then
echo "Changed builder uid/gid... (this may take a while)"
docker exec --tty $CONTAINER_NAME chown -R $(id -u) $HOME
docker exec --tty $CONTAINER_NAME chown -R $(id -u) /data
docker exec --tty $CONTAINER_NAME usermod -u $(id -u) builder
docker exec --tty $CONTAINER_NAME groupmod -g $(id -g) builder
fi
fi
}

View File

@ -1,42 +1,42 @@
#!/data/data/com.termux/files/usr/bin/bash
if [ $# != 1 ]; then
echo "Specify package to run tests for as only argument"
exit 1
echo "Specify package to run tests for as only argument"
exit 1
fi
PACKAGE=$1
TEST_DIR=packages/$PACKAGE/tests
if [ ! -d $TEST_DIR ]; then
echo "ERROR: No tests folder for package $PACKAGE"
exit 1
echo "ERROR: No tests folder for package $PACKAGE"
exit 1
fi
NUM_TESTS=0
NUM_FAILURES=0
for TEST_SCRIPT in $TEST_DIR/*; do
test -t 1 && printf "\033[32m"
echo "Running test ${TEST_SCRIPT}..."
(( NUM_TESTS += 1 ))
test -t 1 && printf "\033[31m"
(
assert_equals() {
FIRST=$1
SECOND=$2
if [ "$FIRST" != "$SECOND" ]; then
echo "assertion failed - expected '$FIRST', got '$SECOND'"
exit 1
fi
}
set -e -u
. $TEST_SCRIPT
)
if [ $? != 0 ]; then
(( NUM_FAILURES += 1 ))
fi
test -t 1 && printf "\033[0m"
test -t 1 && printf "\033[32m"
echo "Running test ${TEST_SCRIPT}..."
(( NUM_TESTS += 1 ))
test -t 1 && printf "\033[31m"
(
assert_equals() {
FIRST=$1
SECOND=$2
if [ "$FIRST" != "$SECOND" ]; then
echo "assertion failed - expected '$FIRST', got '$SECOND'"
exit 1
fi
}
set -e -u
. $TEST_SCRIPT
)
if [ $? != 0 ]; then
(( NUM_FAILURES += 1 ))
fi
test -t 1 && printf "\033[0m"
done
echo "$NUM_TESTS tests run - $NUM_FAILURES failure(s)"