12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #!/usr/bin/env bash
- # This script will add scripts-* to the PATH and the manual to each user's desktop
- # Copyright 2021-2023 Bryan C. Roessler
- parent="${BASH_SOURCE[0]}"
- parent=${parent%/*}
- reload=0
- [[ -f $parent/script-functions ]] && . "$parent"/script-functions || reload=1
- sourcedir="/home/roessler/shared/hartmanlab"
- original_dir="$PWD"
- if [[ "$original_dir" != "$sourcedir" ]]; then
- pushd "$sourcedir" || exit $?
- fi
- (( reload )) && [[ -f $parent/script-functions ]] && . "$parent"/script-functions
- is_root
- target=/usr/local/bin
- for script in script-*; do
- echo "Installing $script to $target"
- [[ $script == "script-functions" ]] && install -m 644 "$script" "$target"
- cp -u "$script" "$target/"
- done
- # Install manual link
- remove=("manual.pdf" "manual.odt" "Notes.pdf" "Notes.odt"
- "README.html" "Link to Manual.desktop" "manual-images"
- "manual.html" "manual-images" "Manual.desktop" "manual.desktop")
- for homedir in /home/*; do
- desktop="$homedir/Desktop"
- [[ -d $desktop ]] || continue
- echo "Scanning $desktop for old manuals"
- for f in "${remove[@]}"; do
- [[ -e $desktop/$f || -L $desktop/$f ]] &&
- echo "Removing $desktop/$f" &&
- rm -f "${desktop:?}/$f"
- done
- echo "Installing manual to $desktop/manual.desktop"
- cat <<-EOF > "$desktop/manual.desktop"
- [Desktop Entry]
- Encoding=UTF-8
- Name=Hartman Lab Server Manual
- Type=Link
- URL=https://docs.google.com/document/d/1K_KwAlv8Zljmy-enwmhT6gMTFutlAFglixvpLGBx0VY
- Icon=text-html
- EOF
- done
|