-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkgsm.sh
executable file
·772 lines (683 loc) · 23.1 KB
/
kgsm.sh
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
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
#!/bin/bash
debug=
# shellcheck disable=SC2199
if [[ $@ =~ "--debug" ]]; then
debug=" --debug"
export PS4='+(\033[0;33m${BASH_SOURCE}:${LINENO}\033[0m): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
set -x
for a; do
shift
case $a in
--debug) continue ;;
*) set -- "$@" "$a" ;;
esac
done
fi
# Absolute path to this script file
KGSM_ROOT="$(dirname "$(readlink -f "$0")")"
export KGSM_ROOT
if [[ ! "$KGSM_COMMON_LOADED" ]]; then
module_common="$(find "$KGSM_ROOT" -type f -name common.sh -print -quit)"
if [[ -z "$module_common" ]]; then
echo "${0##*/} ERROR: Could not find module common.sh" >&2
echo "${0##*/} ERROR: Install compromised, please reinstall KGSM" >&2
exit 1
fi
# shellcheck disable=SC1090
source "$module_common" || exit 1
fi
installer_script="$(__find_or_fail installer.sh)"
if [[ ! -f "$installer_script" ]]; then
__print_error "installer.sh missing, won't be able to check for updates"
__print_error "Installation might be compromised, please reinstall KGSM"
exit "$EC_GENERAL"
fi
function check_for_update() {
"$installer_script" --check-update $debug
}
function update_script() {
"$installer_script" --update $debug
__merge_user_config_with_default
}
function get_version() {
"$installer_script" --version $debug
}
DESCRIPTION="Krystal Game Server Manager - $(get_version)
Create, install, and manage game servers on Linux.
If you have any problems while using KGSM, please don't hesitate to create an
issue on GitHub: https://github.com/TheKrystalShip/KGSM/issues"
function usage() {
local UNDERLINE="\e[4m"
local END="\e[0m"
echo -e "$DESCRIPTION"
echo -e "
Usage:
$(basename "$0") OPTION
Options:
${UNDERLINE}General${END}
-h, --help Print this help message.
[--interactive] Print help information for interactive mode.
--update Update KGSM to the latest version.
[--force] Ignore version check and download the latest
version available.
--update-config Update config.ini with the latest options added
or modified in config.default.ini
--ip Print the external server IP address.
-v, --version Print the KGSM version.
${UNDERLINE}Blueprints${END}
--create-blueprint Create a new blueprints file.
[-h, --help] Print help information about the blueprint
creation process.
--blueprints List all available blueprints.
--blueprints --json Print a JSON array with all blueprints.
--blueprints --json --detailed
Print a detailed JSON formatted Map with
information on all blueprints.
--install BLUEPRINT Run the installation process for an existing
blueprint.
BLUEPRINT must be the name of a blueprint.
Run --blueprints to see available options.
[--install-dir <dir>] Needed in case KGSM_DEFAULT_INSTALL_DIR is not
set.
[--version <version>] WARNING: Not used by game servers that come from
steamcmd, only used by custom game servers.
Specific version to install.
[--id <id>] Identifier for the instance as an alternative
from letting KGSM generate one.
${UNDERLINE}Instances${END}
--uninstall <instance> Run the uninstall process for an instance.
--instances [blueprint] List all installed instances.
--instances --json Print a JSON formatted array with all instances.
--instances --json --detailed
Print a detailed JSON Map with all instances
and their information.
Optionally a blueprint name can be specified in
order to only list instances of that blueprint
-i, --instance <x> OPTION Interact with an instance.
OPTION represents one of the following:
--logs Print a constant output of an instance's log.
--status Return a detailed running status.
--info Print information about the instance.
--is-active Check if the instance is active.
--start Start the instance.
--stop Stop the instance.
--restart Restart the instance.
--save Issues the save command to the instance.
--input <command> Send a command to the instance's interactive
console, if the instance accepts commands.
Will display the last 10 lines of the instance
log.
-v, --version Provide version information.
Running this with no other argument has the same
outcome as adding the --installed argument.
[--installed] Print the currently installed version.
[--latest] Print the latest available version.
--backups Print a list of created backups.
--check-update Check if a new version is available.
--update Run the update process.
--create-backup Create a backup of the currently installed
version, if any.
--restore-backup NAME Restore a backup.
NAME is the backup name.
--modify Modify and existing instance.
--add OPTION Add additional functionality. Possible options:
ufw, systemd
--remove OPTION Remove functionality. Possible options:
ufw, systemd
"
}
function usage_interactive() {
local UNDERLINE="\e[4m"
local END="\e[0m"
echo -e "$DESCRIPTION"
echo -e "Interactive mode menu options:
${UNDERLINE}Install${END} Run the installation process for a blueprint.
${UNDERLINE}List blueprints${END} Display a list of all blueprints.
${UNDERLINE}List instances${END} Display a list of all created instances with a detailed
description.
${UNDERLINE}Start${END} Start up an instance.
${UNDERLINE}Stop${END} Stop a running instance.
${UNDERLINE}Restart${END} Restart an instance.
${UNDERLINE}Status${END} Print a detailed information about an instance.
${UNDERLINE}Modify${END} Modify and existing instance to add or remove
features.
Currently 'ufw' and 'systemd' integrations can
be added/removed.
${UNDERLINE}Check for update${END} Check if a new version of a instance is available.
It will print out the new version if found, otherwise
it will fail with exit code 1.
${UNDERLINE}Update${END} Runs a check for a new instance version, creates a
backup of the current installation if any, downloads the new
version and deploys it.
${UNDERLINE}Logs${END} Print out the last 10 lines of the latest instance
log file.
${UNDERLINE}Create backup${END} Creates a backup of an instance.
${UNDERLINE}Restore backup${END} Restores a backup of an instance
It will prompt to select a backup to restore and
also if the current installation directory of the
instance is not empty.
${UNDERLINE}Uninstall${END} Runs the uninstall process for an instance.
Warning: This will remove everything other than the
blueprint file the instance is based on.
${UNDERLINE}Help${END} Prints this message
"
}
if [[ "$KGSM_RUN_UPDATE_CHECK" -eq 1 ]]; then
check_for_update
fi
while [[ "$#" -gt 0 ]]; do
case $1 in
-h | --help)
shift
[[ -z "$1" ]] && usage && exit 0
case "$1" in
--interactive)
usage_interactive && exit 0
;;
*)
__print_error "Invalid argument $1" && exit "$EC_INVALID_ARG"
;;
esac
;;
--check-update)
check_for_update; exit $?
;;
--update)
update_script; exit $?
;;
*)
break
;;
esac
shift
done
module_blueprints=$(__load_module blueprints.sh)
module_directories=$(__load_module directories.sh)
module_files=$(__load_module files.sh)
module_version=$(__load_module version.sh)
module_download=$(__load_module download.sh)
module_deploy=$(__load_module deploy.sh)
module_update=$(__load_module update.sh)
module_backup=$(__load_module backup.sh)
module_instance=$(__load_module instances.sh)
function _install() {
local blueprint=$1
local install_dir=$2
# Value of 0 means get latest
local version=$3
local identifier=${4:-}
if [[ "$blueprint" != *.bp ]]; then
blueprint="${blueprint}.bp"
fi
local instance
# The user can pass an instance identifier instead of having KGSM generate
# one, for ease of use or easy identification. However it's not mandatory,
# if the user doen't pass one, the $module_instance will generate one
# and use it without any issues.
if [[ -z "$identifier" ]]; then
instance="$("$module_instance" --create "$blueprint" --install-dir "$install_dir")"
else
instance="$("$module_instance" --create "$blueprint" --install-dir "$install_dir" --id "$identifier")"
fi
__emit_instance_installation_started "${instance%.ini}" "${blueprint}"
"$module_directories" -i "$instance" --create $debug || return $?
"$module_files" -i "$instance" --create $debug || return $?
if [[ "$version" == 0 ]]; then
version=$("$module_version" -i "$instance" --latest)
fi
"$module_download" -i "$instance" -v "$version" $debug || return $?
"$module_deploy" -i "$instance" $debug || return $?
"$module_version" -i "$instance" --save "$version" $debug || return $?
__emit_instance_installation_finished "${instance%.ini}" "${blueprint}"
__print_success "Instance $instance has been created in $install_dir"
__emit_instance_installed "${instance%.ini}" "${blueprint}"
return 0
}
function _uninstall() {
local instance=$1
if [[ "$instance" != *.ini ]]; then
instance="${instance}.ini"
fi
__emit_instance_uninstall_started "${instance%.ini}"
"$module_directories" -i "$instance" --remove $debug || return $?
"$module_files" -i "$instance" --remove $debug || return $?
"$module_instance" --remove "$instance" $debug || return $?
__emit_instance_uninstall_finished "${instance%.ini}"
__print_success "Instance ${instance%.ini} uninstalled"
__emit_instance_uninstalled "${instance%.ini}"
return 0
}
function _interactive() {
echo "$DESCRIPTION
KGSM also accepts named arguments for automation, to see all options run:
${0##*/} --help
Press CTRL+C to exit at any time.
KGSM - Interactive menu
"
PS3="Choose an action: "
local action=
local blueprint_or_instance=
declare -a menu_options=(
"Install"
"List blueprints"
"List instances"
"Start"
"Stop"
"Restart"
"Status"
"Modify"
"Check for update"
"Update"
"Logs"
"Create backup"
"Restore backup"
"Uninstall"
"Help"
)
declare -A arg_map=(
["Install"]=--install
["List blueprints"]=--blueprints
["List instances"]=--instances
["Start"]=--start
["Stop"]=--stop
["Restart"]=--restart
["Status"]=--status
["Modify"]=--modify
["Check for update"]=--check-update
["Update"]=--update
["Logs"]=--logs
["Create backup"]=--create-backup
["Restore backup"]=--restore-backup
["Uninstall"]=--uninstall
["Help"]=--help
)
# Select action first
select opt in "${menu_options[@]}"; do
if [[ -z $opt ]]; then
echo "Didn't understand \"$REPLY\" " >&2
REPLY=
else
action="${arg_map[$opt]}"
break
fi
done
# Depending on the action, load up a list of all blueprints or all instances
declare -a blueprints_or_instances=()
PS3="Choose an instance: "
case "$action" in
--install)
# shellcheck disable=SC2178
# shellcheck disable=SC2207
blueprints_or_instances=($("$module_blueprints" --list | tr '\n' ' '))
PS3="Choose a blueprint: "
;;
--blueprints)
exec $0 --blueprints
;;
--instances)
exec $0 --instances
;;
--help)
exec $0 --help --interactive
;;
--status)
# shellcheck disable=SC2207
# shellcheck disable=SC2178
blueprints_or_instances=($("$module_instance" --list))
;;
*)
# shellcheck disable=SC2207
# shellcheck disable=SC2178
blueprints_or_instances=($("$module_instance" --list))
"$module_instance" --list --detailed
;;
esac
[[ "${#blueprints_or_instances[@]}" -eq 0 ]] && __print_warning "No instances found" && return 0
# Select blueprint/instance for the action
select bp in "${blueprints_or_instances[@]}"; do
if [[ -z $bp ]]; then
echo "Didn't understand \"$REPLY\" " >&2
REPLY=
else
blueprint_or_instance="$bp"
break
fi
done
# Recursivelly call the script with the given params.
# --install has a different arg order
case "$action" in
--install)
install_directory=${INSTANCE_DEFAULT_INSTALL_DIR:-}
if [ -z "$install_directory" ]; then
echo "INSTANCE_DEFAULT_INSTALL_DIR is not set in the configuration file, please specify an installation directory" >&2
read -r -p "Installation directory: " install_directory && [[ -n $install_directory ]] || exit "$EC_INVALID_ARG"
fi
read -r -p "Version to install (leave empty for latest): " version
read -r -p "Instance identifier (leave empty for default): " identifier
echo "Creating an instance of $blueprint_or_instance..." >&2
# shellcheck disable=SC2086
"$0" \
$action $blueprint_or_instance \
--install-dir $install_directory \
${version:+--version "$version"} \
${identifier:+--id "$identifier"} \
$debug
;;
--uninstall)
"$0" --uninstall "$blueprint_or_instance"
;;
--restore-backup)
# shellcheck disable=SC2207
backups_array=($("$module_backup" -i "$blueprint_or_instance" --list))
[[ "${#backups_array[@]}" -eq 0 ]] && echo "No backups found. Exiting." >&2 && return "$EC_GENERAL"
PS3="Choose a backup to restore: "
select backup in "${backups_array[@]}"; do
if [[ -z $backup ]]; then
echo "Didn't understand \"$REPLY\" " >&2
REPLY=
else
backup_to_restore="$backup"
break
fi
done
# shellcheck disable=SC2086
"$0" --instance $blueprint_or_instance $action $backup_to_restore $debug
;;
--modify)
declare -a modify_options=()
declare -A modify_arg_map=(
["Add systemd"]="--add systemd"
["Remove systemd"]="--remove systemd"
["Add ufw"]="--add ufw"
["Remove ufw"]="--remove ufw"
)
local mod_action
local instance_config_file
instance_config_file=$(__load_instance "$blueprint_or_instance")
if grep -q "INSTANCE_SYSTEMD_SERVICE_FILE=" <"$instance_config_file"; then
modify_options+=("Remove systemd")
else
modify_options+=("Add systemd")
fi
if grep -q "INSTANCE_UFW_FILE=" <"$instance_config_file"; then
modify_options+=("Remove ufw")
else
modify_options+=("Add ufw")
fi
select mod_arg in "${modify_options[@]}"; do
if [[ -z "$mod_arg" ]]; then
echo "Didn't understand \"$REPLY\"" >&2
REPLY=
else
mod_action="${modify_arg_map[$mod_arg]}"
break
fi
done
# shellcheck disable=SC2086
"$0" --instance "$blueprint_or_instance" --modify $mod_action
;;
*)
# shellcheck disable=SC2086
$0 --instance $blueprint_or_instance $action $debug
;;
esac
}
# If it's started with no args, default to interactive mode
[[ "$#" -eq 0 ]] && _interactive && exit $?
# shellcheck disable=SC2199
if [[ $@ =~ "--json" ]]; then
json_format=1
for a; do
shift
case $a in
--json) continue ;;
*) set -- "$@" "$a" ;;
esac
done
fi
while [[ "$#" -gt 0 ]]; do
case $1 in
--create-blueprint)
shift
[[ -z "$1" ]] && __print_error "Missing arguments" && exit "$EC_MISSING_ARG"
case "$1" in
-h | --help) "$module_blueprints" --help $debug; exit $? ;;
*)
# shellcheck disable=SC2068
"$module_blueprints" --create $@ $debug; exit $?
;;
esac
;;
--install)
shift
[[ -z "$1" ]] && __print_error "Missing argument <blueprint>" && exit "$EC_MISSING_ARG"
bp_to_install="$1"
bp_install_dir=$INSTANCE_DEFAULT_INSTALL_DIR
bp_install_version=0
bp_id=
shift
if [ -n "$1" ]; then
while [[ $# -ne 0 ]]; do
case "$1" in
--install-dir)
shift
[[ -z "$1" ]] && __print_error "Missing argument <install_dir>" && exit "$EC_MISSING_ARG"
bp_install_dir="$1"
;;
--version)
shift
[[ -z "$1" ]] && __print_error "Missing argument <version>" && exit "$EC_MISSING_ARG"
bp_install_version=$1
;;
--id)
shift
[[ -z "$1" ]] && __print_error "Missing argument <id>" && exit "$EC_MISSING_ARG"
bp_id=$1
;;
*)
__print_error "Invalid argument $1" && exit "$EC_INVALID_ARG"
;;
esac
shift
done
fi
[[ -z "$bp_install_dir" ]] && __print_error "Missing argument <dir>" && exit "$EC_MISSING_ARG"
_install "$bp_to_install" "$bp_install_dir" $bp_install_version $bp_id; exit $?
;;
--uninstall)
shift
[[ -z "$1" ]] && __print_error "Missing argument <instance>" && exit "$EC_MISSING_ARG"
_uninstall "$1"; exit $?
;;
--blueprints)
shift
if [[ -z "$1" ]]; then
"$module_blueprints" --list $debug; exit $?
else
while [[ $# -ne 0 ]]; do
case "$1" in
--detailed)
detailed=1
;;
--json)
json_format=1
;;
*)
__print_error "Invalid argument $1" && exit "$EC_INVALID_ARG"
;;
esac
shift
done
"$module_blueprints" --list ${detailed:+--detailed} ${json_format:+--json} $debug; exit $?
fi
;;
--ip)
if command -v wget >/dev/null 2>&1; then
wget -qO- https://icanhazip.com; exit $?
else
__print_error "wget is required but not installed" && exit "$EC_MISSING_DEPENDENCY"
fi
;;
--update)
update_script "$@"; exit $?
;;
--update-config)
__merge_user_config_with_default; exit $?
;;
--instances)
shift
if [[ -z "$1" ]]; then
"$module_instance" --list $debug; exit $?
else
while [[ $# -ne 0 ]]; do
case "$1" in
--detailed)
detailed=1
;;
--json)
json_format=1
;;
*)
blueprint=$1
;;
esac
shift
done
"$module_instance" --list ${detailed:+--detailed} ${json_format:+--json} $blueprint $debug; exit $?
fi
;;
-i | --instance)
shift
[[ -z "$1" ]] && __print_error "Missing argument <instance>" && exit "$EC_MISSING_ARG"
instance=$1
shift
[[ -z "$1" ]] && __print_error "Missing argument [OPTION]" && exit "$EC_MISSING_ARG"
case "$1" in
--logs)
"$module_instance" --logs "$instance" $debug; exit $?
;;
--status)
"$module_instance" --status "$instance" $debug; exit $?
;;
--info)
"$module_instance" --info "$instance" ${json_format:+--json} $debug; exit $?
;;
--is-active)
"$module_instance" --is-active "$instance" $debug; exit $?
;;
--start)
"$module_instance" --start "$instance" $debug; exit $?
;;
--stop)
"$module_instance" --stop "$instance" $debug; exit $?
;;
--restart)
"$module_instance" --restart "$instance" $debug; exit $?
;;
--save)
"$module_instance" --save "$instance" $debug; exit $?
;;
--input)
shift
[[ -z "$1" ]] && __print_error "Missing argument <command>" && exit "$EC_MISSING_ARG"
"$module_instance" --input "$instance" "$1" $debug; exit $?
;;
-v | --version)
shift
if [[ -z "$1" ]]; then "$module_version" -i "$instance" --installed $debug; exit $?; fi
case "$1" in
--installed) "$module_version" -i "$instance" --installed $debug; exit $? ;;
--latest) "$module_version" -i "$instance" --latest $debug; exit $? ;;
*) __print_error "Invalid argument $1" && exit "$EC_INVALID_ARG" ;;
esac
;;
--check-update)
case "$1" in
-h | --help) "$module_version" --help; exit $? ;;
*) "$module_version" -i "$instance" --compare $debug; exit $? ;;
esac
;;
--update)
case "$1" in
-h | --help) "$module_update" --help; exit $? ;;
*) "$module_update" -i "$instance" $debug; exit $? ;;
esac
;;
--backups)
"$module_backup" -i "$instance" --list $debug; exit $? ;;
--create-backup)
case "$1" in
-h | --help) "$module_backup" --help; exit $? ;;
*) "$module_backup" -i "$instance" --create $debug; exit $? ;;
esac
;;
--restore-backup)
[[ -z "$1" ]] && __print_error "Missing argument <backup>" && exit "$EC_MISSING_ARG"
shift
case "$1" in
-h | --help)
"$module_backup" --help; exit $?
;;
*)
"$module_backup" -i "$instance" --restore "$1" $debug; exit $?
;;
esac
;;
--modify)
shift
[[ -z "$1" ]] && __print_error "Missing argument <option>" && exit "$EC_MISSING_ARG"
case "$1" in
--add)
shift
[[ -z "$1" ]] && __print_error "Missing argument <option>" && exit "$EC_MISSING_ARG"
case "$1" in
ufw)
"$module_files" -i "$instance" --create --ufw $debug; exit $?
;;
systemd)
"$module_files" -i "$instance" --create --systemd $debug; exit $?
;;
*)
__print_error "Invalid argument $1"; exit "$EC_INVALID_ARG"
;;
esac
;;
--remove)
shift
[[ -z "$1" ]] && __print_error "Missing argument <option>" && exit "$EC_MISSING_ARG"
case "$1" in
ufw)
"$module_files" -i "$instance" --remove --ufw $debug; exit $?
;;
systemd)
"$module_files" -i "$instance" --remove --systemd $debug; exit $?
;;
*)
__print_error "Invalid argument $1" && exit "$EC_INVALID_ARG"
;;
esac
;;
*)
__print_error "Invalid argument $1" && exit "$EC_INVALID_ARG"
;;
esac
;;
*)
__print_error "Invalid argument $1" && exit "$EC_INVALID_ARG"
;;
esac
;;
-v | --version)
echo "KGSM, version $(get_version)
Copyright (C) 2024 TheKrystalShip
License GPL-3.0: GNU GPL version 3 <https://www.gnu.org/licenses/gpl-3.0.en.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law." && exit 0
;;
*)
__print_error "Invalid argument $1" && exit "$EC_INVALID_ARG"
;;
esac
shift
done
exit 0