blob: c0c6b4d52276c4b25b09f14f40eaa29bd7b4c941 (
plain)
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
|
#!/bin/bash
OUTPUT=${OUTPUT:-/tmp}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
# if no package name, see if we're in a SlackBuild dir.
# if so, build a package if one doesn't exist in $OUTPUT.
# either way, install the package for the current dir.
if [ -z "$@" ]; then
pkgname=$(basename `pwd`)
if [ ! -e "$pkgname.info" ]; then
echo "not in a proper SlackBuild dir and no package given, bailing" 1>&2
exit 1
fi
source ./$pkgname.info
if [ -z "$PRGNAM" -o -z "$VERSION" ]; then
echo "bad/incomplete .info file, bailing" 1>&2
exit 1
fi
if [ "$PRGNAM" != "$pkgname" ]; then
echo "bad PRGNAM=$PRGNAM in $pkgname.info"
exit 1
fi
for myarch in noarch "$ARCH"; do
myglob="$OUTPUT/$PRGNAM-$VERSION-$myarch*t?z"
myfile=$( echo $myglob )
if [ "$myglob" = "$myfile" ]; then
: # do naught
elif [ "$( /bin/ls $myfile 2>/dev/null | wc -l )" -gt "1" ]; then
echo "Multiple packages match, not installing anything:"
/bin/ls $myfile
exit 1
else
if [ -n "$found" ]; then
echo "Multiple packages/arches, not installing anything:"
echo $myfile $found
exit 1
else
found=$myfile
echo found $found
fi
fi
done
if [ -z "$found" ]; then
#echo "No package in $OUTPUT, building"
#sudo ./$pkgname.SlackBuild && exec $0
echo "No package in $OUTPUT, build one!"
exit 1
fi
set "$found"
fi
sudo upgradepkg --reinstall --install-new "$@"
|