Skip to content

Commit 1cc2a90

Browse files
authored
Re-Add: Pf2eTools (#2336)
* Re-Add: Pf2eTools * Update pf2etools.sh * indention * Update pf2etools.sh
1 parent a8a729f commit 1cc2a90

File tree

3 files changed

+175
-0
lines changed

3 files changed

+175
-0
lines changed

ct/pf2etools.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env bash
2+
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: TheRealVira
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://pf2etools.com/
7+
8+
APP="Pf2eTools"
9+
var_tags="wiki"
10+
var_cpu="1"
11+
var_ram="512"
12+
var_disk="6"
13+
var_os="debian"
14+
var_version="12"
15+
var_unprivileged="1"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
27+
if [[ ! -d "/opt/${APP}" ]]; then
28+
msg_error "No ${APP} Installation Found!"
29+
exit
30+
fi
31+
32+
RELEASE=$(curl -s https://api.github.com/repos/Pf2eToolsOrg/Pf2eTools/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
33+
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f "/opt/${APP}_version.txt" ]]; then
34+
msg_info "Updating System"
35+
apt-get update &>/dev/null
36+
apt-get -y upgrade &>/dev/null
37+
msg_ok "Updated System"
38+
39+
msg_info "Updating ${APP}"
40+
cd /opt
41+
wget -q "https://github.com/Pf2eToolsOrg/Pf2eTools/archive/refs/tags/${RELEASE}.zip"
42+
unzip -q ${RELEASE}.zip
43+
rm -rf "/opt/${APP}"
44+
mv ${APP}-${RELEASE:1} /opt/${APP}
45+
cd /opt/Pf2eTools
46+
npm install &>/dev/null
47+
npm run build &>/dev/null
48+
chown -R www-data: "/opt/${APP}"
49+
chmod -R 755 "/opt/${APP}"
50+
echo "${RELEASE}" >"/opt/${APP}_version.txt"
51+
msg_ok "Updated ${APP}"
52+
53+
msg_info "Cleaning Up"
54+
rm -rf /opt/${RELEASE}.zip
55+
msg_ok "Cleanup Completed"
56+
else
57+
msg_ok "No update required. ${APP} is already at ${RELEASE}"
58+
fi
59+
exit
60+
}
61+
62+
start
63+
build_container
64+
description
65+
66+
msg_ok "Completed Successfully!\n"
67+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
68+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
69+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"

install/pf2etools-install.sh

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: TheRealVira
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://pf2etools.com/
7+
8+
# Import Functions und Setup
9+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
10+
color
11+
verb_ip6
12+
catch_errors
13+
setting_up_container
14+
network_check
15+
update_os
16+
17+
msg_info "Installing Dependencies"
18+
$STD apt-get install -y \
19+
curl \
20+
mc \
21+
sudo \
22+
apache2 \
23+
gpg \
24+
ca-certificates \
25+
git
26+
msg_ok "Installed Dependencies"
27+
28+
msg_info "Setting up Node.js Repository"
29+
mkdir -p /etc/apt/keyrings
30+
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
31+
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
32+
msg_ok "Set up Node.js Repository"
33+
34+
msg_info "Installing Node.js"
35+
$STD apt-get update
36+
$STD apt-get install -y nodejs
37+
msg_ok "Installed Node.js"
38+
39+
msg_info "Setup Pf2eTools"
40+
cd /opt
41+
RELEASE=$(curl -s https://api.github.com/repos/Pf2eToolsOrg/Pf2eTools/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
42+
wget -q "https://github.com/Pf2eToolsOrg/Pf2eTools/archive/refs/tags/${RELEASE}.zip"
43+
unzip -q "${RELEASE}.zip"
44+
mv "Pf2eTools-${RELEASE:1}" /opt/Pf2eTools
45+
cd /opt/Pf2eTools
46+
$STD npm install
47+
$STD npm run build
48+
echo "${RELEASE}" >/opt/Pf2eTools_version.txt
49+
msg_ok "Set up Pf2eTools"
50+
51+
msg_info "Creating Service"
52+
cat <<EOF >> /etc/apache2/apache2.conf
53+
<Location /server-status>
54+
SetHandler server-status
55+
Order deny,allow
56+
Allow from all
57+
</Location>
58+
EOF
59+
rm -rf /var/www/html
60+
ln -s "/opt/Pf2eTools" /var/www/html
61+
chown -R www-data: "/opt/Pf2eTools"
62+
chmod -R 755 "/opt/Pf2eTools"
63+
msg_ok "Created Service"
64+
65+
msg_info "Cleaning up"
66+
rm -rf /opt/${RELEASE}.zip
67+
$STD apt-get -y autoremove
68+
$STD apt-get -y autoclean
69+
msg_ok "Cleaned"
70+
71+
motd_ssh
72+
customize

json/pf2etools.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "Pf2eTools",
3+
"slug": "Pf2eTools",
4+
"categories": [
5+
24
6+
],
7+
"date_created": "2025-02-13",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 80,
12+
"documentation": "https://github.com/Pf2eToolsOrg/Pf2eTools/wiki",
13+
"website": "https://pf2etools.com/",
14+
"logo": "https://raw.githubusercontent.com/Pf2eToolsOrg/Pf2eTools/refs/heads/dev/android-chrome-192x192.png",
15+
"description": "Pf2eTools is an open-source website aiming to provide tools and information for Pathfinder 2nd Edition players and gamemasters. It's built using basic web technologies to ensure wide compatibility, and utilises client-side caching for speed, efficiency, and offline access.",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/pf2etools.sh",
20+
"resources": {
21+
"cpu": 1,
22+
"ram": 512,
23+
"hdd": 6,
24+
"os": "debian",
25+
"version": "12"
26+
}
27+
}
28+
],
29+
"default_credentials": {
30+
"username": null,
31+
"password": null
32+
},
33+
"notes": []
34+
}

0 commit comments

Comments
 (0)