|
|
|
#!/sbin/runscript
|
|
|
|
# Copyright 2008-2010 Mir Calculate Ltd. http://www.calculate-linux.org
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
depend() {
|
|
|
|
use localmount
|
|
|
|
after bootmisc consolefont modules netmount
|
|
|
|
after readahead-list ypbind autofs openvpn gpm lircmd
|
|
|
|
after cupsd fbcondecor sshd cron wicd
|
|
|
|
before xdm
|
|
|
|
after acpid consolekit hald xfs
|
|
|
|
}
|
|
|
|
|
|
|
|
start() {
|
|
|
|
# Mount remote Samba filesystems.
|
|
|
|
ebegin "Mounting domain resources"
|
|
|
|
# Identifing domain server by env file
|
|
|
|
local env_file=/var/calculate/calculate.env
|
|
|
|
if [[ -f $env_file ]]
|
|
|
|
then
|
|
|
|
local SERVER=$( sed -rn 's/^cl_remote_host\s*=\s*(\S+)$/\1/p' $env_file )
|
|
|
|
for COUNT in $( seq 0 20 )
|
|
|
|
do
|
|
|
|
ping -w2 -c1 $SERVER &>/dev/null && break || sleep 1
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
cl-client --mount
|
|
|
|
eend $? "Some samba remote resources to mount"
|
|
|
|
}
|
|
|
|
|
|
|
|
stop(){
|
|
|
|
ebegin "Unmount domain resources"
|
|
|
|
[[ $( mount | grep ' /var/calculate/remote ' ) ]] &&
|
|
|
|
umount /var/calculate/remote
|
|
|
|
[[ $( mount | grep '/var/calculate/client-home on /home ' ) ]] &&
|
|
|
|
umount /home
|
|
|
|
eend 0
|
|
|
|
}
|
|
|
|
|
|
|
|
# vim:ts=4
|