Programming :: After USB Boot - Detect Which Device The Ramfs Was Loaded From - Bash Or Python
Sep 22, 2010
How one could determine (for use in a Bash or Python script) which device (eg /dev/sda1, /dev/hda1... etc) a ramfs was loaded from when booting from a USB drive.
I have a RIPLinux/Tinycore live USB disk that automatically needs to run a script that is stored on the same USB drive but not part of the RIPLinux/Tinycore image. (Please note that I do not want to put this script into the RIPLinux image.) I therefore would like to remix the RIPLinux/Tinycore ISO to automatically run this script once it has started up. After RIP linux has booted I would like to automatically mount the USB drive that RIPLinux/Tinycore was booted from. I need help detecting which device this is.
I have a bash script that I want to import in to Python, mainly just to see if I can or not. However in the script I do use some piping of commands into sed to trim it down to what I need. When I tried doing it with the os.system() call, it didn't work. The exact error is
Ive been learning bash over the past 6 months or so and have written a few scripts etc and i have just downloaded julius to execute my scripts and a few commands with speech recognition, the example script that comes with julius to execute commands is written in python and the example works fine when executed but i would like to further extend and customize it but i dont know anything about python, so ideally i would like to translate it to bash as that is what i am learning/using at the minute and would like to learn/use one language at a time, translating it as i think im a little out of my league, i look at the script and sort of understand how it works but i dont know anything about python and my knowledge of bash is limited for use of translating languages.
the python script is:
Code: #! /usr/bin/python -u # How to use it: # julius -quiet -input mic -C julian.jconf 2>/dev/null | ./command.py import sys
I have searched the net for guides on GTK/Glade and have learned that I have to install Glade in order to experiment with it. It also appears that it only works for Perl. I would primarily like to use C ,Bash , Pascal or settle for Python if possible. Can anyone offer some general info on this topic?
I wrote the Automatik widget (you can find it at :http://kde-look.org/content/show.php...&PHPSESSID=caeTo improve it, I would like to add this one-line script into a text sensor :
top -b -n 1 | head -12 | tail -6 | sed '/top/d' | awk '{ printf "%-12.12s %-4s %-4s %-3s " , $12,$9,$10,$2}'
Using xsel I pass a selection into a variable. I then check that the variable includes an embedded newline to be sure that the selection returned by xsel is complete. If the selection content preceding the newline is just a single word, the check fails to detect the newline, thus
managed to get things working so well on my laptop i thought i'd install ubuntu onto an external drive so i can boot to either xp or Ubuntu whenever i want, when i started up after the install it doesn't recognise the drive i loaded it to and appears to have lost the link to xp. the exact words are:
error: no such device: 4368f21f-d1b6-4c60-8c6b-4d2d38d16920. grub rescue>
what i can do to get my xp back, my wife uses the xp and will kill me if i don't sort it, fortunately the comps unrealiable anyway!
I'm setting up a machine that's going to be used to test randomly connected tape drives one at a time, and as such, I'm writing the test routine using mt in a bash script, for user-friendliness. The problem is the block device name changes on occasion as tape drives are swapped out and busses are rescanned, so I can't "hard code" a block name into the script.
I know programs like lsscsi and hwinfo will give you block device names as part of their output, but I can't seem to grep anything in such a way as to have the final output be just the block name (ie /dev/st2, or optimally 'st2'), so that I can just have the script read said output, and drop it into the necessary variable.
I am calling a bash shell script from a python script trying to pass several arguments to the bash script with no succes can this be done? I have researched (google) with no clear indication of how to achieve this. Using "os.system"
Is there some type of functional way to read things in the Python shell interpreter similar to less or more in the bash (and other) command line shells?
Example:
Code:
>>> import subprocess >>> help(subprocess) ... [pages of stuff to read] ...
I'm hoping so as I hate scrolling and love how less works with simple keystrokes for page-up/page-down/searching etc.
I am currently using fedora 11 kernel 2.6.29 version, i wanted to write device driver for usb to detect my own device. My project is radio with computer. My fm radio get connected to usb port so i need to write h/w interfacing program.
How do you find out which driver is being used for a certain device. Say that I run lsusb and I find "Bus 007 Device 002: ID 046d:c043 Logitech, Inc. MX320/MX400 Laser Mouse", how can I find out what the active driver for the device is?Also, is there some way to list all available drivers for a device? Is there a way to change the driver at runtime?
Reboot and select proper boot device or insert boot media in selected boot device and press a key. I got this error after: Reducing my Windows 7 partition by about 100gb. Creating a new partition (100gb) and copying my Ubuntu partition (10gb) to the new partition. After it was copied, and pasted, the original partition was deleted. I now had two partitions a new 100gb Ubuntu partition and a 600gb (or so) Windows 7 partition.
All of this was done using a bootable USB with Ubuntu 10.10 and GParted partition editor. Now when I boot I get the "Reboot and select proper boot device or insert boot media in selected boot device and press a key." error.
I tried all the threads to load and compile the driver for the Belkin wireless-N F5D8053 (Ralink RT2870 chip) I still cannot get it to come up - the wireless status says device not ready. Here is some of the system info relating to the adapter:
I have a function definition in a Python 2.x script which take a tuple as one of its arguments, but 2to3 has no answers nor any of my searching on how to represent the same in Python 3.x
I'm writing a C program that reads the boot sector of a USB disk. (it is mounted as /dev/sda1). I'm able to read the sector, by the calls code...
The problem is when I wish to write. I use the call: bytesWrite = write(fd, buf, 512) The 'write' returns the value of 512, which looks as if the write was successful, yet when I read again the /dev/sda1 device, I see that no writing was actually made.
Can anybody tell me what do I need to do in order to allow an actual write to the device?
I wanna that the pc starts (on/off), the pc arrives to gdm. It waits for an user to log.But but at the boot of this machine, I would like that an user has a script started in the processes (NO X cuz bash script).How can an user runs a script at boot of the PC ? (once only and no one loged)
I do not know how to write either PYTHON or Bash Shell Scripting. I am to learn one for Linux Administration purpose. Which one will you recommend for a Linux Admin/Eng environment?
I use libpcap to write a program to detect network device in Ubuntu but not sucess. The result is no suitable device found. How many reasons are there for that? The code i used is the main user page.
My computer is Dell Inspiron N4020.And after I installed the Ubuntu 10.04 successfully,a problem occured:No wireless device appear nor the wireless signal