wok rev 25473

created recipe for get-java8-jre
author Hans-G?nter Theisgen
date Wed Oct 12 10:36:11 2022 +0100 (2022-10-12)
parents 50e162af45ee
children aa16d45b14bd
files dnsmasq/stuff/etc/init.d/dnsmasq get-java8-jre/receipt get-java8-jre/stuff/get-java8-jre
line diff
     1.1 --- a/dnsmasq/stuff/etc/init.d/dnsmasq	Tue Oct 11 07:33:58 2022 +0000
     1.2 +++ b/dnsmasq/stuff/etc/init.d/dnsmasq	Wed Oct 12 10:36:11 2022 +0100
     1.3 @@ -1,6 +1,6 @@
     1.4  #!/bin/sh
     1.5 -# /etc/init.d/dnsmasq: Start, stop and restart DNSmasq daemon on SliTaz, at boot
     1.6 -# time or with the command line.
     1.7 +# /etc/init.d/dnsmasq: Start, stop and restart DNSmasq daemon on SliTaz
     1.8 +# at boot time or with command.
     1.9  #
    1.10  # To start daemon at boot time, just put the right name in the $RUN_DAEMONS
    1.11  # variable of /etc/rcS.conf and configure options with /etc/daemons.conf.
    1.12 @@ -15,42 +15,43 @@
    1.13  PIDFILE=/var/run/dnsmasq.pid
    1.14  
    1.15  case "$1" in
    1.16 -  start)
    1.17 -    if active_pidfile $PIDFILE dnsmasq ; then
    1.18 -      _ '%s is already running.' $NAME
    1.19 -      exit 1
    1.20 -    fi
    1.21 -    action 'Starting %s: %s...' "$DESC" $NAME
    1.22 -    $DAEMON $OPTIONS
    1.23 -    status
    1.24 -    ;;
    1.25 -  stop)
    1.26 -    if ! active_pidfile $PIDFILE dnsmasq ; then
    1.27 -      _ '%s is not running.' $NAME
    1.28 -      exit 1
    1.29 -    fi
    1.30 -    action 'Stopping %s: %s...' "$DESC" $NAME
    1.31 -    kill $(cat $PIDFILE)
    1.32 -    rm $PIDFILE
    1.33 -    status
    1.34 -    ;;
    1.35 -  restart)
    1.36 -    if ! active_pidfile $PIDFILE dnsmasq ; then
    1.37 -      _ '%s is not running.' $NAME
    1.38 -      exit 1
    1.39 -    fi
    1.40 -    action 'Restarting %s: %s...' "$DESC" $NAME
    1.41 -    kill $(cat $PIDFILE)
    1.42 -    rm $PIDFILE
    1.43 -    sleep 2
    1.44 -    $DAEMON $OPTIONS
    1.45 -    status
    1.46 -    ;;
    1.47 -  *)
    1.48 -    emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
    1.49 -    newline
    1.50 -    exit 1
    1.51 -    ;;
    1.52 +	(start)
    1.53 +		if active_pidfile $PIDFILE dnsmasq
    1.54 +		  then
    1.55 +			_ '%s is already running.' $NAME
    1.56 +			exit 1
    1.57 +		fi
    1.58 +		action 'Starting %s: %s...' "$DESC" $NAME
    1.59 +		$DAEMON $OPTIONS
    1.60 +		status
    1.61 +		;;
    1.62 +	(stop)
    1.63 +		if ! active_pidfile $PIDFILE dnsmasq
    1.64 +		  then
    1.65 +			_ '%s is not running.' $NAME
    1.66 +			exit 1
    1.67 +		fi
    1.68 +		action 'Stopping %s: %s...' "$DESC" $NAME
    1.69 +		kill $(cat $PIDFILE)
    1.70 +		status
    1.71 +		;;
    1.72 +	(restart)
    1.73 +		if ! active_pidfile $PIDFILE dnsmasq
    1.74 +		  then
    1.75 +			_ '%s is not running.' $NAME
    1.76 +			exit 1
    1.77 +		fi
    1.78 +		action 'Restarting %s: %s...' "$DESC" $NAME
    1.79 +		kill $(cat $PIDFILE)
    1.80 +		sleep 2
    1.81 +		$DAEMON $OPTIONS
    1.82 +		status
    1.83 +		;;
    1.84 +	(*)
    1.85 +		emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
    1.86 +		newline
    1.87 +		exit 1
    1.88 +		;;
    1.89  esac
    1.90  
    1.91  exit 0
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/get-java8-jre/receipt	Wed Oct 12 10:36:11 2022 +0100
     2.3 @@ -0,0 +1,17 @@
     2.4 +# SliTaz package receipt.
     2.5 +
     2.6 +PACKAGE="get-java8-jre"
     2.7 +VERSION="1.00"
     2.8 +CATEGORY="non-free"
     2.9 +SHORT_DESC="Oracle Java Runtime Environment"
    2.10 +MAINTAINER="maintainer@slitaz.org"
    2.11 +LICENSE="GPL3"
    2.12 +WEB_SITE="https://www.java.com"
    2.13 +TAGS="java"
    2.14 +
    2.15 +# Rules to gen a SliTaz package suitable for Tazpkg.
    2.16 +genpkg_rules()
    2.17 +{
    2.18 +	mkdir -p $fs/usr/bin
    2.19 +	cp -a stuff/get-java8-jre	$fs/usr/bin
    2.20 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/get-java8-jre/stuff/get-java8-jre	Wed Oct 12 10:36:11 2022 +0100
     3.3 @@ -0,0 +1,243 @@
     3.4 +#!/bin/sh
     3.5 +#
     3.6 +# get-java8-jre - create and install SliTaz package jre
     3.7 +#
     3.8 +# (C) 2022 SliTaz - GNU General Public License v3.
     3.9 +# Author : HGT	2022-10-12
    3.10 +#
    3.11 +
    3.12 +#	=== Initialisations ===
    3.13 +
    3.14 +PKGS_DB="/var/lib/tazpkg"	# packages database directory
    3.15 +PACKAGE="jre"
    3.16 +CATEGORY="non-free"
    3.17 +TAGS="java"
    3.18 +SHORT_DESC="Oracle Java Runtime Environment."
    3.19 +MAINTAINER="nobody@slitaz.org"
    3.20 +LICENSE="non-free"
    3.21 +WEB_SITE="https://www.java.com/"
    3.22 +DEPENDS=""
    3.23 +
    3.24 +# Declare functions check_root, status, ...
    3.25 +. /lib/libtaz.sh
    3.26 +# and make commandline options (if any) available as variables
    3.27 +
    3.28 +is_installed()
    3.29 +{
    3.30 +	if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ]
    3.31 +	  then	#package is deemed to be installed
    3.32 +	 	return 0
    3.33 +	  else
    3.34 +	 	return 1
    3.35 +	fi
    3.36 +}
    3.37 +
    3.38 +# Show commandline options, if requested by --help
    3.39 +if [ "$help" == "yes" ]
    3.40 +  then
    3.41 +	echo "Commandline options:
    3.42 +  $0
    3.43 +	--version=<version>
    3.44 +	--root=<path-to-root>
    3.45 +	--install=yes|no
    3.46 +	--keep=no|yes
    3.47 +	--tmpdir=<directory-to-build-package>
    3.48 +	--logfile=<logging-file>"
    3.49 +	exit
    3.50 +fi
    3.51 +
    3.52 +# Check for system administrator privileges
    3.53 +check_root
    3.54 +
    3.55 +title "Package $PACKAGE will be build as SliTaz package and installed"
    3.56 +
    3.57 +# Fetch latest version
    3.58 +# unless version is set by option --version
    3.59 +[ -z "$version" ] && version="latest"
    3.60 +
    3.61 +# Install SliTaz package
    3.62 +# unless inhibited by option --install=no
    3.63 +[ -z "$install" ] && install="yes"
    3.64 +
    3.65 +# Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation,
    3.66 +# unless option --keep=yes is given
    3.67 +[ -z "$keep" ] && keep="no"
    3.68 +
    3.69 +# Directory for temporary files
    3.70 +TMP_DIR="$tmpdir"
    3.71 +[ -z "$tmpdir" ] && TMP_DIR="/tmp/get-$PACKAGE"
    3.72 +
    3.73 +# Logging file (unused by now)
    3.74 +LOG="$logfile"
    3.75 +[ -z "$logfile" ] && LOG=$TMP_DIR/get-$PACKAGE.log
    3.76 +
    3.77 +cat <<EOT
    3.78 +Options in use:
    3.79 +  root           : $root/
    3.80 +  version        : $version
    3.81 +  install package: $install
    3.82 +  keep tazpkg    : $keep
    3.83 +  build directory: $TMP_DIR
    3.84 +  logging file   : $LOG
    3.85 +
    3.86 +EOT
    3.87 +
    3.88 +separator
    3.89 +newline
    3.90 +
    3.91 +#	=== Remove package, if installed ===
    3.92 +if is_installed
    3.93 +  then
    3.94 +	echo "$PACKAGE is already installed."
    3.95 +	echo -n "Would you like to remove and reinstall this package [y/n]? "
    3.96 +	read answer
    3.97 +	case "$answer" in
    3.98 +		(y|Y)
    3.99 +			action "Removing installed version..."
   3.100 +			newline
   3.101 +			tazpkg remove $PACKAGE --root="$root/"
   3.102 +			[ ! is_installed ] &&
   3.103 +			die "Can't remove installed version. Exiting."
   3.104 +			;;
   3.105 +		(*)
   3.106 +			echo "Leaving $PACKAGE untouched."
   3.107 +			exit 0
   3.108 +			;;
   3.109 +	esac
   3.110 +fi
   3.111 +
   3.112 +#	=== Fetch archive file, if not existing ===
   3.113 +if [ "$version" == "latest" ]
   3.114 +  then
   3.115 +	# Because javascript is used
   3.116 +	echo "Cannot determine latest version from $WEB_SITE"
   3.117 +	echo "Creating version 8u341"
   3.118 +	version=8u341
   3.119 +fi
   3.120 +# newer versions should be inserted here
   3.121 +case "$version" in
   3.122 +	(8u341)
   3.123 +		id="246797"
   3.124 +		md5="424b9da4b48848379167015dcc250d8d"
   3.125 +		;;
   3.126 +	(8u321)
   3.127 +		id="245795"
   3.128 +		md5="df5ad55fdd604472a86a45a217032c7d"
   3.129 +		;;
   3.130 +	(*)
   3.131 +		echo "Cannot fetch archive for $version."
   3.132 +		exit 0
   3.133 +		;;
   3.134 +esac
   3.135 +FILE="jre-$version-linux-i586.tar.gz"
   3.136 +WGET_URL="https://javadl.oracle.com/webapps/download/AutoDL?BundleId=${id}_${md5}"
   3.137 +VERSION=$version
   3.138 +
   3.139 +CUR_DIR=$(pwd)
   3.140 +mkdir -p $TMP_DIR
   3.141 +cd	$TMP_DIR
   3.142 +if [ -f $FILE ]
   3.143 +  then
   3.144 +	echo "Using existing archive file $FILE"
   3.145 +  else
   3.146 +	action "Fetching the archive"
   3.147 +	newline
   3.148 +	wget	--no-check-certificate -O $FILE $WGET_URL
   3.149 +	if [ ! -f $FILE ]
   3.150 +	  then
   3.151 +		cd	$CUR_DIR
   3.152 +		rm -rf	$TMP_DIR
   3.153 +		echo "Could not transfer $FILE from $WGET_URL. Exiting."
   3.154 +		exit 1
   3.155 +	fi
   3.156 +fi
   3.157 +
   3.158 +#	=== Extract files from archive ===
   3.159 +action "Extracting the archive"
   3.160 +newline
   3.161 +
   3.162 +# extract archive to src
   3.163 +mkdir 	src
   3.164 +tar xzf $FILE -C src
   3.165 +# Remove archive file
   3.166 +rm -f	$FILE
   3.167 +
   3.168 +# extract version from directory name
   3.169 +VERSION="$(ls src | sed 's|jre||; s|_|.|')"
   3.170 +# rename extracted directory
   3.171 +[ ! -d "src/jre" ] &&
   3.172 +mv src/jre*	src/jre
   3.173 +
   3.174 +#       === Create SliTaz package ===
   3.175 +
   3.176 +# create directory for package creation
   3.177 +mkdir	$PACKAGE-$VERSION
   3.178 +cd	$PACKAGE-$VERSION
   3.179 +
   3.180 +mkdir -p fs/usr/share/icons
   3.181 +
   3.182 +mv ../src/jre/bin	fs/usr
   3.183 +mv ../src/jre/lib	fs/usr
   3.184 +
   3.185 +# GUI jcontrol: we may not have bash (not really needed)
   3.186 +sed -i s'|/bin/bash|/bin/sh|'	fs/usr/bin/jcontrol
   3.187 +
   3.188 +# Icon for java
   3.189 +mv ../src/jre/plugin/desktop/sun_java.png	fs/usr/share/icons/java.png
   3.190 +
   3.191 +# set appropriate owner for all files
   3.192 +chown -R root:root fs
   3.193 +
   3.194 +# Create desktop file for java control panel
   3.195 +mkdir -p	fs/usr/share/applications
   3.196 +cat > fs/usr/share/applications/jcontrol.desktop <<EOT
   3.197 +[Desktop Entry]
   3.198 +Version=1.0
   3.199 +Encoding=UTF-8
   3.200 +Name=Java Control Panel
   3.201 +Exec=jcontrol
   3.202 +Terminal=false
   3.203 +Categories=Application
   3.204 +Icon=/usr/share/icons/java.png
   3.205 +Comment=Java Control Panel
   3.206 +Type=Application
   3.207 +Categories=Development;
   3.208 +EOT
   3.209 +
   3.210 +# Create recipe for SliTaz package
   3.211 +cat > receipt <<EOT
   3.212 +# SliTaz package receipt.
   3.213 +
   3.214 +PACKAGE="$PACKAGE"
   3.215 +VERSION="$VERSION"
   3.216 +CATEGORY="$CATEGORY"
   3.217 +TAGS="$TAGS"
   3.218 +SHORT_DESC="$SHORT_DESC"
   3.219 +MAINTAINER="$MAINTAINER"
   3.220 +LICENSE="$LICENSE"
   3.221 +WEB_SITE="$WEB_SITE"
   3.222 +
   3.223 +DEPENDS="$DEPENDS"
   3.224 +EOT
   3.225 +
   3.226 +cd	..
   3.227 +
   3.228 +action "Creating the package $PACKAGE..."
   3.229 +# Pack
   3.230 +tazpkg pack $PACKAGE-$VERSION
   3.231 +# Remove package tree
   3.232 +rm -rf $PACKAGE-$VERSION
   3.233 +
   3.234 +#	=== Install the SliTaz package ===
   3.235 +[ "$install" == "yes" ] &&
   3.236 +tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root"
   3.237 +
   3.238 +#	=== Cleanup ===
   3.239 +# Preserve package file, if requested
   3.240 +[ "$keep" == "yes" ] &&
   3.241 +( mv $PACKAGE-$VERSION.tazpkg $CUR_DIR &&
   3.242 +  echo Saved $PACKAGE-$VERSION.tazpkg to $CUR_DIR )
   3.243 +
   3.244 +# Remove temporary build directory
   3.245 +cd	$CUR_DIR
   3.246 +rm -rf	$TMP_DIR