dslreports logo
site
 
    All Forums Hot Topics Gallery
spc

spacer




how-to block ads


Search Topic:
uniqs
3
share rss forum feed

pablo
MVM
join:2003-06-23
kudos:1
reply to coolmohere

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

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