Upgrade SQLite3

Is there a better way of moving the SQLite3 Precompiled Binary into usr/local/bin/ ?

property usr : "username"
property pswd : "password"

do shell script "mkdir ~/tempFolder ; cd ~/tempFolder ; curl -Ss https://www.sqlite.org/sqlite-shell-osx-x86-3071400.zip > sqlite3.zip; unzip sqlite3.zip; mv sqlite3 /usr/local/bin/ ; rm -r ~/tempFolder" user name usr password pswd with administrator privileges


It seems good enough for me, but you asked.

The only thing I can think of, is creating the temp folder in the (path to temporary items from user domain), and use the mktemp command to assure that you get a unique folder name. (man mktemp)

I’d also split the do shell script up into several, not using the “with adminstator privlieges” before I’d have to.

But by all means, your install script looks more than good enough for me. And thanks! :slight_smile:

set instNameFol to POSIX path of (path to temporary items folder from user domain) & "sqll3inst.XXXXXX"
set stage1passed to false
	set tmpInstFol to (do shell script " mktemp -d " & quoted form of instNameFol)
	set stage1passed to true
end try

I can’t see your script right now, but whatever permission a user may have set on the old installation, you should overwrite with the new, so you would use -f for force on whatever command you are using to copy with. Maybe zipping the old version could be a good idea too. But most people use Time machine now a days, don’t they?
Still: maybe zipping the old version and moving it to trash could be a good idea, but those are just thoughts.

All of the computers I am running this on have sqlite3 installed in usr/bin/ (the way it comes with OS X). I am installing the newer version in usr/local/bin/ intentionally to keep the versions separate on the system.

That is a very good thing since sqllite3 is a core technology.

Still, everybody installs whatever in /usr/local/bin, so, you really can’t know for sure, if someone have gotten something by their own from homebrew, macports, fink, and what not, and that package they have composed will overwrite an installation you have made, given that they also think they are the only one.

That is at least my experience. (but not with sqllite3). Some of them like homebrew, even just moves others port trees aside (homebrew does that to freedesktop.org :o. That is of course far worse, and forms the basis for my considerations, in these matters. Moving aside a full source tree is of course far worse.

But if the install script is just for you, or users you know and talk with, then you are of course good. It is of course up to you to consider it. :slight_smile:


It is anyways a good idea to stage an install script, as it saves labour in finding out what went wrong, should anything break for some odd reason.


I have now considered this, and figured, that for my own sake, I’ll stuff stuff into a folder with a prefix of mcusr, then I’m pretty sure my stuff is left in piece. But if the config files are residing in some common place, and I can’t change it. :slight_smile: