wok diff get-litecoin/stuff/get-litecoin @ rev 24107

updated adminer (4.7.5 -> 4.8.1)
author Hans-G?nter Theisgen
date Sat Sep 25 17:50:51 2021 +0100 (2021-09-25)
parents c07aaa614a02
children
line diff
     1.1 --- a/get-litecoin/stuff/get-litecoin	Thu Dec 26 12:26:59 2019 +0100
     1.2 +++ b/get-litecoin/stuff/get-litecoin	Sat Sep 25 17:50:51 2021 +0100
     1.3 @@ -1,56 +1,150 @@
     1.4 -#!/bin/sh -e
     1.5 +#!/bin/sh
     1.6 +#
     1.7 +# get-litecoin - create and install SliTaz package litecoin
     1.8 +#
     1.9 +# (C) 2020 SliTaz - GNU General Public License v3.
    1.10 +# Author : Pascal Bellard
    1.11 +# modified by HGT on 2020-02-11
    1.12 +#
    1.13  
    1.14 -PACKAGE="$(basename $0 | sed 's/get-//')"
    1.15 +#	=== Initialisations ===
    1.16 +
    1.17 +PKGS_DB="/var/lib/tazpkg"	# packages database directory
    1.18 +PACKAGE="litecoin"
    1.19  CATEGORY="misc"
    1.20 -WEB_SITE="http://$PACKAGE.org/"
    1.21  SHORT_DESC="New digital currency for instant payments to anyone, anywhere."
    1.22  MAINTAINER="somebody@$PACKAGE.org"
    1.23 +WEB_SITE="https://litecoin.org/"
    1.24  DEPENDS="libQtGui bzlib"
    1.25  
    1.26 -ROOT="$1"
    1.27 -[ -d "$ROOT" ] || ROOT=""
    1.28 +# Declare functions check_root, status, ...
    1.29 +. /lib/libtaz.sh
    1.30 +# and make commandline options (if any) available as variables
    1.31  
    1.32 -if test $(id -u) != 0 ; then
    1.33 -        echo -e "\nYou must be root to run `basename $0`."
    1.34 -        echo -e "Please type 'su' and root password to become super-user.\n"
    1.35 -        exit 0
    1.36 +is_installed()
    1.37 +{
    1.38 +	if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ]
    1.39 +	  then	#package is deemed to be installed
    1.40 +	 	return 0
    1.41 +	  else
    1.42 +	 	return 1
    1.43 +	 fi
    1.44 +}
    1.45 +
    1.46 +# Show commandline options, if requested by --help
    1.47 +if [ "$help" == "yes" ]
    1.48 +  then
    1.49 +	echo "Commandline options:
    1.50 +  $0
    1.51 +	--version=<version>
    1.52 +	--root=<path-to-root>
    1.53 +	--install=yes|no
    1.54 +	--keep=no|yes
    1.55 +	--tmpdir=<directory-to-build-package>"
    1.56 +	exit
    1.57  fi
    1.58  
    1.59 -if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
    1.60 -	[ -n "$ROOT" ] && exit 1
    1.61 -	tazpkg remove $PACKAGE
    1.62 -	[ -d /var/lib/tazpkg/installed/$PACKAGE ] && exit 1
    1.63 +# Check for system administrator privileges
    1.64 +check_root
    1.65 +
    1.66 +title "Package $PACKAGE will be build as SliTaz package and installed"
    1.67 +
    1.68 +# Fetch latest version, unless version is set by option --version
    1.69 +[ -z "$version" ] && version="latest"
    1.70 +
    1.71 +# Install SliTaz package, unless inhibited by option --install=no
    1.72 +[ -z "$install" ] && install="yes"
    1.73 +
    1.74 +# Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation,
    1.75 +# unless option --keep=yes is given
    1.76 +[ -z "$keep" ] && keep="no"
    1.77 +
    1.78 +# Directory for temporary files
    1.79 +TMP_DIR="$tmpdir"
    1.80 +[ -z "$tmpdir" ] && TMP_DIR="/tmp/get-$PACKAGE"
    1.81 +
    1.82 +# Logging file (unused by now)
    1.83 +LOG="$logfile"
    1.84 +[ -z "$logfile" ] && LOG=$TMP_DIR/get-$PACKAGE.log
    1.85 +
    1.86 +cat <<EOT
    1.87 +Options in use:
    1.88 +  root           : $root/
    1.89 +  version        : $version
    1.90 +  install package: $install
    1.91 +  keep tazpkg    : $keep
    1.92 +  build directory: $TMP_DIR
    1.93 +
    1.94 +EOT
    1.95 +
    1.96 +separator; newline
    1.97 +
    1.98 +#	=== Remove package, if installed ===
    1.99 +if is_installed
   1.100 +  then
   1.101 +	echo "$PACKAGE is already installed."
   1.102 +	echo -n "Would you like to remove and reinstall this package [y/n]? "
   1.103 +	read answer
   1.104 +	case "$answer" in
   1.105 +		y|Y)
   1.106 +			action "Removing installed version..."
   1.107 +			tazpkg remove $PACKAGE --root="$root/"
   1.108 +			[ ! is_installed ] &&
   1.109 +			die "Can't remove installed version. Exiting."
   1.110 +			;;
   1.111 +		*)
   1.112 +			echo "Leaving $PACKAGE untouched."
   1.113 +			exit 0
   1.114 +			;;
   1.115 +	esac
   1.116  fi
   1.117  
   1.118 -TMP_DIR=/tmp/get-$PACKAGE-$$-$RANDOM
   1.119 -CUR_DIR=$(pwd)
   1.120 -mkdir -p $TMP_DIR && cd $TMP_DIR
   1.121 -
   1.122 -# Download tarball
   1.123 -URL=$(wget -O - $WEB_SITE | sed '/linux.tar/!d;;s/.*href="\([^"]*\).*/\1/')
   1.124 -FILE="$(basename $URL)"
   1.125 -VERSION="$(echo $FILE | sed 's/.*coin-\(.*\)-linux.tar.*/\1/')"
   1.126 -wget -O $FILE "$URL"
   1.127 -
   1.128 -if [ ! -f $FILE ]; then
   1.129 -	cd $CUR_DIR
   1.130 -	rm -rf $TMP_DIR
   1.131 -	echo "Could not download $FILE from $URL. Exiting."
   1.132 -	exit 1
   1.133 +#	=== Fetch archive file, if not existing ===
   1.134 +if [ "$version" == "latest" ]
   1.135 +  then
   1.136 +	WGET_URL=$(wget --no-check-certificate -O - $WEB_SITE | \
   1.137 +		sed '/i686-pc-linux-gnu.tar/!d;;s/.*href="\([^"]*\).*/\1/')
   1.138 +	FILE="$(basename $WGET_URL)"
   1.139 +	VERSION="$(echo $WGET_URL | sed 's|.*coin-\(.*\)/linux.*|\1|')"
   1.140 +  else
   1.141 +	FILE="litecoin-${version}-i686-pc-linux-gnu.tar.gz"
   1.142 +	WGET_URL="https://download.litecoin.org/litecoin-$version/linux/$FILE"
   1.143 +	VERSION=$version
   1.144  fi
   1.145  
   1.146 +CUR_DIR=$(pwd)
   1.147 +mkdir -p $TMP_DIR
   1.148 +cd $TMP_DIR
   1.149 +if [ -f $FILE ]
   1.150 +  then
   1.151 +	echo "Using existing archive file $FILE"
   1.152 +  else
   1.153 +	action "Fetching the archive"
   1.154 +	newline
   1.155 +	wget	--no-check-certificate $WGET_URL
   1.156 +	if [ ! -f $FILE ]
   1.157 +	  then
   1.158 +		cd $CUR_DIR
   1.159 +		rm -rf $TMP_DIR
   1.160 +		echo "Could not transfer $FILE from $WGET_URL. Exiting."
   1.161 +		exit 1
   1.162 +	fi
   1.163 +fi
   1.164 +
   1.165 +#	=== Extract files from archive ===
   1.166 +action "Extracting the archive"
   1.167 +newline
   1.168 +set -x
   1.169  mkdir -p $PACKAGE-$VERSION/fs/usr/bin
   1.170  busybox tar xf $FILE
   1.171 +mv $PACKAGE-$VERSION/bin/*	$PACKAGE-$VERSION/fs/usr/bin
   1.172  
   1.173 -mv $PACKAGE-$VERSION-linux/bin/32/* $PACKAGE-$VERSION/fs/usr/bin
   1.174 -rm -rf $PACKAGE-$VERSION-linux
   1.175 -
   1.176 -# extracted pkg can be removed: Save RAM
   1.177 +# Remove archive file
   1.178  rm -f $FILE
   1.179  
   1.180  cd $PACKAGE-$VERSION/fs
   1.181  
   1.182 -# Create menu
   1.183 +# Create desktop file
   1.184  mkdir -p usr/share/applications
   1.185  cat > usr/share/applications/$PACKAGE.desktop <<EOT
   1.186  [Desktop Entry]
   1.187 @@ -65,31 +159,39 @@
   1.188  Type=Application
   1.189  Categories=Office;
   1.190  EOT
   1.191 +
   1.192  cd ../..
   1.193  
   1.194 +# Create recipe for SliTaz package
   1.195  cat > $PACKAGE-$VERSION/receipt <<EOT
   1.196 +# SliTaz package receipt.
   1.197 +
   1.198  PACKAGE="$PACKAGE"
   1.199  VERSION="$VERSION"
   1.200  CATEGORY="$CATEGORY"
   1.201  SHORT_DESC="$SHORT_DESC"
   1.202  MAINTAINER="$MAINTAINER"
   1.203 +WEB_SITE="$WEB_SITE"
   1.204 +
   1.205  DEPENDS="$DEPENDS"
   1.206 -WEB_SITE="$WEB_SITE"
   1.207  EOT
   1.208  
   1.209 +action "Creating the package $PACKAGE..."
   1.210  # Pack
   1.211  tazpkg pack $PACKAGE-$VERSION
   1.212 -
   1.213 -# Clean to save RAM memory
   1.214 +# Remove package tree
   1.215  rm -rf $PACKAGE-$VERSION
   1.216  
   1.217 -# Install pseudo package
   1.218 -tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
   1.219 -case " $@ " in
   1.220 -*\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;;
   1.221 -esac
   1.222 +#	=== Install the SliTaz package ===
   1.223 +[ "$install" == "yes" ] &&
   1.224 +tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root"
   1.225  
   1.226 -# Clean
   1.227 +#	=== Cleanup ===
   1.228 +# Preserve package file, if requested
   1.229 +[ "$keep" == "yes" ] &&
   1.230 +( mv $PACKAGE-$VERSION.tazpkg $CUR_DIR &&
   1.231 +  echo Saved $PACKAGE-$VERSION.tazpkg to $CUR_DIR )
   1.232 +
   1.233 +# Remove temporary build directory
   1.234  cd $CUR_DIR
   1.235  rm -rf $TMP_DIR
   1.236 -