Revision 19932,
1.4 KB
checked in by ghudson, 21 years ago
(diff) |
Check the timestamp on the $menutar symlink as well as what it points
to.
|
Line | |
---|
1 | #!/bin/sh |
---|
2 | # $Id: local-menus.sh,v 1.4 2003-10-23 23:11:49 ghudson Exp $ |
---|
3 | |
---|
4 | # Tar file containing menus (a symlink into the AFS system config area). |
---|
5 | menutar=/usr/athena/share/gnome/athena/menus.tar |
---|
6 | |
---|
7 | # Menu directory; used as a fallback if we can't make a local copy of |
---|
8 | # the menus. |
---|
9 | menudir=/usr/athena/share/gnome/athena/menus |
---|
10 | |
---|
11 | # Local copy of the menu tar file. |
---|
12 | localtar=/var/athena/menus.tar |
---|
13 | |
---|
14 | # Local copy of the menu directory (made from the tar file, not from |
---|
15 | # $menudir). |
---|
16 | localdir=/var/athena/menus.copy |
---|
17 | |
---|
18 | # What panel refers to; will be a symlink to either $localdir or |
---|
19 | # $menudir. |
---|
20 | menus=/var/athena/menus |
---|
21 | |
---|
22 | fail() { |
---|
23 | rm -f $menus $localtar # Removing $localtar ensures we will try again. |
---|
24 | ln -s $menudir $menus |
---|
25 | exit 1 |
---|
26 | } |
---|
27 | |
---|
28 | # Fail quietly if the menu tar file doesn't exist. |
---|
29 | if [ ! -s $menutar ]; then |
---|
30 | fail |
---|
31 | fi |
---|
32 | |
---|
33 | # Nothing to do if $localtar is up to date. (Check the $menutar |
---|
34 | # symlink as well as what it points to; after a full release, the |
---|
35 | # target of the symlink might not be newer than the last time we |
---|
36 | # updated, but the symlink itself will be newer.) |
---|
37 | if [ -s $localtar ] && \ |
---|
38 | [ "`find $menutar -newer $localtar`" != $menutar ] && \ |
---|
39 | [ "`find $menutar -follow -newer $localtar`" != $menutar ]; then |
---|
40 | exit 0 |
---|
41 | fi |
---|
42 | |
---|
43 | # Update the local menus area. |
---|
44 | cp $menutar $localtar || fail |
---|
45 | rm -rf $localdir |
---|
46 | mkdir $localdir || fail |
---|
47 | (cd $localdir && tar xof $localtar) || fail |
---|
48 | chmod -R a+rX $localdir || fail |
---|
49 | rm -rf $menus |
---|
50 | ln -s $localdir $menus |
---|
Note: See
TracBrowser
for help on using the repository browser.