# get usage help this way:
# ./gamepack_manager -h
-: "${CP:=cp -v}"
-: "${CP_R:=cp -r --preserve=timestamps}"
+: "${CP:=cp -va}"
+: "${CP_R:=cp -Rva}"
: "${GIT:=git}"
: "${SVN:=svn}"
: "${WGET:=wget}"
# Obsolete packs #
#######################################################
-# Quake2World was renamed as Quetoo
-# Other gamepacks have better version available
-
-# OpenArena unknown zip http://ingar.intranifty.net/files/netradiant/gamepacks/OpenArenaPack.zip
-# Quake proprietary zip http://ingar.intranifty.net/files/netradiant/gamepacks/QuakePack.zip
-# Quake2World GPL svn svn://jdolan.dyndns.org/quake2world/trunk/gtkradiant
-# Tremulous proprietary svn svn://svn.icculus.org/gtkradiant-gamepacks/TremulousPack/branches/1.5/
-# Unvanquished unknown zip http://ingar.intranifty.net/gtkradiant/files/gamepacks/UnvanquishedPack.zip
-# Warsow GPL svn https://svn.bountysource.com/wswpack/trunk/netradiant/games/WarsowPack/
-# Warsow GPL zip http://ingar.intranifty.net/files/netradiant/gamepacks/WarsowPack.zip
+# Quake2World was renamed as Quetoo.
+# JediAcademy and JediOutcast gamepacks are unusable.
+# Other gamepacks have better version available.
+
+# JediAcademy proprietary svn svn://svn.icculus.org/gtkradiant-gamepacks/JAPack/branches/1.5/
+# JediOutcast proprietary svn svn://svn.icculus.org/gtkradiant-gamepacks/JK2Pack/trunk/
+# Kingpin unknown zip http://download.kingpin.info/kingpin/editing/maps/map_editors/NetRadiant/addon/Kingpinpack.zip
+# Neverball proprietary zip http://ingar.intranifty.net/files/netradiant/gamepacks/NeverballPack.zip
+# OpenArena unknown zip http://ingar.intranifty.net/files/netradiant/gamepacks/OpenArenaPack.zip
+# Quake2World GPL svn svn://jdolan.dyndns.org/quake2world/trunk/gtkradiant
+# Quake3 proprietary svn svn://svn.icculus.org/gtkradiant-gamepacks/Q3Pack/trunk/ 29
+# Quake proprietary zip http://ingar.intranifty.net/files/netradiant/gamepacks/QuakePack.zip
+# Tremulous proprietary svn svn://svn.icculus.org/gtkradiant-gamepacks/TremulousPack/branches/1.5/
+# Tremulous proprietary zip http://ingar.intranifty.net/files/netradiant/gamepacks/TremulousPack.zip
+# Unvanquished unknown zip http://ingar.intranifty.net/gtkradiant/files/gamepacks/UnvanquishedPack.zip
+# Warfork GPL zip https://cdn.discordapp.com/attachments/611741789237411850/659512520553267201/netradiant_warfork_gamepack.zip
+# Warsow GPL svn https://svn.bountysource.com/wswpack/trunk/netradiant/games/WarsowPack/
+# Warsow GPL zip http://ingar.intranifty.net/files/netradiant/gamepacks/WarsowPack.zip
#######################################################
# Usable packs #
#######################################################
+AlienArena GPL svn https://svn.code.sf.net/p/alienarena-cc/code/trunk/tools/netradiant_gamepack/AlienArenaPack
DarkPlaces GPL svn svn://svn.icculus.org/gtkradiant-gamepacks/DarkPlacesPack/branches/1.5/
Doom3 proprietary svn svn://svn.icculus.org/gtkradiant-gamepacks/Doom3Pack/branches/1.5/
ET proprietary svn svn://svn.icculus.org/gtkradiant-gamepacks/ETPack/branches/1.5/
Heretic2 proprietary svn svn://svn.icculus.org/gtkradiant-gamepacks/Her2Pack/branches/1.5/
-JediAcademy proprietary svn svn://svn.icculus.org/gtkradiant-gamepacks/JAPack/branches/1.5/
-Neverball proprietary zip http://ingar.intranifty.net/files/netradiant/gamepacks/NeverballPack.zip
+JediAcademy proprietary git https://gitlab.com/netradiant/gamepacks/jediacademy-mapeditor-support.git
+JediOutcast proprietary git https://gitlab.com/netradiant/gamepacks/jedioutcast-mapeditor-support.git
+Kingpin unknown git https://gitlab.com/netradiant/gamepacks/kingpin-mapeditor-support.git
+Neverball proprietary git https://gitlab.com/netradiant/gamepacks/neverball-mapeditor-support.git
Nexuiz GPL gitdir git://git.icculus.org/divverent/nexuiz.git misc/netradiant-NexuizPack master
OpenArena GPL git https://github.com/NeonKnightOA/oagamepack.git
Osirion GPL zip http://ingar.intranifty.net/files/netradiant/gamepacks/OsirionPack.zip
-Prey proprietary svn svn://svn.icculus.org/gtkradiant-gamepacks/PreyPack/trunk/
-Q3 proprietary svn svn://svn.icculus.org/gtkradiant-gamepacks/Q3Pack/trunk/ 29
+Prey proprietary git https://gitlab.com/netradiant/gamepacks/prey-mapeditor-support.git
+Q3Rally proprietary svn https://svn.code.sf.net/p/q3rallysa/code/tools/radiant-config/radiant15-netradiant/
Quake2 proprietary svn svn://svn.icculus.org/gtkradiant-gamepacks/Q2Pack/branches/1.5/
+Quake3 proprietary git https://gitlab.com/netradiant/gamepacks/quake3-mapeditor-support.git
Quake4 proprietary svn svn://svn.icculus.org/gtkradiant-gamepacks/Q4Pack/branches/1.5/
+QuakeLive proprietary git https://gitlab.com/netradiant/gamepacks/quakelive-mapeditor-support.git
Quake GPL zip http://ingar.intranifty.net/files/netradiant/gamepacks/Quake1Pack.zip
Quetoo GPL svn svn://svn.icculus.org/gtkradiant-gamepacks/QuetooPack/branches/1.5/
-Tremulous proprietary zip http://ingar.intranifty.net/files/netradiant/gamepacks/TremulousPack.zip
+SmokinGuns unknown git https://github.com/smokin-guns/smokinguns-mapeditor-support.git
+SoF2 unknown git https://gitlab.com/netradiant/gamepacks/sof2-mapeditor-support.git
+STVEF unknown git https://gitlab.com/netradiant/gamepacks/stvef-mapeditor-support.git
+Tremulous proprietary git https://gitlab.com/netradiant/gamepacks/tremulous-mapeditor-support.git
TurtleArena proprietary git https://github.com/Turtle-Arena/turtle-arena-radiant-pack.git
UFOAI proprietary svn svn://svn.icculus.org/gtkradiant-gamepacks/UFOAIPack/branches/1.5/
Unvanquished BSD git https://github.com/Unvanquished/unvanquished-mapeditor-support.git
+UrbanTerror unknown git https://gitlab.com/netradiant/gamepacks/urbanterror-mapeditor-support.git
+Warfork GPL git https://gitlab.com/netradiant/gamepacks/warfork-mapeditor-support.git
Warsow GPL git https://github.com/Warsow/NetRadiantPack.git
Wolf proprietary svn svn://svn.icculus.org/gtkradiant-gamepacks/WolfPack/branches/1.5/
+WoP proprietary git https://github.com/PadWorld-Entertainment/wop-mapeditor-support.git
+Wrath GPL git https://gitlab.com/netradiant/gamepacks/wrath-mapeditor-support.git
Xonotic GPL git https://gitlab.com/xonotic/netradiant-xonoticpack.git
+ZEQ2Lite unknown git https://gitlab.com/netradiant/gamepacks/zeq2lite-mapeditor-support.git
EOF
}
+if command -v gsed >/dev/null
+then
+ SED=gsed
+elif sed --help >/dev/null 2>&1
+then
+ SED=sed
+else
+ printf 'ERROR: GNU sed is missing\n' >&2
+ exit 1
+fi
+
+printRealPath ()
+{
+ if command -v grealpath >/dev/null
+ then
+ grealpath "${1}"
+ elif command -v realpath >/dev/null
+ then
+ realpath "${1}"
+ elif command -v greadlink >/dev/null
+ then
+ # test greadlink first as greadlink has the feature on macos
+ # but readlink only has it on linux, note that it's probably
+ # the same on bsd
+ # note: (g)readlink requires the file to be create first
+ greadlink -f "${1}"
+ elif command -v readlink >/dev/null
+ then
+ # --help and -f options are GNU readlink things
+ if readlink --help >/dev/null 2>&1
+ then
+ readlink -f "${1}"
+ else
+ if ! python -c "import os; print(os.path.realpath('${1}'))"
+ then
+ printf 'ERROR: GNU realpath or other way to compute real path of a file is missing\n' >&2
+ exit 1
+ fi
+ fi
+ fi
+}
+
sanitizeDB () {
- sed -e 's/#.*//;s/[ \t][ \t][ \t]*/\t/g;s/^[ \t]*//;s/[ \t]*$//' \
+ ${SED} -e 's/#.*//;s/[ \t][ \t][ \t]*/\t/g;s/^[ \t]*//;s/[ \t]*$//' \
| grep -v '^$'
}
dedupeList () {
printList "${1}" \
| tr '\n' ' ' \
- | sed -e 's/ $//'
+ | ${SED} -e 's/ $//'
}
printGamePackDB () {
printGamePackDB \
| awk '$2 == "'"${license}"'"' \
| awk '{ print $1 }'
- done
+ done | sort -u
}
printNameListByName () {
break
;;
'all')
- local name_list
name_list="$(printNameList)"
break
;;
*)
if printNameList | inList "${name}"
then
- local name_list
name_list="${name_list} ${name}"
else
printError "unknown name: ${name}"
{
if [ -f 'extra-urls.txt' ]
then
- while IFS=' ' read -r extra_file extra_url
+ local line
+ while read line
do
- (
- ${WGET} -O "${extra_file}" "${extra_url}"
- ) </dev/null
+ local extra_file="$(echo "${line}" | cut -f1 -d$'\t')"
+ local extra_url="$(echo "${line}" | cut -f2 -d$'\t')"
+ ${WGET} -O "${extra_file}" "${extra_url}" < /dev/null
done < 'extra-urls.txt'
fi
}
download_dir="${1}"
name="${2}"
- license="$(getValue "${name}" '2')"
- source_type="$(getValue "${name}" '3')"
- source_url="$(getValue "${name}" '4')"
+ license="$(getValue "${name}" 2)"
+ source_type="$(getValue "${name}" 3)"
+ source_url="$(getValue "${name}" 4)"
pack="${name}${pack_suffix}"
case "${source_type}" in
'svn')
- reference="$(getValue "${name}" '5')"
+ reference="$(getValue "${name}" 5)"
if [ -z "${reference}" ]
then
reference='HEAD'
)
${RM_R} "${pack}"
${MKDIR} "${pack}"
- ${MV} 'zipdownload/'*'/'* "${pack}/"
+ if [ -d 'zipdownload/games' ]
+ then
+ ${MV} 'zipdownload/'* "${pack}/"
+ else
+ ${MV} 'zipdownload/'*'/'* "${pack}/"
+ fi
${RM_R} 'zipdownload'
;;
'gitdir')
- local subdir="$(getValue "${name}" '5')"
- local branch="$(getValue "${name}" '6')"
+ local subdir="$(getValue "${name}" 5)"
+ local branch="$(getValue "${name}" 6)"
${RM_R} "${pack}"
${GIT} archive --remote="${source_url}" --prefix="${pack}/" "${branch}":"${subdir}" \
| ${TAR} xvf -
# Some per-game workaround for malformed gamepack
case "${name}" in
- 'JediAcademy')
- pack="${pack}/Tools"
- ;;
- 'Prey'|'Q3')
- pack="${pack}/tools"
- ;;
'Wolf')
pack="${pack}/bin"
;;
esac
- # mkeditorpacks-based gamepack
+ # Game packs built with mkeditorpacks
if [ -d "${download_dir}/${pack}/build/netradiant" ]
then
pack="${pack}/build/netradiant"
+ elif [ -d "${download_dir}/${pack}/netradiant" ]
+ # Other known layout
+ then
+ pack="${pack}/netradiant"
fi
path="${download_dir}/${pack}"
local prog_name
tab="$(printf '\t')"
- prog_name="$(basename "$(readlink -f "${0}")")"
+ prog_name='gamepack-manager'
cat <<-EOF
Usage: ${prog_name} [OPTION] [SELECTION <ARGUMENTS>] [ACTION]
${tab}${tab}select games by name (default: none)
${tab}${tab}special keyword: all, none
${tab}${tab}available games:
- $(printNameList | sed -e 's/^/\t\t\t/')
+ $(printNameList | ${SED} -e 's/^/\t\t\t/')
${tab}-l, --license LICENSES…
${tab}${tab}select games by license (default: none)
${tab}${tab}special keyword: free, all, none
${tab}${tab}available licenses:
- $(printLicenseList | sed -e 's/^/\t\t\t/')
+ $(printLicenseList | ${SED} -e 's/^/\t\t\t/')
ACTIONS:
${tab}-ln, --list-names
${tab}-ll, --list-licenses
${tab}${tab}list all game licenses
- ${tab}-ls, --list
+ ${tab}-ls, --list-selected
${tab}${tab}list selected games
${tab}-d, --download
${tab}-h, --help
${tab}${tab}print this help
- Example:
+ Examples:
+ ${tab}${prog_name} --license GPL BSD --list-selected
${tab}${prog_name} --license GPL BSD --download --install
+ ${tab}${prog_name} --name all --list-selected
+ ${tab}${prog_name} --name all --download --install
+
EOF
exit
fi
case "${1}" in
- '--list-licenses'|'-ll')
+ '--list-names'|'-ln')
arg_type=''
- list_licenses='true'
+ list_names='true'
option_list="${option_list} ${1}"
;;
- '--list-names'|'-ln')
+ '--list-licenses'|'-ll')
arg_type=''
- list_names='true'
+ list_licenses='true'
option_list="${option_list} ${1}"
;;
'--list-selected'|'-ls')
;;
*)
case "${arg_type}" in
- 'pack-license')
- license_list="${license_list} ${1}"
- ;;
'pack-name')
name_list="${name_list} ${1}"
;;
+ 'pack-license')
+ license_list="${license_list} ${1}"
+ ;;
'download-dir')
if [ -z "${download_dir}" ]
then
# compatibility with legacy Makefile
if [ "${DOWNLOAD_GAMEPACKS}" = 'yes' ]
then
- ! [ -z "${DOWNLOADDIR}" ] && download_dir="${DOWNLOADDIR}"
- ! [ -z "${INSTALLDIR}" ] && install_dir="${INSTALDIR}"
+ if ! [ -z "${DOWNLOADDIR}" ]
+ then
+ download_dir="${DOWNLOADDIR}"
+ fi
+
+ if ! [ -z "${INSTALLDIR}" ]
+ then
+ install_dir="${INSTALLDIR}"
+ fi
+
license_list='free'
by_license='true'
+
download_packs='true'
+ mkdir_download='true'
+
install_packs='true'
+ mkdir_install='true'
fi
if [ -z "${download_dir}" ]
install_dir="${default_install_dir}"
fi
-if "${by_license}"
+if "${by_name}"
then
- selected_list="${selected_list} $(printNameListByLicense "${license_list}")"
+ selected_list="${selected_list} $(printNameListByName "${name_list}")"
fi
-if "${by_name}"
+if "${by_license}"
then
- selected_list="${selected_list} $(printNameListByName "${name_list}")"
+ selected_list="${selected_list} $(printNameListByLicense "${license_list}")"
fi
selected_list="$(dedupeList "${selected_list}")"
if "${mkdir_download}"
then
${MKDIR_P} "${download_dir}"
- real_download_dir="$(readlink -f "${download_dir}")"
+ real_download_dir="$(printRealPath "${download_dir}")"
fi
if "${mkdir_install}"
then
${MKDIR_P} "${install_dir}"
- real_install_dir="$(readlink -f "${install_dir}")"
+ real_install_dir="$(printRealPath "${install_dir}")"
fi
-if "${list_licenses}"
+if "${list_names}"
then
- printLicenseList
+ printNameList
fi
-if "${list_names}"
+if "${list_licenses}"
then
- printNameList
+ printLicenseList
fi
+
if "${list_selected}"
then
printList "${selected_list}"