@@ -9,22 +9,27 @@ $(basename "$0") [OPTIONS] [MISSIONS]
99create a GameShell standalone archive
1010
1111options:
12- -h this message
12+ -h this message
1313
14- -p ... choose password for admin commands
15- -P use the "passport mode" by default when running GameShell
16- -A use the "anonymous mode" by default when running GameShell
17- -L LANGS only keep the given languages (ex: -L 'en*,fr')
18- -E only keep english as a language, not generating any ".mo" file
19- and not using gettext
14+ --password ... choose password for admin commands
15+ -P use the "passport mode" by default when running GameShell
16+ -A use the "anonymous mode" by default when running GameShell
17+ -L LANGS only keep the given languages (ex: -L 'en*,fr')
18+ -E only keep english as a language, not generating any ".mo" file
19+ and not using gettext
2020
21- -N ... name of the archive / top directory (default: "gameshell")
21+ -N ... name of the archive / top directory (default: "gameshell")
2222
23- -a keep 'auto.sh' scripts for missions that have one
24- -t keep 'test.sh' scripts for missions that have one
25- -z keep tgz archive
23+ --simple-savefiles
24+ --index-savefiles
25+ --overwrite-savefiles
26+ choose default savefile mode
2627
27- -v show the list of mission directories as they are being processed
28+ -a keep 'auto.sh' scripts for missions that have one
29+ -t keep 'test.sh' scripts for missions that have one
30+ -z keep tgz archive
31+
32+ -v show the list of mission directories as they are being processed
2833EOH
2934}
3035
@@ -57,19 +62,39 @@ KEEP_PO=0 # this is set to 1 if we generate .mo files. Setting it to 1 here
5762LANGUAGES=" "
5863VERBOSE=
5964
60- while getopts " :hp:N:atPzL:Ev" opt
65+ # hack to parse long option --password
66+ # cf https://stackoverflow.com/questions/402377/using-getopts-to-process-long-and-short-command-line-options
67+ _long_option=0
68+ while getopts " :hp:N:atPzL:Ev-:" opt
6169do
70+ if [ " $opt " = " -" ]
71+ then
72+ opt=" ${OPTARG%% =* } " # extract long option name
73+ OPTARG=" ${OPTARG# $opt } " # extract long option argument (may be empty)
74+ OPTARG=" ${OPTARG# =} " # if long option argument, remove assigning `=`
75+ _long_option=1
76+ fi
77+
6278 case $opt in
6379 h)
6480 display_help
6581 exit 0;
6682 ;;
67- p )
83+ password )
6884 ADMIN_PASSWD=$OPTARG
6985 ;;
7086 N)
7187 NAME=$OPTARG
7288 ;;
89+ index-savefiles)
90+ GSH_SAVEFILE_MODE=index
91+ ;;
92+ simple-savefiles)
93+ GSH_SAVEFILE_MODE=simple
94+ ;;
95+ overwrite-savefiles)
96+ GSH_SAVEFILE_MODE=overwrite
97+ ;;
7398 a)
7499 KEEP_AUTO=1
75100 ;;
95120 VERBOSE=1
96121 ;;
97122 * )
123+ if [ " $_long_option " = " 1" ]
124+ then
125+ OPTARG=" -$opt "
126+ fi
98127 echo " invalid option: '-$OPTARG '" >&2
99128 exit 1
100129 ;;
@@ -295,6 +324,12 @@ case $DEFAULT_MODE in
295324 ;;
296325esac
297326
327+ # choose default savefile mode
328+ if [ -n " $GSH_SAVEFILE_MODE " ]
329+ then
330+ sed-i " s/^export GSH_SAVEFILE_MODE=.*$/export GSH_SAVEFILE_MODE='$GSH_SAVEFILE_MODE '/" " $GSH_ROOT /start.sh"
331+ fi
332+
298333# record version
299334if git rev-parse --is-inside-work-tree > /dev/null 2>&1
300335then
0 commit comments