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