Update script-deploy-manual

This commit is contained in:
2025-07-23 23:32:33 -04:00
parent 16fbd908a2
commit 56481c584a
2 changed files with 16 additions and 41 deletions

View File

@@ -91,7 +91,7 @@ X2Go sessions can be paused or suspended from the X2Go client window. Multiple s
## Robot computer remote desktop access ## Robot computer remote desktop access
In an X2Go session, go to *Applications>Internet>Remote Viewer>Connection>New* and enter `vnc://192.168.16.101:5900` In an X2Go session, go to *Applications>Internet>Remote Viewer>Connection>New* and enter [`vnc://192.168.16.101:5900`](vnc://192.168.16.101:5900)
## Webcam robot monitoring ## Webcam robot monitoring

View File

@@ -1,44 +1,26 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# This script installs the Hartman Lab Server Manual to each user's desktop # This script installs the Hartman Lab Server Manual to each user's desktop
# Usage: script-deploy-manual USERNAME|--all
# Copyright 2021-2025 Bryan C. Roessler # Copyright 2021-2025 Bryan C. Roessler
# Licensed under the Apache License, Version 2.0 # Licensed under the Apache License, Version 2.0
p="${BASH_SOURCE[0]%/*}"; [[ -r $p/script-functions ]] && . "$p"/script-functions || exit 1
script-deploy-manual() { manual_url="https://github.com/UAB-Hartman-Lab/server"
local user_arg="$1" remove=("manual.pdf" "manual.odt" "Notes.pdf" "Notes.odt" \
local manual_url="https://github.com/UAB-Hartman-Lab/server"
local remove=("manual.pdf" "manual.odt" "Notes.pdf" "Notes.odt" \
"README.html" "Link to Manual.desktop" "manual-images" \ "README.html" "Link to Manual.desktop" "manual-images" \
"manual.html" "Manual.desktop" "manual.desktop") "manual.html" "Manual.desktop" "manual.desktop")
local users=()
if [[ -z "$user_arg" || "$user_arg" == "--help" ]]; then is_root
cat <<-EOF
Usage: script-deploy-manual USERNAME|--all
USERNAME: Specify a single user's name.
--all: Deploy the manual to all users with a Desktop directory.
EOF
return 1
fi
if [[ "$user_arg" == "--all" ]]; then for desktop in /home/*/Desktop; do
for d in /home/*; do [[ -d $d ]] && users+=("${d##*/}"); done [[ -d $desktop ]] || continue
else echo "Removing old manuals from $desktop"
users+=("$user_arg") for f in "${remove[@]}"; do
fi if [[ -e $desktop/$f || -L $desktop/$f ]]; then
echo "Removing $desktop/$f"
for user in "${users[@]}"; do rm -f "${desktop:?}/$f"
desktop="/home/$user/Desktop" fi
[[ -d $desktop ]] || continue done
echo "Scanning $desktop for old manuals" echo "Installing manual to $desktop/manual.desktop"
for f in "${remove[@]}"; do
if [[ -e $desktop/$f || -L $desktop/$f ]]; then
echo "Removing $desktop/$f"
rm -f "${desktop:?}/$f"
fi
done
echo "Installing manual to $desktop/manual.desktop"
cat <<-EOF > "$desktop/manual.desktop" cat <<-EOF > "$desktop/manual.desktop"
[Desktop Entry] [Desktop Entry]
Encoding=UTF-8 Encoding=UTF-8
@@ -47,11 +29,4 @@ script-deploy-manual() {
URL=$manual_url URL=$manual_url
Icon=text-html Icon=text-html
EOF EOF
done done
}
# Allow script to be safely sourced
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
script-deploy-manual "$@"
exit
fi