Skip to content

Commit

Permalink
build with the latest commit from master with ubuntu-22.04 (#107)
Browse files Browse the repository at this point in the history
* contain verification in the build script
* build with the latest commit
* build with ubuntu-22.04
* fix bootstrap.sh path
  • Loading branch information
openoms authored Dec 16, 2022
1 parent 8058788 commit 6028c48
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/amd64-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:

jobs:
amd64-image-build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/arm64-rpi-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:

jobs:
arm64-rpi-image-build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

Expand Down
45 changes: 32 additions & 13 deletions build_joininbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
# command info
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
echo "JoininBox Build Script"
echo "Usage: sudo bash build_joininbox.sh <github user> <branch> <without-qt>"
echo "Example: 'sudo bash build_joininbox.sh openoms master --without-qt' to install from the dev branch without the QT GUI"
echo "Usage: sudo bash build_joininbox.sh <github user> <branch> <tag|commit> <without-qt>"
echo "Example:"
echo "'sudo bash build_joininbox.sh openoms master commit without-qt'"
echo "to install from the master branch latest commit without the QT GUI"
echo "By default uses https://github.com/openoms/joininbox/tree/master and installs the QT GUI"
exit 1
fi
Expand Down Expand Up @@ -364,18 +366,15 @@ echo "# add the 'joinmarket' user"
adduser --disabled-password --gecos "" joinmarket

echo "# clone the joininbox repo and copy the scripts"
cd /home/joinmarket || (echo "# User wasn't created" ;exit 1)
cd /home/joinmarket || (echo "# User wasn't created"; exit 1)
sudo -u joinmarket git clone -b ${wantedBranch} https://github.com/${githubUser}/joininbox.git

cd /home/joinmarket/joininbox || (echo "# Failed git clone" ;exit 1)

# reset to the last release # be aware this is alphabetical (use one digit versions)
TAG=$(git tag | sort -V | tail -1)
sudo -u joinmarket git reset --hard $TAG
cd /home/joinmarket/joininbox || (echo "# Failed git clone"; exit 1)

PGPsigner="openoms"
PGPpubkeyLink="https://github.com/openoms.gpg"
PGPpubkeyFingerprint="13C688DB5B9C745DE4D2E4545BFB77609B081B65"

sudo -u joinmarket wget -O pgp_keys.asc "${PGPpubkeyLink}"
sudo -u joinmarket gpg --import --import-options show-only ./pgp_keys.asc
fingerprint=$(sudo -u joinmarket gpg pgp_keys.asc 2>/dev/null | grep "${PGPpubkeyFingerprint}" -c)
Expand All @@ -387,9 +386,29 @@ if [ "${fingerprint}" -lt 1 ]; then
exit 7
fi
sudo -u joinmarket gpg --import ./pgp_keys.asc

if [ $# -lt 3 ] || [ "$3" = tag ]; then
# use the latest tag by default
tag=$(git tag | sort -V | tail -1)
# reset to the last release # be aware this is alphabetical (use one digit versions)
sudo -u joinmarket git reset --hard ${tag}
# verify the tag
gitCommand="sudo -u joinmarket git verify-tag ${tag}"
commitOrTag="${tag} tag"

else
if [ $# -gt 2 ] && [ "$3" != commit ]; then
# reset to named commit if given
sudo -u joinmarket git reset --hard $3
fi
commitHash="$(git log --oneline | head -1 | awk '{print $1}')"
# verify the commit
gitCommand="sudo -u joinmarket git verify-commit $commitHash"
commitOrTag="$commitHash commit"
fi

trap 'rm -f "$_temp"' EXIT
_temp="$(mktemp -p /dev/shm/)"
gitCommand="sudo -u joinmarket git verify-tag $TAG"
if ${gitCommand} 2>&1 >&"$_temp"; then
goodSignature=1
else
Expand All @@ -406,9 +425,9 @@ if [ "${correctKey}" -lt 1 ] || [ "${goodSignature}" -lt 1 ]; then
exit 1
else
echo
echo "######################################################################"
echo "# OK --> the PGP signature of the checked out $TAG tag is correct"
echo "######################################################################"
echo "##########################################################################"
echo "# OK --> the PGP signature of the checked out ${commitOrTag} is correct"
echo "##########################################################################"
echo
fi

Expand Down Expand Up @@ -617,7 +636,7 @@ checkEntry=$(sudo -u joinmarket cat /home/joinmarket/joinin.conf | grep -c "qtgu
if [ ${checkEntry} -eq 0 ]; then
echo "qtgui=true" | tee -a /home/joinmarket/joinin.conf
fi
if [ "$3" = "without-qt" ]; then
if [ "$4" = "without-qt" ]; then
qtgui="false"
sed -i "s/^qtgui=.*/qtgui=false/g" /home/joinmarket/joinin.conf
fi
Expand Down
2 changes: 1 addition & 1 deletion ci/amd64/debian/scripts/joininbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ echo 'Download the build_joininbox.sh script ...'
wget https://raw.githubusercontent.com/${github_user}/joininbox/${branch}/build_joininbox.sh

echo 'Build Joininbox ...'
sudo bash build_joininbox.sh "${github_user}" "${branch}"
sudo bash build_joininbox.sh "${github_user}" "${branch}" "commit"

echo 'Delete SSH keys (will be recreated on the first boot)'
sudo rm /etc/ssh/ssh_host_*
Expand Down
2 changes: 1 addition & 1 deletion ci/arm64-rpi/joininbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ echo 'Download the build_joininbox.sh script ...'
wget https://raw.githubusercontent.com/${github_user}/joininbox/${branch}/build_joininbox.sh

echo 'Build Joininbox ...'
sudo bash build_joininbox.sh "${github_user}" "${branch}"
sudo bash build_joininbox.sh "${github_user}" "${branch}" "commit"
2 changes: 1 addition & 1 deletion scripts/standalone/bootstrap.service
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ User=root
Group=root
Type=oneshot
RemainAfterExit=true
ExecStart=/home/joinmarket/scripts/standalone/bootstrap.sh
ExecStart=/home/joinmarket/standalone/bootstrap.sh
StandardOutput=journal
StandardError=journal

Expand Down
6 changes: 3 additions & 3 deletions scripts/verify.git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ if [ $# -lt 3 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "Usage:"
echo "Run after 'git reset --hard VERSION' with the user running the installation"
echo "To verify the checked out commit:"
echo "blitz.git-verify.sh [PGPsigner] [PGPpubkeyLink] [PGPpubkeyFingerprint]"
echo "verify.git.sh [PGPsigner] [PGPpubkeyLink] [PGPpubkeyFingerprint]"
echo "To use 'git verify-tag' add the 'tag':"
echo "blitz.git-verify.sh [PGPsigner] [PGPpubkeyLink] [PGPpubkeyFingerprint] <tag>"
echo "verify.git.sh [PGPsigner] [PGPpubkeyLink] [PGPpubkeyFingerprint] <tag>"
exit 1
fi

Expand All @@ -23,7 +23,7 @@ fi
# PGPpubkeyFingerprint="F579929B39B119CC7B0BB71FB326ACF51F317B69"

# Run with the installing user to clear permissions:
# sudo -u btcrpcexplorer /home/admin/config.scripts/blitz.git-verify.sh \
# sudo -u btcrpcexplorer /home/admin/config.scripts/verify.git.sh \
# "${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1

PGPsigner="$1"
Expand Down

0 comments on commit 6028c48

Please sign in to comment.