Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.3
cifs-utils
cifs.init
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File cifs.init of Package cifs-utils
#! /bin/sh # Copyright (c) 1999-2009 SuSE Linux AG, Nuernberg, Germany. # All rights reserved. # # Author: Thomas Fehr, 1999-2001 # Lars Mueller <lmuelle@suse.de>, 2002-2009 # Bjoern Jacke <bjacke@SerNet.de> 2004 # # /etc/init.d/cifs # and its symbolic link # /usr/sbin/rccifs # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ### BEGIN INIT INFO # Provides: cifs # Required-Start: $network $syslog # Should-Start: nmb # Required-Stop: $network $syslog # Should-Stop: nmb # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: Import remote SMB/ CIFS (MS Windows) file systems # Description: Import remote SMB/ CIFS (MS Windows) file systems ### END INIT INFO # To access SMB/ CIFS servers beyond the network broadcast domain it may be # necessary to also activate the nmb service. Also see section 'cifs and nmb # service' in /usr/share/doc/packages/samba/README.SUSE . /etc/rc.status rc_reset LC_ALL=en_US CIFSTAB="/etc/samba/cifstab" SMB_CONF="/etc/samba/smb.conf" CIFS_STATE_FILE="/var/run/cifs" SLEEP=1 TIMEOUT=10 grep -q " cifs " /proc/mounts test $? -eq 0 && cifs_used=yes || cifs_used=no case "$1" in start) grep -q '^[[:space:]]*[^#].*[[:space:]]cifs[[:space:]]' /etc/fstab rc=$? if [ ! -f ${CIFSTAB} -a ${rc} -ne 0 ]; then echo -n >&2 "No ${CIFSTAB} found and no type cifs active in /etc/fstab. " rc_status -s exit 6 fi echo -n "Mount CIFS File Systems " service_used="no" if [ ${rc} -eq 0 ]; then service_used="yes" timer=${TIMEOUT} JOBS="none" printdot="" while [ "${JOBS}" ] && [ ${timer} -gt 0 ]; do if [ -z "${printdot}" ]; then echo echo -n "from /etc/fstab " mount -at cifs >/dev/null & PID=$! fi test -e /proc/$PID || JOBS="" if [ "${JOBS}" ]; then timer=$[${timer}-1] echo -n "." sleep ${SLEEP} printdot="yes" fi done test "${printdot}" && echo -n " " if [ "${JOBS}" -a ${timer} -eq 0 ]; then echo -n >&2 " Error: timeout while mount. " rc_failed fi rc_status -v fi timer=-1 test -e ${CIFSTAB} && \ while read service mountpoint vfstype options; do case "${service}" in ""|\#*|\;*) continue ;; esac # Set default vfstype which is also a hack for old # cifstab formated files without a vfstype set. if [ "${vfstype}" != "cifs" -a -z "${options}" ]; then options="${vfstype}" vfstype="cifs" fi # If no options are set use an empty password. if [ -z "${options}" ]; then options="password=" fi if [ ${timer} -eq -1 ]; then echo -en "from ${CIFSTAB} \n" timer=0 fi # Remove /s at the end of a mount point. mountpoint=$( echo "$mountpoint"|sed "s/\/*$//") if grep -q "[[:space:]]$mountpoint[[:space:]]" /proc/mounts; then echo -n "$mountpoint: mount point already in use. " rc_status -s continue fi service_used="yes" echo -n "${service} on ${mountpoint} type ${vfstype} " rc_reset timer=${TIMEOUT} JOBS="none" printdot="" while [ "${JOBS}" ] && [ ${timer} -gt 0 ]; do if [ -z "${printdot}" ]; then mount -t "${vfstype}" -o ${options} "${service}" "${mountpoint}" >/dev/null & PID=$! fi test -e /proc/$PID || JOBS="" if [ "${JOBS}" ]; then timer=$[${timer}-1] echo -n "." sleep ${SLEEP} printdot="yes" fi done test "${printdot}" && echo -n " " if [ "${JOBS}" -a ${timer} -eq 0 ]; then echo -n >&2 " Error: timeout while mount. " rc_failed fi rc_status -v done < ${CIFSTAB} test "${service_used}" = "no" && rc_status -u touch ${CIFS_STATE_FILE} ;; stop) echo -n "Umount CIFS File Systems " if [ "${cifs_used}" = "yes" ]; then # # Unmount in background due to possible long timeouts # timer=${TIMEOUT} JOBS="none" printdot="" while [ "${JOBS}" ] && [ ${timer} -gt 0 ]; do if [ -z "${printdot}" ]; then umount -at cifs & PID=$! fi test -e /proc/$PID || JOBS="" if [ "${JOBS}" ]; then timer=$[${timer}-1] echo -n "." sleep ${SLEEP} printdot="yes" fi done test "${printdot}" && echo -n " " if [ "${JOBS}" -a ${timer} -eq 0 ]; then echo -n >&2 " Error: timeout while umount. " rc_failed fi fi rc_status -v ;; try-restart|condrestart) if test "$1" = "condrestart"; then echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" fi $0 status if test $? = 0; then $0 restart else rc_reset fi rc_status ;; force-reload|restart) $0 stop $0 start rc_status ;; reload) echo -n "Reload mounted CIFS File Systems " rc_failed 3 rc_status -v ;; status) echo -n "Checking for mounted CIFS File Systems " if [ "${cifs_used}" = "yes" ]; then mount -t cifs | while read service on mountpoint type vfstype rest; do echo echo -n "${service} on ${mountpoint} type ${vfstype} " done else rc_failed 3 fi rc_status -v ;; probe) test ${CIFSTAB} -nt ${CIFS_STATE_FILE} -o \ ${SMB_CONF} -nt ${CIFS_STATE_FILE} && echo restart ;; *) echo "Usage: $0 {start|stop|status|force-reload|reload|restart|reload|probe}" exit 1 ;; esac rc_exit
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor