You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.8 KiB
70 lines
1.8 KiB
#!/sbin/runscript
|
|
# Copyright 2008-2012 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
|
|
}
|
|
|
|
variable_value()
|
|
{
|
|
local varname=$1
|
|
cl-core-variables-show --only-value client.$varname
|
|
}
|
|
|
|
start() {
|
|
# Mount remote Samba filesystems.
|
|
# Identifing domain server by cl-client variables
|
|
local SERVER=`variable_value cl_remote_host`
|
|
local SERVERLIVE=`variable_value cl_remote_host_live`
|
|
local SERVERPW=`variable_value cl_remote_pw`
|
|
[[ -z $SERVERLIVE ]] && SERVERLIVE=$SERVER
|
|
|
|
if [[ -n $SERVERLIVE ]]
|
|
then
|
|
ebegin "Mounting domain resources"
|
|
for COUNT in $( seq 0 24 )
|
|
do
|
|
ping -w4 -i0.5 -c3 $SERVERLIVE &>/dev/null && break || sleep 0.5
|
|
done
|
|
if [[ -z $SERVER ]]
|
|
then
|
|
cl-client $SERVERLIVE && cl-setup-system -l remote &>/dev/null
|
|
else
|
|
cl-client --mount
|
|
fi
|
|
res=$?
|
|
eend $res "Some samba remote resources to mount"
|
|
else
|
|
true
|
|
fi
|
|
|
|
}
|
|
|
|
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
|