Skip to content

Commit

Permalink
fix bash lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sbtaylor15 committed Jan 16, 2023
1 parent 2f85b74 commit b12dd5a
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 42 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/aptly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ chmod 700 ~/.gnupg
chmod 700 ~/.gnupg/private-keys-v1.d

# import the private key
echo $GPG_KEY | base64 -d | gpg -q --import
echo "$GPG_KEY" | base64 -d | gpg -q --import

# export and import the public key so aptly can access it
gpg --export -a | gpg -q --batch --no-default-keyring --keyring trustedkeys.gpg --import
Expand Down Expand Up @@ -57,24 +57,24 @@ cat > /tmp/aptly.conf << EOL
EOL

# create a mirror from public site
./aptly mirror create -config=/tmp/aptly.conf $RELTYPE https://repo.pyrsia.io/repos/$RELTYPE focal
./aptly mirror update -config=/tmp/aptly.conf $RELTYPE
./aptly snapshot create -config=/tmp/aptly.conf public-snap from mirror $RELTYPE
./aptly mirror create -config=/tmp/aptly.conf "$RELTYPE" "https://repo.pyrsia.io/repos/$RELTYPE" focal
./aptly mirror update -config=/tmp/aptly.conf "$RELTYPE"
./aptly snapshot create -config=/tmp/aptly.conf public-snap from mirror "$RELTYPE"

# create a local repo, add deb and snapshot
./aptly repo create -config=/tmp/aptly.conf $RELTYPE
./aptly repo add -config=/tmp/aptly.conf $RELTYPE $DEBFILE
./aptly snapshot -config=/tmp/aptly.conf create $RELTYPE-snap from repo $RELTYPE
./aptly repo create -config=/tmp/aptly.conf "$RELTYPE"
./aptly repo add -config=/tmp/aptly.conf "$RELTYPE" "$DEBFILE"
./aptly snapshot -config=/tmp/aptly.conf create "$RELTYPE-snap" from repo "$RELTYPE"

# merge the public snap and local
./aptly snapshot merge -config=/tmp/aptly.conf -no-remove $RELTYPE $RELTYPE-snap public-snap
./aptly snapshot merge -config=/tmp/aptly.conf -no-remove "$RELTYPE" "$RELTYPE-snap" public-snap

# publish the merged snapshot
./aptly publish snapshot -batch -passphrase="" -config=/tmp/aptly.conf $RELTYPE $RELTYPE
./aptly publish snapshot -batch -passphrase="" -config=/tmp/aptly.conf "$RELTYPE" "$RELTYPE"

# Generate pretty directory listing web pages
cd /tmp/aptly/public/$RELTYPE
cd "/tmp/aptly/public/$RELTYPE"
python3 /home/runner/work/pyrsia/pyrsia/.github/workflows/genlisting.py -r

# copy new public repo to GCS
gsutil -m rsync -r /tmp/aptly/public/$RELTYPE gs://debrepo/repos/$RELTYPE
gsutil -m rsync -r "/tmp/aptly/public/$RELTYPE" "gs://debrepo/repos/$RELTYPE"
12 changes: 6 additions & 6 deletions .github/workflows/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ set -e

# We need to split out build commands into separate calls in order to run them in parallel
# therefore we cannot use --all-targets since that is equivalent to --lib --bins --tests --benches --examples
# which disables the parallelizm we are trying achive for speed.
# which disables the parallelizm we are trying achive for speed.
#
# "cargo build --workspace" is equivalent to cargo build --workspace --lib --bins
# adding --lib --bins for clarity
#

$( cargo build --workspace --lib --bins --release; echo $? > /tmp/ws.rc ) &
$( cargo build --workspace --tests --benches --examples --release 1>/tmp/tests.log 2>&1; echo $? > /tmp/tests.rc ) &
( cargo build --workspace --lib --bins --release; echo "$?" > /tmp/ws.rc ) &
( cargo build --workspace --tests --benches --examples --release 1>/tmp/tests.log 2>&1; echo "$?" > /tmp/tests.rc ) &
jobs
wait

Expand All @@ -47,10 +47,10 @@ if [[ $(find . -name "Cargo.lock" -exec grep -i openssl {} \; | wc -l) -ne 0 ]];
fi

# Return the max return code between the two processes.
# This is done to tell the GitHub Step to fail (rc != 0). The
# This is done to tell the GitHub Step to fail (rc != 0). The
# value of the rc is not important at this point since each
# build has already displayed its return code.
# build has already displayed its return code.

rc=$(cat /tmp/ws.rc /tmp/tests.rc | sort -nr | head -n1)

exit $rc
exit "$rc"
8 changes: 4 additions & 4 deletions .github/workflows/chartmuseum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ fi

WORKSPACE=$PWD
cd installers/helm
mkdir -p repos/$RELTYPE
mkdir -p "repos/$RELTYPE"
gsutil -m rsync -r gs://helmrepo/repos repos
helm package pyrsia-node
mv pyrsia-node*.tgz repos/$RELTYPE
mv pyrsia-node*.tgz "repos/$RELTYPE"
cd repos/$RELTYPE
helm repo index --url https://helmrepo.pyrsia.io/repos/$RELTYPE .
helm repo index --url "https://helmrepo.pyrsia.io/repos/$RELTYPE" .
cp ../../pyrsia-node/artifacthub-repo.yaml .
cd ../..

# Generate pretty directory listing web pages
python3 $WORKSPACE/.github/workflows/genlisting.py -r
python3 "$WORKSPACE/.github/workflows/genlisting.py" -r

# copy new public repo to GCS
gsutil -m rsync -r repos gs://helmrepo/repos
8 changes: 4 additions & 4 deletions installers/debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

set -e

# Check if Docker service exists.
# Check if Docker service exists.

if type -P "systemctl" 2>&1 1>/dev/null && systemctl --all --type service | grep -q "docker";then
if type -P "systemctl" 1>/dev/null 2>/dev/null && systemctl --all --type service | grep -q "docker";then

echo "***"
echo "*** Adding \"registry-mirrors\": [\"http://localhost:7888\"] to /etc/docker/daemon.json"
Expand Down Expand Up @@ -37,8 +37,8 @@ else
fi

# Start Pyrsia Running
if type -P "systemctl" 2>&1 1>/dev/null; then
if type -P "systemctl" 1>/dev/null 2>/dev/null; then

systemctl start pyrsia

fi
6 changes: 3 additions & 3 deletions installers/debian/preinst
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

set -e

mkdir -p /usr/local/var/pyrsia
mkdir -p /usr/local/var/pyrsia
chmod -R 644 /usr/local/var/pyrsia

# Check if Pyrsia service exists and stop it so we can upgrade existing executables
# Check if Pyrsia service exists and stop it so we can upgrade existing executables

if type -P "systemctl" 2>&1 1>/dev/null && systemctl --all --type service | grep -q "pyrsia";then
if type -P "systemctl" 1>/dev/null 2>/dev/null && systemctl --all --type service | grep -q "pyrsia";then

systemctl stop "pyrsia"

Expand Down
26 changes: 13 additions & 13 deletions installers/docker/node-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,38 @@ if [ -f /var/run/secrets/kubernetes.io/serviceaccount/namespace ]; then
TOKEN=$(cat ${SERVICEACCOUNT}/token)
CACERT=${SERVICEACCOUNT}/ca.crt
PODNAME=`hostname`
export PYRSIA_EXTERNAL_IP=$(curl -s --cacert ${CACERT} --header "Authorization: Bearer ${TOKEN}" -X GET ${APISERVER}/api/v1/namespaces/${NAMESPACE}/services/${PODNAME} | jq -r ".status.loadBalancer.ingress[0].ip")
export PYRSIA_EXTERNAL_IP=$(curl -s --cacert ${CACERT} --header "Authorization: Bearer ${TOKEN}" -X GET "${APISERVER}/api/v1/namespaces/${NAMESPACE}/services/${PODNAME}" | jq -r ".status.loadBalancer.ingress[0].ip")

# Wait for the service to be assigned an ip addr
while [ "${PYRSIA_EXTERNAL_IP}" == "" ] || [ "${PYRSIA_EXTERNAL_IP}" == "null" ]; do
sleep 5
export PYRSIA_EXTERNAL_IP=$(curl -s --cacert ${CACERT} --header "Authorization: Bearer ${TOKEN}" -X GET ${APISERVER}/api/v1/namespaces/${NAMESPACE}/services/${PODNAME} | jq -r ".status.loadBalancer.ingress[0].ip")
export PYRSIA_EXTERNAL_IP=$(curl -s --cacert ${CACERT} --header "Authorization: Bearer ${TOKEN}" -X GET "${APISERVER}/api/v1/namespaces/${NAMESPACE}/services/${PODNAME}" | jq -r ".status.loadBalancer.ingress[0].ip")
done
echo "PYRSIA_EXTERNAL_IP=$PYRSIA_EXTERNAL_IP"

NODE_DOMAIN=$(echo $PYRSIA_BOOTDNS | cut -d'.' -f2-)
NODE_DOMAIN=$(echo "$PYRSIA_BOOTDNS" | cut -d'.' -f2-)
NODE_HOSTNAME=${HOSTNAME}.${NODE_DOMAIN}

# Wait for the ip addr to be mapped to dns and propogated

DNSREADY=$(dig ${NODE_HOSTNAME} 2>&1 | grep "${PYRSIA_EXTERNAL_IP}")
DNSREADY=$(dig "${NODE_HOSTNAME}" 2>&1 | grep "${PYRSIA_EXTERNAL_IP}")
while [ "${DNSREADY}" == "" ]; do
sleep 5
DNSREADY=$(dig ${NODE_HOSTNAME} 2>&1 | grep "${PYRSIA_EXTERNAL_IP}")
DNSREADY=$(dig "${NODE_HOSTNAME}" 2>&1 | grep "${PYRSIA_EXTERNAL_IP}")
done

# detemine if I am pyrsia-node-0.pyrsia.link (first boot node ever) if so be the primary boot node

echo Find Boot Zero
echo ${DNSREADY}
echo "${DNSREADY}"
echo DONE

BOOTZERO=$(echo "${DNSREADY}" | grep "${PYRSIA_BOOTDNS}")
if [ "${BOOTZERO}" != "" ]; then
if [ "${BOOTZERO}" != "" ]; then
if [ "${PYRSIA_BUILDNODE}" == "" ]; then
/usr/bin/pyrsia_node $* --listen-only --init-blockchain
else
/usr/bin/pyrsia_node $* --listen-only --init-blockchain --pipeline-service-endpoint ${PYRSIA_BUILDNODE}
/usr/bin/pyrsia_node $* --listen-only --init-blockchain --pipeline-service-endpoint "${PYRSIA_BUILDNODE}"
fi
exit $?
fi
Expand All @@ -50,13 +50,13 @@ fi
# I am not node-0 so use boot.pyrsia.link for boot address and connect to it

# Wait for the status from node-0 to be available
curl http://${PYRSIA_BOOTDNS}/status
curl "http://${PYRSIA_BOOTDNS}/status"

BOOTADDR=$(curl -s http://${PYRSIA_BOOTDNS}/status | jq -r ".peer_addrs[0]")
BOOTADDR=$(curl -s "http://${PYRSIA_BOOTDNS}/status" | jq -r ".peer_addrs[0]")

while [ "${BOOTADDR}" == "" ] || [ "${BOOTADDR}" == "null" ]; do
sleep 5
BOOTADDR=$(curl -s http://${PYRSIA_BOOTDNS}/status | jq -r ".peer_addrs[0]")
BOOTADDR=$(curl -s "http://${PYRSIA_BOOTDNS}/status" | jq -r ".peer_addrs[0]")
done

/usr/bin/pyrsia_node $* -P $BOOTADDR
/usr/bin/pyrsia_node $* -P "$BOOTADDR"
2 changes: 1 addition & 1 deletion pre-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
exit_on_error() {
exit_msg=$1
if [[ "$exit_msg" != "" ]]; then
>&2 printf "$exit_msg\n"
>&2 printf "%s\n" "$exit_msg"
exit 1
fi
}
Expand Down

0 comments on commit b12dd5a

Please sign in to comment.