| Free Software at Schools: Installing and Maintaining a Debian-Edu Network; Also Known as Skolelinux | ||
|---|---|---|
| Prev | Appendix H. Various "Homemade" Solutions | Next |
For more information about desktop icons and menus, see Chapter 11
Sometimes it can be nice for all users to have a specific desktop icon. If you have 1000 users, then it's even nicer if you can place that icon on everyone's desktop in one sweep.
All shortcuts are really a file. These files are stored in the directory Desktop in the user's home directory. For example, the file that represents the shortcut to the web browser Mozilla is Mozilla_Navigator.desktop; the contents of the file start with:
[Desktop Entry] Type=Application Exec=mozilla Name=Mozilla Navigator Comment=Mozilla Navigator Icon=/usr/share/pixmaps/mozilla.xpmThis is where you find information about where the program is installed, what kind of icon is used, etc.
For example, if you want everyone to have the icon for OpenOffice.org on their desktop as a shortcut (the file in this case is called textdoc.desktop), then you have to do the following as root:
A File Distributed to All Users Simultaneously
First you have to manually add this shortcut to the desktop of one user, for example the user "test". The shortcut will then be found in the directory /skole/tjener/home0/test/Desktop/textdoc.desktop.
The next thing you do is create a script that does the following:
Copies the file textdoc.desktop over to theDesktop-directory for all of your uesrs.
Ensures that the permissions for this file are correct, that is they are set up so that they are owned by the user, and not by root.
#!/bin/sh
#Saved as e.g. spread-desktop
#used as follows ./spread-desktop path-to-target.desktop
#remember to make the script executeable with chmod 755 spread-desktop
#If the users are stored somewhere other than home0, then you must
#change the variable HOMEDIRS below accordingly.
#If your home directories are in different directories on
#/skole/tjener/home0, e.g. /skole/tjener/home0/2004-A,
#then you need to add them all to HOMEDIRS using the spacebar to separate them.
#For example HOMEDIRS="/skole/tjener/home0/2004-B /skole/tjener/home0/2004-A"
#
HOMEDIRS="/skole/tjener/home0"
#
# If there is a "Desktop"-directory, then we copy into it.
copykde () {
if [ -d $U/Desktop ]
then
cp -a "$FILE" $U/Desktop
DEST="`basename \"$FILE\"`"
chown --reference=$U/ $U/Desktop/"$DEST"
fi
}
while [ $# -gt 0 ]
do
FILE="$1"
if [ -f "$FILE" ]
then
# find all folders under /home
for H in $HOMEDIRS
do
USERLIST="`ls -ad $H/*`"
if [ "$USERLIST" ]
then
# for each user
for U in $USERLIST
do
copykde
done
fi
done
fi
shift
done
You can save this script in the root home directory. In this example, the file textdoc.desktop is found under the user test, so the command to copy this file over to all of your uses will be:
./spread-desktop /skole/tjener/home0/test/Desktop/textdoc.desktop