site Search:


 
    All Forums Hot Topics Gallery






how-to block ads


 
Search Topic:
Share Topic
Posting?
Post a:
Post a:
Links: ·Forum FAQ ·Attitude Adjustment ·Linux docs ·DistroWatch ·OPLM
AuthorAll Replies

pablo
MVM
join:2003-06-23
kudos:1

reply to coolmohere

Re: Installing a bin file by taking input from a properties file

said by coolmohere:

I need to install a bin file in UNIX which requires user interaction for giving some information like user id , path, sid etc. All these information is stored in a properties file in the same location.

Hi,

I'm not sure I'm following you above ... are you saying that the user's input is used to create a property file or the user has the ability to override the data found within the property file.

said by coolmohere:

So if i give ./file.bin -f propfile.properties will it install the file taking all the required inputs from the properties file ?
Or else how will i be able to do it ?

I'm going to assume "file.bin" is your example program. The only way using "-f" as an argument is whether your application accepts such an argument. Does it?

Please don't take this the wrong way but it'd be very helpful if you spent an extra few minutes to write clearly. I understand you may not be a native speaker but it's not clear to me what is you're trying to do. If it's too difficult to express with words, you can always take the route I take (when conversing with others who are non-native English speakers) and provide examples of input and expected output.

Cheers!
-pablo
--
openSUSE 12.2/KDE 4.x
ISP: TekSavvy Bonded DSL; backhauled via a 6KM wireless link
Assorted goodies: »pablo.blog.blueoakdb.com


pflog
Bueller? Bueller?
Premium,MVM
join:2001-09-01
El Dorado Hills, CA
kudos:3

I'm guessing it's interactive input on the command line, and the OP wants to answer the values automatically.

Sounds like a job for expect (or something wrapping expect if the OP is more comfortable with Perl or something).
--
"I drank what?" -Socrates


coolmohere

join:2012-12-03

reply to pablo
The file.bin is an application. During the installation of which, the user will be prompted to enter details like path , system id , etc.

All these info ( path , system id etc ) is stored in a properties file in the same directory.

I need to perform a silent installation, by taking the required details from the properties file.

Will that be possible by giving ./file.bin - propfile.properties ( assuming that application accepts -f argument)


pablo
MVM
join:2003-06-23
kudos:1

Hi,

Based on what you wrote, it's very possible. What you want to do is first collect the user's responses and when they're happy with what they entered, create the property file and invoke "./file.bin -f the-properties-file" to have "/file.bin" perform the installation.

You can write the installation script any number of ways. You could easily do it in a shell script for example. Below is an off-the-top, bleary eyed shell script. :)

bash code:
#!/bin/bash

YES=1
IS_USER_HAPPY=0
THE_PROPERTY_FILE=.here-it-is-little-doggy
APPLICATION="./file.bin"

#
# Gather user input
#
while [ $IS_USER_HAPPY -eq 0 ] ; do

echo -n "Please enter the path: "
read MY_PATH

echo -n "Please enter the system id: "
read MY_SYSTEM_ID

echo
echo "You provided the following:"
echo " Path '$MY_PATH'"
echo " System Id '$MY_SYSTEM_ID'"
echo
echo -n "If the above is correct, press <ENTER>, otherwise type N and try again"
read WHAT_DID_THEY_SAY

if [ -z "WHAT_DID_THEY_SAY" ] ; then
IS_USER_HAPPY=$YES
fi
done

#
# Create the property file
#
echo $MY_PATH > $THE_PROPERTY_FILE
echo $MY_SYSTEM_ID >> $THE_PROPER_FILE

#
# Perform the installation
#
$APPLICATION -f $THE_PROPERTY_FILE

exit $?

Cheers,
-pablo

--
openSUSE 12.2/KDE 4.x
ISP: TekSavvy Bonded DSL; backhauled via a 6KM wireless link
Assorted goodies: »pablo.blog.blueoakdb.com

Wednesday, 19-Jun 06:24:28 Terms of Use & Privacy | feedback | contact | Hosting by nac.net - DSL,Hosting & Co-lo
over 13.5 years online © 1999-2013 dslreports.com.
Most commented news this week
Hot Topics