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