wok rev 22060

created package get-uae
author Hans-G?nter Theisgen
date Thu Oct 24 16:03:15 2019 +0100 (13 months ago)
parents 11eb733f5965
children 1fd43dd7ebcb
files get-uae/receipt get-uae/stuff/get-uae
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/get-uae/receipt	Thu Oct 24 16:03:15 2019 +0100
     1.3 @@ -0,0 +1,17 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="get-uae"
     1.7 +VERSION="1.00"
     1.8 +CATEGORY="system-tools"
     1.9 +TAGS="emulator"
    1.10 +SHORT_DESC="Get UAE Amiga emulator."
    1.11 +MAINTAINER="maintainer@slitaz.org"
    1.12 +LICENSE="GPL2"
    1.13 +WEB_SITE="http://www.amigaemulator.org/"
    1.14 +
    1.15 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.16 +genpkg_rules()
    1.17 +{
    1.18 +	mkdir -p $fs/usr/bin
    1.19 +	cp stuff/get-uae $fs/usr/bin
    1.20 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/get-uae/stuff/get-uae	Thu Oct 24 16:03:15 2019 +0100
     2.3 @@ -0,0 +1,134 @@
     2.4 +#!/bin/sh
     2.5 +#
     2.6 +# get-uae - create and install SliTaz package uae
     2.7 +#
     2.8 +# (C) 2019 SliTaz - GNU General Public License v3.
     2.9 +# Author : HGT
    2.10 +# created: 2019-10-24
    2.11 +#
    2.12 +
    2.13 +#	=== Initialisations ===
    2.14 +
    2.15 +PKGS_DB="/var/lib/tazpkg"	# packages database directory
    2.16 +PACKAGE="uae"			# package to create and install
    2.17 +WEB_SITE="http://www.amigaemulator.org/"
    2.18 +CATEGORY="system-tools"
    2.19 +TAGS="emulator"
    2.20 +
    2.21 +# Declare functions check_root, status, ...
    2.22 +. /lib/libtaz.sh
    2.23 +# and make commandline options (if any) available as variables
    2.24 +
    2.25 +is_installed()
    2.26 +{
    2.27 +	 if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ]
    2.28 +	  then	#package is deemed to be installed
    2.29 +	 	return 0
    2.30 +	  else
    2.31 +	 	return 1
    2.32 +	 fi
    2.33 +}
    2.34 +
    2.35 +
    2.36 +# Show commandline options, if requested by --help
    2.37 +if [ "$help" == "yes" ]
    2.38 +	then
    2.39 +	echo "Commandline options:
    2.40 +  $0
    2.41 +	--version=<version>
    2.42 +	--root=<path-to-root>
    2.43 +	--install=yes|no
    2.44 +	--keep=no|yes
    2.45 +	--tmpdir=<directory-to-build-package>"
    2.46 +	exit
    2.47 +fi
    2.48 +
    2.49 +# Check for system administrator privileges
    2.50 +check_root
    2.51 +
    2.52 +title "Package $PACKAGE will be build as SliTaz package and installed"
    2.53 +
    2.54 +# Fetch latest version, unless version is set by option --version
    2.55 +[ -z "$version" ] && version="latest"
    2.56 +
    2.57 +# Install SliTaz package, unless inhibited by option --install=no
    2.58 +[ -z "$install" ] && install="yes"
    2.59 +
    2.60 +# Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation,
    2.61 +# unless option --keep=yes is given
    2.62 +[ -z "$keep" ] && keep="no"
    2.63 +
    2.64 +# Directory for temporary files
    2.65 +[ -z "$tempdir" ] && TMP_DIR="/tmp/get-$PACKAGE"
    2.66 +
    2.67 +# Logging file (unused by now)
    2.68 +LOG=$TMP_DIR/get-$PACKAGE.log
    2.69 +
    2.70 +cat <<EOT
    2.71 +Options in use:
    2.72 +  root           : $root/
    2.73 +  version        : $version
    2.74 +  install package: $install
    2.75 +  keep tazpkg    : $keep
    2.76 +  build directory: $TMP_DIR
    2.77 +
    2.78 +EOT
    2.79 +
    2.80 +separator; newline
    2.81 +
    2.82 +#	=== Remove package, if installed ===
    2.83 +if [ is_installed ]
    2.84 +	then
    2.85 +		action "Removing installed version..."
    2.86 +		tazpkg remove $PACKAGE --root="$root/"
    2.87 +		[ ! is_installed ] &&
    2.88 +		die "Can't remove installed version. Exiting."
    2.89 +fi
    2.90 +
    2.91 +#	=== Fetch archive file, if not existing ===
    2.92 +
    2.93 +URL="https://snapshot.debian.org/archive/debian/20100301T043504Z/pool/contrib/u/uae/"
    2.94 +if [ "$version" == "latest" ]
    2.95 +	then
    2.96 +	  # wget --output-document=index $URL
    2.97 +	  # output to be scanned for latest version!
    2.98 +	  FILE="uae_0.8.29-7_i386.deb"
    2.99 +	else
   2.100 +	  FILE="uae_${version}_i386.deb"
   2.101 +fi
   2.102 +WGET_URL="https://snapshot.debian.org/archive/debian/20100301T043504Z/pool/contrib/u/uae/$FILE"
   2.103 +
   2.104 +CUR_DIR=$(pwd)
   2.105 +mkdir -p $TMP_DIR
   2.106 +cd $TMP_DIR
   2.107 +if [ -f $FILE ]
   2.108 +	then
   2.109 +		echo "Using existing archive file $FILE"
   2.110 +	else
   2.111 +		action "Fetching the archive"
   2.112 +		newline
   2.113 +		wget	--no-check-certificate $WGET_URL
   2.114 +		if [ ! -f $FILE ]
   2.115 +		  then
   2.116 +			cd $CUR_DIR
   2.117 +			rm -rf $TMP_DIR
   2.118 +			echo "Could not transfer $FILE from $URL. Exiting."
   2.119 +			exit 1
   2.120 +		fi
   2.121 +fi
   2.122 +
   2.123 +action "Creating the package $PACKAGE..."
   2.124 +# Convert from Debian format
   2.125 +tazpkg convert $FILE
   2.126 +
   2.127 +#	=== Install the SliTaz package ===
   2.128 +[ "$install" == "yes" ] &&
   2.129 +tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root"
   2.130 +
   2.131 +#	=== Cleanup ===
   2.132 +# Preserve package file, if requested
   2.133 +[ "$keep" == "yes" ] && mv $PACKAGE-$VERSION.tazpkg $CUR_DIR
   2.134 +
   2.135 +# Remove temporary build directory
   2.136 +cd $CUR_DIR
   2.137 +rm -rf $TMP_DIR