Forums FUG-FR
https://forums.fug-fr.org/cgi-bin/yabb2/YaBB.pl
Divers et varié >> Programmation >> Comment identifier une ISO FreeBSD
https://forums.fug-fr.org/cgi-bin/yabb2/YaBB.pl?num=1269598633

Message started by Nix46 on 26. Mar 2010 at 11:17

Title: Comment identifier une ISO FreeBSD
Post by Nix46 on 26. Mar 2010 at 11:17
Bonjour,

Avec la 7.3, les ISO FreeBSD ont changé de nom :
http://www.freebsd.org/releases/7.3R/relnotes.html

Quote:
FreeBSD release ISO images now have “FreeBSD-” at the beginning of the filenames.


Le problème c'est que mon script de création pour le live utilisait le nom de l'iso pour faire un live :
[code]freebsd_info () {
     FREEBSD_ISO=$1
     FREEBSD_NAME=`basename ${FREEBSD_ISO%%.iso}`
     FREEBSD_VERSION=`echo $FREEBSD_NAME | cut -d - -f 1`      #uname -r|cut -d - -f 1
     FREEBSD_MAJOR_VERSION=`echo $FREEBSD_VERSION | cut -d . -f 1`
     FREEBSD_RELEASE=`echo $FREEBSD_NAME | cut -d - -f 1,2`      #uname -r
     FREEBSD_ARCH=`echo $FREEBSD_NAME | cut -d - -f 3`      #uname -p
}[/code]

Du coup je ne sais plus bien comment faire pour tout connaitre de l'iso que j'utilise, à savoir la version et l'architecture, dans tout les cas...

Une idée ?

Nix.



PS : bon je leur pardonne, en même temps voici une nouvelle commande bien pratique :

Quote:
The service(8) command as an easy interface for the rc.d scripts has been added.

Un petit "service gdm restart" me sera utile...

Title: Re: Comment identifier une ISO FreeBSD
Post by Marck on 26. Mar 2010 at 14:58
Salut

Avec un exemple concret please :)

Donc avant c'était comme cela:
8.0-RELEASE-i386-disc1.iso

mais maintenant c'est comme ceci:
FreeBSD-8.0-RELEASE-i386-disc1.iso

Oui ? Et tu veux pouvoir utiliser les deux ? Alors...


Quote:
FREEBSD_ISO=$1

NEWNAME=`echo $FREEBSD_ISO | cut -d - -f 1`
if [ "$NEWNAME" = "FreeBSD" ] ; then
     FREEBSD_ISO=`echo $FREEBSD_ISO | cut -d - -f 2-`
fi

FREEBSD_NAME=`basename ${FREEBSD_ISO%%.iso}`
FREEBSD_VERSION=`echo $FREEBSD_NAME | cut -d - -f 1`      #uname -r|cut -d - -f 1
FREEBSD_MAJOR_VERSION=`echo $FREEBSD_VERSION | cut -d . -f 1`
FREEBSD_RELEASE=`echo $FREEBSD_NAME | cut -d - -f 1,2`      #uname -r
FREEBSD_ARCH=`echo $FREEBSD_NAME | cut -d - -f 3`      #uname -p

echo $FREEBSD_ISO
echo $FREEBSD_NAME
echo $FREEBSD_VERSION
echo $FREEBSD_MAJOR_VERSION
echo $FREEBSD_RELEASE
echo $FREEBSD_ARCH


Si j'ai bien compris, cela devrait aller.

Marc

Title: Re: Comment identifier une ISO FreeBSD
Post by Nix46 on 26. Mar 2010 at 15:41
C'était évident merci !  ;)

Je partais dans l'idée d'utiliser le .inf, désarchiver l'iso puis faire un uname dans la chroot...
:P

Merci

Title: Re: Comment identifier une ISO FreeBSD
Post by Nix46 on 27. Mar 2010 at 11:34
Finallement, il a fallu un peu plus bricoler :


Code (]freebsd_info () {
     FREEBSD_ISO=$1

     # FreeBSD release ISO images now have [ch8220):

FreeBSD-” at the beginning of the filenames.
     NEWNAME=`basename ${FREEBSD_ISO%%.iso}`
     NEWNAME=`echo $NEWNAME | cut -d - -f 1`

     FREEBSD_NAME=`basename $FREEBSD_ISO`
     FREEBSD_ISO=`dirname $FREEBSD_ISO`

     [ "$NEWNAME" = "FreeBSD" ] && FREEBSD_NAME=`echo $FREEBSD_NAME | cut -d - -f 2-`

     FREEBSD_ISO=$FREEBSD_ISO/$FREEBSD_NAME
     FREEBSD_NAME=${FREEBSD_NAME%%.iso}

     FREEBSD_VERSION=`echo $FREEBSD_NAME | cut -d - -f 1`      #uname -r|cut -d - -f 1
     FREEBSD_MAJOR_VERSION=`echo $FREEBSD_VERSION | cut -d . -f 1`
     FREEBSD_RELEASE=`echo $FREEBSD_NAME | cut -d - -f 1,2`      #uname -r
     FREEBSD_ARCH=`echo $FREEBSD_NAME | cut -d - -f 3`      #uname -p
}


Car $FREEBSD_ISO était le chemin complet.
Bon ça fait bricolo mais ça marche.

Dommage, le uname ne fonctionne pas (je m'y attendais un peu), je ne vois pas comment faire autrement.

@+

Title: Re: Comment identifier une ISO FreeBSD
Post by patrick on 27. Mar 2010 at 14:03

Nix46 wrote on 27. Mar 2010 at 11:34:
Finallement, il a fallu un peu plus bricoler :

Dommage, le uname ne fonctionne pas (je m'y attendais un peu), je ne vois pas comment faire autrement.


Ça va être inutile dans ton cas mais le tar(1) FreeBSD est tout à fait capable de lister et d'extraire les fichiers d'une image ISO, comme si c'était une archive.

Forums FUG-FR » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2025. All Rights Reserved.