1#!/bin/sh 2# postinst script for eternallands-sound 3# 4# see: dh_installdeb(1) 5 6set -e 7 8# summary of how this script can be called: 9# * <postinst> `configure' <most-recently-configured-version> 10# * <old-postinst> `abort-upgrade' <new version> 11# * <conflictor's-postinst> `abort-remove' `in-favour' <package> 12# <new-version> 13# * <postinst> `abort-remove' 14# * <deconfigured's-postinst> `abort-deconfigure' `in-favour' 15# <failed-install-package> <version> `removing' 16# <conflicting-package> <version> 17# for details, see http://www.debian.org/doc/debian-policy/ or 18# the debian-policy package 19 20 21case "$1" in 22 configure) 23 24 TARGETDIR="/usr/share/games/EternalLands/sound" 25 CACHEDIR="/var/cache/eternallands" 26 DOWNLOADURL="http://twinmoons.org.uk/el/rel/195" 27 DOWNLOADMAIN="eternallands-sound_1.9.5.9.zip" 28 MD5SUMMAIN="b441ce65da967c937ac030f219fdd9ae" 29 30 [ -f ~paul/el/installpkg/localdownload ] && DOWNLOADURL="https://harry/~paul/el" 31 32 mkdir -p $CACHEDIR 33 cd $CACHEDIR 34 35 # remove old downloads 36 rm -f el_sound_150.zip EL_sound_191.zip EL_sound_update_191.zip \ 37 EL_sound_update_191.1.zip eternallands-sound_1.9.4.zip 38 39 # if we already have an archive check the md5sum is ok and remove if not 40 [ ! -f "$DOWNLOADMAIN" ] || echo "$MD5SUMMAIN $DOWNLOADMAIN" | md5sum -c - || rm -fv $DOWNLOADMAIN 41 42 # Use existing file or download it 43 if [ ! -f "$DOWNLOADMAIN" ] 44 then 45 wget -P "." -v --progress="dot:mega" --no-check-certificate $DOWNLOADURL/$DOWNLOADMAIN 46 echo "$MD5SUMMAIN $DOWNLOADMAIN" | md5sum -c - 47 fi 48 49 # unnpack the archive 50 UNPACKDIR="`mktemp -d /tmp/eternallands-sound.XXXXXXXXXX`" 51 cd $UNPACKDIR 52 unzip -q $CACHEDIR/$DOWNLOADMAIN 53 54 # set the permissions 55 cd sound 56 chown -R root:root . 57 chmod -R a=rX . 58 59 # make the file lists 60 FILELIST="eternallands-sound.filelist" 61 DIRLIST="eternallands-sound.dirlist" 62 find . -type f -exec echo \"{}\" \; > $TARGETDIR/$FILELIST 63 find . -type d ! -name "." -exec echo \"{}\" \; | sort -r > $TARGETDIR/$DIRLIST 64 65 # remove any existing files in the lists then move the new files into the target directory 66 cd $TARGETDIR/ 67 [ ! -s $FILELIST ] || cat $FILELIST | xargs rm -f || true 68 [ ! -s $DIRLIST ] || cat $DIRLIST | xargs rmdir --ignore-fail-on-non-empty > /dev/null 2>&1 || true 69 chmod -R +w . 70 cp --remove-destination -rpf $UNPACKDIR/sound/* . 71 72 rm -rf $UNPACKDIR 73 74 ;; 75 76 abort-upgrade|abort-remove|abort-deconfigure) 77 ;; 78 79 *) 80 echo "postinst called with unknown argument \`$1'" >&2 81 exit 1 82 ;; 83esac 84 85# dh_installdeb will replace this with shell code automatically 86# generated by other debhelper scripts. 87 88#DEBHELPER# 89 90exit 0 91