X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=OSX%2Finstaller.sh;h=120dd9d9b8bed3aa76d89da48b0afe36103a0c9d;hb=dba664f31aa87285db4d76cf8c5e66335299703a;hp=44e7f9bdebbf0b0c0b421b372c5297a36bb1be0e;hpb=2762a7d7cf8d83e68b8f635941f6609119d630ae;p=xscreensaver diff --git a/OSX/installer.sh b/OSX/installer.sh index 44e7f9bd..120dd9d9 100755 --- a/OSX/installer.sh +++ b/OSX/installer.sh @@ -1,5 +1,5 @@ #!/bin/sh -# XScreenSaver, Copyright © 2013 Jamie Zawinski +# XScreenSaver, Copyright © 2013-2014 Jamie Zawinski # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that @@ -19,35 +19,45 @@ #exec >/tmp/xscreensaver.log 2>&1 #set -x -REQUIRED_SPACE=140 # MB. Highly approximate. - DEBUG=0 +REQUIRED_SPACE=160 # MB. Highly approximate. -if [ x"$USER" = xjwz ]; then - DEBUG=1 -fi - -echo "Destination: $DSTVOLUME" >&2 - -if [ "$DEBUG" != 0 ]; then - DSTVOLUME=/tmp -fi - -SRC=`dirname "$PACKAGE_PATH"`/"Screen Savers" -DST1="$DSTVOLUME/Library/Screen Savers" -DST2="$DSTVOLUME/Applications" -PU="$DSTVOLUME/$HOME/Library/Screen Savers" +export PATH="/bin:/sbin:/usr/bin:/usr/sbin:$PATH" function error() { - echo "Error: $@" >&2 + echo "XScreenSaver Installer: Error: $@" >&2 ( + # Using "System Events" says "No user interaction allowed" on 10.9. + # But using "Automator Runner" still seems to work. osascript <<__EOF__ - tell app "System Events" to display dialog "$@" buttons "Bummer" default button 1 with icon 0 with title "Installation Error" + tell app "Automator Runner" to \ + display dialog "$@" \ + buttons "Bummer" \ + default button 1 \ + with icon 0 \ + with title "Installation Error" __EOF__ ) /dev/null 2>&1 & exit 1 } +#if[ x"$DSTVOLUME" = x ]; then error "DSTVOLUME unset"; fi +if [ x"$PACKAGE_PATH" = x ]; then error "PACKAGE_PATH unset"; fi +if [ x"$HOME" = x ]; then error "HOME unset"; fi + + +echo "Destination: $DSTVOLUME" >&2 + +if [ x"$USER" = xjwz ]; then DEBUG=1; fi + +if [ "$DEBUG" != 0 ]; then DSTVOLUME=/tmp; fi + +SRC=`dirname "$PACKAGE_PATH"`/"Screen Savers" +DST1="$DSTVOLUME/Library/Screen Savers" +DST2="$DSTVOLUME/Applications" +PU="$DSTVOLUME/$HOME/Library/Screen Savers" +UPDATER="XScreenSaverUpdater.app" + cd "$SRC" || error "The 'Screen Savers' folder does not exist. You can't copy the installer out of the Disk Image!" @@ -65,16 +75,30 @@ fi mkdir -p "$DST1" || error "Unable to create directory $DST1/" mkdir -p "$DST2" || error "Unable to create directory $DST2/" -# Install the savers in /System/Library/Screen Savers/ +# Install the savers and the updater in /System/Library/Screen Savers/ +# Install the other apps in /Applications/ # -for f in *.saver ; do - DD="$DST1/$f" +for f in *.{saver,app} ; do + EXT=`echo "$f" | sed 's/^.*\.//'` + if [ "$EXT" = "app" -a "$f" != "$UPDATER" ]; then + DST="$DST2" + else + DST="$DST1" + fi + DD="$DST/$f" echo "Installing $DD" >&2 rm -rf "$DD" || error "Unable to delete $DD" - cp -pr "$f" "$DST1/" || error "Unable to install $f in $DST1/" + cp -pR "$f" "$DST/" || error "Unable to install $f in $DST/" + + # Eliminate the "this was downloaded from the interweb" warning. xattr -r -d com.apple.quarantine "$DD" - # If this saver is also installed in the per-user directory, + if [ "$EXT" = "app" ]; then + # Eliminate the "this is from an unknown developer" warning. + spctl --add "$DD" + fi + + # If this saver or app is also installed in the per-user directory, # delete that copy so that we don't have conflicts. # if [ "$DEBUG" = 0 ]; then @@ -82,17 +106,6 @@ for f in *.saver ; do fi done - -# Install the apps in /Applications/ -# -for f in *.app ; do - DD="$DST2/$f" - echo "Installing $DD" >&2 - rm -rf "$DD" || error "Unable to delete $DD" - cp -pr "$f" "$DST2/" || error "Unable to install $f in $DST2/" - xattr -r -d com.apple.quarantine "$DD" -done - # Launch System Preferences with the Screen Saver pane selected. # open /System/Library/PreferencePanes/DesktopScreenEffectsPref.prefPane &