#!/bin/sh # # A quick-n-dirty little script that will copy a folder to all user's # $HOME folders # # give the user a usage message if there were no files specified if [ ! "$1" ] then if [ "$DISPLAY" ] then gdialog --title "Push new icons to all user's desktops" --msgbox "Create a new icon on your desktop.\nOnce it is working the way you want it to, drag-n-drop the new icon ontop of this one and the icon will be copied to all user's home directories" 10 55 else echo echo "This script will copy a *.desktop file to all " echo "user's home directories" echo echo "Usage:" echo " $0 " echo echo fi fi FOLDER="$1" # copy $FOLDER as a Folder to all Users if [ -d "$FOLDER" ] then echo "starting to copy $FOLDER to all users\n" # save a copy in /etc/skel for new users if [ -d /etc/skel ] then cp -af "$FOLDER" /etc/skel/ fi DEST="`basename \"$FOLDER\"`" # find all of the subdirectories under /home #getent passwd | cut -d: -f6 | while read U ls -d /home/pc* /home/science/ /home/bible/ /home/math/ /home/internet/ /home/office/ /home/konqi/ /home/teacher/ /home/talmid/ /home/classview/ | while read U do # copy new-style Desktop if [ -d "$U"/ ]; then cp -auf "$FOLDER" "$U"/ chown -R --reference="$U" "$U"/"$DEST" echo "copying folder: $FOLDER --> $U" # refresh Firefox's Extension list (hack) if [ "$FOLDER" == "/home/sandbox/.mozilla" ]; then echo "$U -- refreshing Firefox's Extension list (hack)" rm -f $U"/.mozilla/firefox/zx6jhkkl.default/extensions.ini" rm -f $U"/.mozilla/firefox/zx6jhkkl.default/extensions.cache" rm -f $U"/.mozilla/firefox/zx6jhkkl.default/compreg.dat" fi fi done fi # copy $FOLDER as a file to all Users if [ -f "$FOLDER" ] then echo "starting to copy file $FOLDER to all users\n" # save a copy in /etc/skel for new users if [ -d /etc/skel ] then cp -auf "$FOLDER" /etc/skel/ fi #DEST="`basename \"$FOLDER\"`" # find all of the subdirectories under /home #getent passwd | cut -d: -f6 | while read U ls -d /home/pc* /home/science/ /home/bible/ /home/math/ /home/internet/ /home/office/ /home/konqi/ /home/teacher/ /home/talmid/ /home/classview/| while read U do # copy new-style Desktop if [ -d "$U"/ ]; then cp -af "$FOLDER" "$U"/ chown -R --reference="$U" "$U"/"$DEST" echo "copying file: $FOLDER --> $U" fi done fi shift