The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script(s) to Automate Tasks droppedonjapan Shell Programming and Scripting 2 05-21-2008 07:32 AM
script to automate mksysb via nim in AIX 5.3 barkath Shell Programming and Scripting 0 12-20-2007 03:46 PM
here document to automate perl script that call script hogger84 Shell Programming and Scripting 3 10-22-2007 07:15 AM
pkgrm XNOR UNIX for Dummies Questions & Answers 7 04-06-2007 04:04 PM
automate the input in a script erwinspeybroeck UNIX for Dummies Questions & Answers 11 01-31-2002 07:54 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #8  
Old 09-24-2008
Moderator
 

Join Date: Sep 2007
Location: Germany
Posts: 1,031
I think you got it wrong.

You write a simple file with the answers in the order you like them:

cat infile:
Code:
y
n
n
y
all
n
y
Then you just call your command like I posted before:
Code:
pkgrm somesoftware < infile
Quote:
"yes | pkgrm [package-name]"
This won't work anyway, there is an "echo" missing in front of "yes".
Reply With Quote
Forum Sponsor
  #9  
Old 09-24-2008
Registered User
 

Join Date: Sep 2008
Posts: 5
I think you got it wrong

I need to use both pkgrm and pkgadd. pkgrm works fine if i use
yes | pkgrm $PACKAGE (without echo)

The problem is with the pkgadd because the first answer should be 'all' and the second 'y'. Not all the answers are yes otherwise the above trick would work for pkgadd as well. I also tried using an input file with :

all
y

but it doesn't work. If you read my previous post again you will understand. Any other help?
Reply With Quote
  #10  
Old 09-24-2008
Moderator
 

Join Date: Sep 2007
Location: Germany
Posts: 1,031
Sadly I don't have those tools available - yes, maybe someone else will help you, good luck ^^
Reply With Quote
  #11  
Old 09-24-2008
Bughunter Extraordinaire
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,262
Quote:
Originally Posted by zaxxon View Post
Sadly I don't have those tools available
Just to clarify: "yes" (/usr/bin/yes) is a tool which produces streams of "y^M" (a "y" followed by a newline). AIX has it as any other Unix derivate i am aware of.

I suspect the reason why pkgadd does not work with an input redirection is because it clears the input channel before reading the second input. This is meant as a security device (to avoid answers which in fact are just accidentally doubly typed keys from the last answer) but is in fact puting an obstacle in using the tool in any pipeline or pipeline-like construct. This is plain bad programming style of the i-have-not-understood-Unix-concepts category.

Aside from feeling sympathetically with you i fear there is no solution to this problem. pkgadd is simply programmed badly on your system.

I hope this helps.

bakunin
Reply With Quote
  #12  
Old 09-25-2008
Moderator
 

Join Date: Sep 2007
Location: Germany
Posts: 1,031
That "yes" tool I did not know, yep. But I meant that I don't have those pkgadd and pkgrm tools available etc.
Reply With Quote
  #13  
Old 09-25-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
The brute-force solution would be to write a simple expect script. It's not a tool I particularly like but it sounds right for this problem.
Reply With Quote
  #14  
Old 09-26-2008
Registered User
 

Join Date: Sep 2008
Posts: 5
I finally found the solution to this problem by doing a simple 'trick'.

pkgadd has an -a option which allows to use your own admin file to control the process. The format of this file is similar to the one below.

instance=overwrite
partial=nocheck
runlevel=nocheck
idepend=nocheck
rdepend=nocheck
space=nocheck
setuid=nocheck
conflict=nocheck
action=nocheck
basedir=default

The 'action=nocheck' line tells to the command to bypass the questions in order to automate the execution.

The problem is that the first question which needs an 'all' answer (instead of 'y') cannot be bypassed by this command.

What I did was to create two files. The first one had the above 'admin file' structure and the second one had only one line with the word 'all'.

echo "mail=
instance=overwrite
partial=nocheck
runlevel=nocheck
idepend=nocheck
rdepend=nocheck
space=nocheck
setuid=nocheck
conflict=nocheck
action=nocheck
basedir=default" > $NOASK_FILE

echo "all" > $INPUT_FILE


By using the following command:


pkgadd -a $NOASK_FILE -d [package-path] < $INPUT_FILE

the package was added automatically without any user interaction.

I hope this helps others that will face the same issue in the future.

Thanks for your replies.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 03:24 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0