-
Type: Bug Report
-
Status: Closed
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: 5.1.0
-
Fix Version/s: 5.2.1-B2
-
Component/s: Data Management
-
Labels:None
-
Change Log Group:Fixed
-
Change Log Message:The "/tools/fix_perms.sh" script wasn't working, when executed using relative path.
-
Story Points:1
-
Copy Issue Key:
-
Patch Instructions:
The way shell scripts under tools/ folder are using relative paths results in absolutely undesired behavior, when they are executed by other scripts.
In following working example current directory will be "/path/to/in-portal/tools", which is correct.
cd /path/to/in-portal/tools
./fix_perms.sh
In following working example current directory will be "/path/to/in-portal", which is not correct.
cd /path/to/in-portal
./tools/fix_perms.sh
After digging a bit on the Internet I've found a solution, that finds absolute path to folder, where executed script is actually located:
SCRIPT_FOLDER=`cd $(dirname $0); pwd`
Also these scripts missing #!/bin/sh at the top of the script.