Steve Scrimpshire Posted December 28, 2003 Report Share Posted December 28, 2003 (edited) This is a script I wrote, part of which was taken from aru. This script assumes you have your urpmi sources correctly configured and it contains no local sources. You can do that here: http://urpmi.org/easyurpmi/index.php I'm trying to figure out how to do this with local sources taken into consideration, too: #!/bin/bash # rpmfix - searches your system for missing files and reinstalls rpms they belong to # Copyright (C) 2003 Steve Scrimpshire # email: omarserenity@gmail.com # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # http://www.gnu.org/copyleft/gpl.html#SEC1 # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. rm -f notonmirrors rm -f missing_files.list rpm -Va --nodeps --nomd5 --noscripts | grep missing | grep -v "/dev/" | tee missing_files.list TEST=$(rpm -qf $(awk '{print $NF}' missing_files.list) | uniq) urpmi.update -a for name in $TEST do echo $name GET=$(urpmq --sources $name 2>/dev/null) if [ $GET ] then if [[ $name != XFree* ]] then wget $GET else echo "I won't fix $name because I always have problems doing that!" fi else echo "$name does not exist on the mirrors!" echo "$name" >> notonmirrors fi done DIR=$(ls) for file in $DIR do if [[ $file == *.rpm ]] then rpm -ivh --replacefiles --replacepkgs $file rm -f $file fi done exit 0 I created a special directory to put this script in and after it runs, you may or may not see a new file in that directory called notonmirrors, which will contain the names of pkgs that have missing files, but urpmq could not find them on the mirrors, so you will have to fix them manually. I have it ignore XFree pkgs, because there is always some files for fonts that are missing and no matter how many times you reinstall it, they are still missing. Edited October 19, 2007 by Steve Scrimpshire Quote Link to comment Share on other sites More sharing options...
Steve Scrimpshire Posted February 15, 2004 Author Report Share Posted February 15, 2004 Has anyone found this useful at all? Quote Link to comment Share on other sites More sharing options...
kmack Posted February 15, 2004 Report Share Posted February 15, 2004 It looks really good, but have not had a chance to try it. In middle of moving across the pacific and my desktop will be in a container for a month or so! :-) THanks for sharing it and did you ever get the local sources added to it? I like to download to a directory and install from local source and then keep cd's of the patches, etc so I can reinstall if I need to do so w/o re-downloading. Quote Link to comment Share on other sites More sharing options...
neutro Posted February 15, 2004 Report Share Posted February 15, 2004 Well I'm currently running the line to see if I am actually missing files ;) This script would have been useful last time my system borked and mistakingly pressed "Y" when fsck asked me to check filesystem integrity (thus bypassing ext3 journal recovery). I lost lots of files and replaced by hand quite a few rpms. Once in a while I still find that some program that I haven't used since is broken, and I have to reinstall it. Are you aware of any risk in using your script? (e.g. overwriting config files or nasty side-effects such as this?) Quote Link to comment Share on other sites More sharing options...
Steve Scrimpshire Posted February 15, 2004 Author Report Share Posted February 15, 2004 I have not experienced it overwriting config files, but that is not to say that it couldn't happen. Quote Link to comment Share on other sites More sharing options...
neutro Posted February 15, 2004 Report Share Posted February 15, 2004 Well thanks, it worked well with no side effects so far. Geez, I wass missing /usr/bin/passwd :o Quote Link to comment Share on other sites More sharing options...
Apoc Posted August 13, 2004 Report Share Posted August 13, 2004 Looks good will try this out tonight.. anything to make my life easier is good :D Quote Link to comment Share on other sites More sharing options...
aroy_802701 Posted September 12, 2004 Report Share Posted September 12, 2004 Has anyone found this useful at all? <{POST_SNAPBACK}> Yeah, thanks. Repaired broken deps for documentation, mainly. Couldn't find glibc-devel in any of the urpmi mirrors (because newer version existed in them) and had to do urpmi manually for that. But basically works really well. Quote Link to comment Share on other sites More sharing options...
frosterrj Posted October 17, 2004 Report Share Posted October 17, 2004 Has anyone found this useful at all? <{POST_SNAPBACK}> Well, its kind of interesting to see what came out of the Missing Files and Not on Mirror lists, just not sure how to interpret the results! For Examlple: Not On Mirror says: glibc-devel-2.3.3-20mdk jre-1.5.0-fcs j2re-1.4.2_05-fcs xorg-x11-6.7.0-2mdk xorg-x11-75dpi-fonts-6.7.0-2mdk Missing Files Says: missing /boot/kernel.h-2.6.8 missing /usr/java/jre1.5.0/lib/charsets.pack missing /usr/java/jre1.5.0/lib/deploy.pack missing /usr/java/jre1.5.0/lib/ext/localedata.pack missing /usr/java/jre1.5.0/lib/javaws.pack missing /usr/java/jre1.5.0/lib/jsse.pack missing /usr/java/jre1.5.0/lib/plugin.pack missing /usr/java/jre1.5.0/lib/rt.pack missing /usr/java/j2re1.4.2_05/javaws/javaws.pack missing /usr/java/j2re1.4.2_05/lib/charsets.pack missing /usr/java/j2re1.4.2_05/lib/ext/localedata.pack missing /usr/java/j2re1.4.2_05/lib/jsse.pack missing /usr/java/j2re1.4.2_05/lib/plugin.pack missing /usr/java/j2re1.4.2_05/lib/rt.pack missing /usr/java/j2re1.4.2_05/lib/unpack missing /usr/X11R6/lib/X11/fonts/Speedo/encodings.dir missing /usr/X11R6/lib/X11/fonts/TTF/encodings.dir missing /usr/X11R6/lib/X11/fonts/Type1/encodings.dir missing /usr/X11R6/lib/X11/fonts/75dpi/encodings.dir Since I am running Xorg from the 10.1CE, is it just a version issue since I have a cooker repository in my sources list? I am pretty sure I have kernel source installed too, so why the missing kernel.h? I am running 2.6.8.1-10mdk. Robert Quote Link to comment Share on other sites More sharing options...
Gowator Posted October 20, 2004 Report Share Posted October 20, 2004 made sticky since its such an outstandingly useful tip! Quote Link to comment Share on other sites More sharing options...
Steve Scrimpshire Posted October 25, 2004 Author Report Share Posted October 25, 2004 (edited) Thanks, Gowator! :blush: There are some packages that are going to always claim to be missing files...that has something to do with the packaging and nothing I can do except put an ignore line in the script. As for the 'not on mirrors', sometimes they change naming conventions and that might cause that or the particular mirror you are using might not be updated properly. Edited October 25, 2004 by Steve Scrimpshire Quote Link to comment Share on other sites More sharing options...
jeanackle Posted December 31, 2004 Report Share Posted December 31, 2004 (edited) Has anyone found this useful at all? <{POST_SNAPBACK}> Do birds fly? :P Are you aware of any risk in using your script? (e.g. overwriting config files or nasty side-effects such as this?) <{POST_SNAPBACK}> I'm not completely sure, but I think that "rpm --replace-files" saves a copy of the old config files as "configfile".rpmsave. Or am I mistaking its behaviour with the one of urpmi? :unsure: Edited December 31, 2004 by jeanackle Quote Link to comment Share on other sites More sharing options...
Steve Scrimpshire Posted January 11, 2005 Author Report Share Posted January 11, 2005 (edited) Ok, let's make it safer: #!/bin/bash # rpmfix - searches your system for missing files and reinstalls rpms they belong to # Copyright (C) 2003 Steve Scrimpshire # email: omarserenity@gmail.com # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # http://www.gnu.org/copyleft/gpl.html#SEC1 # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. rm -f notonmirrors rm -f missing_files.list rpm -Va --nodeps --nomd5 --noscripts | grep missing | grep -v "/dev/" | tee missing_files.list TEST=$(rpm -qf $(awk '{print $NF}' missing_files.list) | uniq) urpmi.update -a for name in $TEST do echo $name GET=$(urpmq --sources $name 2>/dev/null) if [ $GET ] then if [[ $name != XFree* ]] then wget $GET else echo "I won't fix $name because I always have problems doing that!" fi else echo "$name does not exist on the mirrors!" echo "$name" >> notonmirrors fi done DIR=$(ls) for file in $DIR do if [[ $file == *.rpm ]] then rpm -ivh --replacepkgs $file rm -f $file fi done exit 0 That way, it won't replace existing files. Thanks for pointing that out. Edited October 19, 2007 by Steve Scrimpshire Quote Link to comment Share on other sites More sharing options...
LatterDaySaint Posted February 12, 2005 Report Share Posted February 12, 2005 G'Day Steve, I have tried the 2 scripts at the beginning of your thread but I get an empty page on the first webpage and a error on the second ,I'm wondering if their still valid or not as they seem to point to nowhere.. is there another thread somewhere that may have similar teachings on finding missing files ect? Thanks Jason Quote Link to comment Share on other sites More sharing options...
Steve Scrimpshire Posted February 12, 2005 Author Report Share Posted February 12, 2005 What do you mean an empty page? What errors do you get? The second version of the script should be the one to use. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.