Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[script] pouvoir mettre à jour seulement une catégorie!
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index French
View previous topic :: View next topic  
Author Message
tuXXX
n00b
n00b


Joined: 01 Apr 2005
Posts: 32
Location: France/Brest

PostPosted: Fri Apr 01, 2005 5:33 pm    Post subject: [script] pouvoir mettre à jour seulement une catégorie! Reply with quote

Bonjour!

Je suis nouvellement inscrit sur ce forum (avant je le parcourais car il est vraiment très intéressant !)

Bon, alors tout d'abord la petite histoire... Je fais partie (en tant que membre) d'un forum assez actif du côté de linux (http://www.pcinpact.com/forums/rubrique_20.htm) (mais qui n'a pas la prétention de discuter de linux/gentoo d'une manière aussi précise qu'ici, c'est largement plus général).
Sur un topic dédié à gentoo, la question suivante s'est posée : "comment mettre à jour seulement une catégorie, de la même façon que emerge -uD world?"

Nous en sommes finalement parvenus à créer un petit script bash qui liste les packets à mettre à jour pour une catégorie choisie (et même avec des expressions rationelles!!).
Donc pour faire profiter la communautée, voici donc ce script... c'est un simple script bash, et c'est sous licence GNU GPLv2 :
Code:
#!/bin/bash

#
# UpdCateg
# Lists packages that have to be updated in a category
# For Gentoo@PC INpact
#
# By tuXXX and Duke98
# http://www.pcinpact.com/forum/rubrique_20.htm
# Released under GNU-GPL v2
#

function packageName
{
  LIST=`echo $1 | tr '-' ' '`
  OUT=""
  for i in $LIST
  do
     if [ `echo $i | cut -c 1 | tr -d '[:digit:]'` ]
     then OUT="$OUT-$i"
     else break
     fi
  done
  echo $OUT | cut -c 2-
}

if [ "$1" ]
then echo -n "";
else
  echo "Usage : $0 categorie"
  echo ""
  echo "categorie examples :"
  echo "    media-plugins"
  echo "    \"sys-*\""
  exit 0
fi

cat=`echo $1 | awk -F "/" '{print $1}'`
if ! ls -d /var/db/pkg/$cat 1>/dev/null 2>/dev/null
then
  echo "Erreur : mauvaise catégorie !" 1>&2
  exit 1
fi

PACKAGES=`emerge -puD world | cut -c 16- | grep $1 | awk {'print $1'}`
if [ ! "$PACKAGES" ]
then
  echo "Rien a mettre à jour" 1>&2
  exit 2
fi

EMERGE_LIST=""
for pack in $PACKAGES
do
  EMERGE_LIST="$EMERGE_LIST "`packageName $pack`
done

echo $EMERGE_LIST


En gros, il suffit de lancer en faisant "emerge `UpdCateg.sh sys-apps`" .
Toute remarque est évidemment appréciée (même pour dire que ça sert à rien :lol: )


Last edited by tuXXX on Sat Apr 02, 2005 12:12 am; edited 1 time in total
Back to top
View user's profile Send private message
kernelsensei
Bodhisattva
Bodhisattva


Joined: 22 Feb 2004
Posts: 5619
Location: Woustviller/Moselle/FRANCE (49.07°N;7.02°E)

PostPosted: Fri Apr 01, 2005 6:24 pm    Post subject: Reply with quote

bienvenue sur le forum gentoo :)

et merci pour cette contribution ...


Mais ... ca sert a quoi de mettre seulement 1 categorie a jour ?
_________________
$ ruby -e'puts " .:@BFegiklnorst".unpack("x4ax7aaX6ax5aX15ax4aax6aaX7ax2aX5aX8 \
axaX3ax8aX4ax6aX3aX6ax3ax3aX9ax4ax2aX9axaX6ax3aX2ax4ax3aX4aXaX12ax10aaX7a").join'
Back to top
View user's profile Send private message
sireyessire
Advocate
Advocate


Joined: 20 Mar 2003
Posts: 2991
Location: back in Paris, France

PostPosted: Fri Apr 01, 2005 7:42 pm    Post subject: Reply with quote

merci mais faudrait peut-être le proposer sur ce forum:
https://forums.gentoo.org/viewforum-f-51.html
il est tout beau et fait pour ça
_________________
I never think of the future. It comes soon enough.
Albert Einstein

Try simpler first
Shockley
Back to top
View user's profile Send private message
tuXXX
n00b
n00b


Joined: 01 Apr 2005
Posts: 32
Location: France/Brest

PostPosted: Sat Apr 02, 2005 12:13 am    Post subject: Reply with quote

sireyessire wrote:
merci mais faudrait peut-être le proposer sur ce forum:
https://forums.gentoo.org/viewforum-f-51.html
il est tout beau et fait pour ça


Ok, c'est parti :P

EDIT : https://forums.gentoo.org/viewtopic-p-2260979.html
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index French All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum