This repository has been archived by the owner on Jun 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.sh
executable file
·91 lines (75 loc) · 3.02 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/bash
APT_URL="https://github.com/NoozSBC/mcpi-reborn-extended/raw/main/debs/mcpi-reborn-extended.list"
APT_PATH="/etc/apt/sources.list.d/mcpi-reborn-extended.list"
KEY_URL="https://github.com/NoozSBC/mcpi-reborn-extended/raw/main/debs/KEY.gpg"
KEY_PATH="/tmp/mcpi-reborn-extended.gpg"
API_URL="https://raw.githubusercontent.com/martinohanlon/mcpi/0c6ff49377da740c707e8c21b616f7fb21e6e85f/mcpi/minecraft.py"
API_PATH="/usr/lib/python3/dist-packages/mcpi/minecraft.py"
# Define functions
info() {
echo -e "$(tput smul)$(tput setaf 6)$(tput bold)$1$(tput sgr0)"
}
warning() {
echo -e "$(tput setaf 3)$(tput bold)$1$(tput sgr0)"
sleep 2
true
}
error() {
echo -e "$(tput setaf 1)$(tput bold)$1$(tput sgr0)"
echo -e "\nAsk for support at https://discord.gg/XJJNG9jTuh"
exit 1
}
sudo_wget() {
sudo wget "$1" -O "$2" || error "Couldn't download '$2' from '$1'"
}
PAGE_SIZE="$(getconf PAGE_SIZE)"
if [[ "$PAGE_SIZE" == "16384" ]]; then
#switch to 4K pagesize kernel
if [ -f /boot/config.txt ]; then
error "Raspberry Pi 5 PiOS images ship by default with a 16K PageSize Linux Kernel.
This kernel causes incompatibilities with some software including MCPI++ https://github.com/raspberrypi/bookworm-feedback/issues/107
To use it, you must switch to a 4K PageSize Linux Kernel. Enable it by adding 'kernel=kernel8.img' to /boot/config.txt. Reboot afterwards."
fi
fi
# Install depends
#echo -e "\e[4m\e[21m\e[5mInstalling dependencies...\e[0m\e[97m"
info "Installing Dependencies..."
sudo apt-get install -y wget gnupg || error "Failed to install dependencies!"
# Install repo
info "Installing APT Repository..."
sudo_wget "${APT_URL}" "${APT_PATH}" || error "Could not download repo!"
# Install GPG key
info "Downloading APT Repository Signing Key..."
sudo_wget "${KEY_URL}" "${KEY_PATH}" || error "Could not download GPG key!"
sudo apt-key add "${KEY_PATH}"
info "Syncing APT Sources..."
sudo apt update --allow-releaseinfo-change || error "Failed to run 'sudo apt update'!"
# Install packages
if [[ "$1" == "--server" ]]; then
info "Installing Server... This will allow you to host a server, but the game client itself is not installed. "
sudo apt-get install -y minecraft-pi-reborn-server
APP="server"
else
info "Installing Game Client..."
sudo apt-get install -y minecraft-pi-reborn-client
APP="client"
fi
# Install launcher
#if [[ $APP == "client" ]]; then
# echo -e "\nWould you like to install Planet Launcher? This will allow you to customize your skin and add texturepacks. [Y/n]"
# read -p "> " -n 1 -r
#
# if [[ $REPLY =~ ^[Yy]$ ]]; then
# info "Installing Launcher..."
# sudo apt-get install -y planet-launcher
# fi
#fi
# Install Python API
info "Installing Python API..."
sudo apt install -y python3-minecraftpi || warning "Could not install Python API"
sudo_wget "${API_URL}" "${API_PATH}"
# Finish
echo -e "\n"
info "Installation complete! Refer to https://github.com/NoozSBC/mcpi-reborn-extended#user-guide for usage instructions."
# Self destruct
unlink "$0"