LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Importing a script? (https://www.linuxquestions.org/questions/slackware-14/importing-a-script-112288/)

Panzerfrost 11-04-2003 11:21 AM

Importing a script?
 
Hello. I have seen a template for a script which is supposed to mount a CD if not mounted, and eject it if it is mounted.

Code:

#!/bin/sh
# script to mount/umount cdrom
# for use with xfce4-trigger-launcher
if [ "$1" = "1" ]; then
    mount /cdwriter &> /dev/null
elif [ "$1" = "0" ]; then
    eject /cdwriter &> /dev/null
else
    STATUS=`grep cdwriter /proc/mounts`
    if [ "x$STATUS" = "x" ]; then
        echo 0
    else
        echo 1
    fi
fi

My question is how do I make this script work for my own system.

Here's the relevant fstab line:
Code:

/dev/cdrom      /mnt/cdrom      iso9660    noauto,owner,ro  0  0
Also, mounting a cd as a normal user does not work, can anyone tell me how I can enable mounting for a normal user?


Thanks in advance for your replies.

jkobrien 11-04-2003 11:37 AM

Check out the documentation for /etc/fstab (man fstab). As far as I remember if you change "owner" to "user" anyone can mount your cdrom.

As for the script, it looks like it's taking an argument ($1) from another script or program that calls it (presumably xfce4-trigger-launcher ?). If you really want to use it, try changing "/cdwriter" to "/mnt/cdrom" and then type "<script_name> 1" to mount and "<script_name> 0" to eject the disc. Not sure if that gains you much though.

John


All times are GMT -5. The time now is 11:47 PM.