forked from hybridgroup/kidsrubyinstaller-osx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer.sh
executable file
·106 lines (95 loc) · 3.74 KB
/
installer.sh
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/sh
INSTALLDIR="/Applications/KidsRuby"
CODEDIR="/usr/local/kidsruby"
init_messages() {
SHORTLANG=$(defaults read .GlobalPreferences AppleLanguages | tr -d [:space:] | cut -c2-3)
KIDSRUBY_INSTALLER=$SHORTLANG".sh"
if [ -f $KIDSRUBY_INSTALLER ]
then
source $KIDSRUBY_INSTALLER
else
source "en.sh"
fi
}
check_osx_version() {
TIGER=4
LEOPARD=5
SNOW_LEOPARD=6
LION=7
osx_version=$(sw_vers -productVersion | awk 'BEGIN {FS="."}{print $2}')
if [ $osx_version -eq $LEOPARD -o $osx_version -eq $SNOW_LEOPARD -o $osx_version -eq $LION ]; then
echo $KIDSRUBY_START_INSTALL
else
echo $KIDSRUBY_ERROR_NOT_SUPPORTED
exit
fi
}
create_install_dir() {
echo $KIDSRUBY_CREATE_INSTALL_DIRECTORY
if [ ! -d "$INSTALLDIR" ]
then
mkdir "$INSTALLDIR"
fi
echo $KIDSRUBY_CREATE_CODE_DIRECTORY
if [ ! -d "$CODEDIR" ]
then
mkdir "$CODEDIR"
fi
chmod -R a+rw "$CODEDIR"
if [ ! -d "$CODEDIR/lib" ]
then
mkdir "$CODEDIR/lib"
fi
}
install_qt() {
echo $KIDSRUBY_INSTALLING_QT
hdiutil attach qt-mac-opensource-4.7.3.dmg
/usr/sbin/installer -verbose -pkg "/Volumes/Qt 4.7.3/Qt.mpkg" -target /
hdiutil detach "/Volumes/Qt 4.7.3"
}
install_git() {
echo $KIDSRUBY_INSTALLING_GIT
hdiutil attach git-1.7.6-i386-snow-leopard.dmg
/usr/sbin/installer -verbose -pkg "/Volumes/Git 1.7.6 i386 Snow Leopard/git-1.7.6-i386-snow-leopard.pkg" -target /
hdiutil detach "/Volumes/Git 1.7.6 i386 Snow Leopard"
}
install_ruby() {
echo $KIDSRUBY_INSTALLING_RUBY
tar -xvzf ruby-1.9.2-p290.universal.tar.gz -C "$CODEDIR"
export PATH="$CODEDIR/ruby/bin:$PATH"
chmod -R a+rw "$CODEDIR"
}
symlink_qtbindings() {
export DYLD_LIBRARY_PATH=/usr/local/kidsruby/lib:$DYLD_LIBRARY_PATH
ln -s /usr/local/kidsruby/ruby/lib/ruby/gems/1.9.1/gems/qtbindings-4.7.3-universal-darwin-10/ext/build/smoke/qtcore/libsmokeqtcore.3.dylib /usr/local/kidsruby/lib
ln -s /usr/local/kidsruby/ruby/lib/ruby/gems/1.9.1/gems/qtbindings-4.7.3-universal-darwin-10/ext/build/smoke/qtgui/libsmokeqtgui.3.dylib /usr/local/kidsruby/lib
ln -s /usr/local/kidsruby/ruby/lib/ruby/gems/1.9.1/gems/qtbindings-4.7.3-universal-darwin-10/ext/build/smoke/qtxml/libsmokeqtxml.3.dylib /usr/local/kidsruby/lib
ln -s /usr/local/kidsruby/ruby/lib/ruby/gems/1.9.1/gems/qtbindings-4.7.3-universal-darwin-10/ext/build/smoke/qtopengl/libsmokeqtopengl.3.dylib /usr/local/kidsruby/lib
ln -s /usr/local/kidsruby/ruby/lib/ruby/gems/1.9.1/gems/qtbindings-4.7.3-universal-darwin-10/ext/build/smoke/qtsql/libsmokeqtsql.3.dylib /usr/local/kidsruby/lib
ln -s /usr/local/kidsruby/ruby/lib/ruby/gems/1.9.1/gems/qtbindings-4.7.3-universal-darwin-10/ext/build/smoke/qtnetwork/libsmokeqtnetwork.3.dylib /usr/local/kidsruby/lib
ln -s /usr/local/kidsruby/ruby/lib/ruby/gems/1.9.1/gems/qtbindings-4.7.3-universal-darwin-10/ext/build/smoke/qtsvg/libsmokeqtsvg.3.dylib /usr/local/kidsruby/lib
ln -s /usr/local/kidsruby/ruby/lib/ruby/gems/1.9.1/gems/qtbindings-4.7.3-universal-darwin-10/ext/build/ruby/qtruby/src/libqtruby4shared.2.dylib /usr/local/kidsruby/lib
ln -s /usr/local/kidsruby/ruby/lib/ruby/gems/1.9.1/gems/qtbindings-4.7.3-universal-darwin-10/ext/build/smoke/smokebase/libsmokebase.3.dylib /usr/local/kidsruby/lib
ln -s /usr/local/kidsruby/ruby/lib/ruby/gems/1.9.1/gems/qtbindings-4.7.3-universal-darwin-10/ext/build/smoke/qtwebkit/libsmokeqtwebkit.3.dylib /usr/local/kidsruby/lib
}
install_kidsruby() {
echo $KIDSRUBY_INSTALLING_EDITOR
tar -xvzf kidsruby.tar.gz -C "$INSTALLDIR"
}
install_commands() {
echo $KIDSRUBY_INSTALLING_COMMANDS
tar -xvzf KidsRuby.app.tar.gz -C "$INSTALLDIR"
cp kidsirb.sh "$INSTALLDIR"
}
init_messages
check_osx_version
create_install_dir
install_qt
install_git
# # install libyaml here?
install_ruby
./install_gems.sh ${CODEDIR} 2>&1
symlink_qtbindings
install_kidsruby
install_commands
echo $KIDSRUBY_END_INSTALL