[SCM] Installer for game data files branch, document, updated. e606353be29767a062dd73bf821192c0275cff7e

Jon Dowland jmtd at debian.org
Mon Jan 24 17:32:45 UTC 2011


The following commit has been merged in the document branch:
commit d2c23cb5cde8602aa3618cf7aa2a83e67d548378
Merge: 1743aa02f431a822a5cc832c7ee5aea191233b36 e6ce0db0ca7209455ffcfe45b230be6705d87deb
Author: Jon Dowland <jmtd at debian.org>
Date:   Sun Jan 23 23:16:06 2011 +0000

    Merge branch 'master' into document

diff --combined lib/game-data-packager-shared
index 1df0362,f20781e..8a1740c
--- a/lib/game-data-packager-shared
+++ b/lib/game-data-packager-shared
@@@ -12,7 -12,8 +12,8 @@@ supported() 
  }
  options() {
  	echo "game-data-packager arguments:"
- 	echo "        -n            not do not install the generated package (requires -d)"
+ 	echo "        -i            install the generated package"
+ 	echo "        -n            do not install the generated package (requires -d, default)"
  	echo "        -d OUTDIR     write the generated .deb(s) to OUTDIR"
  }
  
@@@ -42,10 -43,6 +43,10 @@@ warn() 
  	echo "WARNING: $*" >&2
  }
  
 +## verify_md5sum(file,sum)
 +##      calculates the md5sum of file and compares it to sum.
 +##      if the sum doesn't match, complains on stderr and causes the program
 +##      to exit.
  verify_md5sum() {
  	FILE=$1
  	GOODSUM=$2
@@@ -58,9 -55,6 +59,9 @@@
  	fi
  }
  
 +## verify_directory(dir)
 +##      ensures dir is a directory, or complains on stderr
 +##      and causes the program to exit.
  verify_directory() {
  	DIR=$1
  	if [ ! -d "$DIR" ]; then
@@@ -69,9 -63,6 +70,9 @@@
  	fi
  }
  
 +## verify_file(file)
 +##      ensures file is a file, or complains on stderr
 +##      and causes the program to exit.
  verify_file() {
  	FILE=$1
  	if [ ! -f "$FILE" ]; then
@@@ -80,9 -71,6 +81,9 @@@
  	fi
  }
  
 +## die(string,retcode)
 +##      end the program, complaining with string on stderr
 +##      and returning retcode if supplied, 2 if not.
  die() { 
      if [ $# -lt 2 ]; then
          RET=2
@@@ -93,15 -81,6 +94,15 @@@
  	exit $RET
  }
  
 +## slipstream(deb,relpath,file1,file2...)
 +##      insert file1,file2... into the deb, under the
 +##      path 'relpath', relative to the package root, e.g.:
 +##          slipstream(deb, 'usr/share/doc', 'README', 'copyright')
 +##              => /usr/share/doc/README
 +##              => /usr/share/doc/copyright
 +##      prerequisites:
 +##        * $WORKDIR must be defined to a directory within which
 +##          slipstream can do it's work (somewhere writeable)
  # TODO: this assumes every file is going to go in the same RELPATH. hmm.
  slipstream() {
  	DEB="$1"     # the .deb file we are going to mangle
@@@ -115,7 -94,14 +116,14 @@@
  	slipstream_unpack "$DEB"
  
  	while [ "$#" -gt 0 ]; do
- 		slipstream_file "$1" "$RELPATH"
+ 		file="$1"
+ 		destpath="$RELPATH"
+ 		if [ "x${RELPATH%/}" != "x${RELPATH}" ]; then
+ 			# RELPATH ends with /; append the basename of the
+ 			# file (e.g. pak0.pk3)
+ 			destpath="${RELPATH}${file##*/}"
+ 		fi
+ 		slipstream_file "$file" "$destpath"
  		shift
  	done
  
@@@ -126,9 -112,6 +134,9 @@@
  	cd "$OLDWD"
  }
  
 +## slipstream_permcheck(deb)
 +##      ensures that the file deb can be written to and
 +##      that the current working directory is writeable
  slipstream_permcheck() {
  	DEB="$1"
  
@@@ -143,20 -126,12 +151,20 @@@
  		die "cannot write to $PWD"
  	fi
  }
 +
 +## slipstream_unpack(deb)
 +##      unpacks the deb file into "./slipstream_unpacked"
 +##      and the control data into "./DEBIAN"
  slipstream_unpack() {
  	DEB="$1"
  	dpkg-deb -e "$DEB" "./DEBIAN"
  	dpkg-deb -x "$DEB" "./slipstream.unpacked"
  }
  
 +## slipstream_file(file,destpath)
 +##      copies the file into "./slipstream_unpacked/$destpath",
 +##      calculates the files md5sum and adds it to the md5sums
 +##      file in the control area.
  slipstream_file() {
  	file="$1"
  	destpath="$2"
@@@ -170,11 -145,6 +178,11 @@@
  	cd ..
  }
  
 +##  slipstream_instsize
 +##      calculates the installed size of the deb, (based on
 +##      the contents of the ./slipstream_unpacked directory)
 +##      and writes the result to the control file in the
 +##      control area.
  slipstream_instsize() {
  	# figure out the new installed-size
  	INSTSIZE=`du -sk ./slipstream.unpacked | cut -f1`
@@@ -182,10 -152,6 +190,10 @@@
  		"./DEBIAN/control"
  }
  
 +## slipstream_repack(deb)
 +##      writes a new debian package over deb, packing
 +##      the files from ./slipstream_unpacked inside,
 +##      using the control area in ./DEBIAN
  slipstream_repack() {
  	DEB="$1"     # the .deb file we are going to mangle
  
@@@ -198,27 -164,18 +206,27 @@@
  
  }
  
 +## slipstream_cleanup()
 +##      removes the ./slipstream_unpacked directory.
  slipstream_cleanup() {
  	rm -rf ./slipstream.unpacked
  }
  
  # stuff relating to installing the generated packages ########################
  
 +## install_deb(deb)
 +##      uses sudo and dpkg to install the supplied .deb file
 +# TODO: configurable priviledge escalation method (not hardcoded sudo)
 +# TODO: configurable package installation method (not hardcoded dpkg)
  install_deb() {
  	DEB="$1"
      echo "using su(1) to obtain root privileges and install the package"
  	su -c "dpkg -i \"$DEB\""
  }
  
 +## unravel(path)
 +##      convert 'path' from relative to absolute
 +##      if it does not begin with a slash.
  unravel() {
  	FILE="$1"
  	if echo "$FILE" | grep ^/ >/dev/null; then
@@@ -238,3 -195,19 +246,19 @@@ els
      GAME_PACKAGE_VERSION=`dpkg-query --showformat='${Version}\n' \
          --show game-data-packager`
  fi
+ 
+ gdp_unzip() {
+     zipfile="$1"
+     shift
+     if which 7za >/dev/null; then
+         debug "using 7za"
+         7za e -y "$zipfile" "$@" >/dev/null
+     fi
+     if which 7z >/dev/null; then
+         debug "using 7z"
+         7z e -y "$zipfile" "$@" >/dev/null
+     else
+         debug "using unzip"
+         unzip -qqo "$zipfile" "$@"
+     fi
+ }

-- 
Installer for game data files



More information about the Pkg-games-commits mailing list