You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
newtype-org-configurations/docs/generate-host-info.sh

15 lines
597 B
Bash

#!/usr/bin/env bash
hostname=$(echo "$2")
report="$hostname.md"
lstopo="$hostname.lstopo.svg"
echo -e "# ${hostname}\n" > "$report"
echo "\`\`\`" >> "$report"
ssh "$1" -- nix-shell -p \'inxi.override { withRecommends = true\; }\' --run \"sudo inxi -F -a -i --slots -xxx -c0 -Z -i -m\" >> "$report"
ssh "$1" -- nix-shell -p hwloc -p dmidecode --run \"sudo lstopo /tmp/$hostname.lstopo.svg\"
scp "$1":/tmp/$hostname.lstopo.svg "$lstopo"
ssh "$1" -- sudo rm /tmp/$hostname.lstopo.svg
echo "\`\`\`" >> "$report"
echo "![hardware topology]($hostname.lstopo.svg)" >> "$report"
echo "wrote $report" >&2