On 10/03/2012, at 7:05 PM, Axel Luttgens wrote:
Le 10 mars 2012 à 07:58, Brian Christmas a écrit :
G'day scripters
As the installer for GeeThree iMovieHD 6 add-ons no longer works with Lion, I thought I'd write an installer for myself.
I find the extras become corrupted after a while, so wanted an installer to keep them updated.
The following second line works in Snow Leopard, but not in Lion.
Can someone set me straight on what's required please?
Regards
Santa
if not (exists (ptl & "Preferences:com.apple.iLife08.plist") as text) then
do shell script "touch /Library/Preferences/com.apple.iLife08.plist"
set theFlag to true
end if
Hello Brian,
Yes, permissions for various system folders have been tightened in Lion.
As a result, if the touch(1) command is to create an item in /Library/Preferences, this requires root privileges; the same way, if the plist already exists and has been created by a regular installer, it is very likely that it is changeable by root only as well.
In previous versions of the OS, members of the admin group (aka Administrator users in the GUI) were able to perform such things; which was not a very desirable state of affairs, as many Mac OS X users tend to run their box as an Administrator user for daily usage...
So, you would need to make use of the following:
do shell script "touch /Library/Preferences/com.apple.iLife08.plist"
with administrator privileges
This will prompt you for an Administrator name/password, and the shell script will be run as system user root.
This also means that the slightest error in such scripts (a path pointing to a wrong item, for example) may prove catastrophic for your system as a whole... Are you sure the cause of the extras corruption couldn't be tracked and remedied instead?
HTH,
Axel
Thanks Axel, that worked.
It's necessary to have at least the com.apple.iLife08.plist file in the preferences folder, when installing iMovieHD 6.
GeeThree have been very slack writing an installer, so I decided to write my own, that would renew the necessary .plist files if I decided to remove them, in case the corruption lay with them.
This script, when run, or saved as an App., in either a desktop folder or CD (named as 'iMovieHD installer'), will re-save any Slick Volumes in the correct places, and replace the iMovieHD.app if desired.
The folder/CD must hold this script app, the iMovieHD6.pkg, and the Slick volumes folders (I've got 1,2,3,5,7,9)
You just need to copy any Slick Volumes from an install previous to Lion, and burn all to CD.
Regards
Santa
on run
set ptd to path to desktop
set ptl to path to library folder as alias
set ptul to path to library folder from user domain as text
set ptsd to path to startup disk
set theFlag to false
set theflag2 to false
set ptdisk to ""
tell application "Finder"
try
if exists disk "iMovieHD installer" then
set ptdisk to disk "iMovieHD installer" as text
else
if exists (ptd & "iMovieHD installer") as text then set ptdisk to (ptd & "iMovieHD installer") as text
end if
on error errmsg
display dialog errmsg
end try
end tell
if ptdisk = "" then
say "Could not find disk or folder."
display dialog "Could not find disk or folder." buttons {"OK"}
--quit me
end if
tell application "Finder"
set x to "This installer requires Administrator User Permission to install file(s)." & return & return & "The file(s) are "
if not (exists (ptl & "Preferences:com.apple.iLife08.plist") as text) then set x to x & "a Root level Library 'com.apple.iLife08.plist' preferences file, and "
if not (exists (ptl & "Preferences:com.apple.iLife.plist") as text) then set x to x & "a Root level Library 'com.apple.iLife.plist' preferences file, and "
set x to x & "the actual 'iMovieHD 6' application." & return & return & "After clicking 'OK' on this dialog box, the installer should open the iMovie package until your normal password is required." & return & return & "Enter your password when asked." & return & return & "Click 'OK' to continue."
tell current application to display dialog x
if not (exists (ptl & "Preferences:com.apple.iLife08.plist") as text) then
do shell script "touch /Library/Preferences/com.apple.iLife08.plist" with administrator privileges
set theFlag to true
end if
if not (exists (ptl & "Preferences:com.apple.iLife.plist") as text) then
do shell script "touch /Library/Preferences/com.apple.iLife.plist" with administrator privileges
set theFlag to true
end if
if not (exists (ptul & "iMovie")) then
make new folder at ptul with properties {name:"iMovie"}
set theflag2 to true
end if
if not (exists (ptul & "iMovie:Plug-ins") as text) then
make new folder at (ptul & "iMovie") as text with properties {name:"Plug-ins"}
set theflag2 to true
end if
try
set transferList to folders of alias ptdisk
repeat with eachFile in transferList
set temp to (name of eachFile) as text
set temp2 to word 1 of temp & " " & word 2 of temp
try
if temp2 is in {"Slick Sampler", "Slick Volume"} then duplicate eachFile to (ptul & ("iMovie:Plug-ins") as text) replacing yes
on error errmsg
display dialog errmsg
end try
end repeat
set theflag2 to true
on error errmsg
display dialog errmsg
end try
if not theFlag then say "The preference files already exist"
if theflag2 then say "Plug in files installed"
set pathToDiskImage to ptdisk & ":iMovieHD6.pkg" as text as alias
open pathToDiskImage
tell application "Installer"
activate
tell application "System Events" to tell process "Installer"
click button "Continue" of window "Install iMovie HD"
delay 0.2
click button "Continue" of window "Install iMovie HD"
delay 0.2
try
click button "Continue" of window "Install iMovie HD"
delay 0.2
end try
try
click button "Agree" of sheet 1 of window "Install iMovie HD"
end try
delay 0.2
try
click button "Install" of window "Install iMovie HD"
end try
end tell
end tell
end tell
end run