-
Notifications
You must be signed in to change notification settings - Fork 1
/
tripskel
executable file
·82 lines (66 loc) · 1.49 KB
/
tripskel
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
#!/bin/sh
if [ $# -lt 3 ]
then
echo "USEAGE: tripskel NAME VERSION SRC(/|.tgz|.tar.(gz|bz2))"
exit 1
fi
name="$1"
vers="$2"
src_loc=`readlink -f "$3"`
unset tempf
mkdir -p "$name-$vers"
pushd "$name-$vers"
mkdir -p support src
###### BEG SUPPORT
pushd support
cat > build.sh << "EOF"
#!/bin/sh
cd "$TMP_BUILD_DIR/"
cp -rPpT "$SRC_DIR/src/" "./"
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make -j3
EOF
cat > install.sh << "EOF"
#!/bin/sh
cd "$TMP_BUILD_DIR"
make install
EOF
cat > identification <<EOF
TRIP_NAME="$name"
TRIP_VERSION="$vers"
TRIP_URL="http://www.google.com/search?q=${name}+program"
TRIP_DESCRIPTION="$name is a locally installed application."
EOF
chmod +x build.sh install.sh
popd # now in base package dir
###### END SUPPORT
dest_loc="src"
test ! -f "$dest_loc" &&
if expr "$src_loc" : "http://.*\.t\(ar\.\)\?\.gz" >/dev/null
then
tempf=`mktemp tmp.XXXX.tgz`
wget -O "$tempf" "$src_loc"
src_loc="$tempf"
fi
if expr "$src_loc" : "^.*\(tar\.gz\|tgz\|bz2\)$" >/dev/null
then
dir="`tar -tf "$src_loc" 2>/dev/null | head -n 1`"
dir="`expr "$dir" : "^\([^/]*\)/.*$"`"
if [ `tar -tf "$src_loc" | wc -l` \
-eq `tar -tf "$src_loc" | grep -c "^$dir"` ]
then
tar -xpf "$src_loc" --transform="s:$dir:./:" -C "$dest_loc"
else
tar -xpf "$src_loc" -C "$dest_loc"
fi
unset dir
else
cp -rPpT "$src_loc/" "$dest_loc/"
fi
popd # back to original
if test "$tempf"
then
rm "$tempf"
unset tempf
fi
exit 0