forked from NREL/OpenStudio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDarwinPostFlight.sh.in
59 lines (48 loc) · 3.09 KB
/
DarwinPostFlight.sh.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
ruby_install_dir="$2/Applications/${CMAKE_PROJECT_NAME} ${OPENSTUDIO_VERSION}/Ruby"
ruby_2=${MAC_RUBY_2}
i386=${I386_FOUND}
#---------- Create Symbolic Links to the Ruby bindings ----------
ln -sf "$2/Applications/${CMAKE_PROJECT_NAME} ${OPENSTUDIO_VERSION}/Ruby/openstudio.rb" /Library/Ruby/Site/
ln -sFf "$2/Applications/${CMAKE_PROJECT_NAME} ${OPENSTUDIO_VERSION}/Ruby/openstudio" /Library/Ruby/Site/
#---------- Write a plugin-config.rb file for later installation ----------
# And put it in the install folder for later reuse by the user if needed
config_file="$ruby_install_dir/Plugins/OpenStudio/OpenStudio-config.rb"
echo "require '$2/Applications/${CMAKE_PROJECT_NAME} ${OPENSTUDIO_VERSION}/Ruby/openstudio'" > "$config_file"
chmod 755 "$config_file"
chown $USER "$config_file"
if $ruby_2 && $i386 ; then
#---------- Install plugin for SketchUp 14 ----------
# Check for the SketchUp 14 Application Support directory
SU14_support_dir="/Library/Application Support/SketchUp 2014"
mkdir -p "$SU14_support_dir/SketchUp/Plugins/OpenStudio"
# copy the plugin into the directory
cp "$ruby_install_dir/Plugins/OpenStudio.rb" "$SU14_support_dir/SketchUp/Plugins/OpenStudio.rb"
cp "$ruby_install_dir/Plugins/OpenStudio/Startup.rb" "$SU14_support_dir/SketchUp/Plugins/OpenStudio/Startup.rb"
cp "$config_file" "$SU14_support_dir/SketchUp/Plugins/OpenStudio/OpenStudio-config.rb"
elif $i386 ; then
#---------- Install plugin for SketchUp 13 ----------
# Check for the SketchUp 13 Application Support directory
SU13_support_dir="/Library/Application Support/SketchUp 2013"
mkdir -p "$SU13_support_dir/SketchUp/Plugins/OpenStudio"
# copy the plugin into the directory
cp "$ruby_install_dir/Plugins/OpenStudio.rb" "$SU13_support_dir/SketchUp/Plugins/OpenStudio.rb"
cp "$ruby_install_dir/Plugins/OpenStudio/Startup.rb" "$SU13_support_dir/SketchUp/Plugins/OpenStudio/Startup.rb"
cp "$config_file" "$SU13_support_dir/SketchUp/Plugins/OpenStudio/OpenStudio-config.rb"
#---------- Install plugin for SketchUp 8 ----------
# Check for the SketchUp 8 Application Support directory
SU8_support_dir="/Library/Application Support/Google SketchUp 8"
mkdir -p "$SU8_support_dir/SketchUp/Plugins/OpenStudio"
# copy the plugin into the directory
cp "$ruby_install_dir/Plugins/OpenStudio.rb" "$SU8_support_dir/SketchUp/Plugins/OpenStudio.rb"
cp "$ruby_install_dir/Plugins/OpenStudio/Startup.rb" "$SU8_support_dir/SketchUp/Plugins/OpenStudio/Startup.rb"
cp "$config_file" "$SU8_support_dir/SketchUp/Plugins/OpenStudio/OpenStudio-config.rb"
fi
#---------- Installation Directory Icon ----------
icon="$2/Applications/${CMAKE_PROJECT_NAME} ${OPENSTUDIO_VERSION}/$(printf 'Icon\r')"
touch "$icon"
chflags hidden "$icon"
# copy the icon into the resource fork
cp "$2/Applications/${CMAKE_PROJECT_NAME} ${OPENSTUDIO_VERSION}/OpenStudio.app/Contents/Resources/folder_icon.rsrc" "$icon/..namedfork/rsrc"
# set the custom icon extended attribute on the directory
xattr -wx com.apple.FinderInfo 0000000000000000040000000000000000000000000000000000000000000000 "$2/Applications/${CMAKE_PROJECT_NAME} ${OPENSTUDIO_VERSION}/"