You are not logged in.

#1 2011-05-05 14:42:51

zenlord
Member
From: Belgium
Registered: 2006-05-24
Posts: 1,223
Website

networkmanager dispatcher: adding NFS-shares?

Hi,

Up until I got hooked on gnome 3, I was using netcfg and I had it configured to only mount my NFS-shares when connected to my home-network.

I would like to do the same now I'm using networkmanager, and it seems that the nm-dispatcher is the way to go? Am I right? Does anyone have some recipes he/she would like to share?

THX!

Offline

#2 2011-05-05 17:20:38

enrique
Member
Registered: 2005-10-25
Posts: 95
Website

Re: networkmanager dispatcher: adding NFS-shares?

I have the following file: /etc/NetworkManager/dispatcher.d/99nfs.sh contaning:

#!/bin/sh
 
IF=$1
STATUS=$2

if [ "${IF}" = "wlan0" ] && [ "${STATUS}" = "up" ]; then

  ssid=`/usr/sbin/iwgetid --raw`
#  logger "ssid: ${ssid}"
  
  if [ "${ssid}" = "SSID_OF_MY_HOME_NETWORK" ]; then
    logger "Home wlan0 up: mounting nfs"
    if [ ! -f '/var/run/rpcbind.pid' ]; then
      logger "starting nfs-common"
      /etc/rc.d/nfs-common start
    fi
    mount /shared
    mount /var/cache/pacman/
    exit $?
  fi

elif [ "${IF}" = "wlan0" ] && [ "${STATUS}" = "down" ]; then
    logger "Home wlan0 down: unmounting nfs shares"
    umount /shared
    umount /var/cache/pacman/
fi

This works for me smile


Kind regards, enrique

Offline

#3 2011-05-05 19:50:53

zenlord
Member
From: Belgium
Registered: 2006-05-24
Posts: 1,223
Website

Re: networkmanager dispatcher: adding NFS-shares?

Looks like it is working - THX!

/EDIT: spoke to soon. After a clean reboot, it doesn't work. Running the script with 'sh <scriptname> wlan0 up' works however...

I have triple checked the permissions (root:root and 755) and the file is in the /etc/NetwokManager/dispatcher.d/-folder. I had another file in that folder, but I removed it to make sure it was not blocking the execution of this script.

Anyone else have an idea?

Last edited by zenlord (2011-05-07 15:06:41)

Offline

#4 2011-05-09 03:42:19

archix
Member
Registered: 2010-11-11
Posts: 12

Re: networkmanager dispatcher: adding NFS-shares?

My script in /etc/NetworkManager/dispatcher.d quit working after the pacman upgrade from networkmanager-0.8.998-3 to networkmanager-0.8.999-1.

The dispatcher script is supposed to be called with 2 parameters: the interface name of the device followed by the action (up, down, etc.)

Some limited troubleshooting indicated that the interface name, which used to be properly passed to the script as the first parameter, is empty.

I downgraded to the previous version (I downgraded network-manager-applet too) and the script began working again.

I stopped there because once my NFS mounts were working again I had other things to do - I guess I should submit an upstream bug report.

Offline

#5 2011-05-09 06:53:25

zenlord
Member
From: Belgium
Registered: 2006-05-24
Posts: 1,223
Website

Re: networkmanager dispatcher: adding NFS-shares?

Offline

#6 2011-05-10 17:48:46

zenlord
Member
From: Belgium
Registered: 2006-05-24
Posts: 1,223
Website

Re: networkmanager dispatcher: adding NFS-shares?

Bug found and squashed in [master] - first real bugreport - yay!

Offline

Board footer

Powered by FluxBB