-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenplacos-0.0.1_pre4.ebuild
174 lines (138 loc) · 5.25 KB
/
openplacos-0.0.1_pre4.ebuild
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="2"
inherit eutils git
DESCRIPTION="This utility is used to create a low cost automation system controlled by computer"
HOMEPAGE="http://openplacos.sourceforge.net/"
EGIT_REPO_URI="git://openplacos.git.sourceforge.net/gitroot/openplacos/openplacos"
EGIT_PATCHES="${FILESDIR}/${P}-gentoo.diff"
#EGIT_BRANCH="master"
#EGIT_COMMIT="d8dc9d2a2a695ec29a2fe2f15274800612e242c5"
OPOS_PATH="/usr/lib/ruby/openplacos"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE="-arduino +gtk2 -phidget -testing"
DEPEND="dev-vcs/git
sys-apps/dbus
dev-lang/ruby
>=dev-ruby/rubygems-1.3.7-r1
arduino? ( dev-embedded/arduino )
phidget? ( dev-embedded/phidget )
gtk2? ( dev-ruby/ruby-gnome2
>=x11-libs/gtk+-2.20.1 )
testing? ( dev-db/sqlite )
!testing? ( dev-db/mysql )"
pkg_setup() {
einfo "Ruby gem library installation"
einfo "This could take a while.. please wait..."
gem install rubygems-update --no-ri --no-rdoc || die "gem install failed !"
# Default gems
einfo "Installing default gems for opos"
gem install activerecord mysql serialport --no-ri --no-rdoc || die "gem install failed !"
# Ruby-dbus-openplacos gem
einfo "Installing ruby-dbus-openplacos gem"
gem install ruby-dbus-openplacos --no-ri --no-rdoc || die "gem install failed !"
# OpenplacOS gem
einfo "Installing openplacos gem"
gem install openplacos --no-ri --no-rdoc || die "gem install failed !"
# Micro-optparse gem (NEW)
einfo "Installing micro-optparse gem"
gem install micro-optparse choice rails --bindir /usr/bin --no-ri --no-rdoc || die "gem install failed !"
# Sqlite3 gem
if use testing ; then
einfo "Installing sqlite3 gem"
gem install sqlite3 --no-ri --no-rdoc || die "gem install failed !"
fi
}
src_unpack () {
# Choose branch master||unstable
if use testing ; then
EGIT_BRANCH="unstable" \
&& EGIT_STORE_DIR="/usr/portage/git-src/openplacos/unstable" \
&& EGIT_COMMIT="d8dc9d2a2a695ec29a2fe2f15274800612e242c5"
fi
git_src_unpack || die "src_unpack failed !"
}
src_install () {
einfo "Copying files"
insinto ${OPOS_PATH} || die "insinto failed !"
doins -r * || die "doins failed !"
einfo "Linking common executables files"
# OPOS Server
if use testing ; then
dohard ${OPOS_PATH}/server/Top.rb /usr/bin/openplacos-server || die "dohard failed !"
fperms +x /usr/bin/openplacos-server || die "fperms failed !"
else
dohard ${OPOS_PATH}/server/main.rb /usr/bin/openplacos-server || die
fperms +x /usr/bin/openplacos-server || die
fi
# CLI Client
dohard ${OPOS_PATH}/client/CLI_client/opos-client.rb /usr/bin/openplacos || die
fperms +x /usr/bin/openplacos || die
# XML-RPC Client
dohard ${OPOS_PATH}/client/xml-rpc/xml-rpc-client.rb /usr/bin/openplacos-xmlrpc || die
fperms +x /usr/bin/openplacos-xmlrpc || die
# SOAP Client
dohard ${OPOS_PATH}/client/soap/soap-client.rb /usr/bin/openplacos-soap || die
fperms +x /usr/bin/openplacos-soap || die
# GTK Client
if use gtk2 ; then
if use testing ; then
dohard ${OPOS_PATH}/client/gtk/gtk.rb /usr/bin/openplacos-gtk || die
fperms +x /usr/bin/openplacos-gtk || die
else
dohard ${OPOS_PATH}/client/deprecated/gtk/gtk.rb /usr/bin/openplacos-gtk || die
fperms +x /usr/bin/openplacos-gtk || die
fi
fi
einfo "Checking default drivers permissions"
fperms a+x ${OPOS_PATH}/drivers/VirtualPlacos/VirtualPlacos.rb || die "fperms failed !"
fperms a+x ${OPOS_PATH}/drivers/VirtualPlacos/compensation_hygro.rb || die
einfo "Copying default configuration"
insinto /etc/default || die "insinto failed !"
doins server/config_with_VirtualPlacos.yaml || die "doins failed"
mv -f ${D}/etc/default/config_with_VirtualPlacos.yaml ${D}/etc/default/openplacos || die "mv config failed !"
dosym /etc/default/openplacos /etc/conf.d/openplacos || die "dosym failed !"
einfo "Copying Dbus integration files"
insinto /usr/share/dbus-1/system-services || die "insinto failed !"
doins setup_files/*.service || die "doins failed !"
insinto /etc/dbus-1/system.d || die
doins setup_files/openplacos.conf || die
einfo "Copying daemon file"
insinto /etc/init.d || die "insinto failed !"
doins setup_files/openplacos || die "doins failed !"
fperms +x /etc/init.d/openplacos || die "fperms failed !"
einfo "Installing Gentoo Linux documentation"
dodoc INSTALL_GENTOO || die "dodoc failed !"
}
pkg_postinst() {
# Adding openplacos user in following groups
enewuser openplacos -1 -1 -1 usb,dialout || die "enewuser failed !"
einfo "Reloading dbus"
/etc/init.d/dbus reload
if use !testing ; then
einfo
einfo "Before running OpemplacOS for first time"
einfo "You should proceed your database configuration"
einfo "Please provide MySQL root password"
einfo "# /usr/bin/mysqladmin -u root -h localhost password 'new-password'"
einfo
einfo "# /etc/init.d/mysql start"
einfo "# mysql -u root -p < /usr/lib/ruby/openplacos/setup_files/install.sql"
einfo "# rc-update add mysql default"
fi
einfo
einfo "Start OpenplacOS daemon"
einfo "# /etc/init.d/openplacos start"
einfo "# rc-update add openplacos default"
if use gtk2 ; then
einfo
einfo "Now, you can launch GTK Client for example"
einfo "$ /usr/bin/openplacos-gtk"
fi
einfo
einfo "Look at http://openplacos.sourceforge.net/ for more information"
einfo
}