From cc7dc441bcc79ebe84fa6d6f76ca483691e588b7 Mon Sep 17 00:00:00 2001 From: Oink70 Date: Wed, 2 Aug 2023 11:00:16 +0000 Subject: [PATCH] Always download latest miner release --- install.sh | 60 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 10 deletions(-) diff --git a/install.sh b/install.sh index 5add2548..5adac0b7 100755 --- a/install.sh +++ b/install.sh @@ -1,21 +1,61 @@ #!/bin/sh sudo apt-get -y update sudo apt-get -y upgrade -sudo apt-get -y install libcurl4-openssl-dev libjansson-dev libomp-dev git screen nano +sudo apt-get -y install libcurl4-openssl-dev libjansson-dev libomp-dev git screen nano jq wget wget http://ports.ubuntu.com/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_arm64.deb sudo dpkg -i libssl1.1_1.1.0g-2ubuntu4_arm64.deb rm libssl1.1_1.1.0g-2ubuntu4_arm64.deb -mkdir ~/.ssh; chmod 0700 ~/.ssh -cat << EOF > ~/.ssh/authorized_keys -ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQBy6kORm+ECh2Vp1j3j+3F1Yg+EXNWY07HbP7dLZd/rqtdvPz8uxqWdgKBtyeM7R9AC1MW87zuCmss8GiSp2ZBIcpnr8kdMvYuI/qvEzwfY8pjvi2k3b/EwSP2R6/NqgbHctfVv1c7wL0M7myP9Zj7ZQPx+QV9DscogEEfc968RcV9jc+AgphUXC4blBf3MykzqjCP/SmaNhESr2F/mSxYiD8Eg7tTQ64phQ1oeOMzIzjWkW+P+vLGz+zk32RwmzX5VJBLZt7QR01HkLhTVTjSjve/6vNWJHwI3yxMI5Q3TGiuEVINMJiP0sp6cr8xRe7Ix24a1ZAc3fdu0z658JXKN rsa-key-20190820 +if [ ! -d ~/.ssh ] +then + mkdir ~/.ssh + chmod 0700 ~/.ssh + cat << EOF > ~/.ssh/authorized_keys +ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQBy6kORm+ECh2Vp1j3j+3F1Yg+EXNWY07HbP7dLZd/rqtdvPz8uxqWdgKBtyeM7R9AC1MW87zuCmss8GiSp2ZBIcpnr8kdMvYuI/qvEzwfY8pjvi2k3b/EwSP2R6/NqgbHctfVv1c7wL0M7myP9Zj7ZQPx+QV9DscogEEfc968RcV9jc+AgphUXC4blBf3MykzqjCP/SmaNhESr2F/mSxYiD8Eg7tTQ64phQ1oeOMzIzjWkW+P+vLGz+zk32RwmzX5V> EOF -chmod 0600 ~/.ssh/authorized_keys -mkdir ~/ccminer + chmod 0600 ~/.ssh/authorized_keys +fi + +if [ ! -d ~/ccminer ] +then + mkdir ~/ccminer +fi cd ~/ccminer -wget https://github.com/Oink70/Android-Mining/releases/download/v3.8.3-3/ccminer-3.8.3-3_ARM -wget https://raw.githubusercontent.com/Oink70/Android-Mining/main/config.json -mv ccminer-3.8.3-3_ARM ccminer -chmod +x ccminer + +GITHUB_RELEASE_JSON=$(curl --silent "https://api.github.com/repos/Oink70/Android-Mining/releases?per_page=1" | jq -c '[.[] | del (.body)]') +GITHUB_DOWNLOAD_URL=$(echo $GITHUB_RELEASE_JSON | jq -r ".[0].assets | .[] | .browser_download_url") +GITHUB_DOWNLOAD_NAME=$(echo $GITHUB_RELEASE_JSON | jq -r ".[0].assets | .[] | .name") + +echo "Downloading latest release: $GITHUB_DOWNLOAD_NAME" + +wget ${GITHUB_DOWNLOAD_URL} -P ~/ccminer +if [ -f ~/ccminer/config.json ] +then + INPUT= + while [ "$INPUT" != "y" ] && [ "$INPUT" != "n" ] + do + printf '"~/ccminer/config.json" already exists. Do you want to overwrite? (y/n) ' + read INPUT + if [ "$INPUT" = "y" ] + then + echo "\noverwriting current \"~/ccminer/config.json\"\n" + rm ~/ccminer/config.json + elif [ "$INPUT" = "n" ] + then + echo "saving as \"~/ccminer/config.json.#\"" + else + echo 'Invalid input. Please answer with "y" or "n".\n' + fi + done +fi +wget https://raw.githubusercontent.com/Oink70/Android-Mining/main/config.json -P ~/ccminer + +if [ -f ~/ccminer/ccminer ] +then + mv ~/ccminer/ccminer ~/ccminer/ccminer_old +fi +mv ~/ccminer/${GITHUB_DOWNLOAD_NAME} ~/ccminer/ccminer +chmod +x ~/ccminer/ccminer + cat << EOF > ~/ccminer/start.sh #!/bin/sh #exit existing screens with the name CCminer