wok diff get-linuxqq/stuff/get-linuxqq @ rev 24928

updated msmtp (1.8.7 -> 1.8.20)
author Hans-G?nter Theisgen
date Wed Apr 13 15:47:53 2022 +0100 (2022-04-13)
parents 7f0fea8ad9f4
children
line diff
     1.1 --- a/get-linuxqq/stuff/get-linuxqq	Sat Mar 03 11:14:56 2012 -0800
     1.2 +++ b/get-linuxqq/stuff/get-linuxqq	Wed Apr 13 15:47:53 2022 +0100
     1.3 @@ -1,51 +1,142 @@
     1.4 -#!/bin/sh 
     1.5 +#!/bin/sh
     1.6 +#
     1.7 +# get-linuxqq - create and install SliTaz package linuxqq (Tencent QQ)
     1.8 +#
     1.9 +# (C) 2020 SliTaz - GNU General Public License v3.
    1.10 +# Author : unknown
    1.11 +# modified by HGT on 2020-02-11
    1.12 +#
    1.13  
    1.14 -# Get and install Tencent QQ for Linux
    1.15 +#	=== Initialisations ===
    1.16  
    1.17 +PKGS_DB="/var/lib/tazpkg"	# packages database directory
    1.18  PACKAGE="linuxqq"
    1.19 -VERSION="v1.0.2"
    1.20 -TARGZ="${PACKAGE}_${VERSION}_i386.tar.gz"
    1.21 -URL="http://dl_dir.qq.com/linuxqq/$TARGZ"
    1.22 -CUR_DIR=$(pwd)
    1.23 -TEMP_DIR=/tmp/$PACKAGE-$VERSION-$$
    1.24 -ROOT="$1"
    1.25 +VERSION="1.0.2"			# latest versions as 64-bit variants only
    1.26 +CATEGORY="non-free"
    1.27 +TAGS="chat im"
    1.28 +SHORT_DESC="QQ for Linux $VERSION."
    1.29 +WEB_SITE="http://im.qq.com/"
    1.30 +DEPENDS="gtk+ gdk-pixbuf"
    1.31  
    1.32 -# Check if we are root
    1.33 -if test $(id -u) != 0 ; then
    1.34 -    echo -e "\nYou must be root to run `basename $0`."
    1.35 -    echo -e "Please type 'su' and root password to become super-user.\n"
    1.36 -    exit 1
    1.37 +# Declare functions check_root, status, ...
    1.38 +. /lib/libtaz.sh
    1.39 +# and make commandline options (if any) available as variables
    1.40 +
    1.41 +is_installed()
    1.42 +{
    1.43 +	if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ]
    1.44 +	  then	#package is deemed to be installed
    1.45 +	 	return 0
    1.46 +	  else
    1.47 +	 	return 1
    1.48 +	 fi
    1.49 +}
    1.50 +
    1.51 +# Show commandline options, if requested by --help
    1.52 +if [ "$help" == "yes" ]
    1.53 +  then
    1.54 +	echo "Commandline options:
    1.55 +  $0
    1.56 +	--root=<path-to-root>
    1.57 +	--install=yes|no
    1.58 +	--keep=no|yes
    1.59 +	--tmpdir=<directory-to-build-package>"
    1.60 +	exit
    1.61  fi
    1.62  
    1.63 -# Avoid reinstall
    1.64 -if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
    1.65 -    echo -e "\n$PACKAGE package is already installed.\n"
    1.66 -    exit 1
    1.67 +# Check for system administrator privileges
    1.68 +check_root
    1.69 +
    1.70 +title "Package $PACKAGE will be build as SliTaz package and installed"
    1.71 +
    1.72 +# Fetch latest version, unless version is set by option --version
    1.73 +[ -z "$version" ] && version="latest"	# unused
    1.74 +
    1.75 +# Install SliTaz package, unless inhibited by option --install=no
    1.76 +[ -z "$install" ] && install="yes"
    1.77 +
    1.78 +# Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation,
    1.79 +# unless option --keep=yes is given
    1.80 +[ -z "$keep" ] && keep="no"
    1.81 +
    1.82 +# Directory for temporary files
    1.83 +TMP_DIR="$tmpdir"
    1.84 +[ -z "$tmpdir" ] && TMP_DIR="/tmp/get-$PACKAGE"
    1.85 +
    1.86 +# Logging file (unused by now)
    1.87 +LOG="$logfile"
    1.88 +[ -z "$logfile" ] && LOG=$TMP_DIR/get-$PACKAGE.log
    1.89 +
    1.90 +cat <<EOT
    1.91 +Options in use:
    1.92 +  root           : $root/
    1.93 +  install package: $install
    1.94 +  keep tazpkg    : $keep
    1.95 +  build directory: $TMP_DIR
    1.96 +
    1.97 +EOT
    1.98 +
    1.99 +separator; newline
   1.100 +
   1.101 +#	=== Remove package, if installed ===
   1.102 +if is_installed
   1.103 +  then
   1.104 +	echo "$PACKAGE is already installed."
   1.105 +	echo -n "Would you like to remove and reinstall this package [y/n]? "
   1.106 +	read answer
   1.107 +	case "$answer" in
   1.108 +		y|Y)
   1.109 +			action "Removing installed version..."
   1.110 +			tazpkg remove $PACKAGE --root="$root/"
   1.111 +			[ ! is_installed ] &&
   1.112 +			die "Can't remove installed version. Exiting."
   1.113 +			;;
   1.114 +		*)
   1.115 +			echo "Leaving $PACKAGE untouched."
   1.116 +			exit 0
   1.117 +			;;
   1.118 +	esac
   1.119  fi
   1.120  
   1.121 -# Create a TEMP_DIR
   1.122 -mkdir $TEMP_DIR
   1.123 -cd $TEMP_DIR
   1.124 -
   1.125 -# Download the file
   1.126 -wget $URL 
   1.127 -if [ ! -f $TARGZ ]; then
   1.128 -	cd $CUR_DIR
   1.129 -	rm -rf $TEMP_DIR
   1.130 -	echo "Could not download $TARGZ. Exiting."
   1.131 -	exit 1
   1.132 +#	=== Fetch archive file, if not existing ===
   1.133 +CUR_DIR=$(pwd)
   1.134 +mkdir -p $TMP_DIR
   1.135 +cd $TMP_DIR
   1.136 +FILE="${PACKAGE}_v${VERSION}_i386.tar.gz"
   1.137 +WGET_URL="http://dl_dir.qq.com/linuxqq/$FILE"
   1.138 +if [ -f $FILE ]
   1.139 +  then
   1.140 +	echo "Using existing archive file $FILE"
   1.141 +  else
   1.142 +	action "Fetching the archive"
   1.143 +	newline
   1.144 +	wget	--no-check-certificate $WGET_URL
   1.145 +	if [ ! -f $FILE ]
   1.146 +	  then
   1.147 +		cd $CUR_DIR
   1.148 +		rm -rf $TMP_DIR
   1.149 +		echo "Could not transfer $FILE from $WGET_URL. Exiting."
   1.150 +		exit 1
   1.151 +	fi
   1.152  fi
   1.153  
   1.154 -tar xzf $TARGZ
   1.155 +#	=== Extract files from archive ===
   1.156 +action "Extracting the archive"
   1.157 +newline
   1.158 +
   1.159 +tar xzf $FILE
   1.160  mkdir -p $PACKAGE-$VERSION/fs/usr/share/tencent/
   1.161  mkdir -p $PACKAGE-$VERSION/fs/usr/share/applications/
   1.162  mkdir -p $PACKAGE-$VERSION/fs/usr/bin/
   1.163 -mv $TEMP_DIR/${PACKAGE}_${VERSION}_i386 $TEMP_DIR/$PACKAGE-$VERSION/fs/usr/share/tencent/qq
   1.164 +mv $TMP_DIR/${PACKAGE}_v${VERSION}_i386 \
   1.165 +	$TMP_DIR/$PACKAGE-$VERSION/fs/usr/share/tencent/qq
   1.166  
   1.167 -# extracted pkg can be removed: Save RAM
   1.168 -rm -rf $TARGZ
   1.169 +# Remove archive file
   1.170 +rm -f $FILE
   1.171  
   1.172 -cd $TEMP_DIR
   1.173 +cd $TMP_DIR
   1.174 +
   1.175 +#	=== Create SliTaz package ===
   1.176  
   1.177  cat > $PACKAGE-$VERSION/fs/usr/bin/qq << EOT
   1.178  #!/bin/sh
   1.179 @@ -71,16 +162,21 @@
   1.180  Comment[zh_CN]=腾讯QQ
   1.181  EOT
   1.182  
   1.183 +# Create recipe for SliTaz package
   1.184  cat > $PACKAGE-$VERSION/receipt << EOT
   1.185 +# SliTaz package receipt.
   1.186 +
   1.187  PACKAGE="$PACKAGE"
   1.188  VERSION="$VERSION"
   1.189 -CATEGORY="non-free"
   1.190 -SHORT_DESC="QQ for Linux $VERSION."
   1.191 -DEPENDS="gtk+ gdk-pixbuf"
   1.192 -WEB_SITE="http://im.qq.com/"
   1.193 -TAGS="chat im"
   1.194 +CATEGORY="$CATEGORY"
   1.195 +TAGS="$TAGS"
   1.196 +SHORT_DESC="$SHORT_DESC"
   1.197 +WEB_SITE="$WEB_SITE"
   1.198  
   1.199 -post_install() {
   1.200 +DEPENDS="$DEPENDS"
   1.201 +
   1.202 +post_install()
   1.203 +{
   1.204      chroot $1/ /usr/bin/gdk-pixbuf-query-loaders --update-cache
   1.205  }
   1.206  EOT
   1.207 @@ -206,17 +302,25 @@
   1.208  YX35w3g+soD/l+P/AMNbZ955C9USAAAAAElFTkSuQmCC
   1.209  ====
   1.210  !
   1.211 -} > $TEMP_DIR/$PACKAGE-$VERSION/fs/usr/share/tencent/qq/qq.png
   1.212 +} > $TMP_DIR/$PACKAGE-$VERSION/fs/usr/share/tencent/qq/qq.png
   1.213  
   1.214 +action "Creating the package $PACKAGE..."
   1.215  # Pack
   1.216  tazpkg pack $PACKAGE-$VERSION
   1.217  
   1.218 -# Clean to save RAM memory
   1.219 +# Remove package tree
   1.220  rm -rf $PACKAGE-$VERSION
   1.221  
   1.222 -# Install pseudo package
   1.223 -yes y | tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
   1.224 +#	=== Install the SliTaz package ===
   1.225 +[ "$install" == "yes" ] &&
   1.226 +yes y | tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root"
   1.227  
   1.228 -# Clean
   1.229 +#	=== Cleanup ===
   1.230 +# Preserve package file, if requested
   1.231 +[ "$keep" == "yes" ] &&
   1.232 +( mv $PACKAGE-$VERSION.tazpkg $CUR_DIR &&
   1.233 +  echo Saved $PACKAGE-$VERSION.tazpkg to $CUR_DIR )
   1.234 +
   1.235 +# Remove temporary build directory
   1.236  cd $CUR_DIR
   1.237 -rm -rf $TEMP_DIR
   1.238 +rm -rf $TMP_DIR