From 6e8a145a55ab7e4474338e8bbdf8187e2d5991ac Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Wed, 2 Aug 2006 04:35:52 +0000 Subject: [PATCH] macos-installer-20060801 partial updates --- src/packaging/MacOS/DS_Store | Bin 12292 -> 12292 bytes src/packaging/MacOS/OpenAFS.Info.plist | 6 +- src/packaging/MacOS/OpenAFS.post_install | 10 +- src/packaging/MacOS/ReadMe.rtf | 2 +- src/packaging/MacOS/Uninstall | 397 +++++++++++++++++++++++++++++++ src/packaging/MacOS/buildpkg.sh | 11 +- 6 files changed, 420 insertions(+), 6 deletions(-) create mode 100755 src/packaging/MacOS/Uninstall diff --git a/src/packaging/MacOS/DS_Store b/src/packaging/MacOS/DS_Store index 52daeaba672ce265990f6dfd1963c3c8dd992582..646bda65aa6be118f0801c380d88f194de75ead2 100644 GIT binary patch delta 112 zcmZokXi1ph&&abeU^hP_&tx6}dkzL~rc%aJtU{ZE1=5)r4@}-IoN6z~5Xz9pkO{=a z3?&SS3^_ok$B@jB&yWj*i9qob&z$_^q@4UD1_lNJ1_s6>K+O3c3>X+T$MdXU-pnrX GR~!J9>mTy~ delta 133 zcmZokXi1ph&&azmU^hP_?_?eUdk)6^jI){TSS&UN3#2nM9-X{fIMtYwA(SDHArpv; z8A=!u8FCnMJah7slXCKt7#J7?7#J9j0O=q9!2rl&VBnjqC?cv@%#h4bz)*rk?RSXU J&7C6E(f|PTDdhkF diff --git a/src/packaging/MacOS/OpenAFS.Info.plist b/src/packaging/MacOS/OpenAFS.Info.plist index c50b198..6f0c416 100644 --- a/src/packaging/MacOS/OpenAFS.Info.plist +++ b/src/packaging/MacOS/OpenAFS.Info.plist @@ -18,6 +18,10 @@ IFPkgFlagAuthorizationAction RootAuthorization + IFPkgFlagBackgroundAlignment + bottomright + IfPkgFlagBackgroundScaling + proportional IFPkgFlagDefaultLocation / IFPkgFlagInstallFat @@ -27,7 +31,7 @@ IFPkgFlagRelocatable IFPkgFlagRestartAction - RecommendedRestart + NoRestart IFPkgFlagRootVolumeOnly IFPkgFlagUpdateInstalledLanguages diff --git a/src/packaging/MacOS/OpenAFS.post_install b/src/packaging/MacOS/OpenAFS.post_install index c6ed97d..c840b18 100644 --- a/src/packaging/MacOS/OpenAFS.post_install +++ b/src/packaging/MacOS/OpenAFS.post_install @@ -59,11 +59,14 @@ if [ -z "$done" -a -f CellServDB ]; then if cmp -s CellServDB CellServDB.master ; then echo CellServDB is up to date. cp CellServDB.master CellServDB.master.last + if [ ! -f CellServDB ]; then + cp CellServDB.master CellServDB + fi done=1 fi fi -if [ -z "$done" -a -f CellServDB ]; then +if [ -z "$done" ]; then # there are local changes to be merged if [ -f CellServDB -a -f CellServDB.master.last ]; then echo Merging CellServDB entries.... @@ -73,7 +76,7 @@ if [ -z "$done" -a -f CellServDB ]; then # this is a new install, or an upgrade from pre-1.2.7 echo "Installing new CellServDB" cp CellServDB.master CellServDB.master.last - if [ ! -e CellServDB ]; then + if [ ! -f CellServDB ]; then cp CellServDB.master CellServDB fi fi @@ -89,3 +92,6 @@ elif [ -e config/afssettings ]; then chmod a-x config/afssettings fi +#here we should run tools which configure the client, and then if it's enabled: +/Library/StartupItems/OpenAFS/OpenAFS start + diff --git a/src/packaging/MacOS/ReadMe.rtf b/src/packaging/MacOS/ReadMe.rtf index 00fbab8..a2c5ddd 100644 --- a/src/packaging/MacOS/ReadMe.rtf +++ b/src/packaging/MacOS/ReadMe.rtf @@ -4,7 +4,7 @@ \margl1440\margr1440\vieww9000\viewh9000\viewkind0 \pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural -\f0\fs20 \cf0 This pre-release of OpenAFS is targeted at MacOS 10.4.1. It is *not* production ready. Use of this release with afs home directories or Library directories is not recommended. (keychain corruption may occur. keychain-using apps may hang). afssettings does not work either. unmount afs manually before rebooting/shutting down, or the shutdown will not complete. \ +\f0\fs20 \cf0 This release of OpenAFS is targeted at MacOS 10.4. \ Select a client cell name by editing /var/db/openafs/etc/ThisCell\ \ diff --git a/src/packaging/MacOS/Uninstall b/src/packaging/MacOS/Uninstall new file mode 100755 index 0000000..1ca62f7 --- /dev/null +++ b/src/packaging/MacOS/Uninstall @@ -0,0 +1,397 @@ +#!/usr/bin/perl -w +# real Perl code begins here +# +# Adapted from Apple's uninstall-devtools.pl (Version 7 for Xcode Tools 1.2) +# +# BSD License: c.f. +# + +use strict; +use File::Basename; + +use vars qw ($do_nothing $print_donothing_removals $receipts_dir $verbose $noisy_warnings); +use vars qw ($suppress_spin $spin_counter $spin_state $spin_slower_downer); +use vars qw (%exception_list $gen_dirs @gen_files @rmfiles @rmdirs @rmpkg); + +#---------------------------------------------------------------------------------------- + +$do_nothing = 0; +$print_donothing_removals = 1; +$verbose = 1; +$noisy_warnings = 0; + +# One of rm -rf in this script uses $receipts_dir -- change with care. +$receipts_dir = "/Library/Receipts"; + +%exception_list = ( +# '/usr/bin/aklog', '', +); + +$gen_dirs = { }; +#$gen_dirs->{"/"}->{"Library"}->{"OpenAFS"}->{"Tools"} = {}; + +@gen_files = ( + "/var/db/openafs/etc/cacheinfo", + "/var/db/openafs/etc/ThisCell", + "/var/db/openafs/etc/config/afsd.options", + "/var/db/openafs/etc/CellServDB.save", + "/var/db/openafs/etc/CellServDB.master.last", + "/var/db/openafs/etc/CellServDB", + "/var/db/openafs/etc/config/settings.plist", +); + +#---------------------------------------------------------------------------------------- + +$| = 1; +#if ($do_nothing == 0 && $< != 0) +# { +# die "ERROR: Must be run with root permissions--prefix command with 'sudo'.\n"; +# } + +sub main + { + # commandline args: + # 0: dir of packages to remove + # 1: flag indicating whether to keep package receipts + # 2: flag indicating whether to supress spin indicator + + if (!@ARGV) { + use FindBin qw($Bin); + @ARGV = ("$Bin/..", 0, 0); + } + $suppress_spin = defined ($ARGV[2]) && $ARGV[2]; + + $spin_counter = 0; + $spin_state = 0; + spin_rate_slow (); + + pre_print (); + print "Uninstalling OpenAFS package:\n\n"; + + remove_generated_files (); + remove_main_packages (); + remove_generated_directories (); + + if ($do_nothing == 0) { + my @rmcmd = ('osascript', '-e', "do shell script \"/bin/rm -f @rmfiles; /bin/rmdir @rmdirs; /bin/rm -rf @rmpkg\" with administrator privileges"); + system @rmcmd; + my $retcode = $? >> 8; + if ($retcode != 0) { + print_warning ("Warning: There may have been a problem uninstalling\n"); + } + } + + pre_print (); + print "\nFinished uninstalling.\n"; + } + +sub remove_main_packages + { +# opendir (DIR, $ARGV[0]) or die "ERROR: package directory $ARGV[0] not found\n"; +# my @pkglist = grep /\.pkg$/, readdir DIR; +# closedir DIR; + my @pkglist = ("OpenAFS", + ); + + foreach (@pkglist) + { + s/\.pkg$//; + my $pkgname = $_; + my $pkgname_fullpath = "$receipts_dir/$pkgname.pkg"; + my $pkgname_bom_fullpath = undef; + + next if (! -d "$pkgname_fullpath" ); + + print_verbose ("Removing package $pkgname.pkg\n"); + + my $f = "$pkgname_fullpath/Contents/Resources/$pkgname.bom"; + if (-f $f && -r $f) { + $pkgname_bom_fullpath = $f; + } + + next if (!defined ($pkgname_bom_fullpath)); + + my $bomroot = ""; + open (INFO, "$pkgname_fullpath/Contents/Info.plist") or next; + while () { + m/IFPkgFlagDefaultLocation/ or next; + $bomroot = ; + } + close (INFO); + + $bomroot =~ />(.*)) + { + chomp; + m#^\.(/.*)$#; + next if (!defined ($1) || $1 eq ""); + my $filename = $bomroot . $1; + + remove_a_file ($filename); + } + close (LSBOM); + + my $rooth = { }; + + open (LSBOM, "/usr/bin/lsbom -d -p f '$pkgname_bom_fullpath' |") or next; + while () + { + chomp; + m#^\.(/.*)$#; + next if (!defined ($1) || $1 eq ""); + my $directory = $bomroot . $1; + if (-d $directory) + { + $rooth = add_directory_to_tree ($directory, $rooth); + } + else + { + if ($noisy_warnings) + { + print_warning ("Warning: \"$directory\" listed in BOM but not present on system.\n"); + } + } + } + close (LSBOM); + + spin_rate_fast (); + remove_empty_directories ($rooth, "/"); + + remove_package_receipts ("$pkgname.pkg") if (!defined ($ARGV[1]) || !$ARGV[1]) ; + } + } + +sub remove_generated_files + { + foreach (@gen_files) + { + remove_a_file ($_); + } + } + +sub remove_generated_directories + { + remove_empty_directories ($gen_dirs, "/"); + } + +sub add_directory_to_tree + { + my $dir = shift; + my $rooth = shift; + my $p = $rooth; + + my @pathcomp = split /\//, $dir; + + progress_point (); + foreach (@pathcomp) + { + my $cur_name = $_; + if ($cur_name eq "" || !defined ($cur_name)) + { + $cur_name = "/"; + } + if (!defined ($p->{"$cur_name"})) + { + $p->{$cur_name} = { }; + } + $p = $p->{$cur_name}; + } + return $rooth; + } + +sub remove_empty_directories + { + my $rooth = shift; + my $path = shift; + my $children = (scalar (keys %{$rooth})); + my $dirs_remain = 0; + + if ($children > 0) + { + foreach my $dirname (sort keys %{$rooth}) + { + my $printpath; + $printpath = "$path/$dirname"; + $printpath =~ s#^/*#/#; + remove_empty_directories ($rooth->{$dirname}, "$printpath"); + $dirs_remain = 1 if (-d "$printpath"); + } + } + + if ($dirs_remain == 0) + { + maybe_remove_ds_store ("$path"); + } + + remove_a_dir ("$path"); + } + +sub remove_a_file + { + my $fn = shift; + my $dirname = dirname ($fn); + my $basename = basename ($fn); + my $ufs_rsrc_file = "$dirname/._$basename"; + + progress_point (); + return if (!defined ($fn) || $fn eq ""); + + # Leave any files that are shared between packages alone. + if (defined($exception_list{$fn})) + { + if ($noisy_warnings) + { + print_warning ("Warning: file \"$fn\" intentionally not removed, even though it's in the BOM.\n"); + } + return; + } + + if (! -f $fn && ! -l $fn) + { + if ($noisy_warnings) + { + print_warning ("Warning: file \"$fn\" present in BOM but not found on disc.\n"); + } + return; + } + + if ($do_nothing == 1) + { + print_donothing ("rm $fn\n"); + print_donothing ("rm $ufs_rsrc_file\n") if ( -f $ufs_rsrc_file); + } + else + { + unshift(@rmfiles, "$fn"); + unshift(@rmfiles, "$fn") if ( -f $ufs_rsrc_file); + } + } + +sub remove_a_dir + { + my $dir = shift; + + progress_point (); + return if (!defined ($dir) || $dir eq "" || $dir eq "/" || $dir eq "/usr"); + if (! -d $dir) + { + if ($noisy_warnings) + { + print_warning ("Warning: directory \"$dir\" present in BOM but not found on disc.\n"); + } + return; + } + + if ($do_nothing == 1) + { + print_donothing ("rmdir $dir\n"); + } + else + { + push(@rmdirs, "$dir"); + } + } + +sub remove_package_receipts + { + my $pkgname = shift; + $pkgname =~ s#/##g; # There shouldn't be any path seps in the pkg name... + return if (!defined ($pkgname) || $pkgname eq "" + || $pkgname eq "." || $pkgname eq ".."); + + my $pkgdir = "$receipts_dir/$pkgname"; + return if (!defined ($pkgdir) || $pkgdir eq "" || ! -d $pkgdir); + + push(@rmpkg, "$pkgdir"); + } + + +sub maybe_remove_ds_store + { + my $path = shift; + my $filecount = 0; + return if (!defined ($path) || $path eq "" || $path eq "/" || $path eq "/usr"); + return if (! -f "$path/.DS_Store"); + + open (LS, "/bin/ls -a '$path' |"); + while () + { + chomp; + next if (m#^\.$# || m#^\.\.$#); + $filecount++; + } + close (LS); + + if ($filecount == 1 && -f "$path/.DS_Store") + { + remove_a_file ("$path/.DS_Store"); + } + } + +sub print_donothing + { + my $msg = shift; + return if ($print_donothing_removals != 1); + pre_print (); + print $msg; + } + +sub print_verbose + { + my $msg = shift; + return if ($verbose != 1); + pre_print (); + print $msg; + } + +sub print_warning + { + my $msg = shift; + pre_print (); + print STDERR $msg; + } + +sub print_error + { + my $msg = shift; + pre_print (); + print STDERR $msg; + } + +sub pre_print + { + print " " unless ($suppress_spin); + } + +sub spin_rate_slow + { + $spin_slower_downer = 150; + } + +sub spin_rate_fast + { + $spin_slower_downer = 75; + } + +sub progress_point + { + return if ($suppress_spin); + $spin_counter++; + if (($spin_counter % $spin_slower_downer) == 0) + { + my $spin_chars = "|/-\\"; + my $c = substr ($spin_chars, $spin_state % 4, 1); + $spin_state++; + print "$c"; + } + } + +main (); + +#---------------------------------------------------------------------------------------- diff --git a/src/packaging/MacOS/buildpkg.sh b/src/packaging/MacOS/buildpkg.sh index 2c6df38..f0a4340 100644 --- a/src/packaging/MacOS/buildpkg.sh +++ b/src/packaging/MacOS/buildpkg.sh @@ -53,7 +53,6 @@ fi if [ $firstpass = yes ]; then if [ -x /usr/bin/curl ]; then -# /usr/bin/curl -f -O http://www.central.org/dl/cellservdb/CellServDB /usr/bin/curl -f -O http://dl.central.org/dl/cellservdb/CellServDB fi @@ -166,6 +165,7 @@ if [ $secondpass = yes ]; then cp OpenAFS.post_install $PKGRES/postinstall cp OpenAFS.pre_upgrade $PKGRES/preupgrade cp OpenAFS.post_install $PKGRES/postupgrade + cp background.jpg $PKGRES/background.jpg if [ $majorvers -ge 8 ]; then cp InstallationCheck $PKGRES mkdir -p $PKGRES/English.lproj @@ -206,7 +206,14 @@ if [ $secondpass = yes ]; then mkdir $CURDIR/dmg mv $CURDIR/OpenAFS.pkg $CURDIR/dmg rm -rf $CURDIR/OpenAFS.dmg - hdiutil create -srcfolder $CURDIR/dmg -volname OpenAFS -anyowners $CURDIR/OpenAFS.dmg + cp Uninstall $CURDIR/dmg/Uninstall.command + cp DS_Store $CURDIR/dmg/.DS_Store + mkdir $CURDIR/dmg/.background + cp afslogo.jpg $CURDIR/dmg/.background +# hdiutil create -srcfolder $CURDIR/dmg -volname OpenAFS -anyowners $CURDIR/OpenAFS.dmg + hdiutil makehybrid -hfs -hfs-volume-name OpenAFS -hfs-openfolder $CURDIR/dmg $CURDIR/dmg -o $CURDIR/TMP.dmg + hdiutil convert -format UDZO TMP.dmg -o $CURDIR/OpenAFS.dmg + rm $CURDIR/TMP.dmg rm -rf $CURDIR/dmg # Unfortunately, sudo sets $USER to root, so I can't chown the #.pkg dir back to myself -- 1.9.4