Re: [#!/fr] Autre problème de droits.

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Yves PETRONIN
Date:  
À: La liste francophone des scripts shell
Sujet: Re: [#!/fr] Autre problème de droits.
L'utilisation de sudo dans un script est normalement déconseilée.

Il faut préférer do shell script "la commande shell" with
administrator privileges
Je ne sais si cela résoudra le problème. Je suis resté quant à moi en
10.4.....





Le 7 août 11 à 17:35, koenig.yvan a écrit :

Si j'exécute depuis mon disque tournant sou 10.6.8 ce petit script :

set leDossier to (path to startup disk as text) & ".DocumentRevisions-
V100:"
set leDossier to "Aluice-500-Lion:.DocumentRevisions-V100:"
set cheminUnix to quoted form of POSIX path of leDossier
set permissions1 to item 1 of my decoupe(do shell script "stat -F " &
cheminUnix, space)
--> "d--x--x--x 7 root wheel 238 Aug 7 11:21:07
2011 /.DocumentRevisions-V100//"
do shell script "chmod 700 " & cheminUnix

set permissions2 to item 1 of my decoupe(do shell script "stat -F " &
cheminUnix, space)

do shell script "rm " & cheminUnix

--=====

on decoupe(t, d)
    local oTIDs, l
    set oTIDs to AppleScript's text item delimiters
    set AppleScript's text item delimiters to d
    set l to text items of t
    set AppleScript's text item delimiters to oTIDs
    return l
end decoupe


--=====

pour me débarrasser du dossier dans lequel Lion stocke les versions
successives des documents, tout se passe bien.

Par contre, lorsque je tente de l'exécuter depuis Lion, j'obtiens le
message d'erreur :

tell current application
    path to startup disk as text
        --> "Aluice-500-Lion:"
    do shell script "stat -F '/.DocumentRevisions-V100/'"
        --> "d--x--x--x 7 root wheel 238 Aug  7 15:47:00  
2011 /.DocumentRevisions-V100//"
    do shell script "chmod 700 '/.DocumentRevisions-V100/'"
        --> error "chmod: Unable to change file mode on /.DocumentRevisions- 
V100/: Operation not permitted" number 1


Je n'en suis pas outre mesure surpris mais j'aimerais savoir quelle
incantation me donnerait l'autorisation de passer à l'acte.

Je suppose que sudo pourrait être utile mais je suis totalement
ignare dans ce qui concerne le(s) Shell(s).

Je précise que les instructions set permissions ne sont là qu'à seul
but informatif.

Yvan KOENIG (VALLAURIS, France) dimanche 7 août 2011 17:35:11


_______________________________________________
archives :
http://listes.patpro.net/list/sshfr.fr.html
http://listes.patpro.net/mailman/listinfo/script_shell_fr

_______________________________________________
archives :
http://listes.patpro.net/list/sshfr.fr.html
http://listes.patpro.net/mailman/listinfo/script_shell_fr