-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathinstall_nix.sh
88 lines (77 loc) · 2.77 KB
/
install_nix.sh
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
#!/bin/bash
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# written by Matt Chisholm
# Who uses makefiles anyways these days?
# This script will install BitTorrent on your machine, attempting to
# use the native, local packaging system (rpm or deb) if possible.
echo "Checking to see if you have permission to install."
if ! `sudo -v` ; then
echo 'Root permission is required to install. Aborting install.'
exit
fi
if python -c 'import sys; assert sys.version >= "2.3"'; then
PYTHONVERSION=`python -c 'import sys; print sys.version[:3]'`
echo "Python $PYTHONVERSION is already installed."
else
echo 'Python 2.3 or greater is required, but it is not installed. Aborting install.'
exit
fi
if python -c 'import wx; import wxPython; assert wxPython.__version__ >= "2.6";' ; then
echo 'wyPython 2.6 or greater is already installed.'
else
echo 'wxPython 2.6 or greater is required, but it is not installed. Aborting install.'
exit
fi
if python -c 'import twisted; import twisted.copyright; assert twisted.copyright.version >= "1.3"' ; then
echo 'Twisted 1.3 or greater is already installed.'
else
echo 'Twisted 1.3 or greater is required, but it is not installed. Aborting install.'
exit
fi
if [[ -d /etc/apt/ && -x `which dpkg-deb` ]]; then
echo -n "This appears to be a deb-based system, building .deb package.... "
if sh build_nix_pkg.sh deb 2>/dev/null >/dev/null ; then
echo 'Done.'
PKG=`ls dist/*$PYTHONVERSION.deb`
echo "Installing $PKG with sudo dpkg -i.... "
if sudo dpkg -i $PKG; then
echo 'Installed.'
else
echo 'Failed.'
fi
else
echo 'Failed.'
fi
elif [ -x `which rpm` ]; then
echo -n "This appears to be a rpm-based system, building .rpm package.... "
if sh build_nix_pkg.sh rpm 2>/dev/null >/dev/null ; then
echo 'Done.'
PKG=`ls dist/*$PYTHONVERSION.noarch.rpm`
echo "Installing $PKG with sudo rpm -ivh.... "
if sudo rpm -ivh $PKG; then
echo 'Installed.'
else
echo 'Failed.'
fi
else
echo 'Failed.'
fi
else
echo -n "Neither rpm nor deb package systems detected. Installing binaries directly.... "
if sudo python setup.py install; then
echo 'Done.'
else:
echo 'Installation failed.'
fi
fi