Skip to content

Commit

Permalink
Improve based on PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
torben-hansen committed Feb 26, 2025
1 parent d375267 commit 1c67037
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions third_party/jitterentropy/import.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -u
#!/usr/bin/env bash

set -o pipefail
set -euo pipefail

# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0 OR ISC
Expand Down Expand Up @@ -33,6 +33,12 @@ GITHUB_TARGET=${GITHUB_TARGET:=master}
SRC="jitterentropy-library"
TMP="TEMP_CAN_DELETE"

# Check if TMP directory already exists
if [ -d "${TMP}" ]; then
echo "Source directory or symlink ${TMP} does already exist -- please remove it before re-running the importer"
exit 1
fi

# Check if source directory already exists
if [ -d "${SRC}" ]; then
echo "Source directory or symlink ${SRC} does already exist -- please remove it before re-running the importer"
Expand All @@ -47,12 +53,12 @@ GITHUB_COMMIT=$(cd ${TMP} >/dev/null; git rev-parse HEAD)

echo "Copy source code ..."
mkdir ${SRC}
cp -r ${TMP}/* ${SRC}
cp -rH ${TMP}/* ${SRC}

echo "Remove temporary artifacts ..."
rm -rf ${TMP}

# Remove upstream repo build scripts from being invoked.
echo "Remove upstream repository build scripts to avoid them being invoked ..."
rm "${SRC}/CMakeLists.txt"
rm "${SRC}/Makefile"

Expand All @@ -62,7 +68,7 @@ name: ${SRC}
source: ${GITHUB_REPOSITORY}
commit: ${GITHUB_COMMIT}
target: ${GITHUB_TARGET}
imported-at: $(date "+%Y-%m-%dT%H:%M:%S%z")
imported-at: $(env TZ=UTC date "+%Y-%m-%dT%H:%M:%S%z")
EOF

# Submodule path might be cached.
Expand Down

0 comments on commit 1c67037

Please sign in to comment.