annotate mac/make-package @ 46177:76bedba7ffd6

2002-07-04 Andrew Choi <akochoi@shaw.ca> * make-package: New file.
author Andrew Choi <akochoi@shaw.ca>
date Thu, 04 Jul 2002 19:33:39 +0000
parents
children 24320eec547a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
46177
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1 #!/bin/sh
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3 #### make-package: create a Mac OS X package for use by the installer.
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4 #### The installer will place the Emacs OSX application in
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5 #### /Application/Emacs and the rest of emacs in the usual unix places
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6 #### under /usr/local or some other location if specified as the first
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7 #### argument. The disc image will be in the file EmacsInstaller.dmg.
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8 ####
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9 #### Upon installation, this will leave two versions of emacs on the
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10 #### computer, 20.7 and 21.1.
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
11 ####
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
12 #### Examples:
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
13 #### ./make-package
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
14 #### Will create an installer that will place the emacs support
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
15 #### files inside /usr/local.
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
16 #### ./make-package /usr
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
17 #### Will create an installer that will place the emacs support
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
18 #### files inside /usr. This will replace the default version of
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
19 #### emacs included with Mac OS X.
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
20
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
21 # Copyright (C) 2002 Free Software Foundation, Inc.
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
22 #
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
23 # This file is part of GNU Emacs.
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
24 #
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
25 # GNU Emacs is free software; you can redistribute it and/or modify
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
26 # it under the terms of the GNU General Public License as published by
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
27 # the Free Software Foundation; either version 2, or (at your option)
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
28 # any later version.
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
29 #
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
30 # GNU Emacs is distributed in the hope that it will be useful,
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
31 # but WITHOUT ANY WARRANTY; without even the implied warranty of
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
32 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
33 # GNU General Public License for more details.
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
34 #
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
35 # You should have received a copy of the GNU General Public License
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
36 # along with GNU Emacs; see the file COPYING. If not, write to the
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
37 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
38 # Boston, MA 02111-1307, USA.
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
39 #
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
40 # Contributed by Steven Tamm (steventamm@mac.com).
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
41
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
42 progname="$0"
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
43 ## Default location to place it is /usr/local
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
44 prefix=/usr/local
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
45 if [ $1 ]; then
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
46 prefix="$1"
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
47 fi
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
48
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
49
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
50 ### Exit if a command fails.
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
51 #set -e
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
52
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
53 ### Print out each line we read, for debugging's sake.
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
54 set -v
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
55
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
56 LANGUAGE=C
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
57 LC_ALL=C
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
58 LC_MESSAGES=
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
59 LANG=
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
60 export LANGUAGE LC_ALL LC_MESSAGES LANG
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
61
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
62 ## Don't restrict access to any files.
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
63 umask 0
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
64
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
65 ### Make sure we're running in the right place.
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
66 if [ -f Emacs.pkg ]; then
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
67 echo "${progname}: Package Emacs.pkg already exists.
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
68 Perhaps a previous invocation of \`${progname}' failed to clean up after
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
69 itself. Move or delete Emacs.pkg and try again." >&2
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
70 exit 1
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
71 fi
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
72
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
73 if [ ! -f Emacs.app/Contents/PkgInfo ]; then
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
74 echo "${progname}: Can't find \`Emacs.app/Contents/PkgInfo'" >&2
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
75 echo "${progname} must be run in the \`mac' directory of the Emacs" >&2
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
76 echo "distribution tree. cd to that directory and try again." >&2
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
77 exit 1
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
78 fi
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
79
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
80 ### Check whether file ../lisp/version.el exists.
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
81 if [ ! -f ../lisp/version.el ]; then
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
82 echo "${progname}: Can't find \`../lisp/version.el'" >&2
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
83 exit 1
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
84 fi
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
85
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
86 ### Find out which version of Emacs this is.
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
87 shortversion=`grep 'defconst[ ]*emacs-version' ../lisp/version.el \
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
88 | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
89 version=`grep 'defconst[ ]*emacs-version' ../lisp/version.el \
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
90 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
91 if [ ! "${version}" ]; then
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
92 echo "${progname}: can't find current Emacs version in \`./lisp/version.el'" >&2
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
93 exit 1
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
94 fi
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
95
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
96 echo Version numbers are $version and $shortversion
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
97
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
98 ### Make sure we don't already have a directory emacs-${version}.
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
99
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
100 emacsname="emacs-${version}${new_extension}"
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
101
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
102 if [ -d ${emacsname} ]
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
103 then
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
104 echo Directory "${emacsname}" already exists >&2
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
105 exit 1
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
106 fi
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
107
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
108 ### Make sure the subdirectory is available.
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
109 tempparent="make-package.tmp.$$"
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
110 if [ -d ${tempparent} ]; then
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
111 echo "${progname}: staging directory \`${tempparent}' already exists.
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
112 Perhaps a previous invocation of \`${progname}' failed to clean up after
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
113 itself. Check that directories whose names are of the form
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
114 \`make-dist.tmp.NNNNN' don't contain any important information, remove
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
115 them, and try again." >&2
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
116 exit 1
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
117 fi
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
118
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
119 if [ -d /Volumes/Emacs ]; then
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
120 echo "${progname}: Already have an Emacs disc image mounted. Please
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
121 eject that disc image and try again." >&2
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
122 exit 1
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
123 fi
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
124
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
125 tempparentfull="`pwd`/${tempparent}"
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
126
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
127 echo Installing into directory ${tempparentfull} >&2
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
128
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
129 (cd ..; ./configure --without-x --prefix=${prefix}; make install prefix=${tempparentfull}${prefix})
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
130
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
131 ### This trap ensures that the staging directory will be cleaned up even
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
132 ### when the script is interrupted in mid-career.
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
133 trap "echo 'Interrupted...cleaning up the staging directory'; rm -rf ${tempparent}; rm -rf Emacs.pkg; exit 1" 1 2 15
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
134
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
135 mkdir ${tempparentfull}/Applications
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
136
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
137 cp -r Emacs.app ${tempparentfull}/Applications
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
138
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
139 echo "Creating Package Info file"
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
140
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
141 mkdir Emacs.pkg
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
142 mkdir Emacs.pkg/Contents
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
143 mkdir Emacs.pkg/Contents/Resources
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
144 mkdir Emacs.pkg/Contents/Resources/English.lproj
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
145 echo 'pmkrpkg1' > Emacs.pkg/Contents/PkgInfo
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
146
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
147 infofile=Emacs.pkg/Contents/Resources/English.lproj/Emacs.info
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
148
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
149 echo 'Title Emacs' > ${infofile}
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
150 echo "Version ${version}" >> ${infofile}
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
151 echo "Description Install GNU Emacs ${version} as a command-line app and a Mac OS Application" >> ${infofile}
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
152 echo 'DefaultLocation /' >> ${infofile}
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
153 echo 'DeleteWarning' >> ${infofile}
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
154 echo 'NeedsAuthorization YES' >> ${infofile}
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
155 echo 'Required NO' >> ${infofile}
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
156 echo 'Relocatable NO' >> ${infofile}
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
157 echo 'RequiresReboot NO' >> ${infofile}
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
158 echo 'UseUserMask NO' >> ${infofile}
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
159 echo 'OverwritePermissions NO' >> ${infofile}
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
160 echo 'InstallFat NO' >> ${infofile}
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
161
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
162 echo "Creating pax file"
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
163 (cd ${tempparentfull}; pax -w -f ../Emacs.pkg/Contents/Resources/Emacs.pax .; cd ..)
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
164 #echo "Compressing pax file"
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
165 #gzip Emacs.pkg/Contents/Resources/Emacs.pax
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
166
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
167 echo "Creating bom file"
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
168 mkbom ${tempparentfull} Emacs.pkg/Contents/Resources/Emacs.bom
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
169
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
170 echo "Generating sizes file"
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
171 sizesfile=Emacs.pkg/Contents/Resources/Emacs.sizes
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
172
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
173 numFiles=`du -a ${tmpparent} | wc -l`
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
174 installedSize=`du -s ${tmpparent} | cut -f1`
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
175 compressedSize=`du -s Emacs.pkg | cut -f1`
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
176
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
177 echo "NumFiles ${numFiles}" > ${sizesfile}
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
178 echo "InstalledSize ${installedSize}" >> ${sizesfile}
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
179 echo "CompressedSize ${compressedSize}" >> ${sizesfile}
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
180 cat ${sizesfile}
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
181
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
182 mv ${tempparentfull} ${emacsname}
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
183
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
184 echo "Creating Disc Image"
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
185 ## Allocate an extra 5000 sectors (about 2.5 mg)
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
186 ## Note a sector appears to be ~500k
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
187 sectorsAlloced=`echo 2*${compressedSize}+5000|bc`
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
188 hdiutil create -ov EmacsRW -sectors ${sectorsAlloced}
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
189 ## Need to format the disc image before mounting
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
190 mountLoc=`hdid -nomount EmacsRW.dmg | grep HFS | cut -f1`
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
191 /sbin/newfs_hfs -v Emacs ${mountLoc}
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
192 hdiutil eject ${mountLoc}
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
193 echo "Copying Package to Disc Image"
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
194 hdid EmacsRW.dmg
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
195
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
196 rm -rf ${emacsname}
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
197
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
198 if [ ! -d /Volumes/Emacs ]; then
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
199 echo "Could not create disc image. The Emacs installer package in this
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
200 directory should be correct. Please use the Disc Copy program to create
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
201 a disc image." >&2
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
202 exit 0
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
203 fi
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
204
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
205 cp -a Emacs.pkg /Volumes/Emacs
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
206
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
207 ## Converting Disk Image to read-only
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
208 echo 'Converting Disc Image to read-only'
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
209 hdiutil eject ${mountLoc}
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
210 hdiutil resize EmacsRW.dmg -sectors min
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
211 hdiutil convert EmacsRW.dmg -format UDRO -o EmacsInstaller.dmg
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
212 gzip EmacsInstaller.dmg
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
213 rm EmacsRW.dmg
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
214
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
215 echo "Cleaning up the staging directory"
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
216 rm -rf Emacs.pkg
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
217
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
218 ### make-package ends here
76bedba7ffd6 2002-07-04 Andrew Choi <akochoi@shaw.ca>
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
219