wok-next view get-libaacs/stuff/get-libaacs @ rev 15474
libee: race condition
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Nov 09 21:39:14 2013 +0000 (2013-11-09) |
parents | 5e2886317a11 |
children |
line source
1 #!/bin/sh -e
3 PACKAGE="libaacs"
4 VERSION="1.0"
5 WEB_SITE="http://vlc-bluray.whoknowsmy.name/"
6 CATEGORY="non-free"
7 SUGGESTED="vlc"
8 SHORT_DESC="A library to play encrypted blu-ray"
9 MAINTAINER="nobody@slitaz.org"
11 ROOT="$1"
12 [ -d "$ROOT" ] || ROOT=""
14 if test $(id -u) != 0 ; then
15 echo -e "\nYou must be root to run `basename $0`."
16 echo -e "Please type 'su' and root password to become super-user.\n"
17 exit 0
18 fi
20 if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
21 [ -n "$ROOT" ] && exit 1
22 tazpkg remove $PACKAGE
23 [ -d /var/lib/tazpkg/installed/$PACKAGE ] && exit 1
24 fi
26 TMP_DIR=/tmp/get-$PACKAGE-$$-$RANDOM
27 CUR_DIR=$(pwd)
28 mkdir -p $TMP_DIR && cd $TMP_DIR
30 for i in KEYDB.cfg linux32/libaacs.so.0 ; do
31 wget ${WEB_SITE}files/$i
32 [ -s $(basename $i) ] && continue
33 cd $CUR_DIR
34 rm -rf $TMP_DIR
35 echo "Could not download $(basename $i) from ${WEB_SITE}files/$i. Exiting."
36 exit 1
37 done
39 mkdir -p $PACKAGE-$VERSION/fs/usr/lib $PACKAGE-$VERSION/fs/etc/skel/.config/aacs
40 mv libaacs.so.0 $PACKAGE-$VERSION/fs/usr/lib
41 mv KEYDB.cfg $PACKAGE-$VERSION/fs/etc/skel/.config/aacs
43 cat > $PACKAGE-$VERSION/receipt <<EOT
44 PACKAGE="$PACKAGE"
45 VERSION="$VERSION"
46 CATEGORY="$CATEGORY"
47 SHORT_DESC="$SHORT_DESC"
48 MAINTAINER="$MAINTAINER"
49 SUGGESTED="$SUGGESTED"
50 WEB_SITE="$WEB_SITE"
52 # Pre and post install commands for Tazpkg.
53 post_install()
54 {
55 for i in \$1/home/*/.config ; do
56 [ -d \$i ] || continue
57 cp -a \$1/etc/skel/.config/aacs \$i
58 chown -R \$(stat -c '%u.%g' \$i) \$i/aacs
59 done
60 }
62 pre_remove()
63 {
64 rm -rf \$1/home/*/.config/aacs
65 }
66 EOT
68 # Pack
69 tazpkg pack $PACKAGE-$VERSION
71 # Clean to save RAM memory
72 rm -rf $PACKAGE-$VERSION
74 # Install pseudo package
75 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
76 case " $@ " in
77 *\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;;
78 esac
80 # Clean
81 cd $CUR_DIR
82 rm -rf $TMP_DIR