Wainting for samba mounts upon login to KDE

Since my employer introduced the policy of switching off office PCs during night hours I'm keeping my documents and other important stuff (most notably my KDE Desktop directory) on a remote samba share. When I arrive to the office in the morning it's useful to have KDE wait for the Desktop directory to be mounted, that in turn only happens after my PC obtains an address via DHCP. Often I was too quick to supply my login credentials so KDE panicked and scattered the contents of my home dir on my desktop instead the contents of the Desktop dir.

I've placed the following small script to an executable file named .xsessionrc in my home directory. The script uses kdialog to display a progress meter that counts for 100 seconds or until my Desktop directory can be found. Then it disposes the progress bar dialog via the KDE DCOP service.

#!/bin/bash
dcopserver

DCOPREF=`kdialog --progressbar "Waiting for samba mounts"  --title "Waiting..."`
DCOPCLIENT=`dcopclient "$DCOPREF"`
DCOPOBJECT=`dcopobject "$DCOPREF"`

dcop "$DCOPCLIENT" "$DCOPOBJECT" showCancelButton true
dcop "$DCOPCLIENT" "$DCOPOBJECT" ignoreCancel true

for i in `seq 1 100`; do
    dcop "$DCOPCLIENT" "$DCOPOBJECT" setProgress $i
    cancel=`dcop "$DCOPCLIENT" "$DCOPOBJECT" wasCancelled`
    if [ "$cancel" = "true" -o -d "/mnt/cifs/mcree/Desktop" ]; then
        dcop "$DCOPCLIENT" "$DCOPOBJECT" close
        exit
    fi
    sleep 1
done

Linkbacks

Use the following URL for manually sending trackbacks: https://rigo.info/lib/plugins/linkback/exe/trackback.php/en:blog:wainting_for_samba_mounts_upon_login_to_kde
en/blog/wainting_for_samba_mounts_upon_login_to_kde.txt · Utolsó módosítás: 2009-04-14 00:00 (külső szerkesztés)
CC Attribution-Noncommercial-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0