]> git.xonotic.org Git - xonotic/netradiant.git/blob - gamepack-manager
gamepacks: update gamelist
[xonotic/netradiant.git] / gamepack-manager
1 #! /usr/bin/env bash
2
3 # get usage help this way:
4 # ./gamepack_manager -h
5
6 : "${CP:=cp -va}"
7 : "${CP_R:=cp -Rva}"
8 : "${GIT:=git}"
9 : "${SVN:=svn}"
10 : "${WGET:=wget}"
11 : "${ECHO:=echo}"
12 : "${MKDIR:=mkdir -v}"
13 : "${MKDIR_P:=mkdir -vp}"
14 : "${RM_R:=rm -vrf}"
15 : "${MV:=mv -v}"
16 : "${TAR:=tar}"
17 : "${UNZIPPER:=unzip}"
18
19 set -e
20
21 default_download_dir='build/download'
22 default_install_dir='build'
23
24 games_dir='games'
25 pack_suffix='Pack'
26
27 free_license_list='BSD GPL'
28
29 printRawDB () {
30 cat <<\EOF
31 #######################################################
32 #                                                     #
33 #  IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT  #
34 #                                                     #
35 #   Use two whitespaces or more as column separator   #
36 #                                                     #
37 #######################################################
38
39 #######################################################
40 # Obsolete packs                                      #
41 #######################################################
42
43 # Quake2World was renamed as Quetoo.
44 # JediAcademy and JediOutcast gamepacks are unusable.
45 # Other gamepacks have better version available.
46
47 # JediAcademy   no   proprietary  svn     svn://svn.icculus.org/gtkradiant-gamepacks/JAPack/branches/1.5/
48 # JediOutcast   no   proprietary  svn     svn://svn.icculus.org/gtkradiant-gamepacks/JK2Pack/trunk/
49 # Kingpin       no   unknown      zip     http://download.kingpin.info/kingpin/editing/maps/map_editors/NetRadiant/addon/Kingpinpack.zip
50 # Neverball     no   proprietary  zip     http://ingar.intranifty.net/files/netradiant/gamepacks/NeverballPack.zip
51 # OpenArena     no   unknown      zip     http://ingar.intranifty.net/files/netradiant/gamepacks/OpenArenaPack.zip
52 # Quake2World   no   GPL          svn     svn://jdolan.dyndns.org/quake2world/trunk/gtkradiant
53 # Quake3        no   proprietary  svn     svn://svn.icculus.org/gtkradiant-gamepacks/Q3Pack/trunk/ 29
54 # Quake         no   proprietary  zip     http://ingar.intranifty.net/files/netradiant/gamepacks/QuakePack.zip
55 # Tremulous     no   proprietary  svn     svn://svn.icculus.org/gtkradiant-gamepacks/TremulousPack/branches/1.5/
56 # Tremulous     no   proprietary  zip     http://ingar.intranifty.net/files/netradiant/gamepacks/TremulousPack.zip
57 # Unvanquished  no   unknown      zip     http://ingar.intranifty.net/gtkradiant/files/gamepacks/UnvanquishedPack.zip
58 # Warfork       no   GPL          zip     https://cdn.discordapp.com/attachments/611741789237411850/659512520553267201/netradiant_warfork_gamepack.zip
59 # Warsow        no   GPL          svn     https://svn.bountysource.com/wswpack/trunk/netradiant/games/WarsowPack/
60 # Warsow        no   GPL          zip     http://ingar.intranifty.net/files/netradiant/gamepacks/WarsowPack.zip
61
62 #######################################################
63 # Usable packs                                        #
64 #######################################################
65
66 AlienArena      yes  GPL          svn     https://svn.code.sf.net/p/alienarena-cc/code/trunk/tools/netradiant_gamepack/AlienArenaPack
67 DarkPlaces      yes  GPL          svn     svn://svn.icculus.org/gtkradiant-gamepacks/DarkPlacesPack/branches/1.5/
68 Doom3           yes  proprietary  svn     svn://svn.icculus.org/gtkradiant-gamepacks/Doom3Pack/branches/1.5/
69 ET              yes  proprietary  svn     svn://svn.icculus.org/gtkradiant-gamepacks/ETPack/branches/1.5/
70 Heretic2        yes  proprietary  svn     svn://svn.icculus.org/gtkradiant-gamepacks/Her2Pack/branches/1.5/
71 JediAcademy     yes  proprietary  git     https://gitlab.com/netradiant/gamepacks/jediacademy-mapeditor-support.git
72 JediOutcast     yes  proprietary  git     https://gitlab.com/netradiant/gamepacks/jedioutcast-mapeditor-support.git
73 Kingpin         yes  unknown      git     https://gitlab.com/netradiant/gamepacks/kingpin-mapeditor-support.git
74 Neverball       yes  proprietary  git     https://gitlab.com/netradiant/gamepacks/neverball-mapeditor-support.git
75 Nexuiz          yes  GPL          gitdir  git://git.icculus.org/divverent/nexuiz.git misc/netradiant-NexuizPack master
76 OpenArena       yes  GPL          git     https://github.com/NeonKnightOA/oagamepack.git
77 Osirion         yes  GPL          zip     http://ingar.intranifty.net/files/netradiant/gamepacks/OsirionPack.zip
78 Prey            yes  proprietary  git     https://gitlab.com/netradiant/gamepacks/prey-mapeditor-support.git
79 Q3Rally         yes  proprietary  svn     https://svn.code.sf.net/p/q3rallysa/code/tools/radiant-config/radiant15-netradiant/
80 Quake2          yes  proprietary  svn     svn://svn.icculus.org/gtkradiant-gamepacks/Q2Pack/branches/1.5/
81 Quake3          yes  proprietary  git     https://gitlab.com/netradiant/gamepacks/quake3-mapeditor-support.git
82 Quake4          yes  proprietary  svn     svn://svn.icculus.org/gtkradiant-gamepacks/Q4Pack/branches/1.5/
83 QuakeLive       yes  proprietary  git     https://gitlab.com/netradiant/gamepacks/quakelive-mapeditor-support.git
84 Quake           yes  GPL          zip     http://ingar.intranifty.net/files/netradiant/gamepacks/Quake1Pack.zip
85 Quetoo          yes  GPL          svn     svn://svn.icculus.org/gtkradiant-gamepacks/QuetooPack/branches/1.5/
86 SmokinGuns      yes  unknown      git     https://github.com/smokin-guns/smokinguns-mapeditor-support.git
87 SoF2            yes  unknown      git     https://gitlab.com/netradiant/gamepacks/sof2-mapeditor-support.git
88 STVEF           yes  unknown      git     https://gitlab.com/netradiant/gamepacks/stvef-mapeditor-support.git
89 Tremulous       yes  proprietary  git     https://gitlab.com/netradiant/gamepacks/tremulous-mapeditor-support.git
90 TurtleArena     yes  proprietary  git     https://github.com/Turtle-Arena/turtle-arena-radiant-pack.git
91 UFOAI           yes  proprietary  svn     svn://svn.icculus.org/gtkradiant-gamepacks/UFOAIPack/branches/1.5/
92 Unvanquished    yes  BSD          git     https://github.com/Unvanquished/unvanquished-mapeditor-support.git
93 UrbanTerror     yes  unknown      git     https://gitlab.com/netradiant/gamepacks/urbanterror-mapeditor-support.git
94 Warfork         yes  GPL          git     https://gitlab.com/netradiant/gamepacks/warfork-mapeditor-support.git
95 Warsow          yes  GPL          git     https://github.com/Warsow/NetRadiantPack.git
96 Wolf            yes  proprietary  svn     svn://svn.icculus.org/gtkradiant-gamepacks/WolfPack/branches/1.5/
97 WoP             yes  proprietary  git     https://github.com/PadWorld-Entertainment/wop-mapeditor-support.git
98 Wrath           yes  GPL          git     https://gitlab.com/netradiant/gamepacks/wrath-mapeditor-support.git
99 Xonotic         yes  GPL          git     https://gitlab.com/xonotic/netradiant-xonoticpack.git
100 ZEQ2Lite        yes  unknown      git     https://gitlab.com/netradiant/gamepacks/zeq2lite-mapeditor-support.git
101 EOF
102 }
103
104 if command -v gsed >/dev/null
105 then
106         SED=gsed
107 elif sed --help >/dev/null 2>&1
108 then
109         SED=sed
110 else
111         printf 'ERROR: GNU sed is missing\n' >&2
112         exit 1
113 fi
114
115 printRealPath ()
116 {
117         if command -v grealpath >/dev/null
118         then
119                 grealpath "${1}"
120         elif command -v realpath >/dev/null
121         then
122                 realpath "${1}"
123         elif command -v greadlink >/dev/null
124         then
125                 # test greadlink first as greadlink has the feature on macos
126                 # but readlink only has it on linux, note that it's probably
127                 # the same on bsd
128                 # note: (g)readlink requires the file to be create first
129                 greadlink -f "${1}"
130         elif command -v readlink >/dev/null
131         then
132                 # --help and -f options are GNU readlink things
133                 if readlink --help >/dev/null 2>&1
134                 then
135                         readlink -f "${1}"
136                 else
137                         if ! python -c "import os; print(os.path.realpath('${1}'))"
138                         then
139                                 printf 'ERROR: GNU realpath or other way to compute real path of a file is missing\n' >&2
140                                 exit 1
141                         fi
142                 fi
143         fi
144 }
145
146 sanitizeDB () {
147         ${SED} -e 's/#.*//;s/[ \t][ \t][ \t]*/\t/g;s/^[ \t]*//;s/[ \t]*$//' \
148         | grep -v '^$'
149 }
150
151 inList () {
152         [ "$(grep "^${1}$")" = "${1}" ]
153 }
154
155 printList () {
156         echo "${1}" \
157         | tr ' ' '\n' \
158         | grep -v '^$' \
159         | sort -u
160 }
161
162 dedupeList () {
163         printList "${1}" \
164         | tr '\n' ' ' \
165         | ${SED} -e 's/ $//'
166 }
167
168 printGamePackDB () {
169         printRawDB \
170         | sanitizeDB
171 }
172
173 printLicenseList () {
174         printGamePackDB \
175         | awk '{ print $3 }' \
176         | sort -u
177 }
178
179 printNameList () {
180         printGamePackDB \
181         | awk '{ print $1 }' \
182         | sort -u
183 }
184
185 printNameListByLicense () {
186         local arg_license_list
187         local license_list
188         local license
189
190         arg_license_list="${1}"
191         license_list=''
192
193         for license in ${arg_license_list}
194         do
195                 case "${license}" in
196                         'none')
197                                 break
198                                 ;;
199                         'all')
200                                 license_list="$(printLicenseList)"
201                                 break
202                                 ;;
203                         'free')
204                                 license_list="${license_list} ${free_license_list}"
205                                 ;;
206                         *)
207                                 if printLicenseList | inList "${license}"
208                                 then
209                                         license_list="${license_list} ${license}"
210                                 else
211                                         printError "unknown license: ${license}"
212                                 fi
213                                 ;;
214                 esac
215         done
216
217         license_list="$(dedupeList "${license_list}")"
218
219         for license in ${license_list}
220         do
221                 printGamePackDB \
222                 | awk '$3 == "'"${license}"'"' \
223                 | awk '{ print $1 }'
224         done | sort -u
225 }
226
227 printNameListByName () {
228         local argname_list
229         local name_list
230         local name
231
232         argname_list="${1}"
233         name_list=''
234
235         for name in ${argname_list}
236         do
237                 case "${name}" in
238                         'none')
239                                 break
240                                 ;;
241                         'all')
242                                 name_list="$(printNameList)"
243                                 break
244                                 ;;
245                         'validated')
246                                 name_list="${name_list} validated"
247                                 ;;
248                         *)
249                                 if printNameList | inList "${name}"
250                                 then
251                                         name_list="${name_list} ${name}"
252                                 else
253                                         printError "unknown name: ${name}"
254                                 fi
255                                 ;;
256                 esac
257         done
258
259         name_list="$(dedupeList "${name_list}")"
260
261         for name in ${name_list}
262         do
263                 if [ "${name}" = 'validated' ]
264                 then
265                         printGamePackDB \
266                         | awk '$2 == "yes"' \
267                         | awk '{ print $1 }'
268                 fi
269
270                 printGamePackDB \
271                 | awk '$1 == "'"${name}"'"' \
272                 | awk '{ print $1 }'
273         done
274 }
275
276 printPackLine () {
277         local name
278
279         name="${1}"
280
281         printGamePackDB \
282         | awk '$1 == "'"${name}"'"'
283 }
284
285 getValue () {
286         local name
287         local key
288
289         name="${1}"
290         key="${2}"
291
292         printPackLine "${name}" \
293         | awk '{ print $'"${key}"' }'
294 }
295
296 downloadExtraUrls ()
297 {
298         if [ -f 'extra-urls.txt' ]
299         then
300                 local line
301                 while read line
302                 do
303                         local extra_file="$(echo "${line}" | cut -f1 -d$'\t')"
304                         local extra_url="$(echo "${line}" | cut -f2 -d$'\t')"
305                         ${WGET} -O "${extra_file}" "${extra_url}" < /dev/null
306                 done < 'extra-urls.txt'
307         fi
308 }
309
310 downloadPack () {
311         local download_dir
312         local name
313         local license
314         local source_type
315         local source_url
316         local pack
317         local reference
318         local subdir
319         local branch
320
321         download_dir="${1}"
322         name="${2}"
323
324         validation="$(getValue "${name}" 2)"
325         license="$(getValue "${name}" 3)"
326         source_type="$(getValue "${name}" 4)"
327         source_url="$(getValue "${name}" 5)"
328
329         pack="${name}${pack_suffix}"
330
331         ${MKDIR_P} "${download_dir}"
332
333         (
334                 cd "${download_dir}"
335
336                 ${ECHO} ''
337                 ${ECHO} "Available pack: ${pack}"
338                 ${ECHO} "  License: ${license}"
339                 ${ECHO} "  Download via ${source_type} from ${source_url}"
340                 ${ECHO} ''
341
342                 if [ -d "${download_dir}/${pack}" ]
343                 then
344                         ${ECHO} "Updating ${name}…"
345                 else
346                         ${ECHO} "Downloading ${pack}…"
347                 fi
348
349                 case "${source_type}" in
350                         'svn')
351                                 reference="$(getValue "${name}" 6)"
352                                 if [ -z "${reference}" ]
353                                 then
354                                         reference='HEAD'
355                                 fi
356
357                                 if [ -d "${pack}" ]
358                                 then
359                                         if [ -d "${pack}/.git" ]
360                                         then
361                                                 (
362                                                         cd "${pack}"
363                                                         ${GIT} svn fetch
364                                                 )
365                                         else
366                                                 ${SVN} update -r"${reference}" "${pack}"
367                                         fi
368                                 else
369                                         ${SVN} checkout -r"${reference}" "${source_url}" "${pack}" \
370                                         || ${GIT} svn clone "${source_url}" "${pack}"
371                                 fi
372                                 ;;
373                         'zip')
374                                 ${RM_R} 'zipdownload'
375                                 ${MKDIR} 'zipdownload'
376                                 (
377                                         cd 'zipdownload'
378                                         ${WGET} "${source_url}"
379                                         ${UNZIPPER} './'*.zip
380                                 )
381                                 ${RM_R} "${pack}"
382                                 ${MKDIR} "${pack}"
383                                 if [ -d 'zipdownload/games' ]
384                                 then
385                                         ${MV} 'zipdownload/'* "${pack}/"
386                                 else
387                                         ${MV} 'zipdownload/'*'/'* "${pack}/"
388                                 fi
389                                 ${RM_R} 'zipdownload'
390                                 ;;
391                         'gitdir')
392                                 local subdir="$(getValue "${name}" 6)"
393                                 local branch="$(getValue "${name}" 7)"
394                                 ${RM_R} "${pack}"
395                                 ${GIT} archive --remote="${source_url}" --prefix="${pack}/" "${branch}":"${subdir}" \
396                                 | ${TAR} xvf -
397                                 ;;
398                         'git')
399                                 if [ -d "${pack}" ]
400                                 then
401                                         (
402                                                 cd "${pack}"
403                                                 ${GIT} pull
404                                         )
405                                 else
406                                         ${GIT} clone "${source_url}" "${pack}"
407                                 fi
408                                 ;;
409                 esac
410
411                 if [ -d "${pack}" ]
412                 then
413                         (
414                                 cd "${pack}"
415                                 downloadExtraUrls
416                         )
417                 fi
418
419         )
420 }
421
422 downloadPackList () {
423         local download_dir
424         local name_list
425
426         download_dir="${1}"
427         name_list="${2}"
428
429         for name in ${name_list}
430         do
431                 if printNameList | inList "${name}"
432                 then
433                         downloadPack "${download_dir}" "${name}"
434                 else
435                         printError "unknown name: ${name}"
436                 fi
437         done
438 }
439
440 installPack () {
441         local download_dir
442         local install_dir
443         local name
444         local pack
445         local path
446         local game_file
447         local game_dir
448
449         download_dir="${1}"
450         install_dir="${2}"
451         name="${3}"
452
453         pack="${name}${pack_suffix}"
454
455         ${MKDIR_P} "${install_dir}/${games_dir}"
456
457         # Some per-game workaround for malformed gamepack
458         case "${name}" in
459                 'Wolf')
460                         pack="${pack}/bin"
461                         ;;
462         esac
463
464         # Game packs built with mkeditorpacks
465         if [ -d "${download_dir}/${pack}/build/netradiant" ]
466         then
467                 pack="${pack}/build/netradiant"
468         elif [ -d "${download_dir}/${pack}/netradiant" ]
469         # Other known layout
470         then
471                 pack="${pack}/netradiant"
472         fi
473
474         path="${download_dir}/${pack}"
475
476         for game_file in "${path}/${games_dir}/"*'.game'
477         do
478                 if [ x"${game_file}" != x"${path}/"*'.game' ]
479                 then
480                         ${CP} "${game_file}" "${real_install_dir}/${games_dir}/"
481                 fi
482         done
483
484         for game_dir in "${path}/"*'.game'
485         do
486                 if [ x"${game_dir}" != x"${path}/"*'.game' ]
487                 then
488                         ${CP_R} "${game_dir}" "${real_install_dir}/"
489                 fi
490         done
491 }
492
493 installPackList () {
494         local download_dir
495         local install_dir
496         local name_list
497
498         download_dir="${1}"
499         install_dir="${2}"
500         name_list="${3}"
501
502         for name in ${name_list}
503         do
504                 if printNameList | inList "${name}"
505                 then
506                         installPack "${download_dir}" "${install_dir}" "${name}"
507                 else
508                         printError "unknown name: ${name}"
509                 fi
510         done
511 }
512
513 printError () {
514         printf 'ERROR: %s\n' "${1}" >&2
515         exit 1
516 }
517
518 printHelp () {
519         local tab
520         local prog_name
521
522         tab="$(printf '\t')"
523         prog_name='gamepack-manager'
524
525         cat <<-EOF
526         Usage: ${prog_name} [OPTION] [SELECTION <ARGUMENTS>] [ACTION]
527
528         OPTIONS:
529         ${tab}-dd, --download-dir DIRNAME
530         ${tab}${tab}store downloaded games to DIRNAME (default: ${default_download_dir})
531
532         ${tab}-id, --install-dir DIRNAME
533         ${tab}${tab}store installed games to DIRNAME (default: ${default_install_dir})
534
535         SELECTIONS:
536         ${tab}-n, --name NAMES…
537         ${tab}${tab}select games by name (default: none)
538         ${tab}${tab}special keyword: validated, all, none
539         ${tab}${tab}available games:
540         $(printNameList | ${SED} -e 's/^/\t\t\t/')
541
542         ${tab}-l, --license LICENSES…
543         ${tab}${tab}select games by license (default: none)
544         ${tab}${tab}special keyword: free, all, none
545         ${tab}${tab}available licenses:
546         $(printLicenseList | ${SED} -e 's/^/\t\t\t/')
547
548         ACTIONS:
549         ${tab}-ln, --list-names
550         ${tab}${tab}list all game names
551
552         ${tab}-ll, --list-licenses
553         ${tab}${tab}list all game licenses
554
555         ${tab}-ls, --list-selected
556         ${tab}${tab}list selected games
557
558         ${tab}-d, --download
559         ${tab}${tab}download selected games
560
561         ${tab}-i, --install
562         ${tab}${tab}install selected games
563
564         ${tab}-h, --help
565         ${tab}${tab}print this help
566
567         Examples:
568         ${tab}${prog_name} --license GPL BSD --list-selected
569         ${tab}${prog_name} --license GPL BSD --download --install
570
571         ${tab}${prog_name} --name validated --list-selected
572         ${tab}${prog_name} --name validated --download --install
573
574         EOF
575
576         exit
577 }
578
579 option_list=''
580
581 list_selected='false'
582 list_licenses='false'
583 list_names='false'
584
585 download_packs='false'
586 install_packs='false'
587
588 mkdir_download='false'
589 mkdir_install='false'
590
591 by_license='false'
592 by_name='false'
593
594 arg_type=''
595 selected_list=''
596 license_list=''
597 name_list=''
598 install_dir=''
599
600 while ! [ -z "${1}" ]
601 do
602
603         if printList "${option_list}" | inList "${1}"
604         then
605                 printError "option called more than once: ${1}"
606         fi
607
608         if echo "${@}" | tr ' ' '\n' | inList '--help'
609         then
610                 printHelp
611         elif echo "${@}" | tr ' ' '\n' | inList '-h'
612         then
613                 printHelp
614         fi
615
616         case "${1}" in
617                 '--list-names'|'-ln')
618                         arg_type=''
619                         list_names='true'
620                         option_list="${option_list} ${1}"
621                         ;;
622                 '--list-licenses'|'-ll')
623                         arg_type=''
624                         list_licenses='true'
625                         option_list="${option_list} ${1}"
626                         ;;
627                 '--list-selected'|'-ls')
628                         arg_type=''
629                         list_selected='true'
630                         option_list="${option_list} ${1}"
631                         ;;
632                 '--download'|'-d')
633                         arg_type=''
634                         download_packs='true'
635                         mkdir_download='true'
636                         option_list="${option_list} ${1}"
637                         ;;
638                 '--install'|'-i')
639                         arg_type=''
640                         install_packs='true'
641                         mkdir_download='true'
642                         mkdir_install='true'
643                         option_list="${option_list} ${1}"
644                         ;;
645                 '--license'|'-l')
646                         by_license='true'
647                         arg_type='pack-license'
648                         option_list="${option_list} ${1}"
649                         ;;
650                 '--name'|'-n')
651                         by_name='true'
652                         arg_type='pack-name'
653                         option_list="${option_list} ${1}"
654                         ;;
655                 '--download-dir'|'-dd')
656                         arg_type='download-dir'
657                         option_list="${option_list} ${1}"
658                         ;;
659                 '--install-dir'|'-id')
660                         arg_type='install-dir'
661                         option_list="${option_list} ${1}"
662                         ;;
663                 '-'*)
664                         printError "unknown option: ${1}"
665                         ;;
666                 *)
667                         case "${arg_type}" in
668                                 'pack-name')
669                                         name_list="${name_list} ${1}"
670                                         ;;
671                                 'pack-license')
672                                         license_list="${license_list} ${1}"
673                                         ;;
674                                 'download-dir')
675                                         if [ -z "${download_dir}" ]
676                                         then
677                                                 download_dir="${1}"
678                                         else
679                                                 printError "more than one download dir: ${1}"
680                                         fi
681                                         ;;
682                                 'install-dir')
683                                         if [ -z "${install_dir}" ]
684                                         then
685                                                 install_dir="${1}"
686                                         else
687                                                 printError "more than one install dir: ${1}"
688                                         fi
689                                         ;;
690                                 *)
691                                         printError "misplaced argument: ${1}"
692                                         ;;
693                         esac
694                         ;;
695         esac
696
697         shift
698 done
699
700 # compatibility with legacy Makefile
701 if [ "${DOWNLOAD_GAMEPACKS}" = 'yes' ]
702 then
703         if ! [ -z "${DOWNLOADDIR}" ]
704         then
705                 download_dir="${DOWNLOADDIR}"
706         fi
707
708         if ! [ -z "${INSTALLDIR}" ]
709         then
710                 install_dir="${INSTALLDIR}"
711         fi
712
713         license_list='free'
714         by_license='true'
715
716         download_packs='true'
717         mkdir_download='true'
718
719         install_packs='true'
720         mkdir_install='true'
721 fi
722
723 if [ -z "${download_dir}" ]
724 then
725         download_dir="${default_download_dir}"
726 fi
727
728 if [ -z "${install_dir}" ]
729 then
730         install_dir="${default_install_dir}"
731 fi
732
733 if "${by_name}"
734 then
735         selected_list="${selected_list} $(printNameListByName "${name_list}")"
736 fi
737
738 if "${by_license}"
739 then
740         selected_list="${selected_list} $(printNameListByLicense "${license_list}")"
741 fi
742
743 selected_list="$(dedupeList "${selected_list}")"
744
745 if "${mkdir_download}"
746 then
747         ${MKDIR_P} "${download_dir}"
748         real_download_dir="$(printRealPath "${download_dir}")"
749 fi
750
751 if "${mkdir_install}"
752 then
753         ${MKDIR_P} "${install_dir}"
754         real_install_dir="$(printRealPath "${install_dir}")"
755 fi
756
757 if "${list_names}"
758 then
759         printNameList
760 fi
761
762 if "${list_licenses}"
763 then
764         printLicenseList
765 fi
766
767 if "${list_selected}"
768 then
769         printList "${selected_list}"
770 fi
771
772 if "${download_packs}"
773 then
774         downloadPackList "${real_download_dir}" "${selected_list}"
775 fi
776
777 if "${install_packs}"
778 then
779         installPackList "${real_download_dir}" "${real_install_dir}" "${selected_list}"
780 fi
781
782 #EOF