Run the PKG file from the same folder as Applescript

I have an apple script that should install a printer driver with administrator privileges, and then a bash script that adds a printer based on the IP address to the computer. The apple script and pkg files are in the same folder.

I kind of got stuck on how to write an apple script so that pkg can work on how it was located. My goal is to place the script somewhere, and other poppies can run and install the same printer. Any ideas guys?

This is what I still have

at startup {input, parameters}

do shell script "sudo  installer -allowUntrusted -pkg  Driver.pkg -target /"
with administrator privileges

return input

end

I am getting an error indicating that the Driver.pkg path is invalid. script and pkg are in the same folder.

+4
1

do shell script / ( ).

:

tell application "Finder"
    set myFolder to (quoted form of (POSIX path of (parent of (path to me) as string)))
end tell

do shell script ¬
  "installer -allowUntrusted -pkg " & myFolder & "Driver.pkg -target /" ¬
  with administrator privileges

sudo , with administrator privileges.

+3

Source: https://habr.com/ru/post/1570095/


All Articles