1
0
mirror of https://github.com/parkervcp/eggs.git synced 2024-10-06 23:57:07 +02:00

Merge pull request #2132 from parkervcp/update_pocketmine

pocketmine: use github release for php
This commit is contained in:
Quinten 2023-02-12 09:39:47 +01:00 committed by GitHub
commit 0b25c22d67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,7 @@
"version": "PTDL_v2",
"update_url": null
},
"exported_at": "2023-01-24T16:28:27+01:00",
"exported_at": "2023-02-12T02:53:07-05:00",
"name": "PocketmineMP",
"author": "info@swisscrafting.ch",
"description": "Pocketmine Egg\r\nby onekintaro from swisscrafting.ch\r\nwith the nice help from #eggs Channel on Pterodactyl-Discord :)",
@ -22,20 +22,20 @@
},
"scripts": {
"installation": {
"script": "#!\/bin\/bash\r\n\r\n\r\napt update\r\napt install -y git curl wget jq file tar unzip zip\r\n\r\ncd \/mnt\/server\r\nARCH=$([[ \"$(uname -m)\" == \"x86_64\" ]] && echo \"amd64\" || echo \"arm64\")\r\n\r\n# Restrict versions to latest pm3 and pm4 for now.\r\nif [[ \"${VERSION}\" == \"pm4\" ]] || [[ \"${VERSION}\" == \"\" ]]; then\r\n DOWNLOAD_LINK=$(curl -ssL https:\/\/update.pmmp.io\/api?channel=stable | grep 'download_url' | cut -d '\"' -f 4)\r\n echo -e \"Downloading latest PocketMine 4 from ${DOWNLOAD_LINK}\"\r\n curl -ssL \"${DOWNLOAD_LINK}\" -o PocketMine-MP.phar\r\nelif [[ \"${VERSION}\" == \"pm3\" ]]; then\r\n DOWNLOAD_LINK=$(curl -ssL https:\/\/update.pmmp.io\/api?channel=pm3 | grep 'download_url' | cut -d '\"' -f 4)\r\n echo -e \"Downloading latest PocketMine 3 from ${DOWNLOAD_LINK}\"\r\n curl -ssL \"${DOWNLOAD_LINK}\" -o PocketMine-MP.phar\r\nelse\r\n echo -e \"Unknown version ${VERSION}\"\r\n exit 1\r\nfi\r\n\r\n\r\n\r\nif [[ \"${ARCH}\" == \"amd64\" ]]; then\r\necho -e \"\\n downloading latest php build from PocketMine https:\/\/jenkins.pmmp.io\/job\/PHP-8.0-Aggregate\/lastSuccessfulBuild\/artifact\/PHP-8.0-Linux-x86_64-PM4.tar.gz\"\r\ncurl -sSL -o php.binary.tar.gz https:\/\/jenkins.pmmp.io\/job\/PHP-8.0-Aggregate\/lastSuccessfulBuild\/artifact\/PHP-8.0-Linux-x86_64-PM4.tar.gz\r\n\r\necho -e \"\\n unpacking php binaries\"\r\ntar -xzvf php.binary.tar.gz\r\n\r\necho -e \"\\n removing php packages\"\r\nrm -rf \/mnt\/server\/php.binary.tar.gz\r\n\r\necho -e \"\\n configuring PHP extensions library directory\"\r\nEXTENSION_DIR=$(find \"bin\" -name *debug-zts*)\r\ngrep -q '^extension_dir' bin\/php7\/bin\/php.ini && sed -i'bak' \"s{^extension_dir=.*{extension_dir=\\\"$EXTENSION_DIR\\\"{\" bin\/php7\/bin\/php.ini || echo \"extension_dir=\\\"$EXTENSION_DIR\\\"\" >>bin\/php7\/bin\/php.ini\r\nelse\r\napt install -y libtool-bin libtool make autoconf automake m4 gzip bzip2 bison g++ git cmake pkg-config re2c\r\n\r\nwget https:\/\/raw.githubusercontent.com\/pmmp\/php-build-scripts\/stable\/compile.sh -O compile.sh \r\nchmod +x compile.sh\r\n\r\necho \"please wait, this will take some time\"\r\n.\/compile.sh\r\nrm compile.sh\r\nrm -rf install_data\/\r\n\r\necho -e \"\\n configuring PHP extensions library directory\"\r\nEXTENSION_DIR=$(find \"bin\" -name *debug-zts*)\r\ngrep -q '^extension_dir' bin\/php7\/bin\/php.ini && sed -i'bak' \"s{^extension_dir=.*{extension_dir=\\\"$EXTENSION_DIR\\\"{\" bin\/php7\/bin\/php.ini || echo \"extension_dir=\\\"$EXTENSION_DIR\\\"\" >>bin\/php7\/bin\/php.ini\r\n\r\nfi\r\n\r\n\r\nif [[ ! -f server.properties ]]; then\r\n echo -e \"\\n downloading default server.properties\"\r\n curl -sSL https:\/\/raw.githubusercontent.com\/parkervcp\/eggs\/master\/game_eggs\/minecraft\/bedrock\/pocketmine_mp\/server.properties >server.properties\r\nfi\r\n\r\n\r\necho -e \"\\n creating files and folders\"\r\ntouch banned-ips.txt banned-players.txt ops.txt white-list.txt server.log\r\nmkdir -p players worlds plugins resource_packs\r\n\r\necho -e \"\\n\\nInstall script completed. Enjoy!\"",
"container": "ghcr.io\/pterodactyl\/installers:debian",
"script": "#!\/bin\/bash\r\n\r\napt-get update\r\napt-get install -y git curl wget jq file tar unzip zip\r\n\r\nmkdir -p \/mnt\/server\/ # Not required. Only here for parkervcp's local test setup\r\n\r\ncd \/mnt\/server || exit 1\r\n\r\nARCH=$([[ \"$(uname -m)\" == \"x86_64\" ]] && printf \"amd64\" || printf \"arm64\")\r\n\r\n# Shouldn't be possible to be empty, but default to PM4 if it is and convert to uppercase\r\nVERSION=\"${VERSION:-PM4}\"\r\nVERSION=\"${VERSION^^}\"\r\n\r\n# Helper functions\r\n\r\ndownload_php_binary() {\r\n printf \"Downloading latest PHP %s binary for %s\\n\" \"$REQUIRED_PHP_VERSION\" \"$VERSION\"\r\n curl --location --progress-bar https:\/\/github.com\/pmmp\/PHP-Binaries\/releases\/download\/php-\"$REQUIRED_PHP_VERSION\"-latest\/PHP-Linux-x86_64-\"$VERSION\".tar.gz | tar -xzv\r\n}\r\n\r\nset_php_extension_dir() {\r\n printf \"Configuring php.ini\\n\"\r\n EXTENSION_DIR=$(find \"bin\" -name '*debug-zts*')\r\n grep -q '^extension_dir' bin\/php7\/bin\/php.ini && sed -i'bak' \"s{^extension_dir=.*{extension_dir=\\\"$EXTENSION_DIR\\\"{\" bin\/php7\/bin\/php.ini || echo \"extension_dir=\\\"$EXTENSION_DIR\\\"\" >>bin\/php7\/bin\/php.ini\r\n}\r\n\r\ndownload_pmmp() {\r\n DOWNLOAD_LINK=$(curl -sSL https:\/\/update.pmmp.io\/api?channel=\"$API_CHANNEL\" | grep 'download_url' | cut -d '\"' -f 4)\r\n printf \"Downloading %s from %s\\n\" \"$VERSION\" \"${DOWNLOAD_LINK}\"\r\n curl --location --progress-bar \"${DOWNLOAD_LINK}\" --output PocketMine-MP.phar\r\n}\r\n\r\n# We have to convert VERSION into an API channel\r\nif [[ \"${VERSION}\" == \"PM4\" ]]; then\r\n API_CHANNEL=\"stable\"\r\n\r\n# Disabled until PM5 is released and API channels or structure are decided for PM4\/PM5\r\n# elif [[ \"${VERSION}\" == \"PM5\" ]]; then\r\n# API_CHANNEL=\"alpha\"\r\nelse\r\n printf \"Unsupported version: %s\" \"${VERSION}\"\r\n exit 1\r\nfi\r\n\r\nREQUIRED_PHP_VERSION=$(curl -sSL https:\/\/update.pmmp.io\/api?channel=\"$API_CHANNEL\" | grep 'php_version' | cut -d '\"' -f 4)\r\n\r\nif [[ \"${ARCH}\" == \"amd64\" ]]; then\r\n download_php_binary\r\n\r\n# There are no ARM64 PHP binaries yet, so we have to compile them\r\nelse\r\n apt install -y libtool-bin libtool make autoconf automake m4 gzip bzip2 bison g++ git cmake pkg-config re2c\r\n\r\n # Each PHP version has its own compile script, so we have to download the correct one\r\n curl --location --progress-bar --remote-name https:\/\/raw.githubusercontent.com\/pmmp\/PHP-Binaries\/php\/\"$REQUIRED_PHP_VERSION\"\/compile.sh\r\n chmod +x compile.sh\r\n\r\n cat <<EOF\r\n----------------------------------------\r\n| |\r\n| Compiling PHP Binary for ARM64 |\r\n| |\r\n| This is a time consuming process |\r\n----------------------------------------\r\nEOF\r\n\r\n printf \"\\n\\nCompiling PHP binary, this is a slow process and will take time\\n\"\r\n THREADS=$(grep -c ^processor \/proc\/cpuinfo) || THREADS=1\r\n .\/compile.sh -j \"$THREADS\"\r\n rm compile.sh\r\n rm -rf install_data\/\r\n\r\nfi\r\n\r\n# Steps below are the same for both architectures\r\ndownload_pmmp\r\nset_php_extension_dir || exit 1\r\n\r\nif [[ ! -f server.properties ]]; then\r\n printf \"Downloading default server.properties template\\n\"\r\n curl --location --progress-bar --remote-name https:\/\/raw.githubusercontent.com\/parkervcp\/eggs\/master\/game_eggs\/minecraft\/bedrock\/pocketmine_mp\/server.properties\r\nfi\r\n\r\nprintf \"Creating default file and folder structure\\n\"\r\ntouch banned-ips.txt banned-players.txt ops.txt white-list.txt server.log\r\nmkdir -p players worlds plugins resource_packs\r\n\r\ncat <<EOF\r\n----------------------------------------\r\n| |\r\n| PocketMine-MP Installation Done |\r\n| |\r\n----------------------------------------\r\nEOF",
"container": "debian:bullseye-slim",
"entrypoint": "bash"
}
},
"variables": [
{
"name": "Version to install [pm3 or pm4]",
"description": "Latest PocketMine version to install. Valid options: pm3 and pm4",
"name": "Version to install",
"description": "Latest PocketMine version to install.",
"env_variable": "VERSION",
"default_value": "pm4",
"default_value": "PM4",
"user_viewable": true,
"user_editable": true,
"rules": "required|string|in:pm3,pm4",
"rules": "required|string|in:PM4",
"field_type": "text"
}
]