File: get-src

package info (click to toggle)
evolution 3.56.2-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 135,044 kB
  • sloc: ansic: 519,950; javascript: 8,494; xml: 5,207; python: 702; makefile: 563; sh: 294; perl: 169
file content (83 lines) | stat: -rwxr-xr-x 1,919 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash

OK=0
MKPWD=$PWD
URLLINK=$1
DOWNLOADEDFILE=$2
EXTRACTTO=$4
EXTRACTEDDIR=$5

if test "$DOWNLOADEDFILE" = "0" ; then
	DOWNLOADEDFILE=$3 ;
else
	URLLINK="$URLLINK/$DOWNLOADEDFILE" ;
fi

if test ! -f "downloads/$DOWNLOADEDFILE" ; then
	cd downloads && \
	wget --no-check-certificate $URLLINK && \
	cd .. && \
	OK=1
else
	OK=1
fi
if test "$OK" = "0" ; then
	exit 1;
fi

case "$DOWNLOADEDFILE" in
   *.7z)
	if test "$EXTRACTEDDIR" = "" ; then
		EXTRACTEDDIR=${DOWNLOADEDFILE%%.7z}
	fi
	if test ! -d "src/${EXTRACTEDDIR}" ; then
		echo " * Unpacking '$DOWNLOADEDFILE'..."
		if test "$EXTRACTTO" != "" ; then
			cd $EXTRACTTO &&
			7za x -y $MKPWD/downloads/$DOWNLOADEDFILE >/dev/null &&
			cd $MKPWD
		else
			cd src && \
			7za x -y ../downloads/$DOWNLOADEDFILE >/dev/null && \
			cd ..
		fi
	fi
	;;
   *.zip)
	if test "$EXTRACTEDDIR" = "" ; then
		EXTRACTEDDIR=${DOWNLOADEDFILE%%.zip}
	fi
	if test ! -d "src/${EXTRACTEDDIR}" ; then
		echo " * Unpacking '$DOWNLOADEDFILE'..."
		if test "$EXTRACTTO" != "" ; then
			cd $EXTRACTTO &&
			unzip -o $MKPWD/downloads/$DOWNLOADEDFILE >/dev/null &&
			cd $MKPWD
		else
			cd src && \
			unzip -o ../downloads/$DOWNLOADEDFILE >/dev/null && \
			cd ..
		fi
	fi
	;;
   *.tar*|*.tgz)
	if test "$EXTRACTEDDIR" = "" ; then
		case "$DOWNLOADEDFILE" in
		   *.tar*) EXTRACTEDDIR=${DOWNLOADEDFILE%%.tar*} ;;
		   *.tgz)  EXTRACTEDDIR=${DOWNLOADEDFILE%%.tgz*} ;;
		   *) echo "unknown archive type for tar case: '$DOWNLOADEDFILE'"; exit 1; ;;
		esac
	fi
	if test ! -d "src/$EXTRACTEDDIR" ; then
		echo " * Unpacking '$DOWNLOADEDFILE'..."
		if test "$EXTRACTTO" = "" ; then
			EXTRACTTO=src
		fi
		if test ! -d "$EXTRACTTO" ; then
			mkdir -p "$EXTRACTTO"; 
		fi
		tar -xf downloads/$DOWNLOADEDFILE --directory=$EXTRACTTO
	fi
	;;
   *) echo "unknown archive type '$DOWNLOADEDFILE'"; exit 1; ;;
esac