Use adduser class mechanism to create system user such as tizenglobalapp & buxton
[scm/bb/meta-tizen.git] / meta-tizen-common-base / recipes-security / buxton / buxton.inc
1 DESCRIPTION = "A security-enabled configuration system"
2 HOMEPAGE = "https://github.com/sofar/buxton"
3 SECTION = "System/Configuration"
4 LICENSE = "LGPL-2.1+"
5 PV = "5"
6
7 SRC_URI = ""
8
9 S = "${WORKDIR}/git"
10
11 inherit manifest autotools-brokensep
12
13 BBCLASSEXTEND = ""
14 PROVIDES = ""
15
16 #PROVIDES by buxton-dev
17 PROVIDES += "buxton-dev"
18
19
20 #PROVIDES by buxtonsimple
21 PROVIDES += "buxtonsimple"
22
23
24 #PROVIDES by buxton-docs
25 PROVIDES += "buxton-docs "
26
27
28 #PROVIDES by buxtonsimple-dev
29 PROVIDES += "buxtonsimple-dev"
30
31
32 #PROVIDES by buxton
33
34
35 RDEPENDS = ""
36 #RDEPENDS of buxton-dev (${PN}-dev)
37 RDEPENDS_${PN}-dev += "buxton"
38
39 #RDEPENDS of buxtonsimple (${PN}simple)
40 RDEPENDS_${PN}simple += "buxton"
41
42 #RDEPENDS of buxtonsimple-dev (${PN}simple-dev)
43 RDEPENDS_${PN}simple-dev += "buxton"
44
45 #RDEPENDS of buxton (${PN})
46 RDEPENDS_${PN} += "coreutils"
47 RDEPENDS_${PN} += "smack"
48 RDEPENDS_${PN} += "buxton"
49
50
51 DEPENDS = ""
52 #DEPENDS of buxton
53 inherit pkgconfig
54 DEPENDS += "libcheck"
55 DEPENDS += "systemd"
56 DEPENDS += "attr"
57 DEPENDS += "gdbm"
58
59
60 do_prep() {
61  cd ${S}
62  chmod -Rf a+rX,u+w,g-w,o-w ${S}
63  #setup -q
64  cp ${S}/packaging/buxton.manifest .
65  
66  
67 }
68 do_patch_append() {
69     bb.build.exec_func('do_prep', d)
70 }
71
72 do_configure() {
73 }
74
75 do_compile() {
76  cd ${S}
77   LANG=C
78   export LANG
79   unset DISPLAY
80   LD_AS_NEEDED=1; export LD_AS_NEEDED ;
81   
82   
83   autotools_do_configure
84   oe_runmake
85   
86   
87   
88 }
89 EXTRA_OECONF += ""
90
91 do_install() {
92  export RPM_BUILD_ROOT=${D}
93  cd ${S}
94  LANG=C
95  export LANG
96  unset DISPLAY
97  rm -rf ${D}
98  mkdir -p ${D}
99  
100  
101    oe_runmake \
102          DESTDIR=${D} \
103          INSTALL_ROOT=${D} \
104          BINDIR=${prefix}/bin \
105    install  
106    rm -f ${D}${infodir}/dir 
107    find ${D} -regex ".*\.la$" | xargs rm -f -- 
108    find ${D} -regex ".*\.a$" | xargs rm -f --
109  # TODO: need to define needed layers for Tizen in tizen.conf
110  install -m 0644 ${S}/packaging/tizen.conf ${D}${sysconfdir}/buxton.conf
111  
112  
113 }
114
115 pkg_postinst_${PN}() {
116     #!/bin/sh -e
117
118     [ "x$D" == "x" ] && ldconfig
119     [ "x$D" != "x" ] && exit 1
120     #buxtond runs as user buxton, which much be created
121     buxtonctl create-db base
122     buxtonctl create-db isp
123     if [ "$1" -eq 1 ] ; then
124         # The initial DBs will not have the correct labels and
125         # permissions when created in postinstall during image
126         # creation, so we set these file attributes here.
127         chsmack -a System ${localstatedir}/lib/buxton/*.db
128         chown buxton:buxton ${localstatedir}/lib/buxton/*.db
129     fi
130
131 }
132
133 pkg_postrm_${PN}() {
134     #!/bin/sh -e
135
136     [ "x$D" == "x" ] && ldconfig
137 }
138
139 PACKAGES = "${PN}-dbg ${PN}-doc ${PN}-locale"
140 PACKAGES += " buxton-dev "
141 PACKAGES += " buxtonsimple "
142 PACKAGES += " buxton-docs "
143 PACKAGES += " buxtonsimple-dev "
144 PACKAGES += " buxton "
145
146 buxton-dev_files = ""
147 buxton-dev_files += "${prefix}/include/buxton.h"
148 buxton-dev_files += "${prefix}/lib/libbuxton.so"
149 buxton-dev_files += "${prefix}/lib/pkgconfig/buxton.pc"
150 MANIFESTFILES_${PN}-dev = "buxton.manifest"
151
152 buxtonsimple_files = ""
153 buxtonsimple_files += "${prefix}/lib/libbuxtonsimple.so.*"
154 MANIFESTFILES_${PN}simple = "buxton.manifest"
155
156 buxton-docs_files = ""
157
158 buxtonsimple-dev_files = ""
159 buxtonsimple-dev_files += "${prefix}/include/buxtonsimple.h"
160 buxtonsimple-dev_files += "${prefix}/lib/libbuxtonsimple.so"
161 buxtonsimple-dev_files += "${prefix}/lib/pkgconfig/buxtonsimple.pc"
162 MANIFESTFILES_${PN}simple-dev = "buxton.manifest"
163
164 buxton_files = ""
165 buxton_files += "${sysconfdir}/buxton.conf"
166 buxton_files += "${prefix}/bin/buxtonctl"
167 buxton_files += "${prefix}/lib/buxton/*.so"
168 buxton_files += "${prefix}/lib/libbuxton.so.*"
169 buxton_files += "/lib/systemd/system/buxton.service"
170 buxton_files += "/lib/systemd/system/buxton.socket"
171 buxton_files += "/lib/systemd/system/sockets.target.wants/buxton.socket"
172 buxton_files += "${prefix}/sbin/buxtond"
173 buxton_files += "%dir ${localstatedir}/lib/buxton"
174 MANIFESTFILES_${PN} = "buxton.manifest"
175
176 FILES_${PN}-dev = "${buxton-dev_files}"
177 FILES_${PN}simple = "${buxtonsimple_files}"
178 FILES_${PN}-docs = "${buxton-docs_files}"
179 FILES_${PN}simple-dev = "${buxtonsimple-dev_files}"
180 FILES_${PN} = "${buxton_files}"
181
182 PKG_buxton-dev= "buxton-dev"
183 PKG_buxtonsimple= "buxtonsimple"
184 PKG_buxton-docs= "buxton-docs"
185 PKG_buxtonsimple-dev= "buxtonsimple-dev"
186 PKG_buxton= "buxton"
187
188 require buxton-extraconf.inc
189