1190 lines
273 KiB
Bash
1190 lines
273 KiB
Bash
#!/bin/bash
|
||
# self-extracting installer for udevil
|
||
|
||
tmp=/tmp
|
||
|
||
|
||
########################################################################
|
||
|
||
|
||
offset=1367 # head file length + 1
|
||
|
||
if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
|
||
cat << EOF
|
||
udevil Self-Extracting Installer
|
||
Usage: bash udevil-VERSION-installer.sh [CONFIGURE-OPTIONS]
|
||
|
||
CONFIGURE-OPTIONS, if any, will be passed to the configure command
|
||
|
||
Example default with no options (installs as /usr/local/bin/udevil):
|
||
bash udevil-VERSION-installer.sh
|
||
|
||
Example with prefix (installs as /usr/bin/udevil):
|
||
bash udevil-VERSION-installer.sh --prefix=/usr
|
||
|
||
udevil Homepage:
|
||
http://ignorantguru.github.com/udevil/
|
||
|
||
EOF
|
||
exit
|
||
fi
|
||
|
||
tdir="$tmp/udevil-installer-$$"
|
||
while [ -e "$tdir" ]; do
|
||
tdir="$tmp/udevil-installer-$$-$RANDOM"
|
||
done
|
||
mkdir -p "$tdir"
|
||
|
||
me="$0"
|
||
arc="$tdir/udevil.tar.xz"
|
||
tail -c +$offset "$me" > "$arc"
|
||
|
||
cd "$tdir"
|
||
if [ $? -ne 0 ]; then
|
||
echo "Error changing to tmp dir"
|
||
rm -f "$arc"
|
||
rmdir "$tdir"
|
||
exit 1
|
||
fi
|
||
|
||
tar xJf "$arc"
|
||
if [ $? -ne 0 ]; then
|
||
echo "Error extracting contents"
|
||
rm -rf "$tdir"
|
||
exit 1
|
||
fi
|
||
|
||
rm -f "$arc"
|
||
srcdir=`find . -maxdepth 1 -type d -name "udevil-*" | head -n 1`
|
||
srcdir=`basename "$srcdir"`
|
||
cd "$srcdir"
|
||
if [ $? -ne 0 ] || [ ! -e "install" ]; then
|
||
echo "Error: This file may be corrupt"
|
||
rm -rf "$tdir"
|
||
exit 1
|
||
fi
|
||
|
||
./install "$@"
|
||
|
||
rm -rf "$tdir"
|
||
|
||
exit
|
||
|
||
|
||
|
||
# begin binary data
|
||
ý7zXZ |