diff options
Diffstat (limited to 'meta-oe/recipes-connectivity/samba/samba.inc')
-rw-r--r-- | meta-oe/recipes-connectivity/samba/samba.inc | 159 |
1 files changed, 159 insertions, 0 deletions
diff --git a/meta-oe/recipes-connectivity/samba/samba.inc b/meta-oe/recipes-connectivity/samba/samba.inc new file mode 100644 index 000000000..aef8aaca1 --- /dev/null +++ b/meta-oe/recipes-connectivity/samba/samba.inc | |||
@@ -0,0 +1,159 @@ | |||
1 | SECTION = "console/network" | ||
2 | LICENSE = "GPL-3.0" | ||
3 | DEPENDS = "readline virtual/libiconv zlib popt" | ||
4 | |||
5 | SAMBA_MIRROR = "http://samba.org/samba/ftp" | ||
6 | |||
7 | MIRRORS += "\ | ||
8 | ${SAMBA_MIRROR} http://mirror.internode.on.net/pub/samba \n \ | ||
9 | ${SAMBA_MIRROR} http://www.mirrorservice.org/sites/ftp.samba.org \n \ | ||
10 | " | ||
11 | |||
12 | SRC_URI = "${SAMBA_MIRROR}/stable/samba-${PV}.tar.gz \ | ||
13 | file://volatiles.03_samba \ | ||
14 | file://smb.conf \ | ||
15 | file://init.samba \ | ||
16 | file://init.winbind \ | ||
17 | file://tdb.pc \ | ||
18 | file://nmb.service \ | ||
19 | file://smb.service \ | ||
20 | file://winbind.service \ | ||
21 | " | ||
22 | |||
23 | S = "${WORKDIR}/samba-${PV}/source" | ||
24 | |||
25 | inherit autotools-brokensep update-rc.d systemd | ||
26 | |||
27 | SYSTEMD_PACKAGES = "${PN} winbind" | ||
28 | SYSTEMD_SERVICE_${PN} = "nmb.service smb.service" | ||
29 | SYSTEMD_SERVICE_winbind = "winbind.service" | ||
30 | |||
31 | SAMBAMMAP = "no" | ||
32 | SAMBAMMAP_libc-glibc = "yes" | ||
33 | |||
34 | # The file system settings --foodir=dirfoo and overridden unconditionally | ||
35 | # in the samba config by --with-foodir=dirfoo - even if the --with is not | ||
36 | # specified! Fix that here. Set the privatedir to /etc/samba/private. | ||
37 | EXTRA_OECONF='--disable-cups \ | ||
38 | --with-readline=${STAGING_LIBDIR}/.. \ | ||
39 | --with-libiconv=${STAGING_LIBDIR}/.. \ | ||
40 | --without-automount \ | ||
41 | --with-configdir=${sysconfdir}/samba \ | ||
42 | --with-privatedir=${sysconfdir}/samba/private \ | ||
43 | --with-lockdir=${localstatedir}/lock \ | ||
44 | --with-piddir=${localstatedir}/run \ | ||
45 | --with-logfilebase=${localstatedir}/log/samba \ | ||
46 | --libdir=${libdir} \ | ||
47 | --with-mandir=${mandir} \ | ||
48 | --with-swatdir=${datadir}/swat \ | ||
49 | --with-aio-support \ | ||
50 | --with-winbind \ | ||
51 | --with-wbclient \ | ||
52 | --without-acl-support \ | ||
53 | --disable-avahi \ | ||
54 | samba_cv_struct_timespec=yes \ | ||
55 | libreplace_cv_HAVE_MMAP=${SAMBAMMAP}' | ||
56 | |||
57 | PACKAGECONFIG = "${@base_contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}" | ||
58 | PACKAGECONFIG[pam] = "--with-pam,--without-pam,libpam" | ||
59 | PACKAGECONFIG[fam] = "--enable-fam,--disable-fam,gamin" | ||
60 | PACKAGECONFIG[talloc] = "--enable-external-libtalloc --with-libtalloc, --disable-external-libtalloc --without-libtalloc, talloc" | ||
61 | |||
62 | INITSCRIPT_PACKAGES = "samba winbind" | ||
63 | INITSCRIPT_NAME_samba = "samba" | ||
64 | INITSCRIPT_NAME_winbind = "winbind" | ||
65 | # No dependencies, goes in at level 20 (NOTE: take care with the | ||
66 | # level, later levels put the shutdown later too - see the links | ||
67 | # in rc6.d, the shutdown must precede network shutdown). | ||
68 | INITSCRIPT_PARAMS = "defaults" | ||
69 | CONFFILES_${PN} = "${sysconfdir}/samba/smb.conf" | ||
70 | |||
71 | do_configure_prepend () { | ||
72 | ./script/mkversion.sh | ||
73 | if [ ! -e acinclude.m4 ]; then | ||
74 | touch aclocal.m4 | ||
75 | cat aclocal.m4 > acinclude.m4 | ||
76 | fi | ||
77 | } | ||
78 | |||
79 | do_compile () { | ||
80 | oe_runmake proto_exists | ||
81 | base_do_compile | ||
82 | } | ||
83 | |||
84 | do_install_append() { | ||
85 | install -d ${D}${libdir}/pkgconfig/ | ||
86 | cp ${WORKDIR}/tdb.pc ${D}${libdir}/pkgconfig/ | ||
87 | mv ${D}${libdir}/libsmbclient.so ${D}${libdir}/libsmbclient.so.0 || true | ||
88 | ln -sf libsmbclient.so.0 ${D}${libdir}/libsmbclient.so | ||
89 | mkdir -p ${D}${base_sbindir} | ||
90 | rm -f ${D}${bindir}/*.old | ||
91 | rm -f ${D}${sbindir}/*.old | ||
92 | [ -f ${D}${sbindir}/mount.cifs ] && mv ${D}${sbindir}/mount.cifs ${D}${base_sbindir}/ | ||
93 | [ -f ${D}${sbindir}/umount.cifs ] && mv ${D}${sbindir}/umount.cifs ${D}${base_sbindir}/ | ||
94 | |||
95 | # This is needed for < 3.2.4 | ||
96 | rm -f ${D}${sbindir}/mount.smbfs ${D}${base_sbindir}/mount.smbfs | ||
97 | if [ -f ${D}${bindir}/smbmount ]; then | ||
98 | ln -sf ${bindir}/smbmount ${D}${base_sbindir}/mount.smb | ||
99 | ln -sf ${bindir}/smbmount ${D}${base_sbindir}/mount.smbfs | ||
100 | fi | ||
101 | |||
102 | install -D -m 755 ${WORKDIR}/init.samba ${D}${sysconfdir}/init.d/samba | ||
103 | install -D -m 755 ${WORKDIR}/init.winbind ${D}${sysconfdir}/init.d/winbind | ||
104 | install -D -m 644 ${WORKDIR}/smb.conf ${D}${sysconfdir}/samba/smb.conf | ||
105 | install -D -m 644 ${WORKDIR}/volatiles.03_samba ${D}${sysconfdir}/default/volatiles/volatiles.03_samba | ||
106 | install -d ${D}/var/log/samba | ||
107 | install -d ${D}/var/spool/samba | ||
108 | |||
109 | # Install other stuff not installed by "make install" | ||
110 | if [ -d ${WORKDIR}/${PN}-${PV}/nsswitch ]; then | ||
111 | install -m 0644 ${WORKDIR}/${PN}-${PV}/nsswitch/libnss_winbind.so ${D}${libdir}/libnss_winbind.so.2 | ||
112 | install -m 0644 ${WORKDIR}/${PN}-${PV}/nsswitch/libnss_wins.so ${D}${libdir}/libnss_wins.so.2 | ||
113 | fi | ||
114 | |||
115 | rmdir --ignore-fail-on-non-empty ${D}${base_sbindir} | ||
116 | sed -i -e '1s,#!.*perl,#!${USRBINPATH}/env perl,' ${D}${bindir}/findsmb | ||
117 | |||
118 | # usershare mount place | ||
119 | mkdir -p ${D}${localstatedir}/lib/samba/usershares | ||
120 | |||
121 | # Remove sysinit script if sysvinit is not in DISTRO_FEATURES | ||
122 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'false', 'true', d)}; then | ||
123 | rm -rf ${D}${sysconfdir}/init.d/ | ||
124 | fi | ||
125 | |||
126 | install -d ${D}${systemd_unitdir}/system | ||
127 | for i in nmb smb winbind; do | ||
128 | install -m 0644 ${WORKDIR}/$i.service ${D}${systemd_unitdir}/system | ||
129 | done | ||
130 | sed -e 's,@BASE_BINDIR@,${base_bindir},g' \ | ||
131 | -e 's,@SBINDIR@,${sbindir},g' \ | ||
132 | -i ${D}${systemd_unitdir}/system/*.service | ||
133 | |||
134 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | ||
135 | install -d ${D}${sysconfdir}/tmpfiles.d | ||
136 | echo "d ${localstatedir}/log/samba 0755 root root -" \ | ||
137 | > ${D}${sysconfdir}/tmpfiles.d/99-${BPN}.conf | ||
138 | fi | ||
139 | } | ||
140 | |||
141 | DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-systemctl-native', '', d)}" | ||
142 | pkg_postinst_${PN} () { | ||
143 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd sysvinit', 'true', 'false', d)}; then | ||
144 | if [ -n "$D" ]; then | ||
145 | OPTS="--root=$D" | ||
146 | fi | ||
147 | systemctl $OPTS mask samba.service | ||
148 | fi | ||
149 | } | ||
150 | |||
151 | pkg_postinst_libnss-winbind () { | ||
152 | # add wins to the list of resolvers | ||
153 | ns=$D${sysconfdir}/nsswitch.conf | ||
154 | if ! grep "hosts:.*wins" $ns > /dev/null; then | ||
155 | hosts="`grep '^hosts:' $ns`" | ||
156 | hosts=`echo "$hosts" | sed 's/\[/\\\\[/g; s/\]/\\\\]/g'` | ||
157 | sed -i "s/$hosts/$hosts wins/" "$ns" | ||
158 | fi | ||
159 | } | ||