Easy Shell Script Question
Hi,
I'm creating an installation package with Bitrock, but I can't get this shell script correct. Here is Bitrock.sh: Code:
#!/bin/sh |
Re: Easy Shell Script Question
Quote:
|
The weird thing is I tried that and it STILL doesn't work. The Bitrock script log says ./rc-local.bash doesn't exist, but it does, I don't get it. I'm stuck on this little thing and it's frustrating!
|
Try putting a
Code:
pwd Also, make sure that the rc-local.bash is really called rc-local.bash and doesn't have any non-ascii characters in its name (e.g. rc–local.bash wouldn't match because it uses the wrong dash character). You might want to put in the line Code:
ls rc*.bash |
There are 3 files in this installation, Bitrock.sh, rc-local.bash, and shell.pl. These are all installed into the same directory. Bitrock.sh, the script, is ran as a Post Install Script. So the files are installed and then Bitrock.sh is ran. Here's what the script looked like this time:
Code:
#!/bin/sh Code:
Error executing post installation script |
As a directory name, . means "the current working directory" as printed by pwd; in this case, /home/user. The file ./rc-local.bash is really /home/user/rc-local.bash, which doesn't exist. You need to make the script point to the file as extracted, which I guess would probably mean something like BitRock/output/sample-1.0/rc-local.bash
|
Thanks I understand. But when the installation package is ran, the user can place the files in any directory which will most likely not be 'BitRock/output/sample-1.0'. I want the script to work no matter what possible directory the files are installed to.
|
You need to find out where the files are installed and use that within the script. If you're using an automated installer then this will most likely be in an environment variable somewhere.
Code:
cd $INST_PATH See the installer's documentation for more details. You could also look at the value of $0, which contains the path of the script, followed by a slash, followed by the name of the script. If you can strip off the /Bitrock.sh at the end, then this will give you the installation directory. |
Yes that variable in bitrock is ${installdir}. That was the first thing I tried(several ways) and that didn't work. I'll go ahead and look into $0. Thanks for helpin out rjlee.
|
All times are GMT -5. The time now is 12:51 PM. |