blob: eb6d2b904188f9eb6387fc8a591e9115a1737a0f (
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
|
set -e
# Needed since post_install runs on user root
if [ -n "$SUDO_USER" ]; then
user=$SUDO_USER
else
echo "USING ROOT USER. MAY CAUSE ISSUES IF THATS NOT YOUR PREFEERED USER." >&2
user=$(whoami) # fallback (if this is used it'll error out anyways)
fi
_update() {
echo "Installing packages using pip"
su "$user" -c "
source venv/bin/activate
# Install the requirements
pip install -r requirements.txt
pip install Xlib # Required on linux, see https://github.com/Podshot/MCEdit-Unified/issues/797
# Build the libs for a faster mcedit
python setup.py all
echo "Done installing pip packages for mcedit."
deactivate
"
}
post_install() {
echo "Setting up MCEdit's venv."
cd /opt/mcedit-unified
# Install & setup the virtualenv
su "$user" -c "
# If pip not found, install it
# Note: not using python2-pip because it seems to be having dependency problems.
if python2 -m pip install virtualenv 2>&1 | grep -q 'No module named pip'; then
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
python2 get-pip.py
python2 -m pip install virtualenv
fi
python2 -m virtualenv venv
"
# Install all packages
_update;
echo "All done !"
}
post_upgrade() {
_update
echo "All done !"
}
post_remove() {
echo "Making sure folder is removed (for venv)."
if [ -d "/opt/mcedit-unified/" ]; then
rm -r "/opt/mcedit-unified/"
echo "Folder has been removed"
else
echo "Folder did not exist."
fi
echo "Done uninstalling mcedit."
}
|