All pastes #1387393 Raw Edit

gnu

public text v1 · immutable
#1387393 ·published 2009-04-09 20:13 UTC
rendered paste body
#!/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 <unpeudescience at gmail dot com># 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 listsecho "I make lists of packages..."rpm -qa --queryformat '%{name}\n'| grep -v 'debug' > $installed_pkgrpm -qa --queryformat '%{name}\n'| grep 'debug' > $installed_debugurpmq -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 linedo  	#debug package does exist?        check=`grep $line $installed_debug`        if [[ $check == '' ]]        then	       echo $line >>$list_debug_clean	fidone < $list_debug#remove undesired debug pkg.echo "I check needed debug packages"while read linedo	name=`echo $line | sed "s/-debug//" `	check=`grep "^$name$" $installed_pkg`	if [[ $check != '' ]]        then        	echo "urpmi --force $line" >> $toinstall        fidone < $list_debug_cleanadd_pkg gdb qt4-debug kdepim4-debug kdeplasma-addons-debug kdepimlibs4-debug kdebase4-debug kdemultimedia4-debug kdenetwork4-debug kdelibs4-debug #ignored packagesurpmq -y "debug" | grep -v "debug$" > $ignored_debug_pkgecho "These packages:"cat $ignored_debug_pkgecho '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 Properrm -rf $installed_pkg $list_debug $list_debug_clean $installed_debugexit 0