Skip to content

Commit

Permalink
apply shellcheck
Browse files Browse the repository at this point in the history
Signed-off-by: Maciej Pijanowski <[email protected]>
  • Loading branch information
macpijan committed Apr 15, 2024
1 parent 9737780 commit 91261f9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 4 additions & 2 deletions include/dts-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,8 @@ You can find more info about HCL in docs.dasharo.com/glossary\r"

show_ram_inf() {
# Get the data:
local data=$(dmidecode)
local data=""
data=$(dmidecode)

# Initialize an empty array to store the extracted values:
local -a memory_devices_array
Expand Down Expand Up @@ -1333,7 +1334,8 @@ show_des_credentials() {

show_ssh_info() {
if systemctl is-active sshd.socket &> /dev/null; then
local ip=$(ip -br -f inet a show scope global | grep UP | awk '{ print $3 }' | tr '\n' ' ')
local ip=""
ip=$(ip -br -f inet a show scope global | grep UP | awk '{ print $3 }' | tr '\n' ' ')
# Display "check your connection" in red color in IP field in case no IPV4
# address is assigned, otherwise display IP/PORT:
if [[ -z "$ip" ]]; then
Expand Down
12 changes: 9 additions & 3 deletions scripts/dasharo-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -739,18 +739,24 @@ restore() {
read -r -p "Enter an option: " OPTION
echo

local network_dev=""
local mac_addr=""
local uuid_string=""

# HCL report should be named as in dasharo-hcl-report so we can find
# the package based on uuid saved in name, we need to check two options
# with and without MAC address
uuid_string="$(cat /sys/class/net/$(ip route show default | awk '/default/ {print $5}')/address)"
network_dev="$(ip route show default | head -1 | awk '/default/ {print $5}')"
mac_addr="$(cat /sys/class/net/${network_dev}/address)"
uuid_string="$(cat /sys/class/net/)"
# if above gives error then there is no internet connection and first
# part of uuid should be blank
if [ ! $? -eq 0 ]; then
uuid_string=""
fi
uuid_string+="_$(dmidecode -s system-product-name)"
uuid_string="${mac_addr}_$(dmidecode -s system-product-name)"
uuid_string+="_$(dmidecode -s system-manufacturer)"
uuid=`uuidgen -n @x500 -N $uuid_string -s`
uuid="$(uuidgen -n @x500 -N $uuid_string -s)"

case ${OPTION} in
1)
Expand Down

0 comments on commit 91261f9

Please sign in to comment.