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 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
#!/bin/sh
# Podracer installer
# By Lorenzo Taylor
testroot()
{
if test ! $(whoami) = "root"
then
echo Only root can $1 Podracer.
return 2
fi
}
installtimeout()
{
cc timeout.c -o /usr/bin/timeout ||return 1
if test -d /usr/share/man/man1
then
cp timeout.1.gz /usr/share/man/man1 || return 1
else
cp timeout.1.gz /usr/man/man1 || return 1
fi
echo Timeout has been successfully installed.
}
removetimeout()
{
rm /usr/bin/timeout >& /dev/null || return 1
rm -f /usr/share/man/man1/timeout.1.gz >& /dev/null || return 1
rm -f /usr/man/man1/timeout.1.gz >& /dev/null || return 1
echo Timeout has been successfully removed.
}
checkdeps()
{
fail=0
if test ! $(which curl)
then
echo Curl is not installed.
fail=1
fi
if test ! $(find /usr -name BitTorrent)
then
echo BitTorrent is not installed.
fail=1
fi
if test ! $(which screen)
then
echo Screen is not installed.
fail=1
fi
if test ! $(which timeout)
then
echo Timeout was not installed on this system. Installing it now.
if ! installtimeout
then
echo Failed installing timeout.
fail=1
fi
fi
return $fail
}
install()
{
if ! checkdeps
then
echo Failed dependency check.
return 3
fi
echo Installing Podracer...
mkdir -p /usr/share/doc/podracer || return 1
cp CREDITS LICENSE README ChangeLog TODO sample.subscriptions \
/usr/share/doc/podracer || return 1
cp podracer /usr/bin || return 1
chmod 755 /usr/bin/podracer || return 1
cp podracer.conf /etc || return 1
if test -d /usr/share/man/man1
then
cp podracer.1.gz /usr/share/man/man1 || return 1
else
cp podracer.1.gz /usr/man/man1 || return 1
fi
echo Podracer has been successfully installed.
echo All documentation files may be found in /usr/share/doc/podracer
echo The podracer program is /usr/bin/podracer
echo And the system-wide configuration file is /etc/podracer.conf
echo You can get info on how to use podracer by typing
echo man podracer
echo Keep winning the pod race with Podracer.
}
uninstall()
{
echo Removing Podracer...
rm -R /usr/share/doc/podracer >& /dev/null || return 1
rm /usr/bin/podracer >& /dev/null || return 1
rm /etc/podracer.conf >& /dev/null || return 1
rm -f /usr/share/man/man1/podracer.1.gz >& /dev/null || return 1
rm -f /usr/man/man1/podracer.1.gz >& /dev/null || return 1
echo Podracer has been successfully removed.
}
description()
{
cat <<- END
Podracer v1.4
By Lorenzo Taylor
To install Podracer, run this script with \`\`install'' as the argument.
To remove Podracer from your system, run this script with \`\`remove'' or
\`\`uninstall'' as the argument.
If you used this package to install Timeout and wish to remove it as well, add
\`\`timeout'' as a second argument after \`\`remove'' or \`\`uninstall''.
Description:
Podracer is a podcast downloader. It takes a file with the URLs to all your
podcast rss feeds and goes and gets the mp3s and stores them in a specified
location. It is a BASH script with an internal BitTorrent downloader
written in Python. See the CREDITS file for information on all the
great work that helped make Podracer the winner of the pod race.
END
}
case $1 in
install)
testroot $1 && install || echo Podracer installation failed. Aborting installer.
;;
remove|uninstall)
testroot $1 && uninstall || echo Podracer is not installed.
test $2 &&
if test $2 = 'timeout'
then
echo Removing Timeout...
removetimeout || echo Failed removing timeout.
fi
;;
*)
description
esac
|