Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Kapral67 committed Feb 28, 2024
1 parent b42b9fc commit d13af09
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 6 deletions.
47 changes: 45 additions & 2 deletions .github/workflows/package_on_device.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,49 @@ jobs:
run: ./setup-environment.sh
- name: Gather build summary
run: |
cat <<EOF > docker.sh
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get remove -y --purge gnupg gpg-agent
sudo apt-get install -y libassuan-dev libnpth0-dev
pwd=$(pwd)
tmpdir=$(mktemp -d)
cd "$tmpdir"
wget https://gnupg.org/ftp/gcrypt/gpgrt/libgpg-error-1.48.tar.bz2
tar -xf libgpg-error-1.48.tar.bz2
cd libgpg-error-1.48
./configure
make -j$(nproc)
sudo make install
cd "$tmpdir"
wget https://gnupg.org/ftp/gcrypt/libksba/libksba-1.6.6.tar.bz2
tar -xf libksba-1.6.6.tar.bz2
cd libksba-1.6.6
./configure
make -j$(nproc)
sudo make install
cd "$tmpdir"
wget https://www.gnupg.org/ftp/gcrypt/gnupg/gnupg-2.4.4.tar.bz2
tar -xf gnupg-2.4.4.tar.bz2
cd gnupg-2.4.4
./configure
make -j$(nproc)
sudo make install
cd "$pwd"
GPG_TTY="$(tty)" || true
export GPG_TTY
gpg --version
wget https://github.com/termux/termux-packages/raw/master/packages/termux-keyring/grimler.gpg
gpg --import grimler.gpg
gpg --no-tty --command-file <(echo -e "trust\n5\ny") --edit-key 2C7F29AE97891F6419A9E2CDB0076E490B71616B
gpg --list-keys
exit 38
EOF
chmod a+x docker.sh
cat docker.sh
docker run --rm arm64v8/ubuntu:22.04 /bin/bash docker.sh
if [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
BASE_COMMIT=$(jq --raw-output .pull_request.base.sha "$GITHUB_EVENT_PATH")
OLD_COMMIT=$(jq --raw-output .commits[0].id "$GITHUB_EVENT_PATH")
Expand Down Expand Up @@ -167,7 +210,7 @@ jobs:
env:
ARCH: ${{ matrix.target_arch }}
run: |
./common-files/build-termux-docker.sh login ./scripts/setup-termux.sh
script -e -O /dev/null -c "./common-files/build-termux-docker.sh login ./scripts/setup-termux.sh"
declare -a packages
for repo_path in $(jq --raw-output 'keys | .[]' repo.json); do
repo=$(jq --raw-output '.["'${repo_path}'"].name' repo.json)
Expand All @@ -177,7 +220,7 @@ jobs:
done
sudo chown -R 1000:1000 $(pwd)
if [ ! -z "$packages" ]; then
./common-files/build-termux-docker.sh login ./build-package.sh --format pacman -I $packages
script -e -O /dev/null -c "./common-files/build-termux-docker.sh login ./build-package.sh --format pacman -I $packages"
fi
- name: Clean up docker containers
env:
Expand Down
8 changes: 5 additions & 3 deletions common-files/build-termux-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ REPOROOT="$(dirname $(readlink -f $0))/../"

# Check whether attached to tty and adjust docker flags accordingly.
if [ -t 1 ]; then
echo 'YES TTY'
DOCKER_TTY=" --tty"
else
echo 'NO TTY'
DOCKER_TTY=""
fi

Expand All @@ -37,11 +39,11 @@ $SUDO docker start $CONTAINER_NAME >/dev/null 2>&1 || {

echo "Running existing container..."

if [ "$#" -eq "0" ]; then
echo "bash"
if [ "$#" -eq "0" ]; then
echo "bash"
$SUDO docker exec --interactive $DOCKER_TTY $CONTAINER_NAME bash
else
echo '$@'
echo '$@'
$SUDO docker exec --interactive $DOCKER_TTY $CONTAINER_NAME "$@"
fi

Expand Down
7 changes: 6 additions & 1 deletion test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/bin/bash
set -x
export GPG_TTY=$(tty)
cd ~
tty
script -e
tty
exit
exit
set +x

0 comments on commit d13af09

Please sign in to comment.