2 # aNetHack 0.0.1 macosx.sh $ANH-Date: 1455930387 2016/02/20 01:06:27 $ $ANH-Branch: master $:$ANH-Revision: 1.16 $
3 # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
4 # aNetHack may be freely redistributed. See license for details.
6 # hints helper script for macosx
7 # DO NOT invoke directly.
9 # Works for 10.4 and 10.5. (The 10.5 support might work for 10.4 but keep
10 # both versions in case we need to support earlier versions.)
16 # fail unless user exists (good through 10.4)
18 gotuser
=`niutil -readval . /users/$user name 0 2>/dev/null`
19 [ -z $gotuser ] && (echo "User $user does not exist."
25 #_writers_passwd: dummy1
26 #_writers_tim_password: dummy1
27 #_writers_picture: dummy1
30 #picture: /Library/User Pictures/Animals/Dragonfly.tif
33 #_writers_hint: dummy1
36 #_writers_realname: dummy1
39 #authentication_authority: ;ShadowHash;
41 #generateduid: F6D4991C-BDF5-481F-A407-D84C6A2D0E2A
44 # fail unless group exists (good through 10.4)
46 gotgrp
=`niutil -readval . /groups/$group name 0 2>/dev/null`
47 [ -z $gotgrp ] && ( echo "Group $group does not exist."
52 #niutil -read . /groups/bin name 0
56 #generateduid: ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000007
57 #smb_sid: S-1-5-21-107
61 # fail unless user exists (required as of 10.5)
63 if( dscl localhost
-read /Search
/Users
/$user 1>/dev
/null
2>&1 );
67 echo "User $user does not exist.";
73 # if group does not exist, create it (required as of 10.5)
75 [ -z $group ] && ( echo "No group specified."
78 if( dscl localhost
-read /Search
/Groups
/$group 1>/dev
/null
2>&1 );
82 echo "Group $group does not exist - creating.";
83 dseditgroup
-o create
-r "Games Group" -s 3600 $group
84 if( dscl localhost
-read /Search
/Groups
/$group 1>/dev
/null
2>&1 );
88 echo "Unable to create group $group."
97 # we should traverse the elements of $PATH instead
98 if [ -f /usr
/bin
/gdb
]; then
99 gdbpath
='GDBPATH=/usr/bin/gdb' #traditional location
100 elif [ -f /opt
/local
/bin
/ggdb
]; then
101 gdbpath
='GDBPATH=/opt/local/bin/ggdb' #macports gdb
102 elif [ -f /Developer
/usr
/bin
/gdb
]; then
103 # this one seems to be broken with Xcode 5.1.1 on Mountain Lion
104 gdbpath
='GDBPATH=/Developer/usr/bin/gdb' #recent Xcode tools
106 gdbpath
='#GDBPATH' #none of the above
108 if [ -f /bin
/grep ]; then
109 greppath
='GREPPATH=/bin/grep'
110 elif [ -f /usr
/bin
/grep ]; then
111 greppath
='GREPPATH=/usr/bin/grep'
115 # PANICTRACE_GDB value should only be replaced if gdbpath is '#GDBPATH'
116 if ! [ -e $dest ]; then
117 sed -e "s:^GDBPATH=.*:$gdbpath:" \
118 -e "s:^GREPPATH=.*:$greppath:" \
119 -e 's/^PANICTRACE_GDB=[12]/PANICTRACE_GDB=0/' \
120 -e 's/^#OPTIONS=.*/&\
121 OPTIONS=!use_darkgray/' \
126 #% dscl localhost -read /Search/Groups/wheel
127 # AppleMetaNodeLocation: /Local/Default
128 # GeneratedUID: ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000000
129 # GroupMembership: root
135 # RecordType: dsRecTypeStandard:Groups
136 # SMBSID: S-1-5-21-100
138 xdescplist
) SVSDOT
=`util/makedefs --svs .`
140 <?xml version="1.0" encoding="UTF-8"?>
141 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
142 <plist version="1.0">
144 <key>IFPkgDescriptionDeleteWarning</key>
146 <key>IFPkgDescriptionDescription</key>
147 <string>aNetHack $SVSDOT for the MacOS X Terminal
149 <key>IFPkgDescriptionTitle</key>
150 <string>aNetHack</string>
151 <key>IFPkgDescriptionVersion</key>
152 <string>$SVSDOT</string>
158 xinfoplist
) SVSDOT
=`util/makedefs --svs .`
160 <?xml version="1.0" encoding="UTF-8"?>
161 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
162 <plist version="1.0">
164 <key>CFBundleGetInfoString</key>
165 <string>aNetHack $SVSDOT for the MacOS X Terminal</string>
166 <key>CFBundleIdentifier</key>
167 <string>org.aanethack.term</string>
168 <key>CFBundleName</key>
169 <string>aNetHack</string>
170 <key>CFBundleShortVersionString</key>
171 <string>$SVSDOT</string>
172 <key>IFMajorVersion</key>
174 <key>IFMinorVersion</key>
176 <key>IFPkgFlagAllowBackRev</key>
178 <key>IFPkgFlagAuthorizationAction</key>
179 <string>RootAuthorization</string>
180 <key>IFPkgFlagDefaultLocation</key>
182 <key>IFPkgFlagInstallFat</key>
184 <key>IFPkgFlagIsRequired</key>
186 <key>IFPkgFlagOverwritePermissions</key>
188 <key>IFPkgFlagRelocatable</key>
190 <key>IFPkgFlagRestartAction</key>
191 <string>NoRestart</string>
192 <key>IFPkgFlagRootVolumeOnly</key>
194 <key>IFPkgFlagUpdateInstalledLanguages</key>
196 <key>IFPkgFlagUseUserMask</key>
198 <key>IFPkgFormatVersion</key>
199 <real>0.10000000149011612</real>
205 *) echo "Unknown command $cmd"
210 # dscl localhost -read /Search/Users/games
211 # dsAttrTypeNative:_writers_hint: games
212 # dsAttrTypeNative:_writers_jpegphoto: games
213 # dsAttrTypeNative:_writers_LinkedIdentity: games
214 # dsAttrTypeNative:_writers_passwd: games
215 # dsAttrTypeNative:_writers_picture: games
216 # dsAttrTypeNative:_writers_realname: games
217 # dsAttrTypeNative:_writers_UserCertificate: games
218 # AppleMetaNodeLocation: /Local/Default
219 # AuthenticationAuthority: ;ShadowHash; ;Kerberosv5;;games@LKDC:SHA1.3F695B215C78511043D9787CA51DE92E6494A021;LKDC:SHA1.3F695B215C78511043D9787CA51DE92E6494A021;
220 # AuthenticationHint: games
221 # GeneratedUID: A727EFB1-D6AA-4FE2-8524-0E154890E9A9
222 # NFSHomeDirectory: /Users/games
225 # /Library/User Pictures/Flowers/Sunflower.tif
229 # RecordType: dsRecTypeStandard:Users
231 # UserShell: /bin/bash
233 # see also: http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/additionalfeatures/chapter_10_section_9.html
235 # another mess: 10.4 creates a group for every user, 10.5 dumps you into staff.
236 # so I think we need to explicitly create group games in both (if it doesn't
237 # exist) and use owner bin (nope that fails since everything seems to be owned
238 # by root. Do we want that? How about just creating user games as well?)
240 # [Hermes:sys/unix/hints] keni% dscl localhost -read /Search/Users/games9
241 # <dscl_cmd> DS Error: -14136 (eDSRecordNotFound)
242 # [Hermes:sys/unix/hints] keni% dscl localhost -read /Search/Users/games9 >/dev/null
243 # <dscl_cmd> DS Error: -14136 (eDSRecordNotFound)
244 # [Hermes:sys/unix/hints] keni% dscl localhost -read /Search/Users/games > /dev/null
245 # status is good: 0 or 56
247 # file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/releasenotes/MacOSXServer/RN-DirectoryServices/index.html