Skip to content

Commit

Permalink
Fixed options processing for Mac OS
Browse files Browse the repository at this point in the history
- getopt is BSD style and does not support long options
- fixed typing error inparameter value extracting for all platforms
  • Loading branch information
luccioman committed Sep 3, 2016
1 parent 24b8741 commit 421a6e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion addon/YaCy.app/Contents/MacOS/startYACYMacOS.sh
Expand Up @@ -5,4 +5,4 @@
# This data directory is set in conforming to OS X File System Programming Guide
# see : https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html

"`dirname $0`"/startYACY.sh -startup "'Library/Application Support/net.yacy.YaCy'"
"`dirname $0`"/startYACY.sh -s "'Library/Application Support/net.yacy.YaCy'"
12 changes: 6 additions & 6 deletions startYACY.sh
Expand Up @@ -40,24 +40,24 @@ Options
-l, --logging save the output of YaCy to yacy.log
-d, --debug show the output of YaCy on the console
-p, --print-out only print the command, which would be executed to start YaCy
--start, --startup [data-path] start YaCy using the specified data folder path, relative to the current user home
-s, --startup [data-path] start YaCy using the specified data folder path, relative to the current user home
-g, --gui start a gui for YaCy
USAGE
}

#startup YaCy
cd "`dirname $0`"

if [ $OS = "OpenBSD" ]
if [ $OS = "OpenBSD" ] || [ $OS = "Darwin" ]
then
if [ $(echo $@ | grep -o "\-\-" | wc -l) -ne 0 ]
then
echo "WARNING: Unfortunately this script does not support long options in $OS."
fi

options="`getopt hdlptg: $*`"
options="`getopt hdlptsg: $*`"
else
options="`getopt -n YaCy -o h,d,l,p,t,g -l help,debug,logging,print-out,tail-log,gui,start,startup -- $@`"
options="`getopt -n YaCy -o h,d,l,p,t,s,g -l help,debug,logging,print-out,tail-log,startup,gui -- $@`"
fi

if [ $? -ne 0 ];then
Expand Down Expand Up @@ -103,7 +103,7 @@ for option in $options;do
-t|--tail-log)
TAILLOG=1
;;
-start|-startup)
-s|-startup)
STARTUP=1
isparameter=1
;;
Expand All @@ -113,7 +113,7 @@ for option in $options;do
;;
esac #case option
else #parameter
if [ x$option = "--" ];then #option / parameter separator
if [ $option = "--" ];then #option / parameter separator
isparameter=1;
continue
else
Expand Down

0 comments on commit 421a6e3

Please sign in to comment.