wok-6.x view get-libaacs/stuff/get-libaacs @ rev 23863
syslinux/isoboot.s: accept user args
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Jun 19 15:46:21 2020 +0000 (2020-06-19) |
parents | 726bbc1c6701 |
children |
line source
1 #!/bin/sh
2 #
3 # get-libaacs - create and install SliTaz package libaacs
4 #
5 # (C) 2020 SliTaz - GNU General Public License v3.
6 # Author : Pascal Bellard
7 # modified by HGT on 2020-02-11
8 #
10 # === Initialisations ===
12 PKGS_DB="/var/lib/tazpkg" # packages database directory
13 PACKAGE="libaacs"
14 VERSION="1.0"
15 CATEGORY="non-free"
16 SHORT_DESC="A library to play encrypted blu-ray."
17 MAINTAINER="nobody@slitaz.org"
18 WEB_SITE="https://vlc-bluray.whoknowsmy.name/"
19 SUGGESTED="vlc"
21 # Declare functions check_root, status, ...
22 . /lib/libtaz.sh
23 # and make commandline options (if any) available as variables
25 is_installed()
26 {
27 if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ]
28 then #package is deemed to be installed
29 return 0
30 else
31 return 1
32 fi
33 }
35 # Show commandline options, if requested by --help
36 if [ "$help" == "yes" ]
37 then
38 echo "Commandline options:
39 $0
40 --version=<version>
41 --root=<path-to-root>
42 --install=yes|no
43 --keep=no|yes
44 --tmpdir=<directory-to-build-package>"
45 exit
46 fi
48 # Check for system administrator privileges
49 check_root
51 title "Package $PACKAGE will be build as SliTaz package and installed"
53 # Fetch latest version, unless version is set by option --version
54 [ -z "$version" ] && version="latest"
56 # Install SliTaz package, unless inhibited by option --install=no
57 [ -z "$install" ] && install="yes"
59 # Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation,
60 # unless option --keep=yes is given
61 [ -z "$keep" ] && keep="no"
63 # Directory for temporary files
64 TMP_DIR="$tmpdir"
65 [ -z "$tmpdir" ] && TMP_DIR="/tmp/get-$PACKAGE"
67 # Logging file (unused by now)
68 LOG="$logfile"
69 [ -z "$logfile" ] && LOG=$TMP_DIR/get-$PACKAGE.log
71 cat <<EOT
72 Options in use:
73 root : $root/
74 version : $version
75 install package: $install
76 keep tazpkg : $keep
77 build directory: $TMP_DIR
79 EOT
81 separator; newline
83 # === Remove package, if installed ===
84 if is_installed
85 then
86 echo "$PACKAGE is already installed."
87 echo -n "Would you like to remove and reinstall this package [y/n]? "
88 read answer
89 case "$answer" in
90 y|Y)
91 action "Removing installed version..."
92 tazpkg remove $PACKAGE --root="$root/"
93 [ ! is_installed ] &&
94 die "Can't remove installed version. Exiting."
95 ;;
96 *)
97 echo "Leaving $PACKAGE untouched."
98 exit 0
99 ;;
100 esac
101 fi
103 # === Fetch files ===
105 CUR_DIR=$(pwd)
106 mkdir -p $TMP_DIR
107 cd $TMP_DIR
109 for i in KEYDB.cfg linux32/libaacs.so.0
110 do
111 wget --no-check-certificate ${WEB_SITE}files/$i
112 [ -s $(basename $i) ] && continue
113 cd $CUR_DIR
114 rm -rf $TMP_DIR
115 echo "Could not download $(basename $i) from ${WEB_SITE}files/$i. Exiting."
116 exit 1
117 done
119 # === Create SliTaz package ===
121 mkdir -p $PACKAGE-$VERSION/fs/usr/lib
122 mkdir -p $PACKAGE-$VERSION/fs/etc/skel/.config/aacs
123 mv libaacs.so.0 $PACKAGE-$VERSION/fs/usr/lib
124 mv KEYDB.cfg $PACKAGE-$VERSION/fs/etc/skel/.config/aacs
126 # Create recipe for SliTaz package
127 cat > $PACKAGE-$VERSION/receipt <<EOT
128 # SliTaz package receipt.
130 PACKAGE="$PACKAGE"
131 VERSION="$VERSION"
132 CATEGORY="$CATEGORY"
133 SHORT_DESC="$SHORT_DESC"
134 MAINTAINER="$MAINTAINER"
135 SUGGESTED="$SUGGESTED"
136 WEB_SITE="$WEB_SITE"
138 # Post install commands for Tazpkg.
139 post_install()
140 {
141 for i in \$1/home/*/.config
142 do
143 [ -d \$i ] || continue
144 cp -a \$1/etc/skel/.config/aacs \$i
145 chown -R \$(stat -c '%u.%g' \$i) \$i/aacs
146 done
147 }
149 # Pre remove commands for Tazpkg.
150 pre_remove()
151 {
152 rm -rf \$1/home/*/.config/aacs
153 }
154 EOT
156 action "Creating the package $PACKAGE..."
157 # Pack
158 tazpkg pack $PACKAGE-$VERSION
159 # Remove package tree
160 rm -rf $PACKAGE-$VERSION
162 # === Install the SliTaz package ===
163 [ "$install" == "yes" ] &&
164 tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root"
166 # === Cleanup ===
167 # Preserve package file, if requested
168 [ "$keep" == "yes" ] &&
169 ( mv $PACKAGE-$VERSION.tazpkg $CUR_DIR &&
170 echo Saved $PACKAGE-$VERSION.tazpkg to $CUR_DIR )
172 # Remove temporary build directory
173 cd $CUR_DIR
174 rm -rf $TMP_DIR