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