forked from Bisa/factorio-init
-
Notifications
You must be signed in to change notification settings - Fork 0
/
factorio
executable file
·708 lines (633 loc) · 19.6 KB
/
factorio
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
#!/bin/bash
### BEGIN INIT INFO
# Provides: Factorio
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop Factorio server
# Description: A init script for Factorio, try the help command
### END INIT INFO
debug(){
if [ ${DEBUG} -gt 0 ]; then
echo "DEBUG: $@" >&2
fi
}
# Load config file
if [ -L $0 ]; then
source `readlink -e $0 | sed "s:[^/]*$:config:"`
else
source `echo $0 | sed "s:[^/]*$:config:"`
fi
if [ -z "${SERVICE_NAME}" ]; then
echo "Couldn't load config file, please edit config.example and rename it to config"
exit 1
fi
# Check/load defaults for backwards compatible config options
if [ -z "${PACKAGE_DIR_NAME}" ]; then
PACKAGE_DIR_NAME=factorio
fi
if [ -z "${USERGROUP}" ]; then
USERGROUP=${USERNAME}
fi
if [ -z "${HEADLESS}" ]; then
# This is a server init script, assume headless default
HEADLESS=1
fi
if [ -z "${LATEST_HEADLESS_URL}" ]; then
LATEST_HEADLESS_URL="https://www.factorio.com/get-download/latest/headless/linux64"
fi
if [ -z "${NONCMDPATTERN}" ]; then
NONCMDPATTERN='(^\s*(\s*[0-9]+\.[0-9]+|\)|\())|(Players:$)'
fi
if [ -z ${BINARY} ]; then
# Factorio headless only comes in x64 flavour - if you run anything else, override it in the config
BINARY="${FACTORIO_PATH}/bin/x64/factorio"
fi
case "$1" in
install|help|listcommands|version|"")
;;
*)
if ! [ -e ${BINARY} ]; then
echo "Could not find factorio binary! ${BINARY}"
echo "(if you store your binary some place else, override BINARY='/your/path' in the config)"
exit 1
fi
if [ -z ${FCONF} ]; then
FCONF="${FACTORIO_PATH}/config/config.ini"
fi
if ! [ -e "${SERVER_SETTINGS}" ]; then
echo "Could not find factorio server settings file: ${SERVER_SETTINGS}"
echo "Update your config and point SERVER_SETTINGS to a modified version of data/server-settings.example.json"
exit 1
fi
if ! [ -e ${FCONF} ]; then
echo "Could not find factorio config file: ${FCONF}"
echo "If this is the first time you run this script you need to generate the config.ini by starting the server manually."
echo "(also make sure you have a save to run or the server will not start)"
echo
echo "Create save: sudo -u ${USERNAME} ${BINARY} --create ${FACTORIO_PATH}/saves/my_savegame"
echo "Start server: sudo -u ${USERNAME} ${BINARY} --start-server-load-latest"
echo
echo "(If you rather store the config.ini in another location, set FCONF='/your/path' in this scripts config file)"
exit 1
fi
if [ -z "${WRITE_DIR}" ]; then
# figure out the write-data path (where factorio looks for saves and mods)
# Note - this is a hefty little operation, possible cause of head ache down the road
# as it relies on the factorio write dir to live ../../ up from the binary if __PATH__executable__
# is used in the config file.. for now, that's the default so cross your fingers it will not change ;)
debug "Determining WRITE_DIR based on ${FCONF}, IF you edited write-data from the default, this probably fails"
WRITE_DIR=$(dirname "$(echo `grep "^write-data=" "$FCONF"` |cut -d'=' -f2 |sed -e 's#__PATH__executable__#'$(dirname "$BINARY")/..'#g')")
fi
debug "write path: $WRITE_DIR"
PIDFILE="${WRITE_DIR}/server.pid"
if [ -z "${FIFO}" ];then
FIFO="${WRITE_DIR}/server.fifo"
fi
if [ -z "${CMDOUT}" ];then
CMDOUT="${WRITE_DIR}/server.out"
fi
if [ -z "${SAVELOG}" ]; then
SAVELOG=0
fi
# Finally, set up the invocation
INVOCATION="${BINARY} --config ${FCONF} --port ${PORT} --start-server-load-latest --server-settings ${SERVER_SETTINGS} ${RCON} ${EXTRA_BINARGS}"
;;
esac
usage(){
echo "Usage: $0 COMMAND"
echo
echo "Available commands:"
echo -e " start \t\t\t\t Starts the server"
echo -e " stop \t\t\t\t Stops the server"
echo -e " restart \t\t\t\t Restarts the server"
echo -e " status \t\t\t\t Displays server status"
echo -e " players-online \t\t\t Shows online players"
echo -e " players \t\t\t\t Shows all players"
echo -e " cmd [command/message] \t\t Open interactive commandline or send a single command to the server"
echo -e " chatlog [--tail|-t] \t\t\t Print the current chatlog, optionally tail the log to follow in real time"
echo -e " new-game name [map-gen-settings] \t Stops the server and creates a new game with the specified name using the specified map gen settings json file"
echo -e " save-game name \t\t\t Stops the server and saves game to specified save"
echo -e " load-save name \t\t\t Stops the server and loads the specified save"
echo -e " install [tarball] \t\t\t Installs the server with optional specified tarball (omit to download and use the latest headless server from Wube)"
echo -e " update [--dry-run] \t\t\t Updates the server"
echo -e " invocation \t\t\t\t Outputs the invocation for debugging purpose"
echo -e " listcommands \t\t\t List all init-commands"
echo -e " listsaves \t\t\t\t List all saves"
echo -e " version \t\t\t\t Prints the binary version"
echo -e " help \t\t\t\t Shows this help message"
}
ME=`whoami`
as_user() {
if [ $ME == $USERNAME ]; then # Are we the factorio user?
bash -c "$1"
elif [ "$(id -u)" == "0" ]; then # Are we root?
su $USERNAME -s /bin/bash -c "$1"
else
# To prevent odd permission behaviour, either
# run this script as the configured user or as root
# (please do not run as root btw!)
echo "Run this script as the $USERNAME user!"
exit 1
fi
}
is_running() {
if [ -e ${PIDFILE} ]; then
if kill -0 $(cat ${PIDFILE}) 2> /dev/null; then
debug "${SERVICE_NAME} is running with pid $(cat ${PIDFILE})"
return 0
else
debug "Found ${PIDFILE}, but the server is not running. It's possible that your server has crashed"
debug "Check the log for details"
rm ${PIDFILE} 2> /dev/null
return 2
fi
fi
return 1
}
start_service() {
if [ -e ${PIDFILE} ]; then
ps -p $(cat ${PIDFILE}) > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "${SERVICE_NAME} is already running!"
return 1
fi
debug "Found rogue pid file, server might have crashed"
rm ${PIDFILE} 2> /dev/null
fi
if ! check_permissions; then
echo "Error! Incorrect permissions, unable to write to ${WRITE_DIR}"
return 1
fi
if [ "${SAVELOG}" == "0" ]; then
debug "Erasing log ${CMDOUT}"
echo "" > ${CMDOUT}
fi
as_user "tail -f ${FIFO} |${INVOCATION} >> ${CMDOUT} 2>&1 & echo \$! > ${PIDFILE}"
ps -p $(cat ${PIDFILE}) > /dev/null 2>&1
if [ "$?" -ne "0" ]; then
echo "Unable to start ${SERVICE_NAME}"
return 1
else
echo "Started ${SERVICE_NAME}, please see log for details"
fi
}
stop_service() {
if [ -e ${PIDFILE} ]; then
echo -n "Stopping ${SERVICE_NAME}: "
if kill -TERM $(cat ${PIDFILE} 2> /dev/null) 2> /dev/null; then
sec=1
while [ "$sec" -le 15 ]; do
if [ -e ${PIDFILE} ]; then
if kill -0 $(cat ${PIDFILE} 2> /dev/null) 2> /dev/null; then
echo -n ". "
sleep 1
else
break
fi
else
break
fi
sec=$(($sec+1))
done
fi
if kill -0 $(cat ${PIDFILE} 2> /dev/null) 2> /dev/null; then
echo "Unable to shut down nicely, killing the process!"
kill -KILL $(cat ${PIDFILE} 2> /dev/null) 2> /dev/null
else
echo "complete!"
fi
# Start the reader (in case tail stopped already)
cat ${FIFO} &
# Open pipe for writing.
exec 3> ${FIFO}
# Write a newline to the pipe, this triggers a SIGPIPE and causes tail to exit
echo "" >&3
# Close pipe.
exec 3>&-
rm ${PIDFILE} 2> /dev/null
return 0 # we've either shut down gracefully or killed the process
else
echo "${SERVICE_NAME} is not running (${PIDFILE} does not exist)"
return 1
fi
}
send_cmd(){
if is_running; then
if [ -p ${FIFO} ]; then
cmdid="FACTORIO_INIT_CMD_DELIMITER"
# Whisper that unknown player
echo "/w ${cmdid}" > ${FIFO}
# Wait for factorio to read stdin
sleep 1
# Run the actual command
echo $@ > ${FIFO}
# Wait again, this might need more sleep for larger command output - time will tell (sorry future self for any head aches)
sleep 1
# Read the output file backwards - capture everything between the end of file until
# factorio tells us our random command id player does not exist.
# This also attempts to filter all non chat/command lines from the output
response=$(sed "/Player ${cmdid} doesn't exist./q" <(tac ${CMDOUT}) |egrep -v "(${cmdid})|${NONCMDPATTERN}")
echo "${response}"
else
echo "${FIFO} is not a pipe!"
return 1
fi
else
echo "Unable to send cmd to a stopped server!"
return 1
fi
}
cmd_players(){
players=$(send_cmd "/p")
if [ -z "${players}" ]; then
echo "No players found!"
return 1
fi
if [ "$1" == "online" ]; then
echo "${players}" |egrep '.+ \(online\)$' |sed -e 's/ (online)//g'
else
echo "${players}"
fi
}
check_permissions(){
if [ ! -e "${BINARY}" ]; then
echo "Can't find ${BINARY}. Please check your config!"
exit 1
fi
if ! as_user "test -w ${WRITE_DIR}" ; then
echo "Check Permissions. Cannot write to ${WRITE_DIR}"
exit 1
fi
if ! as_user "touch ${PIDFILE}" ; then
echo "Check Permissions. Cannot touch pidfile ${PIDFILE}"
exit 1
fi
if ! [ -p ${FIFO} ]; then
if ! as_user "mkfifo ${FIFO}"; then
echo "Failed to create pipe for stdin, if applicable, remove ${FIFO} and try again"
exit 1
fi
fi
if ! as_user "touch ${CMDOUT}" ; then
echo "Check Permissions. Cannot touch cmd output file ${CMDOUT}"
exit 1
fi
}
test_deps(){
return 0 # TODO: Implement ldd check on $BINARY
}
install(){
# Factorio comes packaged in a directory named "factorio"
# Unless overriden in the config we will presume this is also the
# name used in FACTORIO_PATH
expected_path="`dirname ${FACTORIO_PATH}`/${PACKAGE_DIR_NAME}"
if ! [ "${FACTORIO_PATH}" == "${expected_path}" ]; then
echo "Aborting install! FACTORIO_PATH does not match expected path: ${expected_path}"
echo "See config option PACKAGE_DIR_NAME for more details"
exit 1
fi
# Prevent accidential overwrites
if [ -e "${expected_path}" ]; then
echo "Aborting install, ${FACTORIO_PATH} already exists"
exit 1
fi
tarball=$1
if ! [ -z "$tarball" ]; then
if ! [ -f "${tarball}" ]; then
echo "Install package does not exist! ${tarball}"
exit 1
fi
else
downloadlatest=1
fi
target="`dirname ${FACTORIO_PATH}`"
if ! test -w "${target}"; then
echo "Failed to write, aborting install!"
echo "Install needs to be run as a user with write permissions to ${target}"
exit 1
fi
if [ $downloadlatest ]; then
LATEST_HEADLESS_URL_REDIRECT_FILENAME=$(curl ${LATEST_HEADLESS_URL} -s -L -I -o /dev/null -w '%{url_effective}')
if [[ $LATEST_HEADLESS_URL_REDIRECT_FILENAME == *"tar.xz"* ]]; then
TAR_OPTIONS="-xJv"
else
TAR_OPTIONS="-xzv"
fi
if ! wget ${LATEST_HEADLESS_URL} -O - | tar ${TAR_OPTIONS} --directory "${target}"; then
echo "Install failed!"
exit 1
fi
else
echo "Installing ${tarball} ..."
if [[ $tarball == *"tar.xz"* ]]; then
TAR_OPTIONS="-xJvf"
else
TAR_OPTIONS="-xzvf"
fi
if ! tar ${TAR_OPTIONS} "${tarball}" --directory "${target}"; then
echo "Install failed!"
exit 1
fi
fi
echo "Applying file ownership ..."
if ! chown -R ${USERNAME}:${USERGROUP} ${FACTORIO_PATH}; then
echo "Failed to apply ownership ${USERNAME}:${USERGROUP} for ${FACTORIO_PATH}"
exit 1
fi
# Generate default config.ini by creating a save
as_user "${BINARY} --create ${FACTORIO_PATH}/saves/server-save"
if [ $? -eq 0 ]; then
echo "Installation complete, edit data/server-settings.json and start your server"
exit 0
else
echo "Failed to create save, review the output above to recover"
exit 1
fi
}
get_bin_version(){
echo `as_user "$BINARY --version |egrep '^Version: [0-9\.]+' |egrep -o '[0-9\.]+' |head -n 1"`
}
get_bin_arch(){
echo `as_user "$BINARY --version |egrep '^Binary version: ' |egrep -o '[0-9]{2}'"`
}
update(){
if ! [ -e "${UPDATE_SCRIPT}" ]; then
echo "Failed to find update script, blatantly refusing to continue!"
echo "Try cloning into [email protected]:narc0tiq/factorio-updater.git and set the UPDATE_SCRIPT config before you try again."
exit 1
fi
# Assume the user wants a dry run? (our only argument to this function)
if ! [ -z "$1" ]; then
echo "Running updater in --dry-run mode, no patches will be applied"
dryrun=1
else
dryrun=0
fi
if [ ${HEADLESS} -gt 0 ]; then
package="core-linux_headless`get_bin_arch`"
else
package="core-linux`get_bin_arch`"
fi
version=`get_bin_version`
if [ -z "${UPDATE_TMPDIR}" ]; then
UPDATE_TMPDIR=/tmp
fi
tmpdir="${UPDATE_TMPDIR}/factorio-update"
invocation="python ${UPDATE_SCRIPT} --for-version ${version} --package ${package} --output-path ${tmpdir}"
if [ ${UPDATE_EXPERIMENTAL} -gt 0 ]; then
invocation="${invocation} --experimental"
fi
if [ ${HEADLESS} -eq 0 ]; then
#GoodGuy Wube Software allows you to download the headless for free - yay! but you still have to
#buy the game if you want to download the sound/gfx client
invocation="${invocation} --user ${UPDATE_USERNAME} --token ${UPDATE_TOKEN}"
fi
echo "Checking for updates..."
result=`as_user "${invocation} --dry-run"`
exitcode=$?
if [ ${exitcode} -gt 0 ]; then
echo "Update check failed!"
exit 1
else
newversion=`echo ${result} |egrep '^Dry run: ' |egrep -o '[0-9\.]+' |tail -n 1`
fi
if [ -z "${newversion}" ]; then
echo "No new updates for ${package} ${version}"
exit 0
else
echo "New version ${package} ${newversion}"
fi
# Go or no Go?
if [ ${dryrun} -gt 0 ]; then
echo "Dry run, not taking further actions!"
# allow scripts to read return code 0 for no updates and 2 if there are updates to apply
if ! [ -z "${newversion}" ]; then
exit 2
fi
exit 0
fi
if [ -e ${tmpdir} ]; then
echo "Aborting update! Temporary directory already exists ${tmpdir}"
echo "Remnants from a previously failed update?"
exit 1
fi
if ! as_user "mkdir -p ${tmpdir}"; then
echo "Aborting update! Unable to create tmpdir: ${tmpdir}"
exit 1
fi
# Time to download the updates
if ! as_user "${invocation}"; then
echo "Aborting update!"
rm -rf ${tmpdir}
exit 1
fi
# Stop the server if it is running.
if is_running; then
send_cmd "Updating to new Factorio version, be right back"
stop_service
fi
for patch in $(find ${tmpdir} -type f -name "*.zip" | sort -V); do
echo "Applying ${patch} ..."
result=`as_user "$BINARY --apply-update ${patch}"`
exitcode=$?
if [ $exitcode -gt 0 ]; then
echo "${result}"
echo
echo "Error! Failed to apply update"
echo "You can try to apply it manually with:"
echo "su ${USERNAME} -c \"${BINARY} --apply-update ${patch}\""
exit 1
fi
done
echo "Successfully updated factorio"
rm -rf ${tmpdir}
}
case "$1" in
start)
# Starts the server
if is_running; then
echo "Server already running."
exit 0
else
if ! start_service; then
echo "Could not start $SERVICE_NAME"
exit 1
fi
fi
;;
stop)
# Stops the server
if is_running; then
send_cmd "Server is being shut down on request"
if ! stop_service; then
echo "Could not stop $SERVICE_NAME"
exit 1
fi
else
echo "No running server."
exit 0
fi
;;
restart)
# Restarts the server
if is_running; then
send_cmd "Server is being restarted on request, be right back!"
if stop_service; then
if ! start_service; then
echo "Could not start $SERVICE_NAME after restart!"
exit 1
fi
else
echo "Failed to stop $SERVICE_NAME, aborting restart!"
exit 1
fi
else
echo "No running server to restart, starting it..."
if ! start_service; then
echo "Could not start $SERVICE_NAME"
exit 1
fi
fi
;;
status)
# Shows server status
if is_running; then
echo "$SERVICE_NAME is running."
else
echo "$SERVICE_NAME is not running."
exit 1
fi
;;
cmd)
if [ -z "$2" ]; then
trap 'clear' SIGTERM EXIT
clear
echo "Type any command or send chat messages"
echo "This interactive commandline adds additional commands:"
echo ""
echo -e "\texit\t\texit the commandline"
echo -e "\tclear\t\tclear the commandline screen"
echo ""
while true; do
read -e -p "server@${SERVICE_NAME}> " cmd
[ "${cmd}" == "exit" ] && exit 0
[ "${cmd}" == "clear" ] && clear && continue
echo ${cmd} > ${FIFO}
sleep 1
done
else
send_cmd "${@:2}"
fi
;;
chatlog)
case $2 in
--tail|-t)
tail -F -n +0 ${CMDOUT} |egrep -v "${NONCMDPATTERN}"
;;
*)
cat ${CMDOUT} |egrep -v "${NONCMDPATTERN}"
;;
esac
;;
players)
cmd_players
;;
players-online|online)
cmd_players online
;;
new-game)
if [ -z $2 ]; then
echo "You must specify a save name for your new game"
exit 1
fi
savename="${WRITE_DIR}/saves/$2"
createsavecmd="$BINARY --create ${savename}"
# Check if user wants to use custom map gen settings
if [ $3 ]; then
if [ -e "${WRITE_DIR}/$3" ]; then
createsavecmd="$createsavecmd --map-gen-settings=${WRITE_DIR}/$3"
else
echo "Specified map gen settings json does not exist"
exit 1
fi
fi
# Stop Service
if is_running; then
send_cmd "Generating new save, please stand by"
if ! stop_service; then
echo "Failed to stop server, unable to create new save"
exit 1
fi
fi
if ! as_user "$createsavecmd"; then
echo "Failed to create new game"
exit 1
else
echo "New game created: ${savename}.zip"
fi
;;
save-game)
savename="${WRITE_DIR}/saves/$2.zip"
# Stop Service
if is_running; then
send_cmd "Stopping server to save game"
if ! stop_service; then
echo "Failed to stop server, unable to save as \"$2\""
exit 1
fi
fi
lastsave=$(find "${WRITE_DIR}/saves" -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" ")
if ! as_user "cp ${lastsave} ${savename}"; then
echo "Error! Failed to save game"
exit 1
fi
;;
load-save)
# Ensure we get a new save file name
newsave=${WRITE_DIR}/saves/$2.zip
if [ ! -f "${newsave}" ]; then
echo "Save \"${newsave}\" does not exist, aborting action!"
exit 1
fi
# Since stopping the server causes a save we have to stop the server to do this
if is_running; then
send_cmd "Stopping server to load a saved game"
if ! stop_service; then
echo "Aborting, unable to stop $SERVICE_NAME"
exit 1
fi
fi
# Touch the new save file
as_user "touch ${newsave}"
;;
install)
install "$2"
;;
update)
update "$2"
;;
inv|invocation)
echo ${INVOCATION}
;;
help|--help|-h)
usage
;;
listcommands)
echo `$0 help 2> /dev/null |egrep '^ ' |awk '{ print $1 }'`
;;
listsaves)
echo `find ${WRITE_DIR} -type f |egrep -o '\w+\.zip$' |sed -e 's/.zip//'`
;;
version)
echo `get_bin_version`
;;
*)
echo "No such command!"
echo
usage
exit 1
;;
esac
exit 0