racket / drracket

DrRacket, IDE for Racket
http://www.racket-lang.org/
Other
444 stars 93 forks source link

can I make the auth dialog for 'configure command line' say Racket rather than 'authopen'? #672

Open spdegabrielle opened 1 month ago

spdegabrielle commented 1 month ago

can I make the auth dialog for 'configure command line' say Racket rather than 'authopen'?

image

-- feel free to ignore low priority reminder to myself to see if this can be done

sorawee commented 1 month ago

For Mac, one possibility is to write an AppleScript wrapper, though we have to be very careful about shell-injection attack, correct quoting, etc.

#lang racket

(define (do-it path)
  (define tmpdir (make-temporary-directory))
  (define racket.app (build-path tmpdir "Racket.app"))
  (parameterize ([current-input-port
                  (open-input-string
                   (format #<<EOF
set thePath to quoted form of ~s 
do shell script "echo " & thePath & " > /etc/paths.d/racket" with administrator privileges
EOF
                           path))])
    (system* (find-executable-path "osacompile")
             "-x" "-o" racket.app))

  (system* (build-path racket.app "Contents" "MacOS" "applet")))

(do-it "/Users/sorawee/projects/racket/racket/bin")
rfindler commented 1 month ago

Looks like -extauth argument is designed for this purpose.

sorawee commented 1 month ago

I don't know how to use authopen, but if -extauth works, that would be a much better approach!

rfindler commented 1 month ago

I don't really see how to use it but if we do change the code, probably there needs to be a guard on the version of the operating system where the argument was added.

LiberalArtist commented 1 month ago

From the man page, it sounds like using -extauth requires writing a serialized AuthorizationExternalForm, but I'm not familiar with the Authorization Services API.