script-deploy-manual 1008 B

1234567891011121314151617181920212223242526272829303132
  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. if [[ -e $desktop/$f || -L $desktop/$f ]]; then
  16. echo "Removing $desktop/$f"
  17. rm -f "${desktop:?}/$f"
  18. fi
  19. done
  20. echo "Installing manual to $desktop/manual.desktop"
  21. cat <<-EOF > "$desktop/manual.desktop"
  22. [Desktop Entry]
  23. Encoding=UTF-8
  24. Name=Hartman Lab Server Manual
  25. Type=Link
  26. URL=$manual_url
  27. Icon=text-html
  28. EOF
  29. done