Miark wrote:

>I have the opposite problem. I installed Gnome2 directly from
>Ximian, and having updating software using Red Carpet, some 
>of my menu items have disappeared. Most notably, XMMS and gFTP.
>
>Those programs exist, work, and are easily invoked from the
>commandline, but they've disappeared from the menus, and updating
>the menus as root didn't fix it.
>
>Is there a way to fix this?
>
>Miark
>
>P.S. Yes, I've learned my lesson--wait for Mandrake-specific RPMs
>     to come available for major stuff like this.
>
>
>------------------------------------------------------------------------
>
>Want to buy your Pack or Services from MandrakeSoft? 
>Go to http://www.mandrakestore.com
>
Well the real lesson there is don't use Red Carpet unliess you really 
like to do everything with rpm --nodeps.  The price you pay for such 
smoothness in the update is excessive.

Right now what I see is that the easy way to analyze this is likely 
going to be using a script

The following is a very simple-minded one which should do some magic....

#!/usr/bin/env python
#-----------------------------------------------------
# Copyright civileme@mandrakesoft July, 2002
# Licensed under GNU General Public License 2
# See www.fsf.org for license details and restrictions
#------------------------------------------------------

import os, sys, cPickle, popen2, string
print
print "Welcome to Menu file Checker"
print
print "This program will terminate abnormally if"
print "you are not running as root"
print
print "The idea here is to clean menu files--you need to be "
print "aware that menu entries have files in /usr/lib/menu"
print "and a broken file there can cause menu items following it"
print "to disappear."
print
def disposition(menuitemname=''):
    print
    print menuitemname + ' has been disabled'
    print 'check your menus'
    while 1:
        cg=raw_input('keep(k) or remove(r) or abort(a): ')
        if len(cg) != 1:
            continue
       
        if cg != 'k' and cg != 'r' and cg !='a':
            continue

        break
    return cg
def disableitem(menuitemname=''):
    os.system('mv /usr/lib/menu/'+menuitemname+' /var/tmp/'+menuitemname)
    return
def restoreitem(menuitemname=''):
    os.system('mv /var/tmp/'+menuitemname+' /usr/lib/menu/'+menuitemname)
    return
def menuupdate():
    return os.spawnl(os.P_WAIT,'/usr/bin/update-menus','update-menus')
# Prep
menuitems=popen2.Popen3('ls -l /usr/lib/menu')
Menulist=menuitems.fromchild.readlines()
print Menulist
print 'Menu list read... there were...'
print Menulist[0]
print

Menulist=Menulist[1:]  # get rid of count line
MenuL=[]
for j in Menulist:
    if j[:1] == 'd':
        continue
    R=string.split(j)
    l=R[len(R)-1]
    MenuL=MenuL+[l]
print
print 'After removing subdirectory entries, '
print len(MenuL), 'items need to be examined'
print
#end of Prep

for cr in MenuL:
    disableitem(menuitemname=cr)
    menuupdateret=menuupdate()
    if menuupdateret != 0:
        print
        print 'Problem with menu update! return code = ', menuupdateret
        print 'Menuitem file removed was '+cr
        sys.exit(0)
    x=disposition(menuitemname=cr)
    if x=='k' or x=='a':
        restoreitem(menuitemname=cr)
        if x=='a':
            menuupdate()
            print 'stopping after restoring '+cr
            sys.exit(0)
menuupdate()

# end of program menuanalyze


OK you know the drill, I hope...

Cut from the hashbang '#!' line to the end of program line and paste to 
a text editor. DO NOT remove any indentations... they must be preserved 
because that is the ONLY way the python language recognizes block 
beginnings and endings and nestings.
Also that hashbang must be the first line in the script file.

Save the file under a useful name like menuanalyze

make said saved file executable by

chmod a+x menuanalyze

open a terminal and su to root

./menuanalyze

Civileme



Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to