mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-03-17 21:31:45 +01:00
Improve localIP assignment and SSD detection (#3439)
This commit is contained in:
parent
74ee085400
commit
9fe1c47048
@ -302,7 +302,7 @@ echo -e "\n*** SOFTWARE UPDATE ***"
|
||||
# sqlite3 -> database
|
||||
# fdisk -> create partitions
|
||||
# lsb-release -> needed to know which distro version we're running to add APT sources
|
||||
general_utils="policykit-1 htop git curl bash-completion vim jq dphys-swapfile bsdmainutils autossh telnet vnstat parted dosfstools btrfs-progs fbi sysbench build-essential dialog bc python3-dialog unzip whois fdisk lsb-release"
|
||||
general_utils="policykit-1 htop git curl bash-completion vim jq dphys-swapfile bsdmainutils autossh telnet vnstat parted dosfstools btrfs-progs fbi sysbench build-essential dialog bc python3-dialog unzip whois fdisk lsb-release smartmontools"
|
||||
|
||||
# python3-mako --> https://github.com/rootzoll/raspiblitz/issues/3441
|
||||
python_dependencies="python3-venv python3-dev python3-wheel python3-jinja2 python3-pip python3-mako"
|
||||
|
@ -38,6 +38,18 @@ if [ ${btrfsInstalled} -eq 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# install smartmontools if needed
|
||||
smartmontoolsInstalled=$(apt-cache policy smartmontools | grep -c 'Installed: (none)' | grep -c "0")
|
||||
if [ ${smartmontoolsInstalled} -eq 0 ]; then
|
||||
>&2 echo "# Installing smartmontools ..."
|
||||
apt-get install -y smartmontools 1>/dev/null
|
||||
fi
|
||||
smartmontoolsInstalled=$(apt-cache policy smartmontools | grep -c 'Installed: (none)' | grep -c "0")
|
||||
if [ ${smartmontoolsInstalled} -eq 0 ]; then
|
||||
echo "error='missing smartmontools package'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
###################
|
||||
# STATUS
|
||||
###################
|
||||
@ -51,6 +63,7 @@ isBTRFS=$(btrfs filesystem show 2>/dev/null| grep -c 'BLITZSTORAGE')
|
||||
isRaid=$(btrfs filesystem df /mnt/hdd 2>/dev/null | grep -c "Data, RAID1")
|
||||
isZFS=$(zfs list 2>/dev/null | grep -c "/mnt/hdd")
|
||||
isSSD="0"
|
||||
isSMART="0"
|
||||
|
||||
# determine if swap is external on or not
|
||||
externalSwapPath="/mnt/hdd/swapfile"
|
||||
@ -162,8 +175,16 @@ if [ "$1" = "status" ]; then
|
||||
hddDataPartition=""
|
||||
fi
|
||||
|
||||
# try to detect if its an SSD
|
||||
isSSD=$(cat /sys/block/${hdd}/queue/rotational 2>/dev/null | grep -c 0)
|
||||
# try to detect if its an SSD
|
||||
isSMART=$(sudo smartctl -a /dev/${hdd} | grep -c "Rotation Rate:")
|
||||
echo "isSMART=$(isSMART)"
|
||||
if [ ${isSMART} -gt 0 ]; then
|
||||
#detect using smartmontools (preferred)
|
||||
isSSD=$(sudo smartctl -a /dev/${hdd} | grep 'Rotation Rate:' | grep -c "Solid State")
|
||||
else
|
||||
#detect using using fall back method
|
||||
isSSD=$(cat /sys/block/${hdd}/queue/rotational 2>/dev/null | grep -c 0)
|
||||
fi
|
||||
echo "isSSD=${isSSD}"
|
||||
|
||||
# display results from hdd & partition detection
|
||||
@ -384,7 +405,16 @@ if [ "$1" = "status" ]; then
|
||||
fi
|
||||
echo "hddRaspiVersion='${hddRaspiVersion}'"
|
||||
|
||||
isSSD=$(cat /sys/block/${hdd}/queue/rotational 2>/dev/null | grep -c 0)
|
||||
# try to detect if its an SSD
|
||||
isSMART=$(sudo smartctl -a /dev/${hdd} | grep -c "Rotation Rate:")
|
||||
echo "isSMART=$(isSMART)"
|
||||
if [ ${isSMART} -gt 0 ]; then
|
||||
#detect using smartmontools (preferred)
|
||||
isSSD=$(sudo smartctl -a /dev/${hdd} | grep 'Rotation Rate:' | grep -c "Solid State")
|
||||
else
|
||||
#detect using using fall back method
|
||||
isSSD=$(cat /sys/block/${hdd}/queue/rotational 2>/dev/null | grep -c 0)
|
||||
fi
|
||||
echo "isSSD=${isSSD}"
|
||||
|
||||
echo "datadisk='${hdd}'"
|
||||
|
@ -24,7 +24,7 @@ source <(/home/admin/config.scripts/network.aliases.sh getvars cl $2)
|
||||
if [ "$1" = "menu" ]; then
|
||||
|
||||
# get network info
|
||||
localip=$(ip addr | grep 'state UP' -A2 | grep -E -v 'docker0|veth' | grep 'eth0\|wlan0\|enp0' | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
localip=$(hostname -I | awk '{print $1}')
|
||||
toraddress=$(sudo cat /mnt/hdd/tor/${netprefix}sparko/hostname)
|
||||
toraddresstext="Hidden Service address for the Tor Browser (QRcode on LCD):\n$toraddress"
|
||||
if [ ${#toraddress} -eq 0 ];then
|
||||
@ -51,7 +51,7 @@ ${toraddresstext}
|
||||
fi
|
||||
|
||||
if [ $1 = connect ];then
|
||||
localip=$(ip addr | grep 'state UP' -A2 | grep -E -v 'docker0|veth' | grep 'eth0\|wlan0\|enp0' | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
localip=$(hostname -I | awk '{print $1}')
|
||||
toraddress=$(sudo cat /mnt/hdd/tor/${netprefix}sparko/hostname)
|
||||
accesskey=$(sudo cat ${CLCONF} | grep "^sparko-keys=" | cut -d= -f2 | cut -d';' -f1)
|
||||
url="https://${localip}:${portprefix}9000/"
|
||||
|
@ -36,7 +36,7 @@ if [ "$1" = connect ];then
|
||||
|
||||
echo "# Allowing port ${portprefix}6100 through the firewall"
|
||||
sudo ufw allow "${portprefix}6100" comment "${netprefix}clrest" 1>/dev/null
|
||||
localip=$(ip addr | grep 'state UP' -A2 | grep -E -v 'docker0|veth' | grep 'eth0\|wlan0\|enp0' | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
localip=$(hostname -I | awk '{print $1}')
|
||||
# hidden service to https://xx.onion
|
||||
/home/admin/config.scripts/tor.onion-service.sh ${netprefix}clrest 443 ${portprefix}6100 1>/dev/null
|
||||
|
||||
|
@ -22,7 +22,7 @@ systemdService="${netprefix}spark"
|
||||
if [ "$1" = "menu" ]; then
|
||||
|
||||
# get network info
|
||||
localip=$(ip addr | grep 'state UP' -A2 | grep -E -v 'docker0|veth' | grep 'eth0\|wlan0\|enp0' | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
localip=$(hostname -I | awk '{print $1}')
|
||||
toraddress=$(sudo cat /mnt/hdd/tor/${netprefix}spark-wallet/hostname)
|
||||
toraddresstext="Hidden Service address for the Tor Browser (QRcode on LCD):\n$toraddress"
|
||||
if [ ${#toraddress} -eq 0 ];then
|
||||
@ -170,4 +170,4 @@ if [ $1 = off ];then
|
||||
# setting value in raspi blitz config
|
||||
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}spark "off"
|
||||
echo "# ${netprefix}spark was uninstalled"
|
||||
fi
|
||||
fi
|
||||
|
@ -6,7 +6,7 @@ sudo -u bitcoin mkdir /mnt/hdd/app-data/selfsignedcert
|
||||
cd /mnt/hdd/app-data/selfsignedcert || exit 1
|
||||
|
||||
echo "# Create a self signed SSL certificate"
|
||||
localip=$(ip addr | grep 'state UP' -A2 | grep -E -v 'docker0|veth' | grep 'eth0\|wlan0\|enp0' | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
localip=$(hostname -I | awk '{print $1}')
|
||||
|
||||
sudo -u bitcoin openssl genrsa -out selfsigned.key 2048
|
||||
#https://www.humankode.com/ssl/create-a-selfsigned-certificate-for-nginx-in-5-minutes
|
||||
|
Loading…
x
Reference in New Issue
Block a user