wok rev 24038

updated get-vivaldi (1.0 -> 1.01)
author Hans-G?nter Theisgen
date Tue Apr 13 15:38:58 2021 +0100 (4 weeks ago)
parents 469f8561ac86
children 31250d4576c3
files get-vivaldi/receipt get-vivaldi/stuff/get-vivaldi
line diff
     1.1 --- a/get-vivaldi/receipt	Tue Apr 13 06:48:06 2021 +0100
     1.2 +++ b/get-vivaldi/receipt	Tue Apr 13 15:38:58 2021 +0100
     1.3 @@ -1,18 +1,16 @@
     1.4  # SliTaz package receipt.
     1.5  
     1.6  PACKAGE="get-vivaldi"
     1.7 -VERSION="1.0"
     1.8 +VERSION="1.01"
     1.9  CATEGORY="non-free"
    1.10 -SHORT_DESC="An advanced browser made with the power user in mind"
    1.11 +TAGS="web-browser"
    1.12 +SHORT_DESC="An advanced browser made with the power user in mind."
    1.13  MAINTAINER="al.bobylev@gmail.com"
    1.14  LICENSE="non-free"
    1.15  WEB_SITE="https://vivaldi.com/"
    1.16 -TAGS="web-browser"
    1.17 -
    1.18 -DEPENDS="wget"
    1.19  
    1.20  genpkg_rules()
    1.21  {
    1.22 -    mkdir -p $fs/usr/bin
    1.23 -    cp stuff/get-vivaldi $fs/usr/bin
    1.24 +	mkdir -p $fs/usr/bin
    1.25 +	cp stuff/get-vivaldi	$fs/usr/bin
    1.26  }
     2.1 --- a/get-vivaldi/stuff/get-vivaldi	Tue Apr 13 06:48:06 2021 +0100
     2.2 +++ b/get-vivaldi/stuff/get-vivaldi	Tue Apr 13 15:38:58 2021 +0100
     2.3 @@ -1,70 +1,190 @@
     2.4  #!/bin/sh
     2.5 +#
     2.6 +# get-vivaldi - create and install SliTaz package vivaldi
     2.7 +#
     2.8 +# (C) 2021 SliTaz - GNU General Public License v3.
     2.9 +# Author : Aleksej Bobylev
    2.10 +# modified by Hans-G√ľnter Theisgen on 2021-04-13
    2.11 +#
    2.12  
    2.13 -# Get and install Vivaldi browser for Linux
    2.14 +#	=== Initialisations ===
    2.15  
    2.16 -# Check if we are root
    2.17 -if [ $(id -u) -ne 0 ]; then
    2.18 -	echo -e "\nYou must be root to run $(basename $0)."
    2.19 -	echo -e "Please type 'su' and root password to become super-user.\n"
    2.20 -	exit 1
    2.21 +PKGS_DB="/var/lib/tazpkg"	# packages database directory
    2.22 +PACKAGE="vivaldi"
    2.23 +CATEGORY="non-free"
    2.24 +SHORT=DESC="An advanced browser made with the power user in mind."
    2.25 +MAINTAINER="nobody@slitaz.org"
    2.26 +LICENSE="non-free"
    2.27 +WEB_SITE="https://vivaldi.com/"
    2.28 +# at least valid for 3.7.2218.52-1:
    2.29 +DEPENDS="at-spi2-atk bash GConf gtk+3 libcups libexif libxkbcommon mesa-wayland nss xorg-libxshmfence"
    2.30 +
    2.31 +# Declare functions check_root, status, ...
    2.32 +. /lib/libtaz.sh
    2.33 +# and make commandline options (if any) available as variables
    2.34 +
    2.35 +is_installed()
    2.36 +{
    2.37 +	if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ]
    2.38 +	  then	#package is deemed to be installed
    2.39 +	 	return 0
    2.40 +	  else
    2.41 +	 	return 1
    2.42 +	 fi
    2.43 +}
    2.44 +
    2.45 +# Show commandline options, if requested by --help
    2.46 +if [ "$help" == "yes" ]
    2.47 +  then
    2.48 +	echo "Commandline options:
    2.49 +  $0
    2.50 +	--version=<version>
    2.51 +	--root=<path-to-root>
    2.52 +	--install=yes|no
    2.53 +	--keep=no|yes
    2.54 +	--tmpdir=<directory-to-build-package>
    2.55 +	--logfile=<logging-file>"
    2.56 +	exit
    2.57  fi
    2.58  
    2.59 -# Get link to downloading precompiled package
    2.60 -dl_page='https://vivaldi.com/download'
    2.61 -dl_type='32bit RPM'
    2.62 -url=$(busybox wget -O - "$dl_page" | sed "/$dl_type/!d;s|.*href=\"\\([^\"]*\\).*|\\1|")
    2.63 -if [ -z "$url" ]; then
    2.64 -	echo -e "\nCan't find download link on $dl_page for $dl_type."
    2.65 -	exit 1
    2.66 +# Check for system administrator privileges
    2.67 +check_root
    2.68 +
    2.69 +title "Package $PACKAGE will be build as SliTaz package and installed"
    2.70 +
    2.71 +# Fetch latest version, unless version is set by option --version
    2.72 +# For available versions look at https://vivaldi.com/download/archive/
    2.73 +[ -z "$version" ] && version="latest"
    2.74 +
    2.75 +# Install SliTaz package, unless inhibited by option --install=no
    2.76 +[ -z "$install" ] && install="yes"
    2.77 +
    2.78 +# Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation,
    2.79 +# unless option --keep=yes is given
    2.80 +[ -z "$keep" ] && keep="no"
    2.81 +
    2.82 +# Directory for temporary files
    2.83 +TMP_DIR="$tmpdir"
    2.84 +[ -z "$tmpdir" ] && TMP_DIR="/tmp/get-$PACKAGE"
    2.85 +
    2.86 +# Logging file (unused by now)
    2.87 +LOG="$logfile"
    2.88 +[ -z "$logfile" ] && LOG=$TMP_DIR/get-$PACKAGE.log
    2.89 +
    2.90 +cat <<EOT
    2.91 +Options in use:
    2.92 +  root           : $root/
    2.93 +  version        : $version
    2.94 +  install package: $install
    2.95 +  keep tazpkg    : $keep
    2.96 +  build directory: $TMP_DIR
    2.97 +  logging file   : $LOG
    2.98 +
    2.99 +EOT
   2.100 +
   2.101 +separator; newline
   2.102 +
   2.103 +#	=== Remove package, if installed ===
   2.104 +if is_installed
   2.105 +  then
   2.106 +	echo "$PACKAGE is already installed."
   2.107 +	echo -n "Would you like to remove and reinstall this package [y/n]? "
   2.108 +	read answer
   2.109 +	case "$answer" in
   2.110 +		y|Y)
   2.111 +			action "Removing installed version..."
   2.112 +			tazpkg remove $PACKAGE --root="$root/"
   2.113 +			[ ! is_installed ] &&
   2.114 +			die "Can't remove installed version. Exiting."
   2.115 +			;;
   2.116 +		*)
   2.117 +			echo "Leaving $PACKAGE untouched."
   2.118 +			exit 0
   2.119 +			;;
   2.120 +	esac
   2.121  fi
   2.122  
   2.123 -# Download package
   2.124 -tmp_dir="$(mktemp -d)"
   2.125 -cd "$tmp_dir"
   2.126 -busybox wget $url
   2.127 -pkg=$(basename $url)
   2.128 -if [ ! -f $pkg ]; then
   2.129 -	cd -
   2.130 -	rm -r "$tmp_dir"
   2.131 -	echo "Could not download $pkg. Exiting."
   2.132 -	exit 1
   2.133 +#	=== Fetch rpm package, if not existing ===
   2.134 +if [ "$version" == "latest" ]
   2.135 +  then
   2.136 +	dl_page='https://vivaldi.com/download'
   2.137 +	dl_type='i386.rpm'
   2.138 +	WGET_URL=$(busybox wget -O - "$dl_page" | sed "/$dl_type/!d;s|.*href=\"\\([^\"]*\\)\.i386\.rpm.*|\\1|")
   2.139 +	VERSION=${WGET_URL#*vivaldi-stable-*}
   2.140 +	WGET_URL=$WGET_URL.$dl_type
   2.141 +	FILE=$(basename $WGET_URL)
   2.142 +  else
   2.143 +	VERSION=$version
   2.144 +	FILE="${PACKAGE}-stable-${VERSION}.i386.rpm"
   2.145 +	WGET_URL="https://downloads.vivaldi.com/stable/$FILE"
   2.146  fi
   2.147  
   2.148 -# Extract package
   2.149 -rpm2cpio $pkg | cpio -dium
   2.150 -rm $pkg
   2.151 +CUR_DIR=$(pwd)
   2.152 +mkdir -p $TMP_DIR
   2.153 +cd $TMP_DIR
   2.154 +if [ -f $FILE ]
   2.155 +  then
   2.156 +	echo "Using existing archive file $FILE"
   2.157 +  else
   2.158 +	action "Fetching the archive"
   2.159 +	newline
   2.160 +	wget	--no-check-certificate $WGET_URL
   2.161 +	if [ ! -f $FILE ]
   2.162 +	  then
   2.163 +		cd $CUR_DIR
   2.164 +		rm -rf $TMP_DIR
   2.165 +		echo "Could not transfer $FILE from $WGET_URL. Exiting."
   2.166 +		exit 1
   2.167 +	fi
   2.168 +fi
   2.169 +	return
   2.170  
   2.171 +action "Extracting the rpm package"
   2.172 +newline
   2.173 +rpm2cpio $FILE | cpio -dium
   2.174 +status
   2.175 +
   2.176 +# Remove archive file
   2.177 +rm -f $FILE
   2.178 +
   2.179 +#	=== Create SliTaz package ===
   2.180  # Remove updater cron job
   2.181  rm -r ./etc
   2.182  
   2.183  # Add icons
   2.184 -for size in 16 22 24 32 48 64 128 256; do
   2.185 -	mkdir -p "$tmp_dir/usr/share/icons/hicolor/${size}x$size/apps"
   2.186 -	ln -s /opt/vivaldi/product_logo_$size.png "$tmp_dir/usr/share/icons/hicolor/${size}x$size/apps/vivaldi.png"
   2.187 -done
   2.188 +for size in 16 22 24 32 48 64 128 256
   2.189 +  do
   2.190 +	mkdir -p "$TMP_DIR/usr/share/icons/hicolor/${size}x$size/apps"
   2.191 +	ln -s /opt/vivaldi/product_logo_$size.png \
   2.192 +		"$TMP_DIR/usr/share/icons/hicolor/${size}x$size/apps/vivaldi.png"
   2.193 +  done
   2.194  
   2.195  # Prepare to packaging
   2.196 -VERSION="$(echo $pkg | sed 's|[^_]*_\(.*\)\.i386.*|\1|')"
   2.197 -mkdir -p $tmp_dir/vivaldi-$VERSION/fs
   2.198 -mv $tmp_dir/opt $tmp_dir/usr $tmp_dir/vivaldi-$VERSION/fs
   2.199 +mkdir -p $TMP_DIR/$PACKAGE-$VERSION/fs
   2.200 +mv $TMP_DIR/opt	$TMP_DIR/$PACKAGE-$VERSION/fs
   2.201 +mv $TMP_DIR/usr	$TMP_DIR/$PACKAGE-$VERSION/fs
   2.202  
   2.203 -cat > $tmp_dir/vivaldi-$VERSION/receipt << EOT
   2.204 -PACKAGE="vivaldi"
   2.205 +cat > $TMP_DIR/$PACKAGE-$VERSION/receipt << EOT
   2.206 +PACKAGE="$PACKAGE"
   2.207  VERSION="$VERSION"
   2.208 -CATEGORY="non-free"
   2.209 -SHORT_DESC="An advanced browser made with the power user in mind"
   2.210 -DEPENDS="gtk+ bash libcups libexif GConf nss mesa"
   2.211 -WEB_SITE="https://vivaldi.com/"
   2.212 +CATEGORY="$CATEGORY"
   2.213 +SHORT_DESC="$SHORT_DESC"
   2.214 +DEPENDS="$DEPENDS"
   2.215 +WEB_SITE="$WEB_SITE"
   2.216  EOT
   2.217  
   2.218 -tazpkg pack vivaldi-$VERSION gzip
   2.219 +tazpkg pack $PACKAGE-$VERSION gzip
   2.220  
   2.221 -# Clean to save RAM memory
   2.222 -rm -rf $PACKAGE-$VERSION
   2.223 +#	=== Install the SliTaz package ===
   2.224 +[ "$install" == "yes" ] &&
   2.225 +tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root"
   2.226  
   2.227 -# Install pseudo package
   2.228 -yes y | tazpkg install vivaldi-$VERSION.tazpkg
   2.229 +#	=== Cleanup ===
   2.230 +# Preserve package file, if requested
   2.231 +[ "$keep" == "yes" ] &&
   2.232 +( mv $PACKAGE-$VERSION.tazpkg $CUR_DIR &&
   2.233 +  echo "Saved $PACKAGE-$VERSION.tazpkg to $CUR_DIR" )
   2.234  
   2.235 -# Clean
   2.236 -cd -
   2.237 -rm -rf $tmp_dir
   2.238 +# Remove temporary build directory
   2.239 +cd $CUR_DIR
   2.240 +rm -rf $TMP_DIR