source: trunk/packs/maint/local-menus.sh @ 19932

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).
5menutar=/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.
9menudir=/usr/athena/share/gnome/athena/menus
10
11# Local copy of the menu tar file.
12localtar=/var/athena/menus.tar
13
14# Local copy of the menu directory (made from the tar file, not from
15# $menudir).
16localdir=/var/athena/menus.copy
17
18# What panel refers to; will be a symlink to either $localdir or
19# $menudir.
20menus=/var/athena/menus
21
22fail() {
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.
29if [ ! -s $menutar ]; then
30  fail
31fi
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.)
37if [ -s $localtar ] && \
38   [ "`find $menutar -newer $localtar`" != $menutar ] && \
39   [ "`find $menutar -follow -newer $localtar`" != $menutar ]; then
40  exit 0
41fi
42
43# Update the local menus area.
44cp $menutar $localtar || fail
45rm -rf $localdir
46mkdir $localdir || fail
47(cd $localdir && tar xof $localtar) || fail
48chmod -R a+rX $localdir || fail
49rm -rf $menus
50ln -s $localdir $menus
Note: See TracBrowser for help on using the repository browser.