public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in app-arch/makeself/files: makeself-unpack
@ 2009-02-26 19:27 Mike Frysinger (vapier)
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger (vapier) @ 2009-02-26 19:27 UTC (permalink / raw
  To: gentoo-commits

vapier      09/02/26 19:27:43

  Added:                makeself-unpack
  Log:
  Add a script to unpack makeself archives.
  (Portage version: 2.2_rc23/cvs/Linux x86_64)

Revision  Changes    Path
1.1                  app-arch/makeself/files/makeself-unpack

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-arch/makeself/files/makeself-unpack?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-arch/makeself/files/makeself-unpack?rev=1.1&content-type=text/plain

Index: makeself-unpack
===================================================================
#!/bin/bash

# Glue to keep unpack_makeself() unchanged
source /etc/init.d/functions.sh
find_unpackable_file() { echo "$@"; }
debug-print() { :; }
emktemp() { mktemp "$@"; }
alias assert='_pipestatus="${PIPESTATUS[*]}"; [[ "${_pipestatus// /}" -eq 0 ]] || die'

# Straight copied from eutils.eclass ... should be kept in sync
unpack_makeself() {
	local src_input=${1:-${A}}
	local src=$(find_unpackable_file "${src_input}")
	local skip=$2
	local exe=$3

	[[ -z ${src} ]] && die "Could not locate source for '${src_input}'"

	local shrtsrc=$(basename "${src}")
	echo ">>> Unpacking ${shrtsrc} to ${PWD}"
	if [[ -z ${skip} ]] ; then
		local ver=$(grep -a '#.*Makeself' "${src}" | awk '{print $NF}')
		local skip=0
		exe=tail
		case ${ver} in
			1.5.*|1.6.0-nv)	# tested 1.5.{3,4,5} ... guessing 1.5.x series is same
				skip=$(grep -a ^skip= "${src}" | cut -d= -f2)
				;;
			2.0|2.0.1)
				skip=$(grep -a ^$'\t'tail "${src}" | awk '{print $2}' | cut -b2-)
				;;
			2.1.1)
				skip=$(grep -a ^offset= "${src}" | awk '{print $2}' | cut -b2-)
				let skip="skip + 1"
				;;
			2.1.2)
				skip=$(grep -a ^offset= "${src}" | awk '{print $3}' | head -n 1)
				let skip="skip + 1"
				;;
			2.1.3)
				skip=`grep -a ^offset= "${src}" | awk '{print $3}'`
				let skip="skip + 1"
				;;
			2.1.4|2.1.5)
				skip=$(grep -a offset=.*head.*wc "${src}" | awk '{print $3}' | head -n 1)
				skip=$(head -n ${skip} "${src}" | wc -c)
				exe="dd"
				;;
			*)
				eerror "I'm sorry, but I was unable to support the Makeself file."
				eerror "The version I detected was '${ver}'."
				eerror "Please file a bug about the file ${shrtsrc} at"
				eerror "http://bugs.gentoo.org/ so that support can be added."
				die "makeself version '${ver}' not supported"
				;;
		esac
		debug-print "Detected Makeself version ${ver} ... using ${skip} as offset"
	fi
	case ${exe} in
		tail)	exe="tail -n +${skip} '${src}'";;
		dd)		exe="dd ibs=${skip} skip=1 obs=1024 conv=sync if='${src}'";;
		*)		die "makeself cant handle exe '${exe}'"
	esac

	# lets grab the first few bytes of the file to figure out what kind of archive it is
	local tmpfile=$(emktemp)
	eval ${exe} 2>/dev/null | head -c 512 > "${tmpfile}"
	local filetype=$(file -b "${tmpfile}")
	case ${filetype} in
		*tar\ archive*)
			eval ${exe} | tar --no-same-owner -xf -
			;;
		bzip2*)
			eval ${exe} | bzip2 -dc | tar --no-same-owner -xf -
			;;
		gzip*)
			eval ${exe} | tar --no-same-owner -xzf -
			;;
		compress*)
			eval ${exe} | gunzip | tar --no-same-owner -xf -
			;;
		*)
			eerror "Unknown filetype \"${filetype}\" ?"
			false
			;;
	esac
	assert "failure unpacking (${filetype}) makeself ${shrtsrc} ('${ver}' +${skip})"
}

for x; do unpack_makeself "$x" ; done






^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gentoo-commits] gentoo-x86 commit in app-arch/makeself/files: makeself-unpack
@ 2014-12-21 14:25 Michal Gorny (mgorny)
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Gorny (mgorny) @ 2014-12-21 14:25 UTC (permalink / raw
  To: gentoo-commits

mgorny      14/12/21 14:25:39

  Modified:             makeself-unpack
  Log:
  Use sys-apps/gentoo-functions, bug #504388.
  
  (Portage version: 2.2.15/cvs/Linux x86_64, signed Manifest commit with key EFB4464E!)

Revision  Changes    Path
1.3                  app-arch/makeself/files/makeself-unpack

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-arch/makeself/files/makeself-unpack?rev=1.3&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-arch/makeself/files/makeself-unpack?rev=1.3&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-arch/makeself/files/makeself-unpack?r1=1.2&r2=1.3

Index: makeself-unpack
===================================================================
RCS file: /var/cvsroot/gentoo-x86/app-arch/makeself/files/makeself-unpack,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- makeself-unpack	18 Feb 2014 06:18:50 -0000	1.2
+++ makeself-unpack	21 Dec 2014 14:25:39 -0000	1.3
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 # Glue to keep unpack_makeself() unchanged
-source /etc/init.d/functions.sh
+source /lib/gentoo/functions.sh
 find_unpackable_file() { echo "$@"; }
 debug-print() { :; }
 emktemp() { mktemp "$@"; }





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-21 14:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-21 14:25 [gentoo-commits] gentoo-x86 commit in app-arch/makeself/files: makeself-unpack Michal Gorny (mgorny)
  -- strict thread matches above, loose matches on Subject: below --
2009-02-26 19:27 Mike Frysinger (vapier)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox