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

Revision 22351, 1.7 KB checked in by ghudson, 19 years ago (diff)
Prevent menu cache coherency problems when updating to a new full release.
Line 
1#!/bin/sh
2# $Id: local-menus.sh,v 1.5 2005-11-04 17:27:10 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# Record of the release version of the last menu update
15versionfile=/var/athena/menus.version
16
17# Local copy of the menu directory (made from the tar file, not from
18# $menudir).
19localdir=/var/athena/menus.copy
20
21# What panel refers to; will be a symlink to either $localdir or
22# $menudir.
23menus=/var/athena/menus
24
25fail() {
26  rm -f $menus $localtar        # Removing $localtar ensures we will try again.
27  ln -s $menudir $menus
28  exit 1
29}
30
31# Fail quietly if the menu tar file doesn't exist.
32if [ ! -s $menutar ]; then
33  fail
34fi
35
36oldversion=none
37newversion=`/bin/athena/machtype -A`
38if [ -s $versionfile ]; then
39  oldversion=`cat $versionfile`
40fi
41
42# Nothing to do if $localtar is up to date.  (Check the $menutar
43# symlink as well as what it points to; after a full release, the
44# target of the symlink might not be newer than the last time we
45# updated, but the symlink itself will be newer.)
46if [ "x$oldversion" = "x$newversion" ] && \
47   [ -s $localtar ] && \
48   [ "`find $menutar -newer $localtar`" != $menutar ] && \
49   [ "`find $menutar -follow -newer $localtar`" != $menutar ]; then
50  exit 0
51fi
52
53# Update the local menus area.
54cp $menutar $localtar || fail
55rm -rf $localdir
56mkdir $localdir || fail
57(cd $localdir && tar xof $localtar) || fail
58chmod -R a+rX $localdir || fail
59rm -rf $menus
60ln -s $localdir $menus
61echo "$newversion" > $versionfile
Note: See TracBrowser for help on using the repository browser.