File: prep.sh

package info (click to toggle)
glibc 2.1.3-20
  • links: PTS
  • area: main
  • in suites: potato
  • size: 7,512 kB
  • ctags: 161
  • sloc: sh: 8,850; makefile: 288
file content (109 lines) | stat: -rwxr-xr-x 2,452 bytes parent folder | download
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#! /bin/sh

trap 'rm -rf glibc-2.1.3' 1 2 3 13 15

unpack()
{
    local tarfile srcdir destdir compressprog status
    tarfile=$1
    if [ ! -r $tarfile ]; then
	echo "E: $tarfile does not exist."
	exit 1
    fi
    # $2 is "in"
    srcdir=${3}/
    # $4 is "creating"
    destdir=$5
    case $tarfile in
	*.tar.bz2)
	    compressprog=bzip2
	    ;;
	*.tar.gz)
	    compressprog=gzip
	    ;;
    esac
    echo "I: Unpacking ${tarfile} in ${destdir}."
    tar --use-compress-program=$compressprog -C $srcdir -xf ${srcdir}${tarfile}
    status=$?
    if [ $status -gt 0 ]; then
	echo "E: subprocess (tar) exited with $status exit status."
	exit 1
    fi
}

overlay()
{
    local srcdir tarfile destdir compressprog status
    srcdir=$(pwd)/
    tarfile=$1
    if [ ! -r $tarfile ]; then
	echo "E: $tarfile does not exist."
	exit 1
    fi
    # $2 is "on"
    destdir=$(pwd)/$3
    case $tarfile in
	*.tar.bz2)
	    compressprog=bzip2
	    ;;
	*.tar.gz)
	    compressprog=gzip
	    ;;
    esac
    echo "I: Overlaying ${tarfile} on ${destdir}."
    tar --use-compress-program=$compressprog -C $destdir -xf ${srcdir}${tarfile}
    status=$?
    if [ $status -gt 0 ]; then
	echo "E: subprocess (tar) exited with $status exit status."
	exit 1
    fi
}

patch()
{
    local srcdir origdir newdir patchfile strip compressprog status
    srcdir=$(pwd)/
    origdir=$1
    # $2 is "to"
    if [ "$2" != "inplace" ]; then
	newdir=$3
	# $4 is "with" or "using"
	patchfile=$5
	if [ ! -r $patchfile ]; then
	    echo "E: $patchfile does not exist."
	    exit 1
	fi
	# $6 is "strip"
	strip=$7
	if [ ! -d $newdir ] && [ -d $origdir ]; then
	    echo "I: Moving $origdir to $newdir for patching."
	    mv $origdir $newdir
	fi
    else
	newdir=${origdir}
	patchfile=$4
	strip=$6
    fi
    echo "I: Patching $newdir with $patchfile."
    case $patchfile in
	*.bz2)
	    compressprog=bzip2
	    ;;
	*.gz)
	    compressprog=gzip
	    ;;
    esac
	    ($compressprog -dc ${srcdir}${patchfile} | \
	    command patch -d $newdir --no-backup-if-mismatch -p${strip})
	    status=$?
	    if [ $status -gt 0 ]; then
		echo "E: subprocess (patch) exited with $status exit status."
		exit 1
	    fi
}

unpack glibc-2.1.3.tar.bz2 in . creating glibc-2.1.3
overlay glibc-crypt-2.1.tar.gz on glibc-2.1.3
overlay glibc-linuxthreads-2.1.3.tar.bz2 on glibc-2.1.3
overlay glibc-nss-v1-2.0.3.tar.gz on glibc-2.1.3
#patch glibc-2.1.2 to glibc-2.1.3 with 2.1.3-2000.01.31.diff.bz2 stripping 1