Files
hartman-server/script-install-manual-scripts
2021-10-22 19:33:06 -04:00

39 lines
917 B
Bash
Executable File

#!/usr/bin/env bash
# This script will add scripts-* to the PATH and the manual to each user's desktop
# Copyright 2021 Bryan C. Roessler
parent="${BASH_SOURCE[0]}"
parent=${parent%/*}
sourcedir="/home/roessler/shared/hartmanlab"
original_dir="$PWD"
if [[ "$original_dir" != "$sourcedir" ]]; then
cd "$sourcedir" || exit $?
fi
[[ -f functions ]] && . functions || exit 1
is_root
install -m 644 ./functions /usr/local/bin/
for script in script-*; do
cp -u "$script" /usr/local/bin/
done
# Install manual
manual="README.html"
[[ ! -f "$manual" ]] && echo "No manual found, skipping!" && exit 1
for homedir in /home/*; do
remove=("manual.pdf" "manual.odt" "Notes.pdf" "Notes.odt" "$manual")
for f in "${remove[@]}"; do
rm -f "${homedir}/Desktop/$f"
done
[[ -d "$homedir/Desktop" ]] && ln -fs "$sourcedir/$manual" "${homedir}/Desktop/$manual"
done
cd "$original_dir" || exit $?