On 11/12/2012 07:47 PM, Anna wrote:
Just throwing this out, but incron might be something to look into.  For
example, I've set up root's incrontab so that if a specific file is
modified, a script automatically runs with root permissions.

You could set root's incrontab up to watch /run/media/olpc/ and when a
directory is created there (i.e. any USB drive is automounted), incron
would call your script and run it as root.

Again, just brainstorming here.  I won't be offended if someone says
that's a terrible idea.

Anna Schoolfield
Birmingham

On Mon, Nov 12, 2012 at 6:09 PM, Adam Holt <h...@laptop.org
<mailto:h...@laptop.org>> wrote:

    Thanks Tony..adding a couple others involved too :)

    On 11/12/2012 6:59 PM, Tony Anderson wrote:

        Hi,

        First, usbmount is the software that mounts a removable drive.
        So I would think Fedora is replacing it with an alternative
        (some software has to perform that function). CentOS is still
        using usbmount.

        Usbmount provided for a script to be installed by the
        administrator that would be run whenever a removable drive was
        mounted. Daniel Drake uses this to execute a series of XS
        specific scripts (these scripts were developed for OLE Nepal and
        are not in XS-0.7). The scripts he developed for OLE Nepal look
        at the mounted drive and checks for the presence of specific
        folders. If these folders are present then a corresponding
        script is executed.

        So there are two approaches going forward:

        1. Implement the capability on the usbmount replacement.

        2. Execute a script via ssh from an XO, a url, or even direct
        access for a school server on the teacher's XO.

        I am planning to use a 'generic script' on the server:

        if [ -f "$UM_MOUNTPOINT"/XC/xc-install ]; then
             log notice "Installing XC"
             cd $UM_MOUNTPOINT/XC
             if bash xc-install; then
                 log notice "XC installed successfully"
             else
                 log notice "XC install failed with code $?"
                 error_beep
             fi
        fi

        Essentially it tests whether the drive has a folder XC with a
        file xc-install., if so it is executed. If not, nothing happens.

        The xc-install script is on the mounted drive and does whatever
        is needed.

        XC is the counterpart to XO and XS and refers to the content for
        the school server (XS being the software). This isn't hard and
        fast. The XC script can (and does) add packages (e.g. mediawiki
        or django) not in XS-0.7. Of course, it can also change the
        server configuration.

        The script needs to be run with root privileges. In Sridhar's
        scenario this could be a bit tricky. I set up the school server
        for login by admin by password and su to root (requiring another
        password). This works well when you have itinerant technical
        support who may need to administer school servers at many
        different sites. If a teacher is to accomplish this, it would
        probably be easiest to arrange for the teacher to login via a
        public/private key pair and be given root privileges.

        It would be relatively easy to give the teacher's laptop a
        special menu line in the XO icon or in the console so that no
        command line interface would be needed. Essentially I am doing
        this sort of change with a script which works after the XO
        install (it could, of course, also be baked into the build). In
        the latter case, all of the laptops would have the extra menu
        line so the school server could be configured only to accept the
        teacher's click (e.g. identify teacher by serial-number so that
        only the teacher's public key would match).

        Tony




    --
    Help kids everywhere map their world, at http://olpcMAP.net !



_______________________________________________
Server-devel mailing list
Server-devel@lists.laptop.org
http://lists.laptop.org/listinfo/server-devel

Reply via email to