From f9876dbe28c0df47a94b13d85447f4ab6bb7a8ad Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 9 Dec 2003 17:36:11 +0000 Subject: starting on Fedora packaging; reference point to begin with taken from RH 3.0.0-15 packaging files (This used to be commit 4062cc38fde129056ea7ff796f7d00cfb6abf263) --- packaging/Fedora/filter-requires-samba.sh | 3 + packaging/Fedora/makerpms.sh.tmpl | 65 +++++++++++++++++ packaging/Fedora/samba.log | 9 +++ packaging/Fedora/samba.pamd | 2 + packaging/Fedora/samba.sysconfig | 6 ++ packaging/Fedora/samba.xinetd | 15 ++++ packaging/Fedora/smb.init | 117 ++++++++++++++++++++++++++++++ packaging/Fedora/smbprint | 84 +++++++++++++++++++++ packaging/Fedora/swat.desktop | 8 ++ packaging/Fedora/winbind.init | 100 +++++++++++++++++++++++++ 10 files changed, 409 insertions(+) create mode 100755 packaging/Fedora/filter-requires-samba.sh create mode 100644 packaging/Fedora/makerpms.sh.tmpl create mode 100644 packaging/Fedora/samba.log create mode 100644 packaging/Fedora/samba.pamd create mode 100644 packaging/Fedora/samba.sysconfig create mode 100644 packaging/Fedora/samba.xinetd create mode 100644 packaging/Fedora/smb.init create mode 100644 packaging/Fedora/smbprint create mode 100644 packaging/Fedora/swat.desktop create mode 100644 packaging/Fedora/winbind.init diff --git a/packaging/Fedora/filter-requires-samba.sh b/packaging/Fedora/filter-requires-samba.sh new file mode 100755 index 0000000000..1ba10a0ee3 --- /dev/null +++ b/packaging/Fedora/filter-requires-samba.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +/usr/lib/rpm/perl.req $* | grep -v "Net::LDAP" diff --git a/packaging/Fedora/makerpms.sh.tmpl b/packaging/Fedora/makerpms.sh.tmpl new file mode 100644 index 0000000000..4da99123e2 --- /dev/null +++ b/packaging/Fedora/makerpms.sh.tmpl @@ -0,0 +1,65 @@ +#!/bin/sh +# Copyright (C) John H Terpstra 1998-2002 +# Gerald (Jerry) Carter 2003 + +# The following allows environment variables to override the target directories +# the alternative is to have a file in your home directory calles .rpmmacros +# containing the following: +# %_topdir /home/mylogin/redhat +# +# Note: Under this directory rpm expects to find the same directories that are under the +# /usr/src/redhat directory +# + +SPECDIR=`rpm --eval %_specdir` +SRCDIR=`rpm --eval %_sourcedir` + +# At this point the SPECDIR and SRCDIR vaiables must have a value! + +USERID=`id -u` +GRPID=`id -g` +VERSION='PVERSION' +SPECFILE="samba.spec" +RPMVER=`rpm --version | awk '{print $3}'` +RPM="rpmbuild" + +## +## Check the RPM version (paranoid) +## +case $RPMVER in + 4*) + echo "Supported RPM version [$RPMVER]" + ;; + *) + echo "Unknown RPM version: `rpm --version`" + exit 1 + ;; +esac + +( cd ../../source; if [ -f Makefile ]; then make distclean; fi ) +( cd ../../.. ; chown -R ${USERID}.${GRPID} samba-${VERSION} ) + +( cd ../../.. ; tar --exclude=CVS -cf - samba-${VERSION}/. | bzip2 > ${SRCDIR}/samba-${VERSION}.tar.bz2 ) + +## +## copy additional source files +## +for file in samba.pamd samba.sysconfig samba.spec \ + smb.init swat.desktop filter-requires-samba.sh \ + samba.log samba.xinetd smbprint winbind.init +do + cp -p filter-requires-samba.sh ${SRCDIR} + +done + +chmod 755 ${SRCDIR}/filter-requires-samba.sh + +## +## Build +## +echo Getting Ready to build release package +cd ${SPECDIR} +${RPM} -ba --clean --rmsource $SPECFILE + +echo Done. + diff --git a/packaging/Fedora/samba.log b/packaging/Fedora/samba.log new file mode 100644 index 0000000000..04106239fb --- /dev/null +++ b/packaging/Fedora/samba.log @@ -0,0 +1,9 @@ +/var/log/samba/*.log { + notifempty + missingok + sharedscripts + copytruncate + postrotate + /bin/kill -HUP `cat /var/run/smbd.pid /var/run/nmbd.pid /var/run/winbindd.pid 2> /dev/null` 2> /dev/null || true + endscript +} diff --git a/packaging/Fedora/samba.pamd b/packaging/Fedora/samba.pamd new file mode 100644 index 0000000000..d8a27ff08f --- /dev/null +++ b/packaging/Fedora/samba.pamd @@ -0,0 +1,2 @@ +auth required /lib/security/pam_stack.so service=system-auth +account required /lib/security/pam_stack.so service=system-auth diff --git a/packaging/Fedora/samba.sysconfig b/packaging/Fedora/samba.sysconfig new file mode 100644 index 0000000000..944b72fcc2 --- /dev/null +++ b/packaging/Fedora/samba.sysconfig @@ -0,0 +1,6 @@ +# Options to smbd +SMBDOPTIONS="-D" +# Options to nmbd +NMBDOPTIONS="-D" +# Options for winbindd +WINBINDOPTIONS="" diff --git a/packaging/Fedora/samba.xinetd b/packaging/Fedora/samba.xinetd new file mode 100644 index 0000000000..8b62348dde --- /dev/null +++ b/packaging/Fedora/samba.xinetd @@ -0,0 +1,15 @@ +# default: off +# description: SWAT is the Samba Web Admin Tool. Use swat \ +# to configure your Samba server. To use SWAT, \ +# connect to port 901 with your favorite web browser. +service swat +{ + port = 901 + socket_type = stream + wait = no + only_from = 127.0.0.1 + user = root + server = /usr/sbin/swat + log_on_failure += USERID + disable = yes +} diff --git a/packaging/Fedora/smb.init b/packaging/Fedora/smb.init new file mode 100644 index 0000000000..fca823a064 --- /dev/null +++ b/packaging/Fedora/smb.init @@ -0,0 +1,117 @@ +#!/bin/sh +# +# chkconfig: - 91 35 +# description: Starts and stops the Samba smbd and nmbd daemons \ +# used to provide SMB network services. +# +# pidfile: /var/run/samba/smbd.pid +# pidfile: /var/run/samba/nmbd.pid +# config: /etc/samba/smb.conf + + +# Source function library. +if [ -f /etc/init.d/functions ] ; then + . /etc/init.d/functions +elif [ -f /etc/rc.d/init.d/functions ] ; then + . /etc/rc.d/init.d/functions +else + exit 0 +fi + +# Avoid using root's TMPDIR +unset TMPDIR + +# Source networking configuration. +. /etc/sysconfig/network + +if [ -f /etc/sysconfig/samba ]; then + . /etc/sysconfig/samba +fi + +# Check that networking is up. +[ ${NETWORKING} = "no" ] && exit 0 + +# Check that smb.conf exists. +[ -f /etc/samba/smb.conf ] || exit 0 + +# Check that we can write to it... so non-root users stop here +[ -w /etc/samba/smb.conf ] || exit 0 + + +RETVAL=0 + + +start() { + KIND="SMB" + echo -n $"Starting $KIND services: " + daemon smbd $SMBDOPTIONS + RETVAL=$? + echo + KIND="NMB" + echo -n $"Starting $KIND services: " + daemon nmbd $NMBDOPTIONS + RETVAL2=$? + echo + [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && touch /var/lock/subsys/smb || \ + RETVAL=1 + return $RETVAL +} + +stop() { + KIND="SMB" + echo -n $"Shutting down $KIND services: " + killproc smbd + RETVAL=$? + echo + KIND="NMB" + echo -n $"Shutting down $KIND services: " + killproc nmbd + RETVAL2=$? + [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && rm -f /var/lock/subsys/smb + echo "" + return $RETVAL +} + +restart() { + stop + start +} + +reload() { + echo -n $"Reloading smb.conf file: " + killproc smbd -HUP + RETVAL=$? + echo + return $RETVAL +} + +rhstatus() { + status smbd + status nmbd +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + restart + ;; + reload) + reload + ;; + status) + rhstatus + ;; + condrestart) + [ -f /var/lock/subsys/smb ] && restart || : + ;; + *) + echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}" + exit 1 +esac + +exit $? diff --git a/packaging/Fedora/smbprint b/packaging/Fedora/smbprint new file mode 100644 index 0000000000..1c3959d49b --- /dev/null +++ b/packaging/Fedora/smbprint @@ -0,0 +1,84 @@ +#!/bin/sh +# This script is an input filter for printcap printing on a unix machine. It +# uses the smbclient program to print the file to the specified smb-based +# server and service. +# For example you could have a printcap entry like this +# +# smb:lp=/dev/null:sd=/usr/spool/smb:sh:if=/usr/local/samba/smbprint +# +# which would create a unix printer called "smb" that will print via this +# script. You will need to create the spool directory /usr/spool/smb with +# appropriate permissions and ownerships for your system. + +# Set these to the server and service you wish to print to +# In this example I have a WfWg PC called "lapland" that has a printer +# exported called "printer" with no password. + +# +# Script further altered by hamiltom@ecnz.co.nz (Michael Hamilton) +# so that the server, service, and password can be read from +# a /usr/var/spool/lpd/PRINTNAME/.config file. +# +# In order for this to work the /etc/printcap entry must include an +# accounting file (af=...): +# +# cdcolour:\ +# :cm=CD IBM Colorjet on 6th:\ +# :sd=/var/spool/lpd/cdcolour:\ +# :af=/var/spool/lpd/cdcolour/acct:\ +# :if=/usr/local/etc/smbprint:\ +# :mx=0:\ +# :lp=/dev/null: +# +# The /usr/var/spool/lpd/PRINTNAME/.config file should contain: +# share=PC_SERVER +# user="user" +# password="password" +# +# Please, do not modify the order in the file. +# Example: +# share=\\server\deskjet +# user="fred" +# password="" + +# +# The last parameter to the filter is the accounting file name. +# Extract the directory name from the file name. +# Concat this with /.config to get the config file. +# +eval acct_file=\${$#} +spool_dir=`dirname $acct_file` +config_file=$spool_dir/.config + +# Should read the following variables set in the config file: +# share +# hostip +# user +# password + +eval `cat $config_file` + +share=`echo $share | sed "s/[\]/\//g"` + +if [ "$user" != "" ]; then + usercmd="-U" +else + usercmd="" +fi + +if [ "$workgroup" != "" ]; then + workgroupcmd="-W" +else + workgroupcmd="" +fi + +if [ "$translate" = "yes" ]; then + command="translate ; print -" +else + command="print -" +fi +#echo $share $password $translate $x_command > /tmp/smbprint.log + +cat | /usr/bin/smbclient "$share" "$password" -E ${hostip:+-I} \ + $hostip -N -P $usercmd "$user" $workgroupcmd "$workgroup" \ + -c "$command" 2>/dev/null diff --git a/packaging/Fedora/swat.desktop b/packaging/Fedora/swat.desktop new file mode 100644 index 0000000000..0d7b4b5c48 --- /dev/null +++ b/packaging/Fedora/swat.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=Samba Configuration +Name[de]=Samba Konfiguration +Type=Application +Comment=Configure Samba with a web based interface +Exec=htmlview http://127.0.0.1:901/ +Terminal=false +Categories=X-Red-Hat-Extra;Application;System;X-Red-Hat-ServerConfig; diff --git a/packaging/Fedora/winbind.init b/packaging/Fedora/winbind.init new file mode 100644 index 0000000000..ced81135b2 --- /dev/null +++ b/packaging/Fedora/winbind.init @@ -0,0 +1,100 @@ +#!/bin/sh +# +# chkconfig: - 91 35 +# description: Starts and stops the Samba winbind daemon +# # +# pidfile: /var/cache/samba/winbind.pid +# config: /etc/samba/smb.conf + + +# Source function library. +if [ -f /etc/init.d/functions ] ; then + . /etc/init.d/functions +elif [ -f /etc/rc.d/init.d/functions ] ; then + . /etc/rc.d/init.d/functions +else + exit 0 +fi + +# Avoid using root's TMPDIR +unset TMPDIR + +# Source networking configuration. +. /etc/sysconfig/network + +if [ -f /etc/sysconfig/samba ]; then + . /etc/sysconfig/samba +fi + +# Check that networking is up. +[ ${NETWORKING} = "no" ] && exit 0 + +# Check that smb.conf exists. +[ -f /etc/samba/smb.conf ] || exit 0 + +RETVAL=0 + + +start() { + KIND="Winbind" + echo -n $"Starting $KIND services: " + daemon winbindd "$WINBINDOPTIONS" + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/winbindd || RETVAL=1 + return $RETVAL +} + +stop() { + echo + KIND="Winbind" + echo -n $"Shutting down $KIND services: " + killproc winbindd + RETVAL=$? + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/winbindd + echo "" + return $RETVAL +} + +restart() { + stop + start +} + +reload() { + echo -n $"Reloading smb.conf file: " + killproc winbindd -HUP + RETVAL=$? + echo + return $RETVAL +} + +rhstatus() { + status winbindd +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + restart + ;; + reload) + reload + ;; + status) + rhstatus + ;; + condrestart) + [ -f /var/lock/subsys/winbindd ] && restart || : + ;; + *) + echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}" + exit 1 +esac + +exit $? -- cgit