tazpkg rev 734

tazpkg-convert: add tinycore support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Dec 29 11:06:28 2014 +0100 (2014-12-29)
parents 061ee30eaf2d
children 21e01cc4fa1f
files modules/tazpkg-convert
line diff
     1.1 --- a/modules/tazpkg-convert	Mon Dec 29 11:46:12 2014 +0200
     1.2 +++ b/modules/tazpkg-convert	Mon Dec 29 11:06:28 2014 +0100
     1.3 @@ -628,6 +628,75 @@
     1.4  	rm -rf $TMP_DIR
     1.5  }
     1.6  
     1.7 +finish_convert_tinycore()
     1.8 +{
     1.9 +	cat > $file/receipt <<EOT
    1.10 +# SliTaz package receipt.
    1.11 +# generated by tazpkg from tinycore package $(basename $PACKAGE_FILE)
    1.12 +PACKAGE="$package"
    1.13 +VERSION="$version"
    1.14 +CATEGORY="misc"
    1.15 +SHORT_DESC="tinycore package $(basename $PACKAGE_FILE)"
    1.16 +WEB_SITE="http://tinycorelinux.net/"
    1.17 +MAINTAINER="nobody@slitaz.org"
    1.18 +DEPENDS="$(find_depends)"
    1.19 +EOT
    1.20 +	show_unresolved_lib $file/receipt
    1.21 +	script=$file/fs/usr/local/tce.installed/$PACKAGE
    1.22 +	[ -f $script ] && cat >> $file/receipt <<EOM
    1.23 +
    1.24 +post_install()
    1.25 +{
    1.26 +chroot \$1/ sh - << EOT
    1.27 +cd /
    1.28 +$(sed -e 's/\\/\\\\/g' -e 's/\$/\\$/g' < $script)
    1.29 +EOT
    1.30 +}
    1.31 +EOM
    1.32 +	[ -d $file/fs/usr/local/tce.installed ] &&
    1.33 +	rm -rf $file/fs/usr/local/tce.installed
    1.34 +	tazpkg pack $file
    1.35 +	mv $file.tazpkg $TOP_DIR
    1.36 +	cd $TOP_DIR
    1.37 +	rm -rf $TMP_DIR
    1.38 +}
    1.39 +
    1.40 +# convert a .tce package to .tazpkg
    1.41 +
    1.42 +convert_tce()
    1.43 +{
    1.44 +	if ! tar tzf $PACKAGE_FILE | grep -q ^usr/local ; then
    1.45 +		_ 'File "%s" does not look like %s package!' $PACKAGE_FILE 'Tinycore'
    1.46 +		return 1
    1.47 +	fi
    1.48 +	mkdir -p $TMP_DIR 
    1.49 +	cd $TMP_DIR
    1.50 +	case "$PACKAGE_FILE" in
    1.51 +	*.tcel) parse_pkgname .tcel ;;
    1.52 +	*.tcem) parse_pkgname .tcem ;;
    1.53 +	*)	parse_pkgname .tce ;;
    1.54 +	esac
    1.55 +	mkdir -p $file/fs
    1.56 +	tar xzf $PACKAGE_FILE -C $file/fs
    1.57 +	finish_convert_tinycore
    1.58 +}
    1.59 +
    1.60 +# convert a .tcz package to .tazpkg
    1.61 +
    1.62 +convert_tcz()
    1.63 +{
    1.64 +	[ -n "$(which unsquashfs)" ] || tazpkg get-install squashfs 
    1.65 +	if ! unsquashfs -l $PACKAGE_FILE | grep -q squashfs-root/$ ; then
    1.66 +		_ 'File "%s" does not look like %s package!' $PACKAGE_FILE 'Tinycore'
    1.67 +		return 1
    1.68 +	fi
    1.69 +	mkdir -p $TMP_DIR 
    1.70 +	cd $TMP_DIR
    1.71 +	parse_pkgname .tcz
    1.72 +	unsquashfs $PACKAGE_FILE
    1.73 +	mv squashfs-root $file/fs
    1.74 +	finish_convert_tinycore
    1.75 +}
    1.76  
    1.77  
    1.78  if [ "$(dd if=$PACKAGE_FILE bs=8 count=1 skip=1 2> /dev/null)"  == "debian-b" ]; then
    1.79 @@ -656,6 +725,10 @@
    1.80  			convert_upkg;;
    1.81  		*.xbps)
    1.82  			convert_xbps;;
    1.83 +		*.tce|*.tcel|*.tcem)
    1.84 +			convert_tce;;
    1.85 +		*.tcz)
    1.86 +			convert_tcz;;
    1.87  		*)
    1.88  			_ 'Unsupported format' ;;
    1.89  	esac