mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-03-01 00:59:23 +01:00
* add amd64 image build with lean and fatpack option * use the pi user for setup * add notes to ci readme * add gnome desktop to fatpack image, reduce to 30GB * documentation updates * install gnome with --force-yes * install gnome desktop non-interactively * change links to rootzoll dev * pass user and branch to build_sdcard.sh from PR * add user and branch to Makefile * Add arm64 rpi image build (#74) ci: * add arm64-rpi image build * rename to raspiblitz-amd64-debian-11.5-lean/fatpack * use rm -f to not exit with error * place amd64 images under ci/amd64/builds/ * make /dev/shm world writable for fatpack * fix vlc remove and --var syntax * remove sudo-s * leave update and upgrade to the build_sdcard.sh * increase image size to 16GB, rename build dir build_sdcard.sh: * detect raspios_arm64 with raspi.list * switch ssmtp to msmtp related: https://github.com/rootzoll/raspiblitz/pull/2232 Co-authored-by: rootzoll <johndoe@example.com> * i2pd: unified install from repo, /usr/sbin to PATH related: #2413, fixes amd64 build * update CHANGES.md * fix amd64 path in Makefile * use only qemu image, run on ubuntu-22.04 * use file_checksum for the arm64-rpi base image * Fix the local arm64-rpi image generation (#75) * add selfrun script * ubuntu: add universe repo and qemu-user-static * test on ubuntu live (jammy) * build from branches: [ "dev", "v1.8", "v1.9" ] * correct Makefile paths for the local run * make the local run non-interactive * improve readme and Makefile * increase disk image sizes to 32GB * set image sizes to 30 GB for amd64 and arm64-rpi * add network-manager for amd64 * add to readme * skip Code&Compile for VM builds * add to readme * amd64 base image update to debian 11.6.0 * remove debian version from filenames * skip Code&Compile for amd64 builds * Merge branch 'dev' into add-amd64-image-build * amd64: increase cpu and RAM, compile mempool last * trigger workflows only on scripts used or called * Update ci/arm64-rpi/packer.build.arm64-rpi.sh Co-authored-by: Daniel Bast <2790401+dbast@users.noreply.github.com> * arm64 remove setup-qemu-action, leave npm last * set only manual trigger for fatpack, edit triggers Co-authored-by: rootzoll <johndoe@example.com> Co-authored-by: Daniel Bast <2790401+dbast@users.noreply.github.com>
285 lines
8.3 KiB
Bash
285 lines
8.3 KiB
Bash
#!/bin/bash
|
|
|
|
# https://i2pd.readthedocs.io
|
|
|
|
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
|
echo "I2P Daemon install script"
|
|
echo "More info at https://i2pd.readthedocs.io"
|
|
echo "Usage:"
|
|
echo "blitz.i2pd.sh install -> Install i2pd"
|
|
echo "blitz.i2pd.sh on -> Switch on i2pd"
|
|
echo "blitz.i2pd.sh off -> Uninstall i2pd"
|
|
echo "blitz.i2pd.sh addseednodes -> Add all I2P seed nodes from: https://github.com/bitcoin/bitcoin/blob/master/contrib/seeds/nodes_main.txt"
|
|
echo "blitz.i2pd.sh status -> I2P related logs from bitcoind, bitcoin-cli -netinfo 4 and webconsole access"
|
|
exit 1
|
|
fi
|
|
|
|
function confAdd {
|
|
# get parameters
|
|
keystr="$1"
|
|
valuestr=$(echo "$2" | sed 's/\//\\\//g')
|
|
configFile="$3"
|
|
|
|
# check if key needs to be added (prepare new entry)
|
|
entryExists=$(grep -c "^${keystr}=" ${configFile})
|
|
if [ ${entryExists} -eq 0 ]; then
|
|
echo "${keystr}=" | sudo tee -a ${configFile} 1>/dev/null
|
|
fi
|
|
|
|
# add an extra key=value line (needs sudo to operate when user is not root)
|
|
echo "${keystr}=${valuestr}" | sudo tee -a ${configFile}
|
|
}
|
|
|
|
function add_repo {
|
|
# Add repo for the latest version
|
|
# i2pd — https://repo.i2pd.xyz/.help/readme.txt
|
|
# https://repo.i2pd.xyz/.help/add_repo
|
|
|
|
source /etc/os-release
|
|
DIST=$ID
|
|
case $ID in
|
|
debian|ubuntu|raspbian)
|
|
if [[ -n $DEBIAN_CODENAME ]]; then
|
|
VERSION_CODENAME=$DEBIAN_CODENAME
|
|
fi
|
|
if [[ -n $UBUNTU_CODENAME ]]; then
|
|
VERSION_CODENAME=$UBUNTU_CODENAME
|
|
fi
|
|
if [[ -z $VERSION_CODENAME ]]; then
|
|
echo "Couldn't find VERSION_CODENAME in your /etc/os-release file. Did your system supported? Please report issue to me by writing to email: 'r4sas <at> i2pd.xyz'"
|
|
exit 1
|
|
fi
|
|
RELEASE=$VERSION_CODENAME
|
|
;;
|
|
*)
|
|
if [[ -z $ID_LIKE || "$ID_LIKE" != "debian" && "$ID_LIKE" != "ubuntu" ]]; then
|
|
echo "Your system is not supported by this script. Currently it supports debian-like and ubuntu-like systems."
|
|
exit 1
|
|
else
|
|
DIST=$ID_LIKE
|
|
case $ID_LIKE in
|
|
debian)
|
|
if [[ "$ID" == "kali" ]]; then
|
|
if [[ "$VERSION" == "2019"* || "$VERSION" == "2020"* ]]; then
|
|
RELEASE="buster"
|
|
elif [[ "$VERSION" == "2021"* || "$VERSION" == "2022"* ]]; then
|
|
RELEASE="bullseye"
|
|
fi
|
|
else
|
|
RELEASE=$DEBIAN_CODENAME
|
|
fi
|
|
;;
|
|
ubuntu)
|
|
RELEASE=$UBUNTU_CODENAME
|
|
;;
|
|
esac
|
|
fi
|
|
;;
|
|
esac
|
|
if [[ -z $RELEASE ]]; then
|
|
echo "Couldn't detect your system release. Please report issue to me by writing to email: 'r4sas <at> i2pd.xyz'"
|
|
exit 1
|
|
fi
|
|
echo "Importing signing key"
|
|
wget -q -O - https://repo.i2pd.xyz/r4sas.gpg | sudo apt-key --keyring /etc/apt/trusted.gpg.d/i2pd.gpg add -
|
|
echo "Adding APT repository"
|
|
echo "deb https://repo.i2pd.xyz/$DIST $RELEASE main" | sudo tee /etc/apt/sources.list.d/i2pd.list
|
|
echo "deb-src https://repo.i2pd.xyz/$DIST $RELEASE main" | sudo tee -a /etc/apt/sources.list.d/i2pd.list
|
|
}
|
|
|
|
function bitcoinI2Pstatus {
|
|
echo "# I2P related logs from the bitcoin debug log"
|
|
echo "# Follow live with the command:"
|
|
echo "sudo tail -n 1000 -f /mnt/hdd/bitcoin/debug.log | grep i2p"
|
|
echo
|
|
sudo cat /mnt/hdd/bitcoin/debug.log | grep i2p
|
|
echo
|
|
echo "# Running the command:"
|
|
echo "bitcoin-cli -netinfo 4"
|
|
echo
|
|
bitcoin-cli -netinfo 4
|
|
echo
|
|
echo "# i2pd webconsole:"
|
|
localip=$(hostname -I | awk '{print $1}')
|
|
echo "http://${localip}:7070"
|
|
echo "# Username: i2pd"
|
|
echo "# Password: your passwordB"
|
|
echo
|
|
}
|
|
|
|
|
|
echo "# Running: 'blitz.i2pd.sh $*'"
|
|
source /mnt/hdd/raspiblitz.conf
|
|
|
|
# make sure to be present in PATH
|
|
if ! echo "$PATH" | grep "/usr/sbin"; then
|
|
export PATH=$PATH:/usr/sbin
|
|
echo "PATH=\$PATH:/usr/sbin" | sudo tee -a /etc/profile
|
|
fi
|
|
|
|
if [ "$1" = "install" ]; then
|
|
|
|
isInstalled=$(sudo systemctl list-unit-files | grep -c i2pd)
|
|
if [ "${isInstalled}" != "0" ]; then
|
|
echo "# i2pd is already installed."
|
|
else
|
|
echo "# Installing i2pd ..."
|
|
|
|
add_repo
|
|
|
|
sudo apt-get update
|
|
sudo apt-get install -y i2pd
|
|
|
|
fi
|
|
exit 0
|
|
fi
|
|
|
|
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|
|
|
isInstalled=$(sudo systemctl list-unit-files | grep -c i2pd)
|
|
if [ "${isInstalled}" != "0" ]; then
|
|
echo "# i2pd is installed."
|
|
else
|
|
/home/admin/config.scripts/blitz.i2pd.sh install
|
|
fi
|
|
|
|
if systemctl is-active --quiet i2pd.service; then
|
|
echo "# i2pd.service is already active."
|
|
exit 0
|
|
fi
|
|
|
|
echo "# sudo systemctl enable i2pd"
|
|
sudo systemctl enable i2pd
|
|
|
|
echo "# i2pd config"
|
|
/home/admin/config.scripts/blitz.conf.sh set debug tor /mnt/hdd/bitcoin/bitcoin.conf noquotes
|
|
confAdd debug i2p /mnt/hdd/bitcoin/bitcoin.conf
|
|
/home/admin/config.scripts/blitz.conf.sh set i2psam 127.0.0.1:7656 /mnt/hdd/bitcoin/bitcoin.conf noquotes
|
|
/home/admin/config.scripts/blitz.conf.sh set i2pacceptincoming 1 /mnt/hdd/bitcoin/bitcoin.conf noquotes
|
|
/home/admin/config.scripts/blitz.conf.sh set onlynet tor /mnt/hdd/bitcoin/bitcoin.conf noquotes
|
|
confAdd onlynet i2p /mnt/hdd/bitcoin/bitcoin.conf
|
|
PASSWORD_B=$(sudo cat /mnt/hdd/bitcoin/bitcoin.conf | grep rpcpassword | cut -c 13-)
|
|
cat << EOF | sudo tee /etc/i2pd/i2pd.conf
|
|
# i2pd settings for the RaspiBlitz
|
|
# for the defaults see:
|
|
# https://github.com/PurpleI2P/i2pd/blob/openssl/contrib/i2pd.conf
|
|
# Docs:
|
|
# https://i2pd.readthedocs.io/en/latest/user-guide/configuration/
|
|
loglevel = none
|
|
[http]
|
|
address=0.0.0.0
|
|
strictheaders = false
|
|
port = 7070
|
|
auth = true
|
|
user = i2pd
|
|
pass = ${PASSWORD_B}
|
|
[httpproxy]
|
|
enabled = false
|
|
[socksproxy]
|
|
enabled = false
|
|
[sam]
|
|
enabled = true
|
|
[bob]
|
|
enabled = false
|
|
[i2cp]
|
|
enabled = false
|
|
[i2pcontrol]
|
|
enabled = false
|
|
[upnp]
|
|
enabled = false
|
|
EOF
|
|
|
|
sudo ufw allow 7070 comment "i2pd-webconsole"
|
|
|
|
# Restart bitcoind and start i2p
|
|
source <(/home/admin/_cache.sh get state)
|
|
if [ "${state}" == "ready" ]; then
|
|
echo "# Starting i2pd service ..."
|
|
sudo systemctl start i2pd
|
|
|
|
echo "# Restart bitcoind ..."
|
|
sudo systemctl restart bitcoind 2>/dev/null
|
|
sleep 10
|
|
fi
|
|
|
|
if i2pd --version; then
|
|
echo "# Installed i2pd"
|
|
else
|
|
echo "# i2pd is not installed"
|
|
exit 1
|
|
fi
|
|
|
|
# setting value in raspiblitz.conf
|
|
/home/admin/config.scripts/blitz.conf.sh set i2pd "on"
|
|
|
|
echo "# Config: /etc/i2pd/i2pd.conf"
|
|
echo "# i2pd web console: ${localip}:7070"
|
|
echo "# Monitor i2p in bitcoind:"
|
|
echo "sudo tail -n 100 /mnt/hdd/bitcoin/debug.log | grep i2p"
|
|
echo "bitcoin-cli -netinfo 4"
|
|
|
|
exit 0
|
|
fi
|
|
|
|
if [ "$1" = "addseednodes" ]; then
|
|
|
|
/home/admin/config.scripts/blitz.i2pd.sh on
|
|
|
|
echo "Add all I2P seed nodes from: https://github.com/bitcoin/bitcoin/blob/master/contrib/seeds/nodes_main.txt"
|
|
i2pSeedNodeList=$(curl -sS https://raw.githubusercontent.com/bitcoin/bitcoin/master/contrib/seeds/nodes_main.txt | grep .b32.i2p:0)
|
|
for i2pSeedNode in ${i2pSeedNodeList}; do
|
|
bitcoin-cli addnode "$i2pSeedNode" "onetry"
|
|
done
|
|
|
|
echo
|
|
echo "# Display sudo tail -n 100 /mnt/hdd/bitcoin/debug.log | grep i2p"
|
|
sudo tail -n 100 /mnt/hdd/bitcoin/debug.log | grep i2p
|
|
echo
|
|
echo "# Display bitcoin-cli -netinfo 4"
|
|
bitcoin-cli -netinfo 4
|
|
|
|
exit 0
|
|
fi
|
|
|
|
# switch off
|
|
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
|
|
|
echo "# stop & remove systemd service"
|
|
sudo systemctl stop i2pd 2>/dev/null
|
|
sudo systemctl disable i2pd.service
|
|
|
|
echo "# Uninstall with apt"
|
|
sudo apt remove -y i2pd
|
|
|
|
echo "# Remove settings from bitcoind"
|
|
/home/admin/config.scripts/blitz.conf.sh delete debug /mnt/hdd/bitcoin/bitcoin.conf noquotes
|
|
/home/admin/config.scripts/blitz.conf.sh set debug tor /mnt/hdd/bitcoin/bitcoin.conf noquotes
|
|
/home/admin/config.scripts/blitz.conf.sh delete i2psam /mnt/hdd/bitcoin/bitcoin.conf noquotes
|
|
/home/admin/config.scripts/blitz.conf.sh delete i2pacceptincoming /mnt/hdd/bitcoin/bitcoin.conf noquotes
|
|
/home/admin/config.scripts/blitz.conf.sh delete onlynet /mnt/hdd/bitcoin/bitcoin.conf noquotes
|
|
/home/admin/config.scripts/blitz.conf.sh set onlynet tor /mnt/hdd/bitcoin/bitcoin.conf noquotes
|
|
|
|
sudo rm /etc/systemd/system/i2pd.service
|
|
|
|
sudo ufw delete allow 7070
|
|
|
|
if ! i2pd --version 2>/dev/null; then
|
|
echo "# OK - i2pd is not installed now"
|
|
else
|
|
echo "# i2pd is still installed"
|
|
exit 1
|
|
fi
|
|
|
|
# setting value in raspiblitz.conf
|
|
/home/admin/config.scripts/blitz.conf.sh set i2pd "off"
|
|
|
|
exit 0
|
|
fi
|
|
|
|
if [ "$1" = "status" ]; then
|
|
bitcoinI2Pstatus
|
|
exit 0
|
|
fi
|
|
|
|
echo "# FAIL - Unknown Parameter $1"
|
|
exit 1
|