1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #!/usr/bin/env bash
- # This script will add scripts-* to the PATH and the manual to each user's desktop
- # Copyright 2021-2024 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
- target=/usr/local/bin
- for script in script-*; do
- echo "Linking $script to $target"
- [[ $script == "script-functions" ]] && install -m 644 "$script" "$target"
- sudo ln -s "$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
|