wok annotate get-e-uae/stuff/get-e-uae @ rev 22717
updated fcron (3.0.4 -> 3.2.1)
author | Hans-G?nter Theisgen |
---|---|
date | Wed Jan 22 15:57:11 2020 +0100 (2020-01-22) |
parents | |
children | 49bbb4b9da3c |
rev | line source |
---|---|
Hans-G?nter@22062 | 1 #!/bin/sh |
Hans-G?nter@22062 | 2 # |
Hans-G?nter@22062 | 3 # get-e-uae - create and install SliTaz package e-uae |
Hans-G?nter@22062 | 4 # |
Hans-G?nter@22062 | 5 # (C) 2019 SliTaz - GNU General Public License v3. |
Hans-G?nter@22062 | 6 # Author : HGT |
Hans-G?nter@22062 | 7 # created: 2019-10-24 |
Hans-G?nter@22062 | 8 # |
Hans-G?nter@22062 | 9 |
Hans-G?nter@22062 | 10 # === Initialisations === |
Hans-G?nter@22062 | 11 |
Hans-G?nter@22062 | 12 PKGS_DB="/var/lib/tazpkg" # packages database directory |
Hans-G?nter@22062 | 13 PACKAGE="e-uae" # package to create and install |
Hans-G?nter@22062 | 14 WEB_SITE="http://www.rcdrummond.net/uae/" |
Hans-G?nter@22062 | 15 CATEGORY="system-tools" |
Hans-G?nter@22062 | 16 TAGS="emulator" |
Hans-G?nter@22062 | 17 |
Hans-G?nter@22062 | 18 # Declare functions check_root, status, ... |
Hans-G?nter@22062 | 19 . /lib/libtaz.sh |
Hans-G?nter@22062 | 20 # and make commandline options (if any) available as variables |
Hans-G?nter@22062 | 21 |
Hans-G?nter@22062 | 22 is_installed() |
Hans-G?nter@22062 | 23 { |
Hans-G?nter@22062 | 24 if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ] |
Hans-G?nter@22062 | 25 then #package is deemed to be installed |
Hans-G?nter@22062 | 26 return 0 |
Hans-G?nter@22062 | 27 else |
Hans-G?nter@22062 | 28 return 1 |
Hans-G?nter@22062 | 29 fi |
Hans-G?nter@22062 | 30 } |
Hans-G?nter@22062 | 31 |
Hans-G?nter@22062 | 32 |
Hans-G?nter@22062 | 33 # Show commandline options, if requested by --help |
Hans-G?nter@22062 | 34 if [ "$help" == "yes" ] |
Hans-G?nter@22062 | 35 then |
Hans-G?nter@22062 | 36 echo "Commandline options: |
Hans-G?nter@22062 | 37 $0 |
Hans-G?nter@22062 | 38 --version=<version> |
Hans-G?nter@22062 | 39 --root=<path-to-root> |
Hans-G?nter@22062 | 40 --install=yes|no |
Hans-G?nter@22062 | 41 --keep=no|yes |
Hans-G?nter@22062 | 42 --tmpdir=<directory-to-build-package>" |
Hans-G?nter@22062 | 43 exit |
Hans-G?nter@22062 | 44 fi |
Hans-G?nter@22062 | 45 |
Hans-G?nter@22062 | 46 # Check for system administrator privileges |
Hans-G?nter@22062 | 47 check_root |
Hans-G?nter@22062 | 48 |
Hans-G?nter@22062 | 49 title "Package $PACKAGE will be build as SliTaz package and installed" |
Hans-G?nter@22062 | 50 |
Hans-G?nter@22062 | 51 # Fetch latest version, unless version is set by option --version |
Hans-G?nter@22062 | 52 [ -z "$version" ] && version="latest" |
Hans-G?nter@22062 | 53 |
Hans-G?nter@22062 | 54 # Install SliTaz package, unless inhibited by option --install=no |
Hans-G?nter@22062 | 55 [ -z "$install" ] && install="yes" |
Hans-G?nter@22062 | 56 |
Hans-G?nter@22062 | 57 # Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation, |
Hans-G?nter@22062 | 58 # unless option --keep=yes is given |
Hans-G?nter@22062 | 59 [ -z "$keep" ] && keep="no" |
Hans-G?nter@22062 | 60 |
Hans-G?nter@22062 | 61 # Directory for temporary files |
Hans-G?nter@22062 | 62 [ -z "$tempdir" ] && TMP_DIR="/tmp/get-$PACKAGE" |
Hans-G?nter@22062 | 63 |
Hans-G?nter@22062 | 64 # Logging file (unused by now) |
Hans-G?nter@22062 | 65 LOG=$TMP_DIR/get-$PACKAGE.log |
Hans-G?nter@22062 | 66 |
Hans-G?nter@22062 | 67 cat <<EOT |
Hans-G?nter@22062 | 68 Options in use: |
Hans-G?nter@22062 | 69 root : $root/ |
Hans-G?nter@22062 | 70 version : $version |
Hans-G?nter@22062 | 71 install package: $install |
Hans-G?nter@22062 | 72 keep tazpkg : $keep |
Hans-G?nter@22062 | 73 build directory: $TMP_DIR |
Hans-G?nter@22062 | 74 |
Hans-G?nter@22062 | 75 EOT |
Hans-G?nter@22062 | 76 |
Hans-G?nter@22062 | 77 separator; newline |
Hans-G?nter@22062 | 78 |
Hans-G?nter@22062 | 79 # === Remove package, if installed === |
Hans-G?nter@22062 | 80 if [ is_installed ] |
Hans-G?nter@22062 | 81 then |
Hans-G?nter@22062 | 82 action "Removing installed version..." |
Hans-G?nter@22062 | 83 tazpkg remove $PACKAGE --root="$root/" |
Hans-G?nter@22062 | 84 [ ! is_installed ] && |
Hans-G?nter@22062 | 85 die "Can't remove installed version. Exiting." |
Hans-G?nter@22062 | 86 fi |
Hans-G?nter@22062 | 87 |
Hans-G?nter@22062 | 88 # === Fetch archive file, if not existing === |
Hans-G?nter@22062 | 89 |
Hans-G?nter@22062 | 90 WGET_URL="https://snapshot.debian.org/archive/debian/20100605T162440Z/pool/contrib/e/$PACKAGE/" |
Hans-G?nter@22062 | 91 |
Hans-G?nter@22062 | 92 if [ "$version" == "latest" ] |
Hans-G?nter@22062 | 93 then |
Hans-G?nter@22062 | 94 # wget --output-document=index $WGET_URL |
Hans-G?nter@22062 | 95 # output to be scanned for latest version! |
Hans-G?nter@22062 | 96 VERSION="0.8.29-WIP4-10" |
Hans-G?nter@22062 | 97 else |
Hans-G?nter@22062 | 98 VERSION=$version |
Hans-G?nter@22062 | 99 fi |
Hans-G?nter@22062 | 100 |
Hans-G?nter@22062 | 101 FILE="${PACKAGE}_${VERSION}_i386.deb" |
Hans-G?nter@22062 | 102 WGET_URL="https://snapshot.debian.org/archive/debian/20100605T162440Z/pool/contrib/e/$PACKAGE/$FILE" |
Hans-G?nter@22062 | 103 |
Hans-G?nter@22062 | 104 CUR_DIR=$(pwd) |
Hans-G?nter@22062 | 105 mkdir -p $TMP_DIR |
Hans-G?nter@22062 | 106 cd $TMP_DIR |
Hans-G?nter@22062 | 107 if [ -f $FILE ] |
Hans-G?nter@22062 | 108 then |
Hans-G?nter@22062 | 109 echo "Using existing archive file $FILE" |
Hans-G?nter@22062 | 110 else |
Hans-G?nter@22062 | 111 action "Fetching the archive" |
Hans-G?nter@22062 | 112 newline |
Hans-G?nter@22062 | 113 wget --no-check-certificate $WGET_URL |
Hans-G?nter@22062 | 114 if [ ! -f $FILE ] |
Hans-G?nter@22062 | 115 then |
Hans-G?nter@22062 | 116 cd $CUR_DIR |
Hans-G?nter@22062 | 117 rm -rf $TMP_DIR |
Hans-G?nter@22062 | 118 echo "Could not transfer $FILE from $WGET_URL. Exiting." |
Hans-G?nter@22062 | 119 exit 1 |
Hans-G?nter@22062 | 120 fi |
Hans-G?nter@22062 | 121 fi |
Hans-G?nter@22062 | 122 |
Hans-G?nter@22062 | 123 action "Creating the package $PACKAGE..." |
Hans-G?nter@22062 | 124 # Convert from Debian format |
Hans-G?nter@22062 | 125 tazpkg convert $FILE |
Hans-G?nter@22062 | 126 |
Hans-G?nter@22062 | 127 # === Install the SliTaz package === |
Hans-G?nter@22062 | 128 [ "$install" == "yes" ] && |
Hans-G?nter@22062 | 129 tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root" |
Hans-G?nter@22062 | 130 |
Hans-G?nter@22062 | 131 # === Cleanup === |
Hans-G?nter@22062 | 132 # Preserve package file, if requested |
Hans-G?nter@22062 | 133 [ "$keep" == "yes" ] && mv $PACKAGE-$VERSION.tazpkg $CUR_DIR |
Hans-G?nter@22062 | 134 |
Hans-G?nter@22062 | 135 # Remove temporary build directory |
Hans-G?nter@22062 | 136 cd $CUR_DIR |
Hans-G?nter@22062 | 137 rm -rf $TMP_DIR |