mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-08 22:52:18 -04:00
incorporate woodser feedback
This commit is contained in:
parent
a71090dbf5
commit
c11d02a3e4
1 changed files with 59 additions and 61 deletions
|
@ -6,31 +6,31 @@ function remote {
|
||||||
if [[ -z $PRECOMPILED_URL || -z $FINGERPRINT ]]; then
|
if [[ -z $PRECOMPILED_URL || -z $FINGERPRINT ]]; then
|
||||||
printf "\nNo arguments provided!\n\nThis script requires two arguments to be provided:\nBinary URL & PGP Fingerprint\n\nPlease review documentation and try again.\n\nExiting now ...\n"
|
printf "\nNo arguments provided!\n\nThis script requires two arguments to be provided:\nBinary URL & PGP Fingerprint\n\nPlease review documentation and try again.\n\nExiting now ...\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
## Update & Upgrade
|
## Update & Upgrade
|
||||||
apt update && apt upgrade -y
|
apt update && apt upgrade -y
|
||||||
|
|
||||||
|
|
||||||
## Install wget
|
## Install wget
|
||||||
apt install -y wget
|
apt install -y wget
|
||||||
|
|
||||||
|
|
||||||
## Function to print messages in blue:
|
## Function to print messages in blue:
|
||||||
echo_blue() {
|
echo_blue() {
|
||||||
echo -e "\033[1;34m$1\033[0m"
|
echo -e "\033[1;34m$1\033[0m"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Function to print error messages in red:
|
# Function to print error messages in red:
|
||||||
echo_red() {
|
echo_red() {
|
||||||
echo -e "\033[0;31m$1\033[0m"
|
echo -e "\033[0;31m$1\033[0m"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
## Sweep for old release files
|
## Sweep for old release files
|
||||||
rm *.asc desktop-*-SNAPSHOT-all.jar.SHA-256 haveno*
|
rm *.asc desktop-*-SNAPSHOT-all.jar.SHA-256 haveno*
|
||||||
|
|
||||||
|
|
||||||
## Define URL & PGP Fingerprint etc. vars:
|
## Define URL & PGP Fingerprint etc. vars:
|
||||||
user_url=$PRECOMPILED_URL
|
user_url=$PRECOMPILED_URL
|
||||||
base_url=$(printf ${user_url} | awk -F'/' -v OFS='/' '{$NF=""}1')
|
base_url=$(printf ${user_url} | awk -F'/' -v OFS='/' '{$NF=""}1')
|
||||||
|
@ -40,8 +40,8 @@ function remote {
|
||||||
signature_filename="${binary_filename}.sig"
|
signature_filename="${binary_filename}.sig"
|
||||||
key_filename="$(printf "$expected_fingerprint" | tr -d ' ' | sed -E 's/.*(................)/\1/' )".asc
|
key_filename="$(printf "$expected_fingerprint" | tr -d ' ' | sed -E 's/.*(................)/\1/' )".asc
|
||||||
wget_flags="--tries=10 --timeout=10 --waitretry=5 --retry-connrefused --show-progress"
|
wget_flags="--tries=10 --timeout=10 --waitretry=5 --retry-connrefused --show-progress"
|
||||||
|
|
||||||
|
|
||||||
## Debug:
|
## Debug:
|
||||||
printf "\nUser URL=$user_url\n"
|
printf "\nUser URL=$user_url\n"
|
||||||
printf "\nBase URL=$base_url\n"
|
printf "\nBase URL=$base_url\n"
|
||||||
|
@ -50,47 +50,47 @@ function remote {
|
||||||
printf "\nPackage Name=$package_filename\n"
|
printf "\nPackage Name=$package_filename\n"
|
||||||
printf "\nSig Filename=$signature_filename\n"
|
printf "\nSig Filename=$signature_filename\n"
|
||||||
printf "\nKey Filename=$key_filename\n"
|
printf "\nKey Filename=$key_filename\n"
|
||||||
|
|
||||||
|
|
||||||
## Configure for tinyproxy:
|
## Configure for tinyproxy:
|
||||||
export https_proxy=http://127.0.0.1:8082
|
export https_proxy=http://127.0.0.1:8082
|
||||||
|
|
||||||
|
|
||||||
## Download Haveno binary:
|
## Download Haveno binary:
|
||||||
echo_blue "Downloading Haveno from URL provided ..."
|
echo_blue "Downloading Haveno from URL provided ..."
|
||||||
wget "${wget_flags}" -cq "${user_url}" || { echo_red "Failed to download Haveno binary."; exit 1; }
|
wget "${wget_flags}" -cq "${user_url}" || { echo_red "Failed to download Haveno binary."; exit 1; }
|
||||||
|
|
||||||
|
|
||||||
## Download Haveno signature file:
|
## Download Haveno signature file:
|
||||||
echo_blue "Downloading Haveno signature ..."
|
echo_blue "Downloading Haveno signature ..."
|
||||||
wget "${wget_flags}" -cq "${base_url}""${signature_filename}" || { echo_red "Failed to download Haveno signature."; exit 1; }
|
wget "${wget_flags}" -cq "${base_url}""${signature_filename}" || { echo_red "Failed to download Haveno signature."; exit 1; }
|
||||||
|
|
||||||
|
|
||||||
## Download the GPG key:
|
## Download the GPG key:
|
||||||
echo_blue "Downloading signing GPG key ..."
|
echo_blue "Downloading signing GPG key ..."
|
||||||
wget "${wget_flags}" -cqO "${key_filename}" "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x$(echo "$expected_fingerprint" | tr -d ' ')" || { echo_red "Failed to download GPG key."; exit 1; }
|
wget "${wget_flags}" -cqO "${key_filename}" "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x$(echo "$expected_fingerprint" | tr -d ' ')" || { echo_red "Failed to download GPG key."; exit 1; }
|
||||||
|
|
||||||
|
|
||||||
## Import the GPG key:
|
## Import the GPG key:
|
||||||
echo_blue "Importing the GPG key ..."
|
echo_blue "Importing the GPG key ..."
|
||||||
gpg --import "${key_filename}" || { echo_red "Failed to import GPG key."; exit 1; }
|
gpg --import "${key_filename}" || { echo_red "Failed to import GPG key."; exit 1; }
|
||||||
|
|
||||||
|
|
||||||
## Extract imported fingerprints:
|
## Extract imported fingerprints:
|
||||||
imported_fingerprints=$(gpg --with-colons --fingerprint | grep -A 1 'pub' | grep 'fpr' | cut -d: -f10 | tr -d '\n')
|
imported_fingerprints=$(gpg --with-colons --fingerprint | grep -A 1 'pub' | grep 'fpr' | cut -d: -f10 | tr -d '\n')
|
||||||
|
|
||||||
|
|
||||||
## Remove spaces from the expected fingerprint for comparison:
|
## Remove spaces from the expected fingerprint for comparison:
|
||||||
formatted_expected_fingerprint=$(echo "${expected_fingerprint}" | tr -d ' ')
|
formatted_expected_fingerprint=$(echo "${expected_fingerprint}" | tr -d ' ')
|
||||||
|
|
||||||
|
|
||||||
## Check if the expected fingerprint is in the list of imported fingerprints:
|
## Check if the expected fingerprint is in the list of imported fingerprints:
|
||||||
if [[ ! "${imported_fingerprints}" =~ "${formatted_expected_fingerprint}" ]]; then
|
if [[ ! "${imported_fingerprints}" =~ "${formatted_expected_fingerprint}" ]]; then
|
||||||
echo_red "The imported GPG key fingerprint does not match the expected fingerprint."
|
echo_red "The imported GPG key fingerprint does not match the expected fingerprint."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
## Verify the downloaded binary with the signature:
|
## Verify the downloaded binary with the signature:
|
||||||
echo_blue "Verifying the signature of the downloaded file ..."
|
echo_blue "Verifying the signature of the downloaded file ..."
|
||||||
if gpg --digest-algo SHA256 --verify "${signature_filename}" >/dev/null 2>&1; then
|
if gpg --digest-algo SHA256 --verify "${signature_filename}" >/dev/null 2>&1; then
|
||||||
|
@ -98,17 +98,18 @@ function remote {
|
||||||
else echo_red "Verification failed!" && sleep 5
|
else echo_red "Verification failed!" && sleep 5
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo_blue "Haveno binaries have been successfully verified."
|
echo_blue "Haveno binaries have been successfully verified."
|
||||||
|
|
||||||
|
|
||||||
# Install Haveno:
|
# Install Haveno:
|
||||||
echo_blue "Installing Haveno ..."
|
echo_blue "Installing Haveno ..."
|
||||||
apt install -y ./"${package_filename}" || { echo_red "Failed to install Haveno."; exit 1; }
|
apt install -y ./"${package_filename}" || { echo_red "Failed to install Haveno."; exit 1; }
|
||||||
|
|
||||||
## Finalize
|
## Finalize
|
||||||
echo_blue "Haveno TemplateVM installation and configuration complete."
|
echo_blue "Haveno TemplateVM installation and configuration complete."
|
||||||
|
echo_blue "\nHappy Trading\!\n"
|
||||||
printf "%s \n" "Press [ENTER] to complete ..."
|
printf "%s \n" "Press [ENTER] to complete ..."
|
||||||
read ans
|
read ans
|
||||||
#exit
|
#exit
|
||||||
|
@ -122,20 +123,21 @@ function build {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# Dependancies
|
# Dependancies
|
||||||
sudo apt install -y make git expect fakeroot
|
sudo apt install -y make git expect fakeroot binutils
|
||||||
|
|
||||||
# Java
|
# Java
|
||||||
curl -fsSLo jdk21.deb ${JAVA_URL}
|
curl -fsSLo jdk21.deb ${JAVA_URL}
|
||||||
if [[ $(shasum ./jdk21.deb | awk '{ print $1 }') == ${JAVA_SHA1} ]] ; then printf $'SHA Hash IS valid!\n'; else printf $'WARNING: Bad Hash!\n' && exit; fi
|
if [[ $(shasum ./jdk21.deb | awk '{ print $1 }') == ${JAVA_SHA1} ]] ; then printf $'SHA Hash IS valid!\n'; else printf $'WARNING: Bad Hash!\n' && exit; fi
|
||||||
sudo apt install -y ./jdk21.deb
|
sudo apt install -y ./jdk21.deb
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
git clone --depth=1 $SOURCE_URL
|
git clone --depth=1 $SOURCE_URL
|
||||||
cd haveno
|
GIT_DIR=$(awk -F'/' '{ print $NF }' <<< "$SOURCE_URL")
|
||||||
|
cd ${GIT_DIR}
|
||||||
git checkout master
|
git checkout master
|
||||||
sed -i 's|XMR_STAGENET|XMR_MAINNET|g' desktop/package/package.gradle
|
sed -i 's|XMR_STAGENET|XMR_MAINNET|g' desktop/package/package.gradle
|
||||||
./gradlew clean build --refresh-keys --refresh-dependencies
|
./gradlew clean build --refresh-keys --refresh-dependencies
|
||||||
|
|
||||||
# Package
|
# Package
|
||||||
# Expect
|
# Expect
|
||||||
cat <<DONE >> /tmp/haveno_package_deb.exp
|
cat <<DONE >> /tmp/haveno_package_deb.exp
|
||||||
|
@ -154,34 +156,30 @@ send -- "y\r"
|
||||||
expect -exact ""
|
expect -exact ""
|
||||||
send -- "y\r"
|
send -- "y\r"
|
||||||
expect -exact "app-image"
|
expect -exact "app-image"
|
||||||
send -- ""
|
send -- \x03
|
||||||
expect eof
|
expect eof
|
||||||
DONE
|
DONE
|
||||||
|
|
||||||
# Package
|
# Package
|
||||||
expect -f /tmp/haveno_package_deb.exp && find ./ -name '*.deb' -exec qvm-copy {} \;
|
expect -f /tmp/haveno_package_deb.exp && find ./ -name '*.deb' -exec qvm-copy {} \;
|
||||||
|
printf "\nHappy Trading!\n"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ! [[ $# -eq 2 || $# -eq 3 ]] ; then
|
||||||
|
printf "\nFor this script to function, user supplied arguments are required.\n\n"
|
||||||
|
printf "\nPlease review documentation and try again.\n\n"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $# -eq 2 ]] ; then
|
if [[ $# -eq 2 ]] ; then
|
||||||
PRECOMPILED_URL=$1
|
PRECOMPILED_URL=$1
|
||||||
FINGERPRINT=$2
|
FINGERPRINT=$2
|
||||||
|
remote
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $# -eq 3 ]] ; then
|
if [[ $# -eq 3 ]] ; then
|
||||||
JAVA_URL=$1
|
JAVA_URL=$1
|
||||||
JAVA_SHA1=$2
|
JAVA_SHA1=$2
|
||||||
SOURCE_URL=$3
|
SOURCE_URL=$3
|
||||||
|
build
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
read -p $'Do you want to:\nInstall precompiled binary from remote git repository? (r)\n\n\t\tOR\n\nBuild source from remote git repository? (b)\n\n' rb
|
|
||||||
|
|
||||||
case $rb in
|
|
||||||
[rR] ) remote;;
|
|
||||||
[bB] ) build;;
|
|
||||||
* ) printf "\nInvalid Input.\n\nPlease Try again.\n";
|
|
||||||
# exit 1;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
printf "\nCheers m8!\n"
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue