script-deploy-manual 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env bash
  2. # This script installs the Hartman Lab Server Manual to each user's desktop
  3. # Copyright 2021-2025 Bryan C. Roessler
  4. # Licensed under the Apache License, Version 2.0
  5. p="${BASH_SOURCE[0]%/*}"; [[ -r $p/script-functions ]] && . "$p"/script-functions || exit 1
  6. manual_url="https://github.com/UAB-Hartman-Lab/server"
  7. remove=("manual.pdf" "manual.odt" "Notes.pdf" "Notes.odt" \
  8. "README.html" "Link to Manual.desktop" "manual-images" \
  9. "manual.html" "Manual.desktop" "manual.desktop")
  10. is_root
  11. for desktop in /home/*/Desktop; do
  12. [[ -d $desktop ]] || continue
  13. echo "Removing old manuals from $desktop"
  14. for f in "${remove[@]}"; do
  15. [[ -z $f ]] && continue
  16. if [[ -e $desktop/$f || -L $desktop/$f ]]; then
  17. echo "Removing $desktop/$f"
  18. rm -f -- "${desktop:?}/$f"
  19. fi
  20. done
  21. echo "Installing manual to $desktop/manual.desktop"
  22. cat <<-EOF > "$desktop/manual.desktop"
  23. [Desktop Entry]
  24. Encoding=UTF-8
  25. Name=Hartman Lab Server Manual
  26. Type=Link
  27. URL=$manual_url
  28. Icon=text-html
  29. EOF
  30. chmod 644 "$desktop/manual.desktop"
  31. done