From 2beaa4a5cb81ce30b38c84f090e115050f621ff00a722394798b7a6d38b7ea12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20M=C3=BCller?= Date: Tue, 26 Feb 2013 13:18:52 +0000 Subject: [PATCH] - Add cifstab named configuration file to post-12.2 systems; (bnc#804822). - Really use of the existing cifs init script; (bnc#697218). OBS-URL: https://build.opensuse.org/package/show/network:samba:STABLE/cifs-utils?expand=0&rev=85 --- cifs-utils.changes | 6 ++++++ cifs-utils.spec | 44 ++++++++++++++++++++++++++++++++++++++++++++ cifstab | 10 ++++++++++ 3 files changed, 60 insertions(+) create mode 100644 cifstab diff --git a/cifs-utils.changes b/cifs-utils.changes index 2d1cb82..9f6d884 100644 --- a/cifs-utils.changes +++ b/cifs-utils.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Feb 26 12:07:11 UTC 2013 - lmuelle@suse.com + +- Add cifstab named configuration file to post-12.2 systems; (bnc#804822). +- Really use of the existing cifs init script; (bnc#697218). + ------------------------------------------------------------------- Wed Feb 21 10:34:55 UTC 2013 - lmuelle@suse.com diff --git a/cifs-utils.spec b/cifs-utils.spec index cae48f1..4486ae2 100644 --- a/cifs-utils.spec +++ b/cifs-utils.spec @@ -24,9 +24,15 @@ License: GPL-3.0+ Group: System/Filesystems Url: http://www.samba.org/linux-cifs/cifs-utils/ Source: %{name}-%{version}.tar.bz2 +%if "%{_vendor}" == "suse" +%define NET_CFGDIR network +%else +%define NET_CFGDIR network-scripts +%endif Source1: cifs.init Source2: mkinitrd_scripts_boot-cifs.sh Source3: mkinitrd_scripts_setup-cifs.sh +Source4: cifstab Patch: 1a01f7c4b90695211d12291d7a24bec05b1f2922.diff %if 0%{?suse_version} PreReq: insserv %{?fillup_prereq} mkinitrd @@ -108,12 +114,43 @@ install -m 644 -p contrib/request-key.d/cifs.spnego.conf %{buildroot}%{_sysconfd %{__install} -m 0755 ${RPM_SOURCE_DIR}/mkinitrd_scripts_boot-cifs.sh ${RPM_BUILD_ROOT}/lib/mkinitrd/scripts/boot-cifs.sh %{__install} -m 0755 ${RPM_SOURCE_DIR}/mkinitrd_scripts_setup-cifs.sh ${RPM_BUILD_ROOT}/lib/mkinitrd/scripts/setup-cifs.sh %endif +%if 0%{?suse_version} == 0 || 0%{?suse_version} > 1221 +mkdir -p \ + ${RPM_BUILD_ROOT}/%{_sysconfdir}/sysconfig/%{NET_CFGDIR}/if-{down,up}.d \ + ${RPM_BUILD_ROOT}/%{_sysconfdir}/samba \ + ${RPM_BUILD_ROOT}/%{_sbindir} \ + ${RPM_BUILD_ROOT}/var/run +install -m 0755 -p ${RPM_SOURCE_DIR}/cifs.init ${RPM_BUILD_ROOT}/%{_sysconfdir}/init.d/cifs +install -m 0600 -p ${RPM_SOURCE_DIR}/cifstab ${RPM_BUILD_ROOT}/%{_sysconfdir}/samba/cifstab +ln -s %{_sysconfdir}/init.d/${cifs_init_script} ${RPM_BUILD_ROOT}/%{_sbindir}/rccifs +touch ${RPM_BUILD_ROOT}/%{_sysconfdir}/sysconfig/%{NET_CFGDIR}/if-{down,up}.d/${script} \ + ${RPM_BUILD_ROOT}/var/run/cifs +%endif # Hardlink duplicate files %if 0%{?suse_version} > 1110 %fdupes ${RPM_BUILD_ROOT} %endif +%pre +# non SUSE + post-12.2, update, no cifstab, but smbfstab +if [ ! 0%{?suse_version} -lt 1221 -a \ + ${1:-0} -gt 1 -a \ + ! -e /etc/samba/cifstab -a \ + -f /etc/samba/smbfstab ]; then + cp -a /etc/samba/smbfstab /var/adm/backup/etc_samba_smbfstab-move + chkconfig -c smbfs && >/var/adm/backup/etc_samba_smbfs-enabled || : +fi + %post +if [ ${1:-0} -gt 1 -a -f /var/adm/backup/etc_samba_smbfstab-move -a ]; then + test -f /etc/samba/cifstab && \ + mv /etc/samba/cifstab /etc/samba/cifstab.rpmnew + mv /var/adm/backup/etc_samba_smbfstab-move /etc/samba/cifstab + if [ -f /var/adm/backup/etc_samba_smbfs-enabled ]; then + chkconfig -a cifs >/dev/null + rm /var/adm/backup/etc_samba_smbfs-enabled + fi +fi [ -x /sbin/mkinitrd_setup ] && mkinitrd_setup exit 0 @@ -155,6 +192,13 @@ exit 0 %{_libdir}/%{name}/idmapwb.so %doc %{_mandir}/man8/idmapwb.8.* %endif +%if 0%{?suse_version} == 0 || 0%{?suse_version} > 1221 +%attr(0754,root,root) %config %{_sysconfdir}/init.d/cifs +%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/samba/cifstab +%{_sbindir}/rccifs +%dir %{_sysconfdir}/samba +%ghost %{_localstatedir}/run/cifs +%endif %files devel %defattr(-,root,root) diff --git a/cifstab b/cifstab new file mode 100644 index 0000000..4bec591 --- /dev/null +++ b/cifstab @@ -0,0 +1,10 @@ +# This file allows you to mount SMB/ CIFS shares during system boot while +# hiding passwords to other people than root. Use /etc/fstab for public +# available services. You have to specify at least a service name and a mount +# point. Current default vfstype is cifs. +# +# The options are explained in the manual page of mount.cifs. +# +# service moint-point vfstype options + +;//fjall/test /data/test cifs username=tridge,password=foobar