Hi all, I did not see anything like what I needed so I created one. Below is a script to copy image files to a users local directory. It works fine, very basic, but I'd like to combine the two if statements and work out an exit code if the source files are not present. If anyone is bored out there???? : )
#!/bin/sh
#Created by Brian LaMantia 6/1/2020
#Move FIS background images from /private/tmp to the current users Uploads folder in Teams.
#Run after the images are deployed to the tmp folder then displays a message to the user.
#If the package fails, do not display a message.
#If you make this better, post a copy for me!
#get current user
currentUser=$(/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }')
#Check if the images package was installed
sourceFiles=/private/tmp/Teams
#Check if Teams uploads folder exists
teamsPath=/Users/"$currentUser"/Library/Application Support/Microsoft/Teams/Backgrounds/Uploads/
#jamfhelper path
jamfHelper=/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper
#set icon
icon=/Applications/Microsoft Teams.app/Contents/Resources/icon.icns
if [ ! -d "$sourceFiles" ]; then
echo "Missing source files, script will fail, did not display messsage."
else
#Tell the user that the backgrounds are available.
"$jamfHelper" -windowType hud -windowPosition ul -title "Your title here" -heading "Microsoft Teams" -description "Check it out! New Teams video backgrounds are available now. We hope you enjoy them!" -icon "$icon" -button1 "OK" &
fi
#if teamsPath exists copy background images to the Uploads folder and set permissions, else quit
if [ -d "$teamsPath" ]; then
cp /private/tmp/Teams/*.* /Users/"$currentUser"/Library/Application Support/Microsoft/Teams/Backgrounds/Uploads
chown "$currentUser":wheel /Users/"$currentUser"/Library/Application Support/Microsoft/Teams/Backgrounds/Uploads/*.*
else
echo "Path is missing, creating required folders"
mkdir -p /Users/"$currentUser"/Library/Application Support/Microsoft/Teams/Backgrounds/Uploads
cp /private/tmp/Teams/*.* /Users/"$currentUser"/Library/Application Support/Microsoft/Teams/Backgrounds/Uploads
chown "$currentUser":wheel /Users/"$currentUser"/Library/Application Support/Microsoft/Teams/Backgrounds/Uploads/*.*
fi