[Lunar-commits] CVS: theedge/var/lib/lunar/plugins unpack-generic.plugin, NONE, 1.1 unpack-rpm.plugin, NONE, 1.1 unpack-zip.plugin, NONE, 1.1

Auke Kok sofar at lunar-linux.org
Fri Mar 25 10:47:09 UTC 2005


Update of /var/cvs/lunar/theedge/var/lib/lunar/plugins
In directory espresso.foo-projects.org:/tmp/cvs-serv4953/var/lib/lunar/plugins

Added Files:
	unpack-generic.plugin unpack-rpm.plugin unpack-zip.plugin 
Log Message:
Fix lvu urls: now lists ALL urls!!!
Migrate unpack() to use plugins for all types (allows zip and rpm code to be migrated out of core later)


--- NEW FILE: unpack-generic.plugin ---
#!/bin/bash
#############################################################
#                                                           #
# unpack-generic.plugin - generic plugin that unpacks       #
#                         sources                           #
#                                                           #
#############################################################
#                                                           #
# Copyright 2005 by Auke Kok under GPLv2                    #
#                                                           #
#############################################################


plugin_unpack_generic() {
	case $1 in
		*.tar.bz2|*.tbz2)
			debug_msg "Unpacking tar.bz2 file \"$1\""
			tar jxf $1 --no-same-owner --no-same-permissions || return 1
			;;
		*.tar.gz|*.tgz)
			debug_msg "Unpacking tar.gz file \"$1\""
			tar zxf $1 --no-same-owner --no-same-permissions || return 1
			;;
		*.bz2)
			debug_msg "Unpacking bz2 file \"$1\""
			cp $1 . || return 1
			bunzip2 $1 || return 1
			;;
		*.gz)
			debug_msg "Unpacking gz file \"$1\""
			cp $1 . || return 1
			gunzip $1 || return 1
			;;
		*)
			# fallback: we don't know what to do!
			return 2
			;;
	esac
	# return success!
	return 0
}


plugin_register SOURCE_UNPACK plugin_unpack_generic

--- NEW FILE: unpack-rpm.plugin ---
#!/bin/bash
#############################################################
#                                                           #
# unpack-rpm.plugin - generic plugin that unpacks rpmfiles  #
#                                                           #
#############################################################
#                                                           #
# Copyright 2005 by Auke Kok under GPLv2                    #
#                                                           #
#############################################################


plugin_unpack_rpm() {
	case $1 in
		*.rpm)
			if [ ! -x /usr/bin/rpmunpack ]; then
				message "${PROBLEM_COLOR}! Cannot unpack rpm files without ${MODULE_COLOR}rpmunpack${DEFAULT_COLOR}${PROBLEM_COLOR} installed${DEFAULT_COLOR}";
				exit 1
			fi
			debug_msg "Unpacking rpm file \"$1\""
			rpmunpack < $1 | gzip -d | cpio -idm || return 1
			;;
		*)
			# fallback: we don't know what to do!
			return 2
			;;
	esac
	# return success!
	return 0
}


plugin_register SOURCE_UNPACK plugin_unpack_rpm

--- NEW FILE: unpack-zip.plugin ---
#!/bin/bash
#############################################################
#                                                           #
# unpack-zip.plugin - generic plugin that unpacks zipfiles  #
#                                                           #
#############################################################
#                                                           #
# Copyright 2005 by Auke Kok under GPLv2                    #
#                                                           #
#############################################################


plugin_unpack_zip() {
	case $1 in
		*.zip)
			if [ ! -x /usr/bin/unzip ]; then
				message "${PROBLEM_COLOR}! Cannot unpack zip-files without ${MODULE_COLOR}unzip${DEFAULT_COLOR}${PROBLEM_COLOR} installed${DEFAULT_COLOR}";
				exit 1
			fi
			debug_msg "Unpacking zip file \"$1\""
			unzip -q $1 || return 1
			;;
		*)
			# fallback: we don't know what to do!
			return 2
			;;
	esac
	# return success!
	return 0
}


plugin_register SOURCE_UNPACK plugin_unpack_zip



More information about the Lunar-commits mailing list