Advertisement
illwieckz

xonotic pk3 to dpk

Mar 10th, 2019
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.45 KB | None | 0 0
  1. #! /bin/sh
  2.  
  3. p="$(ls 'xonotic-'*'-maps.pk3' | tail -n 1)"
  4. b='xonotic-maps'
  5.  
  6. listMaps () {
  7.     unzip -l "${p}" \
  8.     | tail -n +4 \
  9.     | head -n -2 \
  10.     | egrep '\.bsp$' \
  11.     | sed -e 's|^.* maps/||;s|\.bsp$||'
  12. }
  13.  
  14. filterSystem () {
  15.     egrep -v '^_'
  16. }
  17.  
  18. filterInvalid () {
  19.     egrep -v '_'
  20. }
  21.  
  22. ln -sfv "${p}" "${b}_0.dpk"
  23.  
  24. for m in $(listMaps | filterSystem | filterInvalid)
  25. do
  26.     d="map-${m}_0.dpkdir"
  27.     mkdir -pv "${d}"
  28.     echo "${b}" > "${d}/DEPS"
  29. done
  30.  
  31. #EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement