#!/bin/sh ########################################################### # This script is developped for Mandriva # It allow you to install all needed debug packages # for your system ########################################################### # 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. # # 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ############################################################ # # Written by Spip # Version 0.1 # ############################################################ installed_pkg='/tmp/installed_pkg' toinstall='./toinstall' list_debug='/tmp/list_debug' list_debug_clean='/tmp/list_debug_clean' installed_debug='/tmp/installed_debug' ignored_debug_pkg='./ingored_debug_packages' function add_pkg() { for pkg in $@ do check=`rpm -qa $pkg` if [[ $check = '' ]] then echo "urpmi --force $pkg" >> $toinstall fi done } #I make lists echo "I make lists of packages..." rpm -qa --queryformat '%{name}\n'| grep -v 'debug' > $installed_pkg rpm -qa --queryformat '%{name}\n'| grep 'debug' > $installed_debug urpmq -y "debug" | grep "debug$" > $list_debug #now we create toinstall list. #initialisation >$toinstall >$list_debug_clean # are there debug packages on the system? echo "I check if some debug packages are already installed..." while read line do #debug package does exist? check=`grep $line $installed_debug` if [[ $check == '' ]] then echo $line >>$list_debug_clean fi done < $list_debug #remove undesired debug pkg. echo "I check needed debug packages" while read line do name=`echo $line | sed "s/-debug//" ` check=`grep "^$name$" $installed_pkg` if [[ $check != '' ]] then echo "urpmi --force $line" >> $toinstall fi done < $list_debug_clean add_pkg gdb qt4-debug kdepim4-debug kdeplasma-addons-debug kdepimlibs4-debug kdebase4-debug kdemultimedia4-debug kdenetwork4-debug kdelibs4-debug #ignored packages urpmq -y "debug" | grep -v "debug$" > $ignored_debug_pkg echo "These packages:" cat $ignored_debug_pkg echo 'were ignored by the script but they contain a "debug" string. Check if you need some of them.' echo "this list is saved in $ignored_debug_pkg \n\n" nb_pkg=`wc -l $toinstall | awk '{print $1}'` echo "$nb_pkg -debug packages were found." echo "Please, run as root: ./toinstall in order to install all of them." chmod +x $toinstall #Mr Proper rm -rf $installed_pkg $list_debug $list_debug_clean $installed_debug exit 0