forked from scratch2mcpi/scratch2mcpi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
91 lines (80 loc) · 3.87 KB
/
install.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
89
90
91
#!/bin/sh
cd /home/pi
if [ ! -d /home/pi/mcpi -a ! -f /usr/bin/minecraft-pi ]; then
echo "\n\033[33m\033[1mMinecraft Pi is not installed in your computer. Please install it first.\033[00m\n"
else
# Install scratch2mcpi
echo "\n\033[36m\033[1mInstalling scratch2mcpi...\033[00m\n"
sudo apt-get -y install python-setuptools
sudo easy_install scratchpy
wget -P /tmp https://github.com/eduardofilo/scratch2mcpi/archive/master.zip
unzip /tmp/master.zip
if [ -d /home/pi/scratch2mcpi ]; then
cp -rf scratch2mcpi-master/* scratch2mcpi/
rm -rf scratch2mcpi-master
else
mv scratch2mcpi-master scratch2mcpi
fi
rm /tmp/master.zip
if [ -d "/home/pi/mcpi/api/python/mcpi" ]; then
cp -rf /home/pi/mcpi/api/python/mcpi scratch2mcpi/
fi
if [ -d "/opt/minecraft-pi/api/python/mcpi" ]; then
cp -rf /opt/minecraft-pi/api/python/mcpi scratch2mcpi/
fi
# Install Minecraft Graphics Turtle
echo "\n\033[36m\033[1mInstalling MinecraftGraphicsTurtle...\033[00m\n"
wget -P /tmp https://github.com/scratch2mcpi/minecraft-turtle/archive/master.zip
unzip /tmp/master.zip
if [ -d /home/pi/scratch2mcpi/minecraft-turtle/ ]; then
rm -rf scratch2mcpi/minecraft-turtle/
fi
mv minecraft-turtle-master scratch2mcpi/mcturtle
rm /tmp/master.zip
# Install Minecraft Stuff
echo "\n\033[36m\033[1mInstalling MinecraftStuff...\033[00m\n"
wget -P /tmp https://github.com/scratch2mcpi/minecraft-stuff/archive/master.zip
unzip /tmp/master.zip
if [ -d /home/pi/scratch2mcpi/minecraft-stuff/ ]; then
rm -rf scratch2mcpi/minecraft-stuff/
fi
mv minecraft-stuff-master scratch2mcpi/mcstuff
rm /tmp/master.zip
# Download sample Scratch projects
echo "\n\033[36m\033[1mDownloading sample Scratch projects...\033[00m\n"
files="mcpi_template mcpi_sphere mcpi_stagescanner"
for file in $files
do
if [ -f "/home/pi/Documents/Scratch Projects/$file.sb" ]; then
echo "\n\033[33m\033[1m$file.sb exists. Skipped downloading.\033[00m\n"
else
wget -P "/home/pi/Documents/Scratch Projects" https://github.com/eduardofilo/scratch2mcpi/raw/master/scratch_projects/$file.sb
fi
done
# Download MinecraftGraphicsTurtle and Stuff sample Scratch projects
echo "\n\033[36m\033[1mDownloading MinecraftGraphicsTurtle and MinecraftStuff sample Scratch projects...\033[00m\n"
files="3dnautilus AdventuresInRasPi buildBoxHouse pattern3 star stuff_face wallbox_ans colorcircle drawcircle_color drawsphere_color stuff_line"
for file in $files
do
if [ -f "/home/pi/Documents/Scratch Projects/turtle_$file.sb" ]; then
echo "\n\033[33m\033[1mturtle_$file.sb exists. Skipped downloading.\033[00m\n"
else
wget -P "/home/pi/Documents/Scratch Projects" https://github.com/eduardofilo/scratch2mcpi/raw/master/scratch_projects/turtle_$file.sb
fi
done
# Copy Scratch2MCPI shortcut on Desktop
if [ -f /home/pi/Desktop/scratch2mcpi.desktop ]; then
echo "\n\033[33m\033[1mScratch2MCPI shortcut on Desktop exists. Skipped copying.\033[00m\n"
else
echo "\n\033[36m\033[1mCopying Scratch2MCPI shortcut on Desktop...\033[00m\n"
wget -P "/home/pi/Desktop" https://github.com/eduardofilo/scratch2mcpi/raw/master/desktop_files/scratch2mcpi.desktop
fi
# Copy Scratch2MCPI Terminal shortcut on Desktop
if [ -f /home/pi/Desktop/scratch2mcpi_terminal.desktop ]; then
echo "\n\033[33m\033[1mScratch2MCPI Terminal shortcut on Desktop exists. Skipped copying.\033[00m\n"
else
echo "\n\033[36m\033[1mCopying Scratch2MCPI Terminal shortcut on Desktop...\033[00m\n"
wget -P "/home/pi/Desktop" https://github.com/eduardofilo/scratch2mcpi/raw/master/desktop_files/scratch2mcpi_terminal.desktop
fi
echo "\n\033[32m\033[1mInstallation of scratch2mcpi is completed.\033[00m\n"
fi