#3427 sd card clean bloat (#3495)

This commit is contained in:
/rootzoll
2022-12-06 17:25:06 +01:00
committed by GitHub
parent 022d1eee4f
commit 0a697bb59a
12 changed files with 59 additions and 21 deletions

View File

@@ -21,6 +21,7 @@
- Update: Circuitbreaker v0.3.2 [details](https://github.com/lightningequipment/circuitbreaker/blob/master/README.md)
- Info: Run RaspiBlitz on Proxmox [details](https://github.com/rootzoll/raspiblitz/tree/dev/alternative.platforms/Proxmox)
- Fixed: SCB/Emergency-Backup to USB drive (now also with cln emergency file)
- Info: 32GB sdcard is now enforced (after being recommended since v1.5)
## What's new in Version 1.8.0c of RaspiBlitz?

View File

@@ -69,11 +69,6 @@ function blitzhelp() {
echo " gettx retrieve transaction from mempool or blockchain and print as JSON"
echo " watchtx retrieve transaction from mempool or blockchain until certain confirmation target"
echo
echo "LND:"
echo " balance your satoshi balance"
echo " channels your lightning channels"
echo " fwdreport show forwarding report"
echo
echo "Users:"
echo " bos Balance of Satoshis"
echo " chantools ChanTools"
@@ -85,6 +80,15 @@ function blitzhelp() {
echo "Extras:"
echo " whitepaper download the whitepaper from the blockchain to /home/admin/bitcoin.pdf"
echo " notifyme wrapper for blitz.notify.sh that will send a notification using the configured method and settings"
echo
echo "LND:"
echo " lncli LND commandline interface (when installed)"
echo " balance your satoshi balance"
echo " channels your lightning channels"
echo " fwdreport show forwarding report"
echo
echo "CLN:"
echo " lightning-cli Core-Lightning commandline interface (when installed)"
}
# command: raspiblitz

View File

@@ -10,12 +10,12 @@ source /home/admin/raspiblitz.info </dev/null
# command info
if [ "$1" == "" ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "# tools for the boot drive / sd card"
echo "# blitz.sdcard.sh status"
echo "# blitz.sdcard.sh expand"
echo "# blitz.bootdrive.sh status"
echo "# blitz.bootdrive.sh fsexpand"
exit 1
fi
# check if sudo
# check if su
if [ "$EUID" -ne 0 ]
then echo "Please run as root (with sudo)"
exit 1
@@ -28,7 +28,7 @@ action=$1
# STATUS
# gather data on sd card
minimumSizeByte=8192000000
minimumSizeByte=16384000000
rootPartition=$(sudo mount | grep " / " | cut -d " " -f 1 | cut -d "/" -f 3)
rootPartitionBytes=$(lsblk -b -o NAME,SIZE | grep "${rootPartition}" | tr -s ' ' | cut -d " " -f 2)

View File

@@ -369,8 +369,18 @@ fi
echo
echo "*** MOUNTED DRIVES ***"
echo "df -T -h"
df -T -h
echo
echo "*** SD CARD HOMES ***"
echo "sudo du -ahd1 /home"
sudo du -ahd1 /home
echo
echo "*** LOGFILES ***"
sudo journalctl --disk-usage
sudo du -sh /var/log
echo
echo "*** DATADRIVE ***"
@@ -397,11 +407,6 @@ echo "*** SYSTEM CACHE STATUS ***"
/home/admin/_cache.sh "export" ln_default | grep -v "ln_default_address"
/home/admin/_cache.sh "export" btc_default | grep -v "btc_default_address"
echo
echo "*** LOGFILES ***"
sudo journalctl --disk-usage
sudo du -sh /var/log
echo
echo "*** OPTION: SHARE THIS DEBUG OUTPUT ***"
echo "An easy way to share this debug output on GitHub or on a support chat"

View File

@@ -447,6 +447,10 @@ WantedBy=multi-user.target
bitcoindRestart=yes
fi
# clean up
sudo rm -R /home/electrs/.cargo
sudo rm -R /home/electrs/.rustup
source <(/home/admin/_cache.sh get state)
if [ "${state}" == "ready" ]; then
if [ "${bitcoindRestart}" == "yes" ]; then

View File

@@ -104,6 +104,9 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
# install helipad
sudo -u $HELIPAD_USER $HELIPAD_CARGO_BIN install --path $HELIPAD_BUILD_DIR
# clean up
sudo rm -R $HELIPAD_HOME_DIR/.rustup
###############
# CONFIG
###############

View File

@@ -138,6 +138,7 @@ buildFromSource() {
echo "# compile/install the app. This will take a long time"
sudo -u ${APPID} /home/${APPID}/.cargo/bin/cargo install --path taker --locked --target-dir /home/${APPID}/bin/
exitCode=$?
sudo rm -R /home/${APPID}/.rustup
if ! [ ${exitCode} -eq 0 ]; then
echo "# FAIL - cargo install did not run correctly - deleting code & exit"
sudo rm -r /home/${APPID}/${APPID}
@@ -565,6 +566,9 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
echo "# mark app as uninstalled in raspiblitz config"
/home/admin/config.scripts/blitz.conf.sh set ${APPID} "off"
echo "# delete user"
sudo userdel -rf itchysats 2>/dev/null
# only if 'delete-data' is an additional parameter then also the data directory gets deleted
if [ "$(echo "$@" | grep -c delete-data)" -gt 0 ]; then
echo "# found 'delete-data' parameter --> also deleting the app-data"

View File

@@ -477,12 +477,10 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
isInstalled=$(sudo ls /etc/systemd/system/${systemdService}.service 2>/dev/null | grep -c "${systemdService}.service")
if [ ${isInstalled} -eq 1 ]; then
echo "# Removing RTL for ${LNTYPE} ${CHAIN}"
sudo systemctl disable ${systemdService}.service
sudo rm /etc/systemd/system/${systemdService}.service
echo "# OK ${systemdService} removed."
else
echo "# ${systemdService} is not installed."
fi

View File

@@ -120,7 +120,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "# get the github code ${githubRepo}"
sudo rm -r /home/squeaknode/squeaknode 2>/dev/null
cd /home/squeaknode
sudo -u squeaknode git clone ${githubRepo}.git
sudo -u squeaknode git clone ${githubRepo}.git
cd /home/squeaknode/squeaknode
sudo -u squeaknode git checkout ${pinnedVersion}

View File

@@ -29,7 +29,7 @@ PORT="${portprefix}4772"
function buildGRPCplugin() {
echo "# - Build the cln-grpc plugin"
if [ ! -f /home/bitcoin/cl-plugins-available/cln-grpc/debug/cln-grpc ]; then
if [ ! -f /home/bitcoin/cl-plugins-available/cln-grpc ]; then
# check if the source code is present
if [ ! -d /home/bitcoin/lightning/plugins/grpc-plugin ];then
echo "# - install Core Lightning ..."
@@ -41,19 +41,31 @@ function buildGRPCplugin() {
cd /home/bitcoin/lightning/plugins/grpc-plugin || exit 1
# build
sudo -u bitcoin /home/bitcoin/.cargo/bin/cargo build \
--target-dir /home/bitcoin/cl-plugins-available/cln-grpc
--target-dir /home/bitcoin/cln-grpc-build
# delete old dir or binary
sudo rm -rf /home/bitcoin/cl-plugins-available/cln-grpc
# move to /home/bitcoin/cl-plugins-available/
sudo -u bitcoin mv /home/bitcoin/cln-grpc-build/debug/cln-grpc /home/bitcoin/cl-plugins-available/
else
echo "# - cln-grpc plugin was already built/installed"
fi
echo "# Cleaning"
sudo rm -rf /home/bitcoin/.rustup
sudo rm -rf /home/bitcoin/.cargo/
sudo rm -rf /home/bitcoin/.cache
sudo rm -rf /home/bitcoin/cln-grpc-build
}
function switchOn() {
if ! "$lightningcli_alias" plugin list | grep "/home/bitcoin/${netprefix}cl-plugins-enabled/cln-grpc"; then
if ! $lightningcli_alias plugin list | grep "/home/bitcoin/${netprefix}cl-plugins-enabled/cln-grpc"; then
buildGRPCplugin
# symlink to plugin directory
echo "# symlink cln-grpc to /home/bitcoin/${netprefix}cl-plugins-enabled/"
sudo ln -s /home/bitcoin/cl-plugins-available/cln-grpc/debug/cln-grpc /home/bitcoin/${netprefix}cl-plugins-enabled/
# delete old symlink
sudo rm /home/bitcoin/${netprefix}cl-plugins-enabled/cln-grpc
sudo ln -s /home/bitcoin/cl-plugins-available/cln-grpc /home/bitcoin/${netprefix}cl-plugins-enabled/
# blitz.conf.sh set [key] [value] [?conffile] <noquotes>
/home/admin/config.scripts/blitz.conf.sh set "grpc-port" "${PORT}" "${CLCONF}" "noquotes"
/home/admin/config.scripts/blitz.conf.sh set "${netprefix}clnGRPCport" "${PORT}"

View File

@@ -97,6 +97,10 @@ if [ "$1" = "on" ];then
echo
sudo -u bitcoin /home/bitcoin/.cargo/bin/cargo build --release
sudo chmod a+x /home/bitcoin/cl-plugins-available/c-lightning-http-plugin/target/release/c-lightning-http-plugin
# clean up
sudo rm -R /home/bitcoin/.cargo
sudo rm -R /home/bitcoin/.rustup
fi
if [ ! -L /home/bitcoin/cl-plugins-enabled/c-lightning-http-plugin ];then

View File

@@ -482,6 +482,9 @@ alias ${netprefix}lndconf=\"sudo nano /home/bitcoin/.lnd/${netprefix}lnd.conf\"\
fi
fi
# needed to make lnd.newwallet.py work
pip install --upgrade google-api-python-client
exit 0
fi