blob: 226291dd75989e7517536f3dcb5956fd8805f825 (
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
|
set -e
# Needed since post_install runs on user root
if [ -n "$SUDO_USER" ]; then
user=$SUDO_USER
else
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 "
python2 -m pip install virtualenv
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."
}
|