Skip to content

Commit

Permalink
Always download latest miner release
Browse files Browse the repository at this point in the history
  • Loading branch information
Oink70 committed Aug 2, 2023
1 parent d7ab6e6 commit cc7dc44
Showing 1 changed file with 50 additions and 10 deletions.
60 changes: 50 additions & 10 deletions install.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit cc7dc44

Please sign in to comment.