summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Martin <paul.martin@codethink.co.uk>2015-07-20 16:44:42 +0100
committerBaserock Gerrit <gerrit@baserock.org>2015-07-27 10:45:44 +0000
commit3b9c0ddf8c0f3da601cbf0981ae233e07b09c27b (patch)
tree40d95265e3665c662a06ff0b868614f4ee13de9e
parent827cd43c02e7341102e46efab6383084e14ede13 (diff)
downloaddefinitions-3b9c0ddf8c0f3da601cbf0981ae233e07b09c27b.tar.gz
Add a simple samba stratum
Change-Id: I46ca2add3ec07be66053bdf8b2a9956c680855b8
-rw-r--r--strata/samba.morph12
-rw-r--r--strata/samba/samba.morph127
2 files changed, 139 insertions, 0 deletions
diff --git a/strata/samba.morph b/strata/samba.morph
new file mode 100644
index 00000000..33dcd856
--- /dev/null
+++ b/strata/samba.morph
@@ -0,0 +1,12 @@
+name: samba
+kind: stratum
+description: Simple samba server
+build-depends:
+- morph: strata/core.morph
+- morph: strata/foundation.morph
+chunks:
+- name: samba
+ morph: strata/samba/samba.morph
+ repo: upstream:samba
+ ref: 704592c14dfedbe98e95d43860d062dc6338bca3
+ unpetrify-ref: master
diff --git a/strata/samba/samba.morph b/strata/samba/samba.morph
new file mode 100644
index 00000000..748ee886
--- /dev/null
+++ b/strata/samba/samba.morph
@@ -0,0 +1,127 @@
+name: samba
+kind: chunk
+configure-commands:
+- |
+ # Here are really really ugly hacks:
+ #
+ # This fixes a problem with ./configure and recent compilers
+ # which implement c9x by default.
+ sed -i "s/#define bool int//" source3/lib/util_sec.c
+ #
+ # This fixes the problem with Baserock build environments running
+ # as root but sandboxed, and preventing certain privileged operations
+ # from taking effect. eg. seteuid()
+ # Instead, convince it that we're not running as root so that it
+ # doesn't run these tests.
+ sed -i "s/getuid() != 0/1/" source3/lib/util_sec.c
+ #
+ #
+ ./configure \
+ --without-ldap \
+ --disable-gnutls \
+ --without-ad-dc \
+ --without-acl-support \
+ --without-ads \
+ --prefix="$PREFIX" --sysconfdir=/etc --localstatedir=/var --enable-fhs
+build-commands:
+- make
+install-commands:
+- make install DESTDIR="$DESTDIR"
+# systemd configuration
+- mkdir -p "$DESTDIR/etc/tmpfiles.d"
+- install -m 644 ./packaging/systemd/samba.conf.tmp "$DESTDIR/etc/tmpfiles.d/samba.conf"
+- mkdir -p "$DESTDIR/lib/systemd/system/multi-user.target.wants"
+- |
+ cat <<EOF >"$DESTDIR/lib/systemd/system/nmb.service"
+ [Unit]
+ Description=Samba NMB Daemon
+ After=syslog.target network-online.target
+
+ [Service]
+ Type=forking
+ PIDFile=/var/run/samba/nmbd.pid
+ EnvironmentFile=-/etc/sysconfig/samba
+ ExecStart=$PREFIX/sbin/nmbd \$NMBDOPTIONS
+ ExecReload=$PREFIX/bin/kill -HUP \$MAINPID
+
+ [Install]
+ WantedBy=multi-user.target
+ EOF
+- |
+ cat <<EOF >"$DESTDIR/lib/systemd/system/smb.service"
+ [Unit]
+ Description=Samba SMB Daemon
+ After=syslog.target network-online.target nmb.service winbind.service
+
+ [Service]
+ Type=forking
+ PIDFile=/var/run/samba/smbd.pid
+ EnvironmentFile=-/etc/sysconfig/samba
+ ExecStart=$PREFIX/sbin/smbd \$NMBDOPTIONS
+ ExecReload=$PREFIX/bin/kill -HUP \$MAINPID
+
+ [Install]
+ WantedBy=multi-user.target
+ EOF
+- |
+ cat <<EOF >"$DESTDIR/lib/systemd/system/winbind.service"
+ [Unit]
+ Description=Samba winbind Daemon
+ After=syslog.target network-online.target nmb.service
+
+ [Service]
+ Type=forking
+ PIDFile=/var/run/samba/winbindd.pid
+ EnvironmentFile=-/etc/sysconfig/samba
+ ExecStart=$PREFIX/sbin/winbindd \$NMBDOPTIONS
+ ExecReload=$PREFIX/bin/kill -HUP \$MAINPID
+
+ [Install]
+ WantedBy=multi-user.target
+ EOF
+- |
+ for i in nmb smb winbind
+ do
+ ln -s ../$i.service "$DESTDIR/lib/systemd/system/multi-user.target.wants/$i.service"
+ done
+- mkdir -p "$DESTDIR/var/log/samba"
+# Install a sample configuration
+- mkdir -p "$DESTDIR/etc/samba"
+- |
+ cat <<EOF >"$DESTDIR/etc/samba/smb.conf"
+ [global]
+ workgroup = WORKGROUP
+ dns proxy = no
+ local master = yes
+ preferred master = yes
+ os level = 2
+ log file = /var/log/samba/log.%m
+ max log size = 1000
+ syslog = 0
+ server role = standalone server
+ passdb backend = tdbsam
+ obey pam restrictions = yes
+ unix password sync = yes
+ pam password change = yes
+ map to guest = bad user
+ usershare allow guests = yes
+ [homes]
+ comment = Home Directories
+ browseable = no
+ read only = yes
+ create mask = 0700
+ valid users = %S
+ ;[printers]
+ ;comment = All Printers
+ ;browseable = no
+ ;path = /var/spool/samba
+ ;printable = yes
+ ;guest ok = no
+ ;read only = yes
+ ;create mask = 0700
+ ;[src]
+ ;comment = Source code
+ ;path = /src
+ ;read only = yes
+ ;guest ok = yes
+ EOF