logo Debian Debian Debian-France Debian-Facile Debian-fr.org Forum-Debian.fr Debian ? Communautés logo inclusivité

Debian-facile

Bienvenue sur Debian-Facile, site d'aide pour les nouveaux utilisateurs de Debian.

Vous n'êtes pas identifié(e).

#1 11-06-2010 15:20:56

Thuban
aka prx
Distrib. : OpenBSD
Noyau : current
(G)UI : cwm
Inscription : 09-01-2009
Site Web

un yaourt-like pour apt

Si vous avez testé archlinux, vous avez sans doute apprécié ce programme, qui simplifie la ligne de commande. Voici quelque chose qui y ressemble. J'espère qu'il vous plaira. Ce qui serait super, c'est que chacun contribue un peu à l'améliorer smile !

#!/bin/sh
#
#//    Petit script simplifiant l'utilisation d'apt
#//    à la façon de yaourt pour pacman dans archlinux
#//      yapt.sh
#//      
#//      Copyright 2010 xavier <arrakispice@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.
#//      
#//      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 Street, Fifth Floor, Boston,
#//      MA 02110-1301, USA.
LIST=/tmp/yapt-get_research
ROUGE="\033[31m"
VERT="\033[0;33;32m"
NORMAL="\033[1;0m"
CYAN="\033[0;33;36m"
usage_ () {
  echo "Usage :"
  echo " yapt-get <nom du paquet> <nom d'un autre paquet> <...>"
  echo " yapt-get -update : mise à jour de la base de données"
  echo " yapt-get -upgrade : mise à jour du système "
  echo " yapt-get -source <nom du/des paquets> : téléchargement des sources"
}

install_ () {
  for i in $@; do
    PACKAGE=$(sed -n ${i}p $LIST | awk '{print $1}')
    echo " *** Installation de "$ROUGE" $PACKAGE "$NORMAL" *** \n "
    su --shell=/bin/bash --command "apt-get install $PACKAGE"
  done
}

searching_ () {
  echo "Choix\tNom - Description (séparer par des espaces)"
  echo "--------------------------------------------------------------"
  apt-cache search $1 > $LIST
  sed = $LIST | sed 'N;s/\n/\t/' | awk -F"\t" '{print "'$VERT'"$1 "\t" "'$CYAN'"$2"'$NORMAL'"}'
  read CHOICE
  install_ $CHOICE
}


#Pour commencer, on regarde le nombre d'arguments entrés. Ensuite \
#on effectue la recherche pour chacuns d'eux.
if [ "$#" = 0 ]; then
  usage_
fi
  case $1 in
    "-update" )
      su --shell=/bin/bash --command "apt-get update"
      ;;
    "-upgrade" )
      su --shell=/bin/bash --command "apt-get upgrade"
      ;;
    "-source" )
      apt-get source $(echo $@ | cut -d" " -f2-)
      ;;
    * )
      for i in $@; do
        searching_ $i
      done
  esac
   


exit 0

Hors ligne

#2 11-06-2010 17:16:19

smolski
quasi...modo
Lieu : AIN
Distrib. : backports (buster) 10
Noyau : Linux 4.19.0-8-amd64
(G)UI : gnome
Inscription : 21-10-2008

Re : un yaourt-like pour apt

Même truc que pour ton script de gravure, il me paraît bien au chaud ici, avec ses copains ! wink

Pareil, pour le tester, un peu de temps il me faudra smile

Amitié, Jojo ebahi

saque eud dun (patois chtimi : fonce dedans)

Hors ligne

Pied de page des forums