multiple distros systems running the same script. - Slackware

This is a discussion on multiple distros systems running the same script. - Slackware ; Hello, I have a problem and I was hoping you can help me, I'm writing a script in TCL that need to use a device: set mydev {/dev/hda1} ;# for example In other distros of Linux the same device is ...

+ Reply to Thread
Results 1 to 13 of 13

Thread: multiple distros systems running the same script.

  1. multiple distros systems running the same script.

    Hello,

    I have a problem and I was hoping you can help me,
    I'm writing a script in TCL that need to use a device:

    set mydev {/dev/hda1} ;# for example

    In other distros of Linux the same device is called "sda2" or "hdd3".
    does anyone have an idea how can I direct my variable to the same
    device on all distros?

    Thank you in advanced,
    Neuzen


  2. Re: multiple distros systems running the same script.

    On Wed, 13 Jun 2007 01:05:53 -0700, neuzen wrote:

    > Hello,
    >
    > I have a problem and I was hoping you can help me, I'm writing a script in
    > TCL that need to use a device:
    >
    > set mydev {/dev/hda1} ;# for example
    >
    > In other distros of Linux the same device is called "sda2" or "hdd3".


    no they are not.

    you should learn more about basic linux devices before "writing" scripts.

    > does
    > anyone have an idea how can I direct my variable to the same device on
    > all distros?


    wanna free lunch too?
    You need to learn more before you can be helped.

    For example you could test for the existancxe of hardware and examine exit
    codes.

    >
    > Thank you in advanced,
    > Neuzen



  3. Re: multiple distros systems running the same script.

    neuzen wrote:
    > Hello,
    >
    > I have a problem and I was hoping you can help me,
    > I'm writing a script in TCL that need to use a device:
    >
    > set mydev {/dev/hda1} ;# for example
    >
    > In other distros of Linux the same device is called "sda2" or "hdd3".
    > does anyone have an idea how can I direct my variable to the same
    > device on all distros?
    >
    > Thank you in advanced,


    Your question is not very clear; "/dev/sda2" cannot be the same device
    as "/dev/hda1" (hda1 is the first partition on the hard disk /dev/hda;
    while /dev/sda refer to another type of disk and /dev/sda2 is the second
    partition). You must be more precise about what device you expect to
    access. Usually what you want can be done with a properly configured
    udev which put the appropriate links.

    Olive

  4. Re: multiple distros systems running the same script.

    On Jun 13, 11:43 am, Olive wrote:
    > neuzen wrote:
    > > Hello,

    >
    > > I have a problem and I was hoping you can help me,
    > > I'm writing a script in TCL that need to use a device:

    >
    > > set mydev {/dev/hda1} ;# for example

    >
    > > In other distros of Linux the same device is called "sda2" or "hdd3".
    > > does anyone have an idea how can I direct my variable to the same
    > > device on all distros?

    >
    > > Thank you in advanced,

    >
    > Your question is not very clear; "/dev/sda2" cannot be the same device
    > as "/dev/hda1" (hda1 is the first partition on the hard disk /dev/hda;
    > while /dev/sda refer to another type of disk and /dev/sda2 is the second
    > partition). You must be more precise about what device you expect to
    > access. Usually what you want can be done with a properly configured
    > udev which put the appropriate links.
    >
    > Olive


    Hi Olive & Anon
    Thanks for your reply on my question,
    The device name is not important at this time cause I'm not sure if I
    need to use a USB device or other peripheral. I just wanted to know if
    there is a way to access the same peripheral from my script the same
    way on all distros ( without changing or editing the script every time
    I'm running the script from a different distro ).
    Thanks again ^_^
    Neuzen


  5. Re: multiple distros systems running the same script.

    neuzen wrote:
    > On Jun 13, 11:43 am, Olive wrote:
    >> neuzen wrote:
    >>> Hello,
    >>> I have a problem and I was hoping you can help me,
    >>> I'm writing a script in TCL that need to use a device:
    >>> set mydev {/dev/hda1} ;# for example
    >>> In other distros of Linux the same device is called "sda2" or "hdd3".
    >>> does anyone have an idea how can I direct my variable to the same
    >>> device on all distros?
    >>> Thank you in advanced,

    >> Your question is not very clear; "/dev/sda2" cannot be the same device
    >> as "/dev/hda1" (hda1 is the first partition on the hard disk /dev/hda;
    >> while /dev/sda refer to another type of disk and /dev/sda2 is the second
    >> partition). You must be more precise about what device you expect to
    >> access. Usually what you want can be done with a properly configured
    >> udev which put the appropriate links.
    >>
    >> Olive

    >
    > Hi Olive & Anon
    > Thanks for your reply on my question,
    > The device name is not important at this time cause I'm not sure if I
    > need to use a USB device or other peripheral. I just wanted to know if
    > there is a way to access the same peripheral from my script the same
    > way on all distros ( without changing or editing the script every time
    > I'm running the script from a different distro ).
    > Thanks again ^_^
    > Neuzen
    >


    For this, you should configure udev. udev can be configured to put a
    link to a device based several physical characteristics and amoung other
    the serial number which is unique to this specific device. For this you
    should read the udev documentation. (But once again /dev/sda2 is never
    the same device as /dev/hda1).

    Olive

  6. Re: multiple distros systems running the same script.

    On Wed, 13 Jun 2007 09:02:29 -0000, neuzen wrote:

    >On Jun 13, 11:43 am, Olive wrote:
    >> neuzen wrote:
    >> > Hello,

    >>
    >> > I have a problem and I was hoping you can help me,
    >> > I'm writing a script in TCL that need to use a device:

    >>
    >> > set mydev {/dev/hda1} ;# for example

    >>
    >> > In other distros of Linux the same device is called "sda2" or "hdd3".
    >> > does anyone have an idea how can I direct my variable to the same
    >> > device on all distros?

    >>
    >> > Thank you in advanced,

    >>
    >> Your question is not very clear; "/dev/sda2" cannot be the same device
    >> as "/dev/hda1" (hda1 is the first partition on the hard disk /dev/hda;
    >> while /dev/sda refer to another type of disk and /dev/sda2 is the second
    >> partition). You must be more precise about what device you expect to
    >> access. Usually what you want can be done with a properly configured
    >> udev which put the appropriate links.
    >>
    >> Olive

    >
    >Hi Olive & Anon
    >Thanks for your reply on my question,
    >The device name is not important at this time cause I'm not sure if I
    >need to use a USB device or other peripheral. I just wanted to know if
    >there is a way to access the same peripheral from my script the same
    >way on all distros ( without changing or editing the script every time
    >I'm running the script from a different distro ).
    >Thanks again ^_^
    >Neuzen


    The devices in your example are entirely hardware-dependent and have
    nothing to do with a particular Linux distribution. See
    http://www.cyberciti.biz/faq/linux-p...rive-mappings/

    >> > I'm writing a script in TCL that need to use a device

    If you have a specific device that you are trying to access, test for
    it's existance in your script. If this does not answer your question
    then you will need to provide a detailed explanation of what you are
    trying to accomplish.

    --
    Scott McMillan

  7. Re: multiple distros systems running the same script.




    In alt.os.linux.slackware, neuzen wrote:
    >
    >Olive wrote:
    >
    >> neuzen wrote:
    >>
    >>> I'm writing a script in TCL that need to use a device:

    >>
    >>> set mydev {/dev/hda1} ;# for example

    >>
    >>> In other distros of Linux the same device is called "sda2" or "hdd3".
    >>> does anyone have an idea how can I direct my variable to the same
    >>> device on all distros?

    >>
    >> Your question is not very clear; "/dev/sda2" cannot be the same device
    >> as "/dev/hda1" (hda1 is the first partition on the hard disk /dev/hda;
    >> while /dev/sda refer to another type of disk and /dev/sda2 is the second
    >> partition). You must be more precise about what device you expect to
    >> access. Usually what you want can be done with a properly configured
    >> udev which put the appropriate links.

    >
    >The device name is not important at this time cause I'm not sure if I
    >need to use a USB device or other peripheral. I just wanted to know if
    >there is a way to access the same peripheral from my script the same
    >way on all distros ( without changing or editing the script every time
    >I'm running the script from a different distro ).


    I was going to ask how, if you are running the script from a
    different linux distribution on the same hardware, your IDE
    drive (/dev/hda) suddenly becomes a SCSI drive (/dev/sda),
    but I see from a web search that others report the same sort
    of thing. See the following pages:
    http://kerneltrap.org/node/7474
    http://www.beranger.org/index.php?article=2696&page=3k
    http://www.beranger.org/feature/sorr...re.php?page=19

    Leaving aside the issues of running a script on different
    devices (see other posts in this thread for advice about
    doing that) it would seem that preventing distributions
    from misidentifying the hard disk hardware is a Good
    Thing, and something I want to know how to fix if I ever
    run into it.

    Would you be so kind as to post exactly how each of your
    distributions and kernel versions identify the hard disk
    hardware? Also, could you change the BIOS settings as
    suggested in the URLs above and tell us if that changes
    the behavior? Be sure to write down the original settings
    so you can go back if needed. You might wish to read the
    following guidelines for best results:

    How To Ask Questions The Smart Way
    http://www.catb.org/~esr/faqs/smart-questions.html

    Thanks!

    --
    Guy Macon



  8. Re: multiple distros systems running the same script.

    On 2007-06-13, neuzen wrote:
    >
    > The device name is not important at this time cause I'm not sure if I
    > need to use a USB device or other peripheral.


    If you're not sure, then you should prompt the user.

    > I just wanted to know if
    > there is a way to access the same peripheral from my script the same
    > way on all distros ( without changing or editing the script every time
    > I'm running the script from a different distro ).


    Since you can't count on the end-user's box running udev, there's no way
    to hard-code the device and expect it to work, particularly for USB
    drives. It's probably more consistent and more safe to ask the user
    which device he needs.

    --keith

    --
    kkeller-usenet@wombat.san-francisco.ca.us
    (try just my userid to email me)
    AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
    see X- headers for PGP signature information


  9. Re: multiple distros systems running the same script.

    Keith Keller wrote:
    > On 2007-06-13, neuzen wrote:
    >>
    >> The device name is not important at this time cause I'm not sure if I
    >> need to use a USB device or other peripheral.

    >
    > If you're not sure, then you should prompt the user.
    >


    Coming from the old "give a command and it runs" world, I dislike prompting
    the user. However, requiring the user to enter an argument to the script is
    the way I would approach it. It is relatively simple to check that the user
    has give a valid device name and even to have a default device using this
    approach. Most importantly, it doesn't require the user to type anything
    beyond the initial command line w/ the device argument.

  10. Re: multiple distros systems running the same script.

    neuzen wrote:
    > I'm not sure if I need to use a USB device or other
    > peripheral. I just wanted to know if there is a way to access the same
    > peripheral from my script the same way on all distros ( without changing
    > or editing the script every time I'm running the script from a different
    > distro ).


    I think this should be done in two steps:

    1) Figure out the device name
    2) Open that device

    Some distributions might have tools to allways give the same name to a
    certain device, but as you want your script to run on any machine you can
    not depend on such a tool. Worse, some distributions might not even
    recognize the device. If you run an old Slackware 3.0 with kernel 1.2.13
    it will not be able to recognize USB devices, nor will it be able to
    recognize a modern IDE chipset. Even if the distribution is able to
    recognize the device you will most likely need root priveleges to open the
    device.

    So once you find an distribution able to use your device, how will you
    know the name of the device? Maybe you can solve this with the help of
    something you know about the device? Maybe you have a special label on the
    disk partition? Maybe you can place a file on the device with a special
    name or a special content?

    regards Henrik
    --
    The address in the header is only to prevent spam. My real address is:
    hc1(at)poolhem.se Examples of addresses which go to spammers:
    root@localhost postmaster@localhost


  11. Re: multiple distros systems running the same script.

    Keith Keller wrote:

    > Since you can't count on the end-user's box running udev, there's no way
    > to hard-code the device and expect it to work, particularly for USB
    > drives. It's probably more consistent and more safe to ask the user
    > which device he needs.


    Why don't you do us all a favour and give the pgp trash trolls a
    tutorial on how to bury the pgp in the headers?

    Your contribution would be appreciated by more than just us.

    cordially, as always,

    rm

  12. Re: multiple distros systems running the same script.

    On 2007-06-13, Melissa wrote:
    > Keith Keller wrote:
    >> On 2007-06-13, neuzen wrote:
    >>>
    >>> The device name is not important at this time cause I'm not sure if I
    >>> need to use a USB device or other peripheral.

    >>
    >> If you're not sure, then you should prompt the user.

    >
    > Coming from the old "give a command and it runs" world, I dislike prompting
    > the user. However, requiring the user to enter an argument to the script is
    > the way I would approach it. It is relatively simple to check that the user
    > has give a valid device name and even to have a default device using this
    > approach. Most importantly, it doesn't require the user to type anything
    > beyond the initial command line w/ the device argument.


    Thanks for writing what I meant instead of what I wrote. :-) Yes, in
    my world "prompting the user" generally includes making the user provide
    the argument in some form; on the commandline is just as okay as a real
    prompt.

    --keith


    --
    kkeller-usenet@wombat.san-francisco.ca.us
    (try just my userid to email me)
    AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
    see X- headers for PGP signature information


  13. Re: multiple distros systems running the same script.

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1
    NotDashEscaped: You need GnuPG to verify this message

    On Wed, 13 Jun 2007, rm@biteme.org wrote:

    > Keith Keller wrote:
    >
    >> Since you can't count on the end-user's box running udev, there's no way
    >> to hard-code the device and expect it to work, particularly for USB
    >> drives. It's probably more consistent and more safe to ask the user
    >> which device he needs.

    >
    > Why don't you do us all a favour and give the pgp trash trolls a
    > tutorial on how to bury the pgp in the headers?
    >


    yaaaaaaaaaaaaaaaaaawwwwwwwnnnnnnnnnnnnnnnnnnnnnnnn nnnnnnnnnn


    --
    Cheers
    Res
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.7 (GNU/Linux)

    iD8DBQFGcHDysWhAmSIQh7MRAmNbAJ9vbLm8vU/s8OumMsZ365aiTme3mQCeKnsA
    F/WNVLkEB0sfsPmrNVyUVsI=
    =kN7W
    -----END PGP SIGNATURE-----

+ Reply to Thread