Reply
Thread Tools
kingoddball's Avatar
Posts: 1,187 | Thanked: 816 times | Joined on Apr 2010 @ Australia
#1
Hello!!

I need a little help with scripting.

I want to install a .DEB from a script (4 in totoal).

I had the idea, but did not go right..

Essentially I want this:

(located in MyDocs)

Code:
#!/bin/sh

cd /specified-folder/


sudo dpkg -i genericprogram-name_test.deb

sudo dpkg -i genericprogram-name1_modules.deb

sudo dpkg -i generic_program-name2_special.deb

sudo dpkg -i generic_program-name3.deb
This spits out a bunch of errors saying --help and such. Nothing of help.

I use dpgk -i to install these *.deb files normally. Please help.
__________________
The thanks button? Sure! You can press it! I would!

Last edited by kingoddball; 2011-05-29 at 08:57.
 
Posts: 1,680 | Thanked: 3,685 times | Joined on Jan 2011
#2
Originally Posted by kingoddball View Post
Hello!!

I need a little help with scripting.

I want to install a .DEB from a script (4 in totoal).

I had the idea, but did not go right..

Essentially I want this:

(located in MyDocs)

Code:
#!/bin/sh

cd /specified-folder/


sudo dpkg -i genericprogram-name_test.deb

sudo dpkg -i genericprogram-name1_modules.deb

sudo dpkg -i generic_program-name2_special.deb

sudo dpkg -i generic_program-name3.deb
Code:
#!/bin/sh
cd /specified-folder/

echo "dpkg -i *.deb" | root

echo "job done!"
__________________
N900: One of God's own prototypes. A high-powered mutant of some kind never even considered for mass production. Too weird to live, and too rare to die.
 

The Following User Says Thank You to vi_ For This Useful Post:
kingoddball's Avatar
Posts: 1,187 | Thanked: 816 times | Joined on Apr 2010 @ Australia
#3
You're a hero! You come out of nowhere and save the day! AGAIN!
__________________
The thanks button? Sure! You can press it! I would!
 
Posts: 1,680 | Thanked: 3,685 times | Joined on Jan 2011
#4
Originally Posted by kingoddball View Post
You're a hero! You come out of nowhere and save the day! AGAIN!
NP breh, What is more important is you understand the script so that in the future you will be better at writing 'em.

Code:
#!/bin/sh
cd /specified-folder/
You clearly know what that stuff is.



Code:
echo "dpkg -i *.deb" | root
Here we use the pipe '|' it is a special unix character that essentialy allows us to direct the output of a program to another program. In this example, the 'echo' command simply echos whatever parameter you give it. In this case 'dpkg -i *.deb'. This string is enclosed in quotes so the echo program knows it is a single string.

So echo echos that string back to us, we then use pipe to direct that string to the program root. (root is of course 'root shell', the land of sudo.)

So in essence we have:

SAY 'dpkg -i *.deb' TO root



Code:
echo "job done!"
echos 'job done' to the current shell, as we are working on the current shell we see job done!

comprende?
__________________
N900: One of God's own prototypes. A high-powered mutant of some kind never even considered for mass production. Too weird to live, and too rare to die.
 

The Following User Says Thank You to vi_ For This Useful Post:
kingoddball's Avatar
Posts: 1,187 | Thanked: 816 times | Joined on Apr 2010 @ Australia
#5
Unfortunately this keep throwing errors.

Using the same as you posted:
dpkg: error processing *.deb (--install): cannot access archive: No such file or directory. Errors encounered while processing: *.deb (I have also added the start of the filename).

When I do it using the full filename:
Error is:

./script
line 6: syntax error: "|" unextected

Edit: If I remove the pipe | all it does is echo the words

I am doing all this on the N900 if thats any different.
__________________
The thanks button? Sure! You can press it! I would!

Last edited by kingoddball; 2011-05-29 at 10:21.
 
Posts: 1,680 | Thanked: 3,685 times | Joined on Jan 2011
#6
oopz

As the *.deb is in the quotes it is being treated as a literal string as opposed to a globbed expression.

Replace the line with:

Code:
sudo dpkg -i *.deb
So much for trying to show off huh?
__________________
N900: One of God's own prototypes. A high-powered mutant of some kind never even considered for mass production. Too weird to live, and too rare to die.
 

The Following User Says Thank You to vi_ For This Useful Post:
Posts: 1,680 | Thanked: 3,685 times | Joined on Jan 2011
#7
Code:
#!/bin/sh
sudo apt-get install kernel-power
cd wl1251-maemo/binary/kernel-power/
sudo dpkg -i *.deb
Will install ALL .deb in that directory.
__________________
N900: One of God's own prototypes. A high-powered mutant of some kind never even considered for mass production. Too weird to live, and too rare to die.
 

The Following 2 Users Say Thank You to vi_ For This Useful Post:
kingoddball's Avatar
Posts: 1,187 | Thanked: 816 times | Joined on Apr 2010 @ Australia
#8
You're excellent!
I used the one you said that will install all. It worked perfectly!
But what would I do to install.. Maybe 2 only.

Just seems odd that it failed to install one using the same method.

Also: VI_ what does your signature mean/do....
__________________
The thanks button? Sure! You can press it! I would!
 
Bartcore3's Avatar
Posts: 118 | Thanked: 36 times | Joined on Feb 2011 @ Belgium
#9
what does this mean?
Code:
#!/bin/sh
i'm planning to learn all this when i finish my exams ^^
 
kingoddball's Avatar
Posts: 1,187 | Thanked: 816 times | Joined on Apr 2010 @ Australia
#10
Shell script.
You can also use #!/bin/bash

I'm not sure what it fully means in the Linux terminology, the way I know it " this is a script";
__________________
The thanks button? Sure! You can press it! I would!
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 17:59.