Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 136792 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/lib/portage/bin/ebuild.sh (-5 / +76 lines)
Lines 360-366 Link Here
360
		y=${y##*.}
360
		y=${y##*.}
361
361
362
		myfail="${x} does not exist"
362
		myfail="${x} does not exist"
363
		if [ "${x:0:2}" = "./" ] ; then
363
		if [ "${x:0:2}" = "./" -o "${x:0:1}" = "/" ] ; then
364
			srcdir=""
364
			srcdir=""
365
		else
365
		else
366
			srcdir="${DISTDIR}/"
366
			srcdir="${DISTDIR}/"
Lines 401-420 Link Here
401
				;;
401
				;;
402
			7Z|7z)
402
			7Z|7z)
403
				local my_output
403
				local my_output
404
				my_output="$(7z x -y "${srcdir}/${x}")"
404
				my_output="$(7z x -y "${srcdir}${x}")"
405
				if [ $? -ne 0 ]; then
405
				if [ $? -ne 0 ]; then
406
					echo "${my_output}" >&2
406
					echo "${my_output}" >&2
407
					die "$myfail"
407
					die "$myfail"
408
				fi
408
				fi
409
				;;
409
				;;
410
			RAR|rar)
410
			RAR|rar)
411
				unrar x -idq "${srcdir}/${x}" || die "$myfail"
411
				unrar x -idq "${srcdir}${x}" || die "$myfail"
412
				;;
412
				;;
413
			LHa|LHA|lha|lzh)
413
			LHa|LHA|lha|lzh)
414
				lha xqf "${srcdir}/${x}" || die "$myfail"
414
				lha xqf "${srcdir}${x}" || die "$myfail"
415
				;;
415
				;;
416
			a|deb)
416
			a|deb)
417
				ar x "${srcdir}/${x}" || die "$myfail"
417
				ar x "${srcdir}${x}" || die "$myfail"
418
				;;
419
			sh|bin|run)
420
				local src=${srcdir}${x}
421
				if ! grep -aq '#.*Makeself' "${src}"; then
422
					vecho "unpack ${x}: no Makeself packed file. Ignoring."
423
				else
424
					local ver=$(grep -a '#.*Makeself' "${src}" | awk '{print $NF}')
425
					local skip=0 exe=tail
426
					case ${ver} in
427
						1.5.*|1.6.0-nv)	# tested 1.5.{3,4,5} ... guessing 1.5.x series is same
428
							skip=$(grep -a ^skip= "${src}" | cut -d= -f2)
429
							;;
430
						2.0|2.0.1)
431
							skip=$(grep -a ^$'\t'tail "${src}" | awk '{print $2}' | cut -b2-)
432
							;;
433
						2.1.1)
434
							skip=$(grep -a ^offset= "${src}" | awk '{print $2}' | cut -b2-)
435
							let skip="skip + 1"
436
							;;
437
						2.1.2)
438
							skip=$(grep -a ^offset= "${src}" | awk '{print $3}' | head -n 1)
439
							let skip="skip + 1"
440
							;;
441
						2.1.3)
442
							skip=`grep -a ^offset= "${src}" | awk '{print $3}'`
443
							let skip="skip + 1"
444
							;;
445
						2.1.4|2.1.5)
446
							skip=$(grep -a offset=.*head.*wc "${src}" | awk '{print $3}' | head -n 1)
447
							skip=$(head -n ${skip} "${src}" | wc -c)
448
							exe="dd"
449
							;;
450
						*)
451
							eerror "I'm sorry, but I was unable to support the Makeself file."
452
							eerror "The version I detected was '${ver}'."
453
							eerror "Please file a bug about the file ${x} at"
454
							eerror "http://bugs.gentoo.org/ so that support can be added."
455
							die "makeself version '${ver}' not supported"
456
							;;
457
					esac
458
					debug-print "Detected Makeself version ${ver} ... using ${skip} as offset"
459
					case ${exe} in
460
						tail)		exe="tail -n +${skip} '${src}'";;
461
						dd)		exe="dd ibs=${skip} skip=1 obs=1024 conv=sync if='${src}'";;
462
						*)		die "makeself cant handle exe '${exe}'";;
463
					esac
464
465
					# lets grab the first few bytes of the file to figure out what kind of archive it is
466
					local tmpfile="${T}/tmp.${RANDOM}.${RANDOM}.${RANDOM}"
467
					eval ${exe} 2>/dev/null | head -c 512 > "${tmpfile}"
468
					local filetype="$(file -b "${tmpfile}")"
469
					case ${filetype} in
470
						*tar\ archive)
471
							eval ${exe} | tar --no-same-owner -xf -
472
							;;
473
						bzip2*)
474
							eval ${exe} | bzip2 -dc | tar --no-same-owner -xf -
475
							;;
476
						gzip*)
477
							eval ${exe} | tar --no-same-owner -xzf -
478
							;;
479
						compress*)
480
							eval ${exe} | gunzip | tar --no-same-owner -xf -
481
							;;
482
						*)
483
							eerror "makeself: Unknown filetype \"${filetype}\" ?"
484
							false
485
							;;
486
					esac
487
					assert "failure unpacking (${filetype}) makeself ${x} ('${ver}' +${skip})"
488
				fi
418
				;;
489
				;;
419
			*)
490
			*)
420
				vecho "unpack ${x}: file format not recognized. Ignoring."
491
				vecho "unpack ${x}: file format not recognized. Ignoring."

Return to bug 136792